WIP_noinitrd-machineid to set /etc/machine-id to barebox's machine-id (or set barebox's) if no machine-id is set
I also did manage to set up a hacky overlayfs prototype, but I'll either need to use a C or busybox to do this as I need to pivot the root filesystem mount from / to /tmp/overlay/upper then boot systemd- which is hard to do with shell scripts as I execute external programs, programs I don't have without a root filesystem.
I'm ashamed of the code, but here's the example if you REALLY want to try:
#!/bin/bash
mount -t proc none /proc
mount -t sysfs none /sys
mkdir -p /run/lock
DEFAULT_MACHINE_ID="402de934e3cca78c23ce21875f309dcf"
MACHINE_ID="$(barebox-state -g machine-id)"
if [[ "${MACHINE_ID}" == "${DEFAULT_MACHINE_ID}" ]]; then
MACHINE_ID="$(dbus-uuidgen)"
barebox-state -s machine-id="${MACHINE_ID}"
fi
echo "${MACHINE_ID}" > /etc/machine-id
mount -t tmpfs none /tmp
mkdir /tmp/overlay
cd /tmp/overlay
mkdir lower upper work merged
cd /
mount /dev/mmcblk1p4 lower
mount -t overlay overlay -o lowerdir=/tmp/overlay/lower,upperdir=/tmp/overlay/upper,workdir=/tmp/overlay/work /tmp/overlay/merged
umount /proc
umount /sys
exec chroot /tmp/overlay/merged /sbin/init
Since we're not pivoting root and just chrooting, the original root mount is still active and systemd can't free it. Nasty.
This pull request allows the build to no longer depend on an initramfs. This has several adventages:
I've done two branches off of this:
I also did manage to set up a hacky overlayfs prototype, but I'll either need to use a C or busybox to do this as I need to pivot the root filesystem mount from / to /tmp/overlay/upper then boot systemd- which is hard to do with shell scripts as I execute external programs, programs I don't have without a root filesystem.
I'm ashamed of the code, but here's the example if you REALLY want to try:
Since we're not pivoting root and just chrooting, the original root mount is still active and systemd can't free it. Nasty.
Okay here's the code to make an overlay that removes access to filesystem:
WIP make the build initramfs-less
tomake the build initramfs-less
on 11 Aug 2020Do not depend on an initramfs any longer.
bd5571e
intostable-dev-board
fromWIP_initramfs-less
on 11 Aug 2020