commit: 9010e9786e2761b13f56f2f839a3a20c84b6a10c
parent 206d7adb640ccb5a929091c2ac430032a6c452b7
Author: Bastian Bittorf <bb@npl.de>
Date: Tue, 12 Jan 2021 13:04:13 +0100
add chroot-mode, so it works without qemu/kernel
Diffstat:
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/rootfs.sh b/rootfs.sh
@@ -1,8 +1,8 @@
#!/bin/bash
set -ex
-QEMU_CMD=$1
-RAM=$2
+QEMU_CMD="${1:-qemu-system-x86_64}" # or 'chroot'
+QEMU_RAM="${2:-8G}"
pushd sysa
@@ -116,11 +116,15 @@ cd tmp
find . | cpio -H newc -o | gzip > initramfs.igz
# Run
-${QEMU_CMD:-qemu-system-x86_64} -enable-kvm \
- -m "${RAM:-8G}" \
- -nographic \
- -no-reboot \
- -kernel ../../kernel -initrd initramfs.igz -append console=ttyS0
+if [ "${QEMU_CMD}" = 'chroot' ]; then
+ sudo PATH="/after/bin:${PATH}" chroot . /init
+else
+ ${QEMU_CMD} -enable-kvm \
+ -m "${QEMU_RAM:-8G}" \
+ -nographic \
+ -no-reboot \
+ -kernel ../../kernel -initrd initramfs.igz -append console=ttyS0
+fi
cd ../..