Initial RAM disk
The initial ramdisk is built using the tooling in the initrd
repository.
Edit the init
script as required below and run make
and make install
to build initrd.img
and install it to /boot/EFI/ironforge/initrd.img
.
#!/bin/sh
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devtmpfs none /dev
# NOTE: Here we should open up the root=... device
cryptsetup luksOpen /dev/sda2 os
# NOTE: If you want to use LVM...
# lvm vgscan --mknodes
# lvm vgchange -ay
# TODO: Fetch squashfs root from kernel parameter
mount /dev/vg/os /mnt
mount -t proc none /mnt/proc
mount -t sysfs none /mnt/sys
mount -t devtmpfs none /mnt/dev
mount -t tmpfs none /mnt/run -o mode=750
mount -t tmpfs none /mnt/tmp
mkdir -p /mnt/dev/pts
mkdir -p /mnt/dev/shm
mkdir -p /mnt/sys/fs/cgroup
mkdir -p /mnt/run/dbus
mount -t devpts none /mnt/dev/pts
mount -t tmpfs none /mnt/dev/shm
mount -t cgroup2 none /mnt/sys/fs/cgroup
mount /dev/sda1 /mnt/boot
echo =====================================
echo PRESS ANY KEY TO SELECT CUSTOM ROOTFS
echo =====================================
# Wait for 2 seconds for any keyboard input
if read -t 2 -n 1; then
# A key was pressed
ROOT=$(ls -t /mnt/var/ironforge/*.sqfs | fzf)
else
# usr.sqfs symlink to latest usr.sqfs image
ROOT=/mnt/var/ironforge/usr.sqfs
fi
if [ -z "$ROOT" ]; then
exec /bin/sh -i
fi
mount $ROOT /mnt/usr
# if [ -d /mnt/local ]; then
# mount -o bind /mnt/local /mnt/usr/local
# fi
#mount /dev/vg/modules /mnt/usr/lib/modules
#mount /dev/vg/firmware /mnt/usr/lib/firmware
mount /mnt/var/ironforge/iron /mnt/lib/firmware
exec switch_root /mnt /mnt/bin/init HOME=/root USER=root