Aarch64 on qemu x86_64

Has anyone got aarch64 vms running on qemu on an x86_64 host?

I’m assuming it’s possible?

I have a VM template with:

CPU = "1"

CPU_MODEL = [

  MODEL = "cortex-a57" ]

DISK = [

  BUS = "virtio",

  IMAGE = "Alpine aarch",

  TARGET = "vda" ]

EMULATOR = "/usr/bin/qemu-system-aarch64"

GRAPHICS = [

  LISTEN = "0.0.0.0",

  TYPE = "vnc" ]

MEMORY = "1024"

OS = [

  ARCH = "aarch64",

  MACHINE = "virt" ]

RAW = [

  DATA = "

    <os>

      <loader readonly='yes' type='pflash'>/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw</loader>


    </os>

  ",

  TYPE = "qemu" ]

VIDEO = [

  TYPE = "virtio" ] 

This seems to error out on OpenNebula creating a nvram vars file that is too small:

qemu-system-aarch64: cfi.pflash01 device ‘/machine/virt.flash1’ requires 67108864 bytes, block backend provides 540672 bytes Could not create domain from /var/lib/one//datastores/0/2963/deployment.0 ExitCode: 255

hi.
can you post the deployment file. its seems that the file flash have some error…

Hi,

Here’s the deployment file

<domain type='qemu' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
        <name>one-2967</name>
        <title>Copy of Alpine aarch64-2967</title>
        <uuid>33f2269c-614f-4860-90f0-23a7202c0540</uuid>
        <vcpu><![CDATA[1]]></vcpu>
        <cputune>
                <shares>1024</shares>
        </cputune>
        <memory>1048576</memory>
        <os>
                <type arch='x86_64'>hvm</type>
                <loader readonly="yes" type="pflash" secure="no">/usr/share/edk2/aarch64/QEMU_EFI.fd</loader>
                <nvram>/var/lib/one//datastores/0/2967/Copy of Alpine aarch64-2967_VARS.fd</nvram>
        </os>
        <pm>
                <suspend-to-disk enabled="no"/>
                <suspend-to-mem enabled="no"/>
        </pm>
        <cpu mode='host-passthrough'>
        </cpu>
        <devices>
                <emulator><![CDATA[/usr/bin/qemu-system-aarch64]]></emulator>
                <disk type='file' device='disk'>
                        <source file='/var/lib/one//datastores/0/2967/disk.0'/>
                        <target dev='vda' bus='virtio'/>
                        <driver name='qemu' type='raw' cache='none' discard='unmap'/>
                </disk>
                <controller type='scsi' index='0' model='virtio-scsi'>
                        <driver queues='1'/>
                </controller>
                <graphics type='vnc' listen='0.0.0.0' port='8867'/>
                <video>
                        <model type='virtio'>
                        </model>
                </video>
        </devices>
        <features>
                <acpi/>
        </features>
        <devices>
                <channel type='unix'>
                        <source mode='bind'/><target type='virtio' name='org.qemu.guest_agent.0'/>
                </channel>
        </devices>
        <metadata>
                <one:vm xmlns:one="http://opennebula.org/xmlns/libvirt/1.0">
                        <one:system_datastore><![CDATA[/var/lib/one//datastores/0/2967]]></one:system_datastore>
                        <one:name><![CDATA[Copy of Alpine aarch64-2967]]></one:name>
                        <one:uname><![CDATA[oneadmin]]></one:uname>
                        <one:uid>0</one:uid>
                        <one:gname><![CDATA[oneadmin]]></one:gname>
                        <one:gid>0</one:gid>
                        <one:opennebula_version>6.10.0</one:opennebula_version>
                        <one:stime>1750420957</one:stime>
                        <one:deployment_time>1750420966</one:deployment_time>
                </one:vm>
        </metadata>
</domain>

hi.

I think that ‘copy of alpine aarch64-2967_VARS.fd’ is creating any conflict.

Please try with no spaces. The problem is that. When creating the file, fd fails to create the correct size that libvirt requires.

You can see if the files *.fd are 64MB?
usr/share/edk2/aarch64/QEMU_EFI.fd
/var/lib/one//datastores/0/2967/Copy of Alpine aarch64-2967_VARS.fd

Sadly removing the space didn’t help, get the same issue.

These are the files in /usr/share/edk2/aarach64/

-rw-r--r--. 1 root root 2.0M Dec 18  2024 QEMU_EFI.fd
-rw-r--r--. 1 root root 2.1M Dec 18  2024 QEMU_EFI-pflash.qcow2
-rw-r--r--. 1 root root  64M Dec 18  2024 QEMU_EFI-pflash.raw
-rw-r--r--. 1 root root 2.0M Dec 18  2024 QEMU_EFI.silent.fd
-rw-r--r--. 1 root root 2.1M Dec 18  2024 QEMU_EFI-silent-pflash.qcow2
-rw-r--r--. 1 root root  64M Dec 18  2024 QEMU_EFI-silent-pflash.raw
-rw-r--r--. 1 root root 768K Dec 18  2024 QEMU_VARS.fd
-rw-r--r--. 1 root root 788K Dec 18  2024 vars-template-pflash.qcow2
-rw-r--r--. 1 root root  64M Dec 18  2024 vars-template-pflash.raw

whereas the alpine_aarch-2976_VARS.fd file it creates is 528K.

I noticed when using virsh to create a VM it uses QEMU_EFI-silent-pflash.raw as the loader, so i’ve changed to that in a hope that it’d use vars-template-pflash.raw to generate the nvram properly, but it didn’t help.

Edit: I notice by default it uses /usr/share/edk2/ovmf/OVMF_VARS.fd to generate the nvram file which explains the 528k file size. It seems this is a cluster wide setting, can this not be overriden on a host/vm level?

I’m sorry. I thought the issue was there because of the error I saw in how the file was being generated. But I can’t help you any further
I’ve never worked with the type of images you’re using.

Good luck, and if you find the problem, please share it.

Hello,
Did you try expanding the VARS file/template with zeroes to fit the size before starting the VM?

truncate -s 64M .../alpine_aarch-2976_VARS.fd  #or the template file, wherever it is

Best Regards,
Anton

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.