Search code examples
qemuapple-m1

qemu-system-aarch64: -accel hvf: invalid accelerator hvf


I have already compiled QEMU by myself in MacBook pro M1, and downloaded ubuntu 20.04.

When I am trying to install ubuntu by:

DYLD_LIBRARY_PATH=. \
./qemu-system-aarch64 \
-M virt,highmem=off \
-accel hvf \
-m 4G \
-smp 4 \
-cpu max \
-drive file=ubuntu.img,index=0,media=disk,format=raw \
-serial stdio \
-netdev type=user,id=net0 \
-device virtio-gpu-pci -vga none \
-device nec-usb-xhci \
-device usb-kbd \
-device usb-tablet \
-device intel-hda -device hda-duplex \
-device virtio-net-pci,netdev=net0,romfile="" \
-drive file=ubuntu-20.04.2-live-server-arm64.iso,media=cdrom,if=none,id=cdrom -device usb-storage,drive=cdrom \
-bios QEMU_EFI.fd

I got an error: qemu-system-aarch64: -accel hvf: invalid accelerator hvf.

I have tried this: sudo xattr -rd com.apple.quarantine ~/Desktop/buildV6 to close the gatekeeper, but it didn't work.

I don't quite understand this and I am new in QEMU. Could you just give me the solution?


Solution

  • Nearly a year later, QEMU released new version with support of macOS aarch64 now(version 7.0.0).

    Here is the method to use it:

    1. get QEMU's source code
    git clone --single-branch --branch v6.2.0 https://github.com/qemu/qemu.git
    
    1. compile it
    ./configure --target-list=aarch64-softmmu --enable-hvf
    make -j -1
    
    1. install it
    make install
    
    1. how to use
    qemu-system-aarch64 <your args>
    

    args here is what you can do with qemu, check

    qemu-system-aarch64 -h
    

    to see the help message.


    update: Now you don't need to compile by yourself, homebrew provide newest version.

    Download:

    brew install qemu
    

    and you can use them freely.