Building arm64 image for booting in qemu

Oleksandr Tymoshenko gonzo at bluezbox.com
Thu May 21 02:30:05 UTC 2020


Gordon Bergling via freebsd-hackers (freebsd-hackers at freebsd.org) wrote:
> Greetings,
> 
> I am currently try to setup a crossbuild for arm64 to test some 
> local changes. I use the following steps to create the image 
> after crossbuilding arm64 on amd64. These steps were taken from
> the arm64_build.sh found at the FreeBSD wiki.

Hi Gordon,

I believe that script is very outdated in several areas. It refers
to boot1.efifat which is not boot1.efi but a FAT image that contains
boot1.efi as EFI\BOOT\bootaa64.efi. Also current version of u-boot-qemu
looks for DTB file which is not provided by the script (probably it was
built into u-boot before).

I think the easiest way to run FreeBSD on quemu/arm64 these days is by using
UEFI. I was able to build bootable image by hacking together your script
and pieces from release/ directory of the src tree:

https://people.freebsd.org/~gonzo/build-qemu-aarch4-img.sh

It's not very clean but it should give you an idea of what's required.
The start command for qemu I used:

BIOS=QEMU_EFI.fd
qemu-system-aarch64 -m 4096M -cpu cortex-a57 -M virt  \
        -bios $BIOS \
        -serial mon:stdio -nographic \
        -drive if=none,file=/src/FreeBSD/tftproot/disk.img,id=hd0 \
        -device virtio-blk-device,drive=hd0 \
        -device virtio-net-device,netdev=net0 \
        -netdev user,id=net0

QEMU_EFI.fd was downloaded from 
http://releases.linaro.org/components/kernel/uefi-linaro/16.02/release/qemu64/QEMU_EFI.fd



-- 
gonzo


More information about the freebsd-hackers mailing list