1*f834b64fSMario BălănicăRaspberry Pi 5 2*f834b64fSMario Bălănică============== 3*f834b64fSMario Bălănică 4*f834b64fSMario BălănicăThe `Raspberry Pi 5`_ is a single-board computer that contains four 5*f834b64fSMario BălănicăArm Cortex-A76 cores. 6*f834b64fSMario Bălănică 7*f834b64fSMario BălănicăThis port is a minimal BL31 implementation capable of booting 64-bit EL2 8*f834b64fSMario Bălănicăpayloads such as Linux and EDK2. 9*f834b64fSMario Bălănică 10*f834b64fSMario Bălănică**IMPORTANT NOTE**: This port isn't secure. All of the memory used is DRAM, 11*f834b64fSMario Bălănicăwhich is available from both the Non-secure and Secure worlds. The SoC does 12*f834b64fSMario Bălănicănot seem to feature a secure memory controller of any kind, so portions of 13*f834b64fSMario BălănicăDRAM can't be protected properly from the Non-secure world. 14*f834b64fSMario Bălănică 15*f834b64fSMario BălănicăBuild 16*f834b64fSMario Bălănică------------------ 17*f834b64fSMario Bălănică 18*f834b64fSMario BălănicăTo build this platform, run: 19*f834b64fSMario Bălănică 20*f834b64fSMario Bălănică.. code:: shell 21*f834b64fSMario Bălănică 22*f834b64fSMario Bălănică CROSS_COMPILE=aarch64-linux-gnu- make PLAT=rpi5 DEBUG=1 23*f834b64fSMario Bălănică 24*f834b64fSMario BălănicăThe firmware will be generated at ``build/rpi5/debug/bl31.bin``. 25*f834b64fSMario Bălănică 26*f834b64fSMario BălănicăThe following build options are supported: 27*f834b64fSMario Bălănică 28*f834b64fSMario Bălănică- ``RPI3_DIRECT_LINUX_BOOT``: Enabled by default. Allows direct boot of the Linux 29*f834b64fSMario Bălănică kernel from the firmware. 30*f834b64fSMario Bălănică 31*f834b64fSMario Bălănică- ``PRELOADED_BL33_BASE``: Used to specify the fixed address of a BL33 binary 32*f834b64fSMario Bălănică that has been preloaded by earlier boot stages (VPU). Useful for bundling 33*f834b64fSMario Bălănică BL31 and BL33 in the same ``armstub`` image (e.g. TF-A + EDK2). 34*f834b64fSMario Bălănică 35*f834b64fSMario Bălănică- ``RPI3_PRELOADED_DTB_BASE``: This option allows to specify the fixed address of 36*f834b64fSMario Bălănică a DTB in memory. Can only be used if ``device_tree_address=`` is present in 37*f834b64fSMario Bălănică config.txt. 38*f834b64fSMario Bălănică 39*f834b64fSMario Bălănică- ``RPI3_RUNTIME_UART``: Indicates whether TF-A should use the debug UART for 40*f834b64fSMario Bălănică runtime messages or not. ``-1`` (default) disables the option, any other value 41*f834b64fSMario Bălănică enables it. 42*f834b64fSMario Bălănică 43*f834b64fSMario BălănicăUsage 44*f834b64fSMario Bălănică------------------ 45*f834b64fSMario Bălănică 46*f834b64fSMario BălănicăCopy the firmware binary to the first FAT32 partition of a supported boot media 47*f834b64fSMario Bălănică(SD, USB) and append ``armstub=bl31.bin`` to config.txt, or just rename the 48*f834b64fSMario Bălănicăfile to ``armstub8-2712.bin``. 49*f834b64fSMario Bălănică 50*f834b64fSMario BălănicăNo other config options or files are required by the firmware alone, this will 51*f834b64fSMario Bălănicădepend on the payload you intend to run. 52*f834b64fSMario Bălănică 53*f834b64fSMario BălănicăFor Linux, you must also place an appropriate DTB and kernel in the boot 54*f834b64fSMario Bălănicăpartition. This has been validated with a copy of Raspberry Pi OS. 55*f834b64fSMario Bălănică 56*f834b64fSMario BălănicăThe VPU will preload a BL33 AArch64 image named either ``kernel_2712.img`` or 57*f834b64fSMario Bălănică``kernel8.img``, which can be overridden by adding a ``kernel=filename`` option 58*f834b64fSMario Bălănicăto config.txt. 59*f834b64fSMario Bălănică 60*f834b64fSMario BălănicăKernel and DTB load addresses are also chosen by the VPU and can be changed with 61*f834b64fSMario Bălănică``kernel_address=`` and ``device_tree_address=`` in config.txt. If TF-A was built 62*f834b64fSMario Bălănicăwith ``PRELOADED_BL33_BASE`` or ``RPI3_PRELOADED_DTB_BASE``, setting those config 63*f834b64fSMario Bălănicăoptions may be necessary. 64*f834b64fSMario Bălănică 65*f834b64fSMario BălănicăBy default, all boot stages print messages to the dedicated UART debug port. 66*f834b64fSMario BălănicăConfiguration is ``115200 8n1``. 67*f834b64fSMario Bălănică 68*f834b64fSMario BălănicăDesign 69*f834b64fSMario Bălănică------------------ 70*f834b64fSMario Bălănică 71*f834b64fSMario BălănicăThis port is largely based on the RPi 4 one. 72*f834b64fSMario Bălănică 73*f834b64fSMario BălănicăThe boot process is essentially the same, the only notable difference being that 74*f834b64fSMario Bălănicăall VPU blobs have been moved into EEPROM (former start4.elf & fixup4.dat). There's 75*f834b64fSMario Bălănicăalso a custom BL31 TF-A armstub included for PSCI, which can be replaced with this 76*f834b64fSMario Bălănicăport. 77*f834b64fSMario Bălănică 78*f834b64fSMario Bălănică.. _Raspberry Pi 5: https://www.raspberrypi.com/products/raspberry-pi-5/ 79