1# QEMU AArch64 emulator 2This page describes how to build and run coreboot for QEMU/AArch64. 3You can use LinuxBoot via `make menuconfig` or an arbitrary FIT image 4as a payload for QEMU/AArch64. 5 6## Running coreboot in QEMU 7```bash 8qemu-system-aarch64 -bios ./build/coreboot.rom \ 9 -M virt,secure=on,virtualization=on -cpu cortex-a53 \ 10 -nographic -m 8192M 11``` 12 13- The default CPU in QEMU for AArch64 is a cortex-a15 which is 32-bit 14ARM CPU. You need to specify 64-bit ARM CPU via `-cpu cortex-a53`. 15- The default privilege level in QEMU for AArch64 is EL1 that we can't 16have the right to access EL3/EL2 registers. You need to enable EL3/EL2 17via `-machine secure=on,virtualization=on`. 18- You need to specify the size of memory more than 544 MiB because 512 19MiB is reserved for the kernel. 20- The maximum size of memory is 255GiB (-m 261120). 21 22## Building coreboot with an arbitrary FIT payload 23There are 3 steps to make coreboot.rom for QEMU/AArch64. If you select 24LinuxBoot, step 2 and 3 have done by LinuxBoot. 251. Get a DTB (Device Tree Blob) 262. Build a FIT image with a DTB 273. Add a FIT image to coreboot.rom 28 29### 1. Get a DTB 30You can get the DTB from QEMU with the following command. 31``` 32$ qemu-system-aarch64 \ 33 -M virt,dumpdtb=virt.dtb,secure=on,virtualization=on \ 34 -cpu cortex-a53 -nographic -m 8192M 35``` 36 37### 2. Build a FIT image with a DTB 38You need to write an image source file that has an `.its` extension to 39configure kernels, ramdisks, and DTBs. 40See [Flattened uImage Tree documentation](../../lib/payloads/fit.md) for more details. 41 42### 3. Add a FIT image to coreboot.rom 43You can use cbfstool to add the payload you created in step 2 to 44the coreboot.rom. 45``` 46$ ./build/cbfstool ./build/coreboot.rom add -f <path-to-a-payload>/uImage \ 47 -n fallback/payload -t fit -c lzma 48``` 49