xref: /rk3399_ARM-atf/docs/plat/qemu.rst (revision 24dba2b39f880e156965237dc49a253aa196585a)
1*24dba2b3SPaul BeesleyQEMU virt Armv8-A
2*24dba2b3SPaul Beesley=================
36f625747SDouglas Raillard
44def07d5SDan HandleyTrusted Firmware-A (TF-A) implements the EL3 firmware layer for QEMU virt
54def07d5SDan HandleyArmv8-A. BL1 is used as the BootROM, supplied with the -bios argument.
66f625747SDouglas RaillardWhen QEMU starts all CPUs are released simultaneously, BL1 selects a
76f625747SDouglas Raillardprimary CPU to handle the boot and the secondaries are placed in a polling
86f625747SDouglas Raillardloop to be released by normal world via PSCI.
96f625747SDouglas Raillard
106f625747SDouglas RaillardBL2 edits the Flattened Device Tree, FDT, generated by QEMU at run-time to
116f625747SDouglas Raillardadd a node describing PSCI and also enable methods for the CPUs.
126f625747SDouglas Raillard
134def07d5SDan HandleyAn ARM64 defconfig v4.5 Linux kernel is known to boot, FDT doesn't need to be
146f625747SDouglas Raillardprovided as it's generated by QEMU.
156f625747SDouglas Raillard
166f625747SDouglas RaillardCurrent limitations:
176f625747SDouglas Raillard
186f625747SDouglas Raillard-  Only cold boot is supported
196f625747SDouglas Raillard-  No build instructions for QEMU\_EFI.fd and rootfs-arm64.cpio.gz
206f625747SDouglas Raillard-  No instructions for how to load a BL32 (Secure Payload)
216f625747SDouglas Raillard
226f625747SDouglas Raillard``QEMU_EFI.fd`` can be dowloaded from
236f625747SDouglas Raillardhttp://snapshots.linaro.org/components/kernel/leg-virt-tianocore-edk2-upstream/latest/QEMU-KERNEL-AARCH64/RELEASE_GCC49/QEMU_EFI.fd
246f625747SDouglas Raillard
256f625747SDouglas RaillardBoot binaries, except BL1, are primarily loaded via semi-hosting so all
266f625747SDouglas Raillardbinaries has to reside in the same directory as QEMU is started from. This
276f625747SDouglas Raillardis conveniently achieved with symlinks the local names as:
286f625747SDouglas Raillard
296f625747SDouglas Raillard-  ``bl2.bin`` -> BL2
306f625747SDouglas Raillard-  ``bl31.bin`` -> BL31
316f625747SDouglas Raillard-  ``bl33.bin`` -> BL33 (``QEMU_EFI.fd``)
326f625747SDouglas Raillard-  ``Image`` -> linux/Image
336f625747SDouglas Raillard
346f625747SDouglas RaillardTo build:
356f625747SDouglas Raillard
366f625747SDouglas Raillard::
376f625747SDouglas Raillard
386f625747SDouglas Raillard    make CROSS_COMPILE=aarch64-none-elf- PLAT=qemu
396f625747SDouglas Raillard
406f625747SDouglas RaillardTo start (QEMU v2.6.0):
416f625747SDouglas Raillard
426f625747SDouglas Raillard::
436f625747SDouglas Raillard
446f625747SDouglas Raillard    qemu-system-aarch64 -nographic -machine virt,secure=on -cpu cortex-a57  \
456f625747SDouglas Raillard        -kernel Image                           \
466f625747SDouglas Raillard        -append console=ttyAMA0,38400 keep_bootcon root=/dev/vda2   \
476f625747SDouglas Raillard        -initrd rootfs-arm64.cpio.gz -smp 2 -m 1024 -bios bl1.bin   \
486f625747SDouglas Raillard        -d unimp -semihosting-config enable,target=native
49