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
This commit is contained in:
Pankaj Raghav 2021-12-27 09:28:11 +05:30 committed by Andreas Kling
parent e99fafb683
commit 344cfa0db4
Notes: sideshowbarker 2024-07-17 21:50:45 +09:00

View file

@ -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