Neil Armstrong | 2ea9868 | 2022-03-02 10:42:22 +0100 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
| 3 | Pre-Generated FIP file set |
| 4 | ========================== |
| 5 | |
| 6 | The Amlogic ARMv8 based SoCs uses a vendor variant of the Trusted Firmware-A |
| 7 | boot architecture. |
| 8 | |
| 9 | You can find documentation on the Trusted Firmware-A architecture on: https://www.trustedfirmware.org/projects/tf-a/ |
| 10 | |
| 11 | The Trusted Firmware-A uses the following boot elements (simplified): |
| 12 | |
| 13 | - BL1: First boot step, implemented in ROM on Amlogic SoCs |
| 14 | - BL2: Second boot step, used to initialize the SoC main clocks & DDR interface. The BL21 and ACS board-specific binaries are "inserted" in the BL32 binary before signing/packaging in order to be flashed on the platform. |
| 15 | - BL30: Amlogic Secure Co-Processor (SCP) firmware used to handle all the system management operations (DVFS, suspend/resume, ...) |
| 16 | - BL301: Amlogic Secure Co-Processor (SCP) board-specific firmware "plug-in" to handle custom DVFS & suspend-resume parameters |
| 17 | - BL31: Initializes the interrupt controller and the system management interface (PSCI) |
| 18 | - BL32 (Optional): Is the Trusted Environment Execution (TEE) Operating System to run secure Trusted Apps, e.g. OP-TEE |
| 19 | - BL33: Is the last non-secure step, usually U-Boot which loads Linux |
| 20 | |
| 21 | Amlogic provides in binary form: |
| 22 | |
| 23 | - bl2.bin |
| 24 | - bl30.bin |
| 25 | - bl30.bin |
| 26 | - bl31.img |
| 27 | - bl32.bin |
| 28 | |
| 29 | And for lastest SoCs, Amlogic also provides the DDR drivers used by the BL2 binary. |
| 30 | |
| 31 | The licence of these files wasn't clear until recently, the currently Amlogic distribution licence |
| 32 | is the following: |
| 33 | |
| 34 | .. code-block:: C |
| 35 | |
| 36 | // Copyright (C) 2018 Amlogic, Inc. All rights reserved. |
| 37 | // |
| 38 | // All information contained herein is Amlogic confidential. |
| 39 | // |
| 40 | // This software is provided to you pursuant to Software License |
| 41 | // Agreement (SLA) with Amlogic Inc ("Amlogic"). This software may be |
| 42 | // used only in accordance with the terms of this agreement. |
| 43 | // |
| 44 | // Redistribution and use in source and binary forms, with or without |
| 45 | // modification is strictly prohibited without prior written permission |
| 46 | // from Amlogic. |
| 47 | // |
| 48 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 49 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 50 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 51 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 52 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 53 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 54 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 55 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 56 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 57 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 58 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 59 | |
| 60 | The following files are generated from the Amlogic U-Boot fork: |
| 61 | |
| 62 | - acs.bin: contains the PLL & DDR parameters for the board |
| 63 | - bl301.bin: contains the DVFS & suspend-resume handling code for the board |
| 64 | - bl33.bin: U-boot binary image |
| 65 | |
| 66 | The acs.bin & bl301.bin uses the U-Boot GPL-2.0+ headers & build systems, thus those |
| 67 | are considered issued from GPL-2.0+ source code. |
| 68 | |
| 69 | The tools used to sign & package those binary files are delivered in binary format |
| 70 | for Intel x86-64 and Python 2.x only. |
| 71 | |
| 72 | A collection of pre-built with the corresponding Amlogic binaries for the common |
| 73 | commercially available boards were collected in the https://github.com/LibreELEC/amlogic-boot-fip |
| 74 | repository. |
| 75 | |
| 76 | Using this collection for a commercially available board is very easy. |
| 77 | |
| 78 | Here considering the Libre Computer AML-S905X-CC, which codename is `lepotato`: |
| 79 | |
| 80 | .. code-block:: bash |
| 81 | |
| 82 | $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1 |
| 83 | $ cd amlogic-boot-fip |
| 84 | $ mkdir my-output-dir |
| 85 | $ ./build-fip.sh lepotato /path/to/u-boot/u-boot.bin my-output-dir |
| 86 | |
| 87 | and then write the image to SD with: |
| 88 | |
| 89 | .. code-block:: bash |
| 90 | |
| 91 | $ DEV=/dev/your_sd_device |
| 92 | $ dd if=my-output-dir/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1 |
| 93 | $ dd if=my-output-dir/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444 |