Search code examples
armqemu

QEMU: How come ARM ISO image need pflash/bios, but not X86 ISO image


I am trying to create two VMs from alpine Linux image in QEMU. One for X86 and for ARM64.

For X86

qemu-system-x86_64 \
-m 512 \
-hda alpine_x86.qcow2 \
-cdrom path/to/img.iso \
-boot d

For ARM64

qemu-system-aarch64 \
-M virt \
-cpu cortex-a57 \
-m 2048 \
-hda alpine_arm.qcow2 \
-cdrom path/to/img.iso \
-drive if=pflash,format=raw,file=flash.img \ <--------- ?
-nographic

Comparing the two flows, specifying -cdrom in X86 flow is enough. But in the ARM64 case, I need to specify pflash option.

I checked the ARM64 image using file and it says bootable.

file alpine-standard-3.20.1-aarch64.iso 
alpine-standard-3.20.1-aarch64.iso: ISO 9660 CD-ROM filesystem data (DOS/MBR boot sector) 'alpine-std 3.20.1 aarch64' (bootable)

If I do not specify the pflash, QEMU ARM VM does not come up.

Is this a QEMU limitation or there exists a technical reason behind this?


Solution

  • In fact both x86 and aarch64 VMs need a BIOS to be able to boot from a CDROM ISO image. The difference is just that the x86 PC machine type will start a BIOS by default even if you don't explicitly ask for one, whereas the AArch64 virt machine type defaults to no BIOS, and you have to explicitly ask for one.

    This is mostly for historical reasons, both within QEMU and with the two architectures more generally:

    • the x86 PC real hardware has always had a BIOS and it does a lot of work, which Linux and other guests assume has happened; so there are very few guests which can boot without a BIOS
    • arm, on the other hand, has historically tended more to require Linux to configure hardware and not relied on firmware to do it; so the amount of work required to boot a kernel without firmware is very small
    • when the virt machine was first added to QEMU there was no conveniently available UEFI firmware to use as the BIOS, and most developers were used to directly booting a kernel without firmware; so the default was set up as "no BIOS"