1
0
Fork 0

start-qemu-vm.sh: fix for ARM and x86

This commit is contained in:
Pratham Patel 2024-02-17 10:57:51 +05:30
parent a750a27ff2
commit 34e1330265
Signed by: thefossguy
SSH Key Fingerprint: SHA256:/B3wAg7jnMEBQ2JwkebbS/eXVZANDmqRfnd9QkIhxMI
1 changed files with 6 additions and 6 deletions

View File

@ -34,17 +34,17 @@ HDA="$2"
CDR="$3"
[ -d "${HOME}/.vms" ] || mkdir "${HOME}/.vms"
if [ ! -f "${HOME}/.vms/result/u-boot.bin" ]; then
OVMF_DIR="${HOME}/.vms/result-fd/FV"
if [ ! -d "${OVMF_DIR}" ]; then
if [ "$(uname -m)" == 'aarch64' ]; then
NIX_UBOOT_ARCH='Aarch64'
QEMU_MACHINE='virt'
BIOS="${OVMF_DIR}/QEMU_EFI.fd"
elif [ "$(uname -m)" == 'x86_64' ]; then
NIX_UBOOT_ARCH='X86'
QEMU_MACHINE='pc'
BIOS="${OVMF_DIR}/OVMF.fd"
fi
NIX_UBOOT_PKG="nixpkgs#ubootQemu${NIX_UBOOT_ARCH}"
pushd "${HOME}/.vms"
nix build "${NIX_UBOOT_PKG}"
nix build 'nixpkgs#OVMF.fd'
popd
fi
@ -56,7 +56,7 @@ QEMU_COMMON="--all-tasks --cpu-list 4-7 \
-accel kvm \
-m 8192 \
-nographic \
-bios ${HOME}/.vms/result/u-boot.bin \
-bios ${BIOS} \
-sandbox on \
-netdev user,id=mynet0,hostfwd=tcp::${HOST_PORT}-:22 \
-device virtio-net-pci,netdev=mynet0"