diff --git a/OSDK.toml b/OSDK.toml index 101e663f5..ca6a1f3fd 100644 --- a/OSDK.toml +++ b/OSDK.toml @@ -50,29 +50,7 @@ qemu.args = "$(./tools/qemu_args.sh tdx)" supported_archs = ["riscv64"] boot.method = "qemu-direct" build.strip_elf = false - -qemu.args = """\ - -cpu rv64,svpbmt=true \ - -machine virt \ - -m ${MEM-:8G} \ - -smp ${SMP-:1} \ - --no-reboot \ - -nographic \ - -display none \ - -serial chardev:mux \ - -monitor chardev:mux \ - -chardev stdio,id=mux,mux=on,signal=off,logfile=qemu.log \ - -drive if=none,format=raw,id=x0,file=./test/initramfs/build/ext2.img \ - -drive if=none,format=raw,id=x1,file=./test/initramfs/build/exfat.img \ - # NOTE: The `/etc/profile.d/init.sh` assumes that `ext2.img` appears as the first block device (`/dev/vda`). - # The ordering below ensures `x1` (ext2.img) is discovered before `x0`, maintaining this assumption. - # TODO: Once UUID-based mounting is implemented, this strict ordering will no longer be required. - -device virtio-blk-device,drive=x1 \ - -device virtio-blk-device,drive=x0 \ - -device virtio-keyboard-device \ - -device virtio-serial-device \ - -device virtconsole,chardev=mux \ -""" +qemu.args = "$(./tools/qemu_args.sh riscv)" [scheme."sifive_u"] supported_archs = ["riscv64"] diff --git a/tools/qemu_args.sh b/tools/qemu_args.sh index 04792e66c..8e6c7e705 100755 --- a/tools/qemu_args.sh +++ b/tools/qemu_args.sh @@ -56,6 +56,32 @@ else CONSOLE_ARGS="-serial chardev:mux" fi +if [ "$1" = "riscv" ]; then + # NOTE: The `/etc/profile.d/init.sh` assumes that `ext2.img` appears as the first block device (`/dev/vda`). + # The ordering below ensures `x1` (ext2.img) is discovered before `x0`, maintaining this assumption. + # TODO: Once UUID-based mounting is implemented, this strict ordering will no longer be required. + QEMU_ARGS="\ + -cpu rv64,svpbmt=true \ + -machine virt \ + -m ${MEM-:8G} \ + -smp ${SMP-:1} \ + --no-reboot \ + -nographic \ + -display none \ + -monitor chardev:mux \ + -chardev stdio,id=mux,mux=on,signal=off,logfile=qemu.log \ + -drive if=none,format=raw,id=x0,file=./test/initramfs/build/ext2.img \ + -drive if=none,format=raw,id=x1,file=./test/initramfs/build/exfat.img \ + -device virtio-blk-device,drive=x1 \ + -device virtio-blk-device,drive=x0 \ + -device virtio-keyboard-device \ + -device virtio-serial-device \ + $CONSOLE_ARGS \ + " + echo $QEMU_ARGS + exit 0 +fi + if [ "$1" = "tdx" ]; then TDX_OBJECT='{ "qom-type": "tdx-guest", "id": "tdx0", "sept-ve-disable": true, "quote-generation-socket": { "type": "vsock", "cid": "2", "port": "4050" } }'