Booting UEFI with QEMU arm


Pintu Agarwal <pintu.ping@...>
 

Hi,
Is it possible to boot UEFI on a qemu arm based emulator?
Since I am working from home and my uefi related work leads to device crash many times, which becomes painful for me.

So I wanted to do all my experiments on a qemu environment before I verify the final changes on a real hardware.
So, I am just wondering is this possible?

According to my search I see its possible but still I could not find a proper way to do it.
Please help me if someone has already tried it.

I already have the qemu-arm setup on my Linux/Ubuntu PC.


Thanks,
Pintu


Laszlo Ersek
 

On 05/04/21 13:32, Pintu Agarwal wrote:
Hi,
Is it possible to boot UEFI on a qemu arm based emulator?
Since I am working from home and my uefi related work leads to device crash
many times, which becomes painful for me.

So I wanted to do all my experiments on a qemu environment before I verify
the final changes on a real hardware.
So, I am just wondering is this possible?

According to my search I see its possible but still I could not find a
proper way to do it.
Please help me if someone has already tried it.

I already have the qemu-arm setup on my Linux/Ubuntu PC.
From "qemu-system-arm", it seems like you really mean 32-bit ARM.

Yes, there is support for that in edk2.

Build:

$ git submodule update --init --force
$ . edksetup.sh
$ nice make -C "$EDK_TOOLS_PATH" -j $(getconf _NPROCESSORS_ONLN)
$ build -a ARM -b DEBUG -p ArmVirtPkg/ArmVirtQemu.dsc -t GCC5
$ for FD in QEMU_EFI.fd QEMU_VARS.fd; do
cat -- \
"$WORKSPACE/Build/ArmVirtQemu-ARM/DEBUG_GCC5/FV/$FD" \
/dev/zero \
| head -c 64m >| /tmp/"$FD.padded"
done

Run:

$ if ! [ -e vars.fd ]; then
cp /tmp/QEMU_VARS.fd.padded vars.fd
fi
$ qemu-system-arm \
-M virt \
-cpu cortex-a15 \
-m 1024 \
-serial stdio \
-drive if=pflash,unit=0,format=raw,readonly=on,file=/tmp/QEMU_EFI.fd.padded \
-drive if=pflash,unit=1,format=raw,file=vars.fd \
-device virtio-gpu-pci \
-device id=xhci0,driver=qemu-xhci \
-device usb-kbd,bus=xhci0.0 \
-boot menu=on,splash-time=5000 \
[...]

HTH
Laszlo



Thanks,
Pintu