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

# These stable links resolve through releases/current and therefore always
# select /usr and /opt from the same release.
USR_SQFS=/mnt/var/ironforge/usr.sqfs
OPT_SQFS=/mnt/var/ironforge/opt.sqfs

test -f "$USR_SQFS" || exec /bin/sh -i
test -f "$OPT_SQFS" || exec /bin/sh -i

mount "$USR_SQFS" /mnt/usr
mount "$OPT_SQFS" /mnt/opt

# 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

For a manual rollback in the initrd, select one directory beneath /mnt/var/ironforge/releases/ and derive both usr.sqfs and opt.sqfs from that directory. Do not select the two images independently. The normal and safer rollback workflow is documented in Release layout and updates.