2023-10-23 13:27:23 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [[ -z $BANAN_DISK_IMAGE_PATH ]]; then
|
|
|
|
echo "You must set the BANAN_DISK_IMAGE_PATH environment variable" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z $OVMF_PATH ]]; then
|
|
|
|
OVMF_PATH="/usr/share/ovmf/x64/OVMF.fd"
|
|
|
|
fi
|
|
|
|
|
2023-11-21 11:53:50 +02:00
|
|
|
if (($BANAN_UEFI_BOOT)); then
|
2023-10-23 13:27:23 +03:00
|
|
|
BIOS_ARGS="-bios $OVMF_PATH -net none"
|
|
|
|
fi
|
|
|
|
|
2024-01-14 01:39:48 +02:00
|
|
|
if [[ $BANAN_DISK_TYPE == "NVME" ]]; then
|
|
|
|
DISK_ARGS="-device nvme,serial=deadbeef,drive=disk"
|
|
|
|
else
|
|
|
|
DISK_ARGS="-device ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0"
|
|
|
|
fi
|
|
|
|
|
2024-03-26 03:18:54 +02:00
|
|
|
QEMU_ARCH=$BANAN_ARCH
|
|
|
|
if [ $BANAN_ARCH = "i686" ]; then
|
|
|
|
QEMU_ARCH=i386
|
|
|
|
fi
|
|
|
|
|
|
|
|
qemu-system-$QEMU_ARCH \
|
2024-02-03 02:40:15 +02:00
|
|
|
-m 1G \
|
2024-03-03 02:17:24 +02:00
|
|
|
-smp 4 \
|
2023-10-23 13:27:23 +03:00
|
|
|
$BIOS_ARGS \
|
|
|
|
-drive format=raw,id=disk,file=${BANAN_DISK_IMAGE_PATH},if=none \
|
2024-02-03 02:40:15 +02:00
|
|
|
-device e1000e,netdev=net \
|
|
|
|
-netdev user,id=net \
|
2024-07-15 11:48:48 +03:00
|
|
|
-device qemu-xhci -device usb-kbd -device usb-mouse \
|
2024-01-14 01:39:48 +02:00
|
|
|
$DISK_ARGS \
|
2023-10-23 13:27:23 +03:00
|
|
|
$@ \
|