Paul Beesley | f3653a6 | 2019-05-22 11:22:44 +0100 | [diff] [blame] | 1 | QEMU virt Armv8-A |
| 2 | ================= |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 3 | |
Dan Handley | 610e7e1 | 2018-03-01 18:44:00 +0000 | [diff] [blame] | 4 | Trusted Firmware-A (TF-A) implements the EL3 firmware layer for QEMU virt |
| 5 | Armv8-A. BL1 is used as the BootROM, supplied with the -bios argument. |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 6 | When QEMU starts all CPUs are released simultaneously, BL1 selects a |
| 7 | primary CPU to handle the boot and the secondaries are placed in a polling |
| 8 | loop to be released by normal world via PSCI. |
| 9 | |
| 10 | BL2 edits the Flattened Device Tree, FDT, generated by QEMU at run-time to |
| 11 | add a node describing PSCI and also enable methods for the CPUs. |
| 12 | |
Andrew Walbran | 9c4d069 | 2020-01-15 14:11:31 +0000 | [diff] [blame] | 13 | If ``ARM_LINUX_KERNEL_AS_BL33`` is set to 1 then this FDT will be passed to BL33 |
| 14 | via register x0, as expected by a Linux kernel. This allows a Linux kernel image |
| 15 | to be booted directly as BL33 rather than using a bootloader. |
| 16 | |
Masahiro Yamada | 894a38d | 2019-12-26 13:26:49 +0900 | [diff] [blame] | 17 | An ARM64 defconfig v5.5 Linux kernel is known to boot, FDT doesn't need to be |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 18 | provided as it's generated by QEMU. |
| 19 | |
| 20 | Current limitations: |
| 21 | |
| 22 | - Only cold boot is supported |
| 23 | - No build instructions for QEMU\_EFI.fd and rootfs-arm64.cpio.gz |
| 24 | - No instructions for how to load a BL32 (Secure Payload) |
| 25 | |
| 26 | ``QEMU_EFI.fd`` can be dowloaded from |
Masahiro Yamada | 894a38d | 2019-12-26 13:26:49 +0900 | [diff] [blame] | 27 | http://snapshots.linaro.org/components/kernel/leg-virt-tianocore-edk2-upstream/latest/QEMU-KERNEL-AARCH64/RELEASE_GCC5/QEMU_EFI.fd |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 28 | |
| 29 | Boot binaries, except BL1, are primarily loaded via semi-hosting so all |
| 30 | binaries has to reside in the same directory as QEMU is started from. This |
| 31 | is conveniently achieved with symlinks the local names as: |
| 32 | |
| 33 | - ``bl2.bin`` -> BL2 |
| 34 | - ``bl31.bin`` -> BL31 |
| 35 | - ``bl33.bin`` -> BL33 (``QEMU_EFI.fd``) |
Masahiro Yamada | 894a38d | 2019-12-26 13:26:49 +0900 | [diff] [blame] | 36 | - ``Image`` -> linux/arch/arm64/boot/Image |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 37 | |
| 38 | To build: |
| 39 | |
Paul Beesley | 493e349 | 2019-03-13 15:11:04 +0000 | [diff] [blame] | 40 | .. code:: shell |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 41 | |
Paul Beesley | f3653a6 | 2019-05-22 11:22:44 +0100 | [diff] [blame] | 42 | make CROSS_COMPILE=aarch64-none-elf- PLAT=qemu |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 43 | |
Masahiro Yamada | 894a38d | 2019-12-26 13:26:49 +0900 | [diff] [blame] | 44 | To start (QEMU v4.1.0): |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 45 | |
Paul Beesley | 493e349 | 2019-03-13 15:11:04 +0000 | [diff] [blame] | 46 | .. code:: shell |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 47 | |
| 48 | qemu-system-aarch64 -nographic -machine virt,secure=on -cpu cortex-a57 \ |
| 49 | -kernel Image \ |
Masahiro Yamada | 894a38d | 2019-12-26 13:26:49 +0900 | [diff] [blame] | 50 | -append "console=ttyAMA0,38400 keep_bootcon root=/dev/vda2" \ |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 51 | -initrd rootfs-arm64.cpio.gz -smp 2 -m 1024 -bios bl1.bin \ |
| 52 | -d unimp -semihosting-config enable,target=native |