Skip to content

Commit

Permalink
mkimage-iso-efi: Mount installer rootfs squashfs image
Browse files Browse the repository at this point in the history
Change the initrd.sh script to look for a squashfs image in the installer
device and mount this image as the installer rootfs.

Signed-off-by: Renê de Souza Pinto <[email protected]>
(cherry picked from commit 4f83d70)
  • Loading branch information
rene authored and eriknordmark committed Mar 10, 2025
1 parent 00a6f35 commit 9853715
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion pkg/mkimage-iso-efi/initrd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ root_param=$(cat /proc/cmdline | tr ' ' '\n' | grep '^root=' | head -n 1)
# remove the leading "root=" to get the actual value
root_value=${root_param#root=}

# Search for the rootimg= cmdline property
# shellcheck disable=SC2002
rootimg_param=$(cat /proc/cmdline | tr ' ' '\n' | grep '^rootimg=' | head -n 1)
# remove the leading "root=" to get the actual value
root_img=${rootimg_param#rootimg=}

# Check if root_value is set
if [ -z "$root_value" ]; then
echo "Error: No root= parameter found in /proc/cmdline"
Expand Down Expand Up @@ -81,7 +87,22 @@ done
if [ -n "$rootdev" ]; then
echo "found root filesystem: $rootdev, switching"
mount "$rootdev" /newroot
exec switch_root /newroot /sbin/init
# Now, check for the installer rootfs squashfs image
if [ -n "$root_img" ]; then
rootfsimg=/newroot/"$root_img"
if [ -e "$rootfsimg" ]; then
# Mount the image and call switch_root
mkdir -p /installer_root
mount "$rootfsimg" /installer_root
exec switch_root /installer_root /sbin/init
else
echo "$root_img image not found!"
exec sh
fi
else
# No image provided, let's just switch root
exec switch_root /newroot /sbin/init
fi
else
echo "Root filesystem not found!"
exec sh
Expand Down

0 comments on commit 9853715

Please sign in to comment.