From 344cfa0db4a76601754aead153fa52d2cde6db1e Mon Sep 17 00:00:00 2001 From: Pankaj Raghav Date: Mon, 27 Dec 2021 09:28:11 +0530 Subject: Meta: Enable attaching NVMe storage devices to qemu Add an option to enable NVMe storage device as the boot drive. To enable NVMe support, run the following: $ SERENITY_NVME_ENABLE=1 Meta/serenity.sh run i686 root=/dev/nvme0n1 --- Meta/run.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'Meta/run.sh') diff --git a/Meta/run.sh b/Meta/run.sh index 27e361252c..25fcff50b7 100755 --- a/Meta/run.sh +++ b/Meta/run.sh @@ -189,6 +189,19 @@ else SERENITY_QEMU_DISPLAY_DEVICE="VGA,vgamem_mb=64 " fi +# Check if SERENITY_NVME_ENABLE is unset +if [ -z ${SERINITY_NVME_ENABLE+x} ]; then + SERENITY_BOOT_DRIVE="-drive file=${SERENITY_DISK_IMAGE},format=raw,index=0,media=disk" +else + if [ "$SERINITY_NVME_ENABLE" -eq 1 ]; then + SERENITY_BOOT_DRIVE="-drive file=${SERENITY_DISK_IMAGE},format=raw,index=0,media=disk,if=none,id=disk" + SERENITY_BOOT_DRIVE="$SERENITY_BOOT_DRIVE -device i82801b11-bridge,id=bridge4 -device sdhci-pci,bus=bridge4" + SERENITY_BOOT_DRIVE="$SERENITY_BOOT_DRIVE -device nvme,serial=deadbeef,drive=disk,bus=bridge4" + else + SERENITY_BOOT_DRIVE="-drive file=${SERENITY_DISK_IMAGE},format=raw,index=0,media=disk" + fi +fi + if [ -z "$SERENITY_DISABLE_GDB_SOCKET" ]; then SERENITY_EXTRA_QEMU_ARGS="$SERENITY_EXTRA_QEMU_ARGS -s" fi @@ -206,7 +219,6 @@ if [ -z "$SERENITY_MACHINE" ]; then -smp $SERENITY_CPUS -display $SERENITY_QEMU_DISPLAY_BACKEND -device $SERENITY_QEMU_DISPLAY_DEVICE - -drive file=${SERENITY_DISK_IMAGE},format=raw,index=0,media=disk -device virtio-serial,max_ports=2 -device virtconsole,chardev=stdout -device isa-debugcon,chardev=stdout @@ -219,6 +231,7 @@ if [ -z "$SERENITY_MACHINE" ]; then -device i82801b11-bridge,id=bridge3 -device sdhci-pci,bus=bridge3 -device ich9-ahci,bus=bridge3 -chardev stdio,id=stdout,mux=on + $SERENITY_BOOT_DRIVE " fi fi @@ -289,6 +302,7 @@ $SERENITY_EXTRA_QEMU_ARGS -device virtio-rng-pci $SERENITY_AUDIO_BACKEND $SERENITY_AUDIO_HW +$SERENITY_BOOT_DRIVE " export SDL_VIDEO_X11_DGAMOUSE=0 -- cgit v1.2.3