xref: /rk3399_ARM-atf/docs/plat/qemu.rst (revision 6f62574767546b11199142b1b577a86571051c40)
1*6f625747SDouglas RaillardARM Trusted Firmware for QEMU virt ARMv8-A
2*6f625747SDouglas Raillard==========================================
3*6f625747SDouglas Raillard
4*6f625747SDouglas RaillardARM Trusted Firmware implements the EL3 firmware layer for QEMU virt
5*6f625747SDouglas RaillardARMv8-A. BL1 is used as the BootROM, supplied with the -bios argument.
6*6f625747SDouglas RaillardWhen QEMU starts all CPUs are released simultaneously, BL1 selects a
7*6f625747SDouglas Raillardprimary CPU to handle the boot and the secondaries are placed in a polling
8*6f625747SDouglas Raillardloop to be released by normal world via PSCI.
9*6f625747SDouglas Raillard
10*6f625747SDouglas RaillardBL2 edits the Flattened Device Tree, FDT, generated by QEMU at run-time to
11*6f625747SDouglas Raillardadd a node describing PSCI and also enable methods for the CPUs.
12*6f625747SDouglas Raillard
13*6f625747SDouglas RaillardAn ARM64 defonfig v4.5 Linux kernel is known to boot, FTD doesn't need to be
14*6f625747SDouglas Raillardprovided as it's generated by QEMU.
15*6f625747SDouglas Raillard
16*6f625747SDouglas RaillardCurrent limitations:
17*6f625747SDouglas Raillard
18*6f625747SDouglas Raillard-  Only cold boot is supported
19*6f625747SDouglas Raillard-  No build instructions for QEMU\_EFI.fd and rootfs-arm64.cpio.gz
20*6f625747SDouglas Raillard-  No instructions for how to load a BL32 (Secure Payload)
21*6f625747SDouglas Raillard
22*6f625747SDouglas Raillard``QEMU_EFI.fd`` can be dowloaded from
23*6f625747SDouglas Raillardhttp://snapshots.linaro.org/components/kernel/leg-virt-tianocore-edk2-upstream/latest/QEMU-KERNEL-AARCH64/RELEASE_GCC49/QEMU_EFI.fd
24*6f625747SDouglas Raillard
25*6f625747SDouglas RaillardBoot binaries, except BL1, are primarily loaded via semi-hosting so all
26*6f625747SDouglas Raillardbinaries has to reside in the same directory as QEMU is started from. This
27*6f625747SDouglas Raillardis conveniently achieved with symlinks the local names as:
28*6f625747SDouglas Raillard
29*6f625747SDouglas Raillard-  ``bl2.bin`` -> BL2
30*6f625747SDouglas Raillard-  ``bl31.bin`` -> BL31
31*6f625747SDouglas Raillard-  ``bl33.bin`` -> BL33 (``QEMU_EFI.fd``)
32*6f625747SDouglas Raillard-  ``Image`` -> linux/Image
33*6f625747SDouglas Raillard
34*6f625747SDouglas RaillardTo build:
35*6f625747SDouglas Raillard
36*6f625747SDouglas Raillard::
37*6f625747SDouglas Raillard
38*6f625747SDouglas Raillard    make CROSS_COMPILE=aarch64-none-elf- PLAT=qemu
39*6f625747SDouglas Raillard
40*6f625747SDouglas RaillardTo start (QEMU v2.6.0):
41*6f625747SDouglas Raillard
42*6f625747SDouglas Raillard::
43*6f625747SDouglas Raillard
44*6f625747SDouglas Raillard    qemu-system-aarch64 -nographic -machine virt,secure=on -cpu cortex-a57  \
45*6f625747SDouglas Raillard        -kernel Image                           \
46*6f625747SDouglas Raillard        -append console=ttyAMA0,38400 keep_bootcon root=/dev/vda2   \
47*6f625747SDouglas Raillard        -initrd rootfs-arm64.cpio.gz -smp 2 -m 1024 -bios bl1.bin   \
48*6f625747SDouglas Raillard        -d unimp -semihosting-config enable,target=native
49