Skip to content

Commit 7a84b2b

Browse files
jannaumarcan
authored andcommitted
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 <[email protected]>
1 parent cd8e9d6 commit 7a84b2b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

proxyclient/tools/run_guest_kernel.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ else
4747
fi
4848

4949
if [ -n "$initramfs" ]; then
50+
initramfs_size=$(stat --printf='%s' "$initramfs")
51+
python - << EOF >>"$TMPDIR/m1n1-linux.bin"
52+
import os, sys
53+
54+
magic = b'm1n1_initramfs'
55+
size = int(${initramfs_size}).to_bytes(4, byteorder='little')
56+
os.write(sys.stdout.fileno(), magic + size)
57+
EOF
5058
cat "$initramfs" >>"$TMPDIR/m1n1-linux.bin"
5159
fi
5260

0 commit comments

Comments
 (0)