1c5407693SSandrine BailleuxBooting Firmware Update images 2c5407693SSandrine Bailleux------------------------------ 3c5407693SSandrine Bailleux 4c5407693SSandrine BailleuxWhen Firmware Update (FWU) is enabled there are at least 2 new images 5c5407693SSandrine Bailleuxthat have to be loaded, the Non-Secure FWU ROM (NS-BL1U), and the 6c5407693SSandrine BailleuxFWU FIP. 7c5407693SSandrine Bailleux 8c5407693SSandrine BailleuxThe additional fip images must be loaded with: 9c5407693SSandrine Bailleux 10c5407693SSandrine Bailleux:: 11c5407693SSandrine Bailleux 12c5407693SSandrine Bailleux --data cluster0.cpu0="<path_to>/ns_bl1u.bin"@0x0beb8000 [ns_bl1u_base_address] 13c5407693SSandrine Bailleux --data cluster0.cpu0="<path_to>/fwu_fip.bin"@0x08400000 [ns_bl2u_base_address] 14c5407693SSandrine Bailleux 15c5407693SSandrine BailleuxThe address ns_bl1u_base_address is the value of NS_BL1U_BASE. 16c5407693SSandrine BailleuxIn the same way, the address ns_bl2u_base_address is the value of 17c5407693SSandrine BailleuxNS_BL2U_BASE. 18c5407693SSandrine Bailleux 19c5407693SSandrine BailleuxBooting an EL3 payload 20c5407693SSandrine Bailleux---------------------- 21c5407693SSandrine Bailleux 22c5407693SSandrine BailleuxThe EL3 payloads boot flow requires the CPU's mailbox to be cleared at reset for 23c5407693SSandrine Bailleuxthe secondary CPUs holding pen to work properly. Unfortunately, its reset value 24c5407693SSandrine Bailleuxis undefined on the FVP platform and the FVP platform code doesn't clear it. 25c5407693SSandrine BailleuxTherefore, one must modify the way the model is normally invoked in order to 26c5407693SSandrine Bailleuxclear the mailbox at start-up. 27c5407693SSandrine Bailleux 28c5407693SSandrine BailleuxOne way to do that is to create an 8-byte file containing all zero bytes using 29c5407693SSandrine Bailleuxthe following command: 30c5407693SSandrine Bailleux 31c5407693SSandrine Bailleux.. code:: shell 32c5407693SSandrine Bailleux 33c5407693SSandrine Bailleux dd if=/dev/zero of=mailbox.dat bs=1 count=8 34c5407693SSandrine Bailleux 35c5407693SSandrine Bailleuxand pre-load it into the FVP memory at the mailbox address (i.e. ``0x04000000``) 36c5407693SSandrine Bailleuxusing the following model parameters: 37c5407693SSandrine Bailleux 38c5407693SSandrine Bailleux:: 39c5407693SSandrine Bailleux 40c5407693SSandrine Bailleux --data cluster0.cpu0=mailbox.dat@0x04000000 [Base FVPs] 41c5407693SSandrine Bailleux --data=mailbox.dat@0x04000000 [Foundation FVP] 42c5407693SSandrine Bailleux 43c5407693SSandrine BailleuxTo provide the model with the EL3 payload image, the following methods may be 44c5407693SSandrine Bailleuxused: 45c5407693SSandrine Bailleux 46c5407693SSandrine Bailleux#. If the EL3 payload is able to execute in place, it may be programmed into 47c5407693SSandrine Bailleux flash memory. On Base Cortex and AEM FVPs, the following model parameter 48c5407693SSandrine Bailleux loads it at the base address of the NOR FLASH1 (the NOR FLASH0 is already 49c5407693SSandrine Bailleux used for the FIP): 50c5407693SSandrine Bailleux 51c5407693SSandrine Bailleux :: 52c5407693SSandrine Bailleux 53c5407693SSandrine Bailleux -C bp.flashloader1.fname="<path-to>/<el3-payload>" 54c5407693SSandrine Bailleux 55c5407693SSandrine Bailleux On Foundation FVP, there is no flash loader component and the EL3 payload 56c5407693SSandrine Bailleux may be programmed anywhere in flash using method 3 below. 57c5407693SSandrine Bailleux 58c5407693SSandrine Bailleux#. When using the ``SPIN_ON_BL1_EXIT=1`` loading method, the following DS-5 59c5407693SSandrine Bailleux command may be used to load the EL3 payload ELF image over JTAG: 60c5407693SSandrine Bailleux 61c5407693SSandrine Bailleux :: 62c5407693SSandrine Bailleux 63c5407693SSandrine Bailleux load <path-to>/el3-payload.elf 64c5407693SSandrine Bailleux 65c5407693SSandrine Bailleux#. The EL3 payload may be pre-loaded in volatile memory using the following 66c5407693SSandrine Bailleux model parameters: 67c5407693SSandrine Bailleux 68c5407693SSandrine Bailleux :: 69c5407693SSandrine Bailleux 70c5407693SSandrine Bailleux --data cluster0.cpu0="<path-to>/el3-payload>"@address [Base FVPs] 71c5407693SSandrine Bailleux --data="<path-to>/<el3-payload>"@address [Foundation FVP] 72c5407693SSandrine Bailleux 73c5407693SSandrine Bailleux The address provided to the FVP must match the ``EL3_PAYLOAD_BASE`` address 74c5407693SSandrine Bailleux used when building TF-A. 75c5407693SSandrine Bailleux 762de9a254SSalman NabiBooting a kernel image in BL33 772de9a254SSalman Nabi------------------------------ 78c5407693SSandrine Bailleux 791a219805SSalman NabiTF-A can boot a Linux kernel, which uses a ramdisk as a filesystem. The 801a219805SSalman Nabirequired initrd properties are injected in to the device tree blob (DTB) at 811a219805SSalman Nabibuild time. 82c5407693SSandrine Bailleux 832de9a254SSalman NabiKernel image packaged in fip as a BL33 image 842de9a254SSalman Nabi^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 852de9a254SSalman Nabi 862de9a254SSalman NabiA Linux kernel image can be packaged in the fip as a BL33 image and then 872de9a254SSalman Nabibooted in TF-A. 882de9a254SSalman Nabi 892de9a254SSalman NabiFor example, the firmware can be built as: 902de9a254SSalman Nabi 912de9a254SSalman Nabi.. code:: shell 922de9a254SSalman Nabi 932de9a254SSalman Nabi make PLAT=fvp DEBUG=1 \ 942de9a254SSalman Nabi ARM_LINUX_KERNEL_AS_BL33 \ 952de9a254SSalman Nabi BL33=<path-to-kernel-binary> \ 962de9a254SSalman Nabi INITRD_SIZE=0x8000000 \ 972de9a254SSalman Nabi all fip 982de9a254SSalman Nabi 992de9a254SSalman NabiThe options ``INITRD_SIZE`` or ``INITRD_PATH`` triggers the insertion of initrd 1002de9a254SSalman Nabiproperties in to the DTB. ``INITRD_BASE`` is also required but a default value 1012de9a254SSalman Nabiis set by the FVP platform. 1022de9a254SSalman Nabi 1032de9a254SSalman NabiThe options available here are: 1042de9a254SSalman Nabi 1052de9a254SSalman Nabi:: 1062de9a254SSalman Nabi 1072de9a254SSalman Nabi INITRD_BASE: Set the initrd base address in memory. Defaults to 0x90000000 in FVP. 1082de9a254SSalman Nabi INITRD_SIZE: Set the initrd size in dec or hex format. Hex format must precede with '0x'. 1092de9a254SSalman Nabi INITRD_PATH: Provide an initrd path for the build time to determine its exact size. 1102de9a254SSalman Nabi 1112de9a254SSalman NabiUsers can provide either ``INITRD_SIZE`` or ``INITRD_PATH`` to set the initrd 1122de9a254SSalman Nabisize value. ``INITRD_SIZE`` takes prioty over ``INITRD_PATH``. 1132de9a254SSalman Nabi 1142de9a254SSalman NabiNow the fvp binary can be run as: 1152de9a254SSalman Nabi 1162de9a254SSalman Nabi.. code:: shell 1172de9a254SSalman Nabi 1182de9a254SSalman Nabi <path-to>/FVP_Base_AEMv8A-AEMv8A \ 1192de9a254SSalman Nabi -C bp.secureflashloader.fname=<path-to>/bl1.bin \ 1202de9a254SSalman Nabi -C bp.flashloader0.fname=<path-to>/fip.bin \ 1212de9a254SSalman Nabi --data cluster0.cpu0="<path-to>/<initrd.bin>"@0x90000000 1222de9a254SSalman Nabi 1232de9a254SSalman Nabi.. note:: 1242de9a254SSalman Nabi Providing a higher value for an initrd size than the actual size of the file 1252de9a254SSalman Nabi is supported but it will trigger a non-breaking "Initramfs unpacking failed" 1262de9a254SSalman Nabi error by the kernel at runtime. This error can be ignored because initrd's 1272de9a254SSalman Nabi can be stacked one after another, when the kernel unpacks the first initrd it 1282de9a254SSalman Nabi looks for another in the extra space which it won't find, hence the error. 1292de9a254SSalman Nabi 1301a219805SSalman NabiPreloaded kernel image - Normal flow 1311a219805SSalman Nabi^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1321a219805SSalman Nabi 1331a219805SSalman NabiThe following example uses a simplified boot flow to boot a Linux kernel 1341a219805SSalman Nabiusing TF-A. This can be useful if the kernel is already present in memory 1351a219805SSalman Nabi(like in FVP). 1361a219805SSalman Nabi 1371a219805SSalman NabiFor example, if the kernel is loaded at ``0x80080000`` the firmware can be 1381a219805SSalman Nabibuilt like this: 139c5407693SSandrine Bailleux 140c5407693SSandrine Bailleux.. code:: shell 141c5407693SSandrine Bailleux 142c5407693SSandrine Bailleux make PLAT=fvp DEBUG=1 \ 143c5407693SSandrine Bailleux ARM_LINUX_KERNEL_AS_BL33=1 \ 144c5407693SSandrine Bailleux PRELOADED_BL33_BASE=0x80080000 \ 1451a219805SSalman Nabi INITRD_SIZE=0x8000000 \ 146c5407693SSandrine Bailleux all fip 147c5407693SSandrine Bailleux 1481a219805SSalman NabiNow the FVP binary can be run with the following command: 149c5407693SSandrine Bailleux 150c5407693SSandrine Bailleux.. code:: shell 151c5407693SSandrine Bailleux 152c5407693SSandrine Bailleux <path-to>/FVP_Base_AEMv8A-AEMv8A \ 1531a219805SSalman Nabi -C bp.secureflashloader.fname=<path-to>/bl1.bin \ 1541a219805SSalman Nabi -C bp.flashloader0.fname=<path-to>/fip.bin \ 1551a219805SSalman Nabi --data cluster0.cpu0="<path-to>/<kernel-binary>"@0x80080000 \ 1561a219805SSalman Nabi --data cluster0.cpu0="<path-to>/<initrd.bin>"@0x90000000 1571a219805SSalman Nabi 1582de9a254SSalman NabiPreloaded kernel image - Reset to BL31 1592de9a254SSalman Nabi^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1601a219805SSalman Nabi 1611a219805SSalman NabiWe can also boot a Linux kernel by jumping directly to BL31 ``RESET_TO_BL31=1``. 1621a219805SSalman NabiThis requires preloading a DTB into memory. We can inject the initrd start and 1631a219805SSalman Nabiend properties into the DTB (HW_CONFIG) at build time which is then stored by 1641a219805SSalman NabiTF-A in ``build/fvp/<build-type>/fdts/`` directory. 1651a219805SSalman Nabi 1661a219805SSalman NabiFor example, we can build the firmware as: 1671a219805SSalman Nabi 1681a219805SSalman Nabi.. code:: shell 1691a219805SSalman Nabi 1701a219805SSalman Nabi make PLAT=fvp DEBUG=1 \ 1711a219805SSalman Nabi RESET_TO_BL31=1 \ 1721a219805SSalman Nabi ARM_LINUX_KERNEL_AS_BL33=1 \ 1731a219805SSalman Nabi PRELOADED_BL33_BASE=0x80080000 \ 1741a219805SSalman Nabi ARM_PRELOADED_DTB_BASE=0x87F00000 \ 1751a219805SSalman Nabi INITRD_BASE=0x88000000 \ 1761a219805SSalman Nabi INITRD_PATH=<path-to>/initrd.bin 1771a219805SSalman Nabi 1781a219805SSalman NabiNow we can run the binary as: 1791a219805SSalman Nabi 1801a219805SSalman Nabi.. code:: shell 1811a219805SSalman Nabi 1821a219805SSalman Nabi <path-to>/FVP_Base_AEMv8A-AEMv8A \ 183c5407693SSandrine Bailleux -C cluster0.NUM_CORES=4 \ 184c5407693SSandrine Bailleux -C cluster0.cpu0.RVBAR=0x04001000 \ 185c5407693SSandrine Bailleux -C cluster0.cpu1.RVBAR=0x04001000 \ 186c5407693SSandrine Bailleux -C cluster0.cpu2.RVBAR=0x04001000 \ 187c5407693SSandrine Bailleux -C cluster0.cpu3.RVBAR=0x04001000 \ 188c5407693SSandrine Bailleux --data cluster0.cpu0="<path-to>/bl31.bin"@0x04001000 \ 189c5407693SSandrine Bailleux --data cluster0.cpu0="<path-to>/<kernel-binary>"@0x80080000 \ 1901a219805SSalman Nabi --data cluster0.cpu0="<path-to>/<initrd.bin>"@0x88000000 \ 1911a219805SSalman Nabi --data cluster0.cpu0="<path-to>/fdts/fvp-base-gicv3-psci.dtb"@87F00000 192c5407693SSandrine Bailleux 193c5407693SSandrine BailleuxObtaining the Flattened Device Trees 194c5407693SSandrine Bailleux^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 195c5407693SSandrine Bailleux 196c5407693SSandrine BailleuxDepending on the FVP configuration and Linux configuration used, different 197c5407693SSandrine BailleuxFDT files are required. FDT source files for the Foundation and Base FVPs can 198c5407693SSandrine Bailleuxbe found in the TF-A source directory under ``fdts/``. The Foundation FVP has 199c5407693SSandrine Bailleuxa subset of the Base FVP components. For example, the Foundation FVP lacks 200c5407693SSandrine BailleuxCLCD and MMC support, and has only one CPU cluster. 201c5407693SSandrine Bailleux 202c5407693SSandrine Bailleux.. note:: 203c5407693SSandrine Bailleux It is not recommended to use the FDTs built along the kernel because not 204c5407693SSandrine Bailleux all FDTs are available from there. 205c5407693SSandrine Bailleux 206c5407693SSandrine BailleuxThe dynamic configuration capability is enabled in the firmware for FVPs. 207c5407693SSandrine BailleuxThis means that the firmware can authenticate and load the FDT if present in 208c5407693SSandrine BailleuxFIP. A default FDT is packaged into FIP during the build based on 209c5407693SSandrine Bailleuxthe build configuration. This can be overridden by using the ``FVP_HW_CONFIG`` 210c5407693SSandrine Bailleuxor ``FVP_HW_CONFIG_DTS`` build options (refer to 211c5407693SSandrine Bailleux:ref:`build_options_arm_fvp_platform` for details on the options). 212c5407693SSandrine Bailleux 213c5407693SSandrine Bailleux- ``fvp-base-gicv2-psci.dts`` 214c5407693SSandrine Bailleux 215c5407693SSandrine Bailleux For use with models such as the Cortex-A57-A53 or Cortex-A32 Base FVPs 216c5407693SSandrine Bailleux without shifted affinities and with Base memory map configuration. 217c5407693SSandrine Bailleux 218c5407693SSandrine Bailleux- ``fvp-base-gicv3-psci.dts`` 219c5407693SSandrine Bailleux 220c5407693SSandrine Bailleux For use with models such as the Cortex-A57-A53 or Cortex-A32 Base FVPs 221c5407693SSandrine Bailleux without shifted affinities and with Base memory map configuration and 222c5407693SSandrine Bailleux Linux GICv3 support. 223c5407693SSandrine Bailleux 224c5407693SSandrine Bailleux- ``fvp-base-gicv3-psci-1t.dts`` 225c5407693SSandrine Bailleux 226c5407693SSandrine Bailleux For use with models such as the AEMv8-RevC Base FVP with shifted affinities, 227c5407693SSandrine Bailleux single threaded CPUs, Base memory map configuration and Linux GICv3 support. 228c5407693SSandrine Bailleux 229c5407693SSandrine Bailleux- ``fvp-base-gicv3-psci-dynamiq.dts`` 230c5407693SSandrine Bailleux 231c5407693SSandrine Bailleux For use with models as the Cortex-A55-A75 Base FVPs with shifted affinities, 232c5407693SSandrine Bailleux single cluster, single threaded CPUs, Base memory map configuration and Linux 233c5407693SSandrine Bailleux GICv3 support. 234c5407693SSandrine Bailleux 235c5407693SSandrine Bailleux- ``fvp-foundation-gicv2-psci.dts`` 236c5407693SSandrine Bailleux 237c5407693SSandrine Bailleux For use with Foundation FVP with Base memory map configuration. 238c5407693SSandrine Bailleux 239c5407693SSandrine Bailleux- ``fvp-foundation-gicv3-psci.dts`` 240c5407693SSandrine Bailleux 241c5407693SSandrine Bailleux (Default) For use with Foundation FVP with Base memory map configuration 242c5407693SSandrine Bailleux and Linux GICv3 support. 243c5407693SSandrine Bailleux 24464c83420SManish PandeyGICv5 Support 24564c83420SManish Pandey^^^^^^^^^^^^^ 24664c83420SManish Pandey 24764c83420SManish PandeyGICv5 support in TF-A is currently **experimental** and provided only for early 24864c83420SManish Pandeydevelopment and testing purposes. A simplified build configuration is available 24964c83420SManish Pandeyto allow booting the Linux kernel as a BL33 payload on the FVP platform. 25064c83420SManish Pandey 25164c83420SManish PandeyKey notes: 25264c83420SManish Pandey 25364c83420SManish Pandey- The support is **not production-ready** and is intended to assist with 25464c83420SManish Pandey upstream kernel development and validation. 255*d358eb21SBoyan Karatotev- The device tree bindings are **not finalized** 25664c83420SManish Pandey- Use this configuration at your own discretion, understanding that the design 25764c83420SManish Pandey and register usage may change in future revisions. 25864c83420SManish Pandey 25964c83420SManish PandeyThis configuration is **temporary** and may be removed once full GICv5 support 26064c83420SManish Pandeyis integrated upstream. 26164c83420SManish Pandey 26264c83420SManish Pandey.. code:: shell 26364c83420SManish Pandey 26464c83420SManish Pandey make PLAT=fvp DEBUG=1 \ 26564c83420SManish Pandey CTX_INCLUDE_AARCH32_REGS=0 \ 26664c83420SManish Pandey FVP_USE_GIC_DRIVER=FVP_GICV5 \ 26764c83420SManish Pandey ARM_LINUX_KERNEL_AS_BL33=1 \ 26864c83420SManish Pandey PRELOADED_BL33_BASE=0x84000000 \ 26964c83420SManish Pandey FVP_HW_CONFIG_DTS=<PROVIDE_YOUR_OWN_DT> \ 27064c83420SManish Pandey 271c5407693SSandrine Bailleux-------------- 272c5407693SSandrine Bailleux 273*d358eb21SBoyan Karatotev*Copyright (c) 2019-2025, Arm Limited. All rights reserved.* 274