tools/run_guest_kernel.sh: Support concatenated initramfs images

This allows booting a kernel with the firmware cpio and a cpio
containing matching modules. The modules initramfs can be prepared from
the kernel source directory with:

`make dir-pkg && usr/gen_initramfs.sh -o initramfs_mod.cpio -u squash -g squash ./tar-install/lib/`

The modules are available in /modules/$(uname -r) and the initramfs can
handle modules in the same way as the vendor firmware to make them
available for itself and the main OS.

Signed-off-by: Janne Grunau <j@jannau.net>
This commit is contained in:
Janne Grunau 2022-12-04 15:35:10 +01:00
parent a2b4a7479a
commit 0069ea213e

View file

@ -47,6 +47,14 @@ else
fi
if [ -n "$initramfs" ]; then
initramfs_size=$(stat --printf='%s' "$initramfs")
python - << EOF >>"$TMPDIR/m1n1-linux.bin"
import os, sys
magic = b'm1n1_initramfs'
size = int(${initramfs_size}).to_bytes(4, byteorder='little')
os.write(sys.stdout.fileno(), magic + size)
EOF
cat "$initramfs" >>"$TMPDIR/m1n1-linux.bin"
fi