| 1 | # QEMU AArch64 emulator |
| 2 | This page describes how to build and run coreboot for QEMU/AArch64. |
| 3 | You can use LinuxBoot via `make menuconfig` or an arbitrary FIT image |
| 4 | as a payload for QEMU/AArch64. |
| 5 | |
| 6 | ## Running coreboot in QEMU |
| 7 | ```bash |
| 8 | qemu-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 |
| 14 | ARM 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 |
| 16 | have the right to access EL3/EL2 registers. You need to enable EL3/EL2 |
| 17 | via `-machine secure=on,virtualization=on`. |
| 18 | - You need to specify the size of memory more than 544 MiB because 512 |
| 19 | MiB is reserved for the kernel. |
| 20 | - The maximum size of memory is 255GiB (-m 261120). |
| 21 | |
| 22 | ## Building coreboot with an arbitrary FIT payload |
| 23 | There are 3 steps to make coreboot.rom for QEMU/AArch64. If you select |
| 24 | LinuxBoot, step 2 and 3 have done by LinuxBoot. |
| 25 | 1. Get a DTB (Device Tree Blob) |
| 26 | 2. Build a FIT image with a DTB |
| 27 | 3. Add a FIT image to coreboot.rom |
| 28 | |
| 29 | ### 1. Get a DTB |
| 30 | You 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 |
| 38 | You need to write an image source file that has an `.its` extension to |
| 39 | configure kernels, ramdisks, and DTBs. |
| 40 | See [Flattened uImage Tree documentation](../../lib/payloads/fit.md) for more details. |
| 41 | |
| 42 | ### 3. Add a FIT image to coreboot.rom |
| 43 | You can use cbfstool to add the payload you created in step 2 to |
| 44 | the 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 | ``` |