From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 46419C6FD1D for ; Mon, 20 Mar 2023 12:55:22 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6116085BAC; Mon, 20 Mar 2023 13:54:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TdYNIQY6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2410F85ABB; Mon, 20 Mar 2023 12:46:24 +0100 (CET) Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 07D1384CFA for ; Mon, 20 Mar 2023 12:46:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=christianshewitt@gmail.com Received: by mail-wr1-x430.google.com with SMTP id h17so10026093wrt.8 for ; Mon, 20 Mar 2023 04:46:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679312777; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PtLZz3+pquEcU8HzOf+k36RUHv2uWugpdgCBCali/z8=; b=TdYNIQY65NwCkccTwR/6PQbHYtoBny7zsJjU8rkn/98eqEW7+s5nptS8uR4t+9OZD8 YWB6hacVStLjykFDMxWj1uuQ03zV158F5ubtYFm6P3yjaPrLQiuTQdjc1NecAM60oL3Z DVeE/D6/DuV5g/bNmGCClScVF+EhYZ22QOc2AbxAa1EL4ktRjzTWRNO9gKvKisLyCFgg ovhaNBn3dUZrE22FfFy/fxUM13k/LmWy/6OsyFsTSh40djh0OP24Na+jK5HFtrYTyqXQ NF1lYXw2FRcXaywj6BN/Y9XNAofp2kPbKVDp+64Z0QeXZy+y4k59GDHibHD9GvjC9aas juEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679312777; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PtLZz3+pquEcU8HzOf+k36RUHv2uWugpdgCBCali/z8=; b=0mZ06v3vKIc53wdXYHljGF/pqbeA86OST1WGQU+RKQU9473xzI7HFwIxw1fmf9rAPA xOnb13YA16RqTtQoHNhPtxLfUy8ZHWgQetpFcFEfwSphjNelB9i1iRDlf9dZgMh36B9c FMVswMVzJOFRUFmyCCNThqL4ukTVm0YACYHiWQItezE9iQntHR702dihmhUhtlukSvkE HbbGNbvUM2NV0LFipvA4PWLhcjWRNdkk2JLSy5dJ7WNoEPpbGF31pKSZUm7rEanSOq7O YvlhB4NakoojAzH2a67FLszQmA9T3pwQ3x1dFQLlb+gbThv+X7Fm+U1F/71z/Flwdr1s ZokQ== X-Gm-Message-State: AO0yUKUnCvG0pCIkoxG/UVoYFkw3c4bwJyqrBL71r9E+EW0i7CWZ+BYj HbJcYB8iuEViWt5ms/sqXtYZPmRtYJczy7yC X-Google-Smtp-Source: AK7set/r8yj2UwEc/KtkoH4Brxyb0Au/D6PQZQDvyeue2mv9RpUje8T/bdM0fSF2m95eLKp0S4VJxA== X-Received: by 2002:adf:f84f:0:b0:2cf:e645:aa60 with SMTP id d15-20020adff84f000000b002cfe645aa60mr13349409wrq.19.1679312777472; Mon, 20 Mar 2023 04:46:17 -0700 (PDT) Received: from toolbox.. ([87.200.95.144]) by smtp.gmail.com with ESMTPSA id w2-20020a5d6802000000b002cfe687fc7asm8669836wru.67.2023.03.20.04.46.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 04:46:17 -0700 (PDT) From: Christian Hewitt To: u-boot@lists.denx.de, u-boot-amlogic@groups.io, linux-amlogic@lists.infradead.org Cc: Christian Hewitt Subject: [PATCH 03/33] doc: boards: amlogic: update documentation for pre-generated-fip's Date: Mon, 20 Mar 2023 11:45:39 +0000 Message-Id: <20230320114609.930145-4-christianshewitt@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230320114609.930145-1-christianshewitt@gmail.com> References: <20230320114609.930145-1-christianshewitt@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Mon, 20 Mar 2023 13:54:05 +0100 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Improve documentation. Signed-off-by: Christian Hewitt --- doc/board/amlogic/pre-generated-fip.rst | 138 +++++++++++++++--------- 1 file changed, 88 insertions(+), 50 deletions(-) diff --git a/doc/board/amlogic/pre-generated-fip.rst b/doc/board/amlogic/pre-generated-fip.rst index c63ea616b8..6a43d776d4 100644 --- a/doc/board/amlogic/pre-generated-fip.rst +++ b/doc/board/amlogic/pre-generated-fip.rst @@ -1,24 +1,57 @@ .. SPDX-License-Identifier: GPL-2.0+ -Pre-Generated FIP file set -========================== +Pre-Generated FIP File Repo +=========================== -The Amlogic ARMv8 based SoCs uses a vendor variant of the Trusted Firmware-A -boot architecture. +Pre-built Flattened Image Package (FIP) sources and Amlogic signing binaries for many +commercially available boards and some Android STB devices are collected for use with +distro build-systems here: https://github.com/LibreELEC/amlogic-boot-fip -You can find documentation on the Trusted Firmware-A architecture on: https://www.trustedfirmware.org/projects/tf-a/ +Using the pre-built FIP sources to sign U-Boot is simple, e.g. for LePotato: -The Trusted Firmware-A uses the following boot elements (simplified): +.. code-block:: bash + + $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1 + $ cd amlogic-boot-fip + $ mkdir my-output-dir + $ ./build-fip.sh lepotato /path/to/u-boot/u-boot.bin my-output-dir + +Then write U-Boot to SD or eMMC with: + +.. code-block:: bash + + $ DEV=/dev/boot_device + $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1 + $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440 + +Files Included +-------------- + +Amlogic ARMv8 SoCs use a vendor modified variant of the ARM Trusted Firmware-A boot +architecture. See documentation here: https://www.trustedfirmware.org/projects/tf-a/ + +Trusted Firmware-A uses the following boot elements (simplified): + +- BL1: First boot step implemented in ROM on Amlogic SoCs + +- BL2: Second boot step used to initialize the SoC main clocks & DDR interface. BL21 + and ACS board-specific binaries must be "inserted" into the BL2 binary before signing + and packaging in order to be flashed on the platform + +- BL30: Amlogic Secure Co-Processor (SCP) firmware used to handle all system management + operations (DVFS, suspend/resume, ..) + +- BL301: Amlogic Secure Co-Processor (SCP) board-specific firmware "plug-in" to handle + custom DVFS & suspend-resume parameters -- BL1: First boot step, implemented in ROM on Amlogic SoCs -- 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. -- BL30: Amlogic Secure Co-Processor (SCP) firmware used to handle all the system management operations (DVFS, suspend/resume, ...) -- BL301: Amlogic Secure Co-Processor (SCP) board-specific firmware "plug-in" to handle custom DVFS & suspend-resume parameters - BL31: Initializes the interrupt controller and the system management interface (PSCI) -- BL32 (Optional): Is the Trusted Environment Execution (TEE) Operating System to run secure Trusted Apps, e.g. OP-TEE + +- BL32 (Optional): Is the Trusted Environment Execution (TEE) Operating System used to + run secure Trusted Apps, e.g. OP-TEE + - BL33: Is the last non-secure step, usually U-Boot which loads Linux -Amlogic provides in binary form: +Amlogic sources provide the following binaries: - bl2.bin - bl30.bin @@ -26,10 +59,50 @@ Amlogic provides in binary form: - bl31.img - bl32.bin -And for lastest SoCs, Amlogic also provides the DDR drivers used by the BL2 binary. +For G12A/B and SM1 Amlogic also provides DDR drivers used by the BL2 binary: + +- ddr4_1d.fw +- ddr4_2d.fw +- ddr3_1d.fw +- piei.fw +- lpddr4_1d.fw +- lpddr4_2d.fw +- diag_lpddr4.fw +- aml_ddr.fw + +The following files are generated from the Amlogic U-Boot fork: + +- acs.bin: Contains the PLL & DDR parameters for the board +- bl301.bin: Contains the DVFS & suspend-resume handling code for the board +- bl33.bin: U-boot binary image + +The acs.bin and bl301.bin files use U-Boot GPL-2.0+ headers and U-Boot build system and +are thus considered to be issued from GPL-2.0+ source code. + +Amlogic alo provides pre-compiled x86_64 and Python2 binaries: -The licence of these files wasn't clear until recently, the currently Amlogic distribution licence -is the following: +- aml_encrypt_gxb +- aml_encrypt_gxl +- aml_encrypt_g12a +- aml_encrypt_g12b +- acs_tool.pyc + +The repo replaces the pre-compiled acs_tool.pyc with a Python3 acs_tool.py that can be +used with modern build hosts. + +The repo also provides the following files used with GXBB boards: + +- bl1.bin.hardkernel +- aml_chksum + +The repo also supports the open-source 'gxlimg' signing tool that can be used to sign +U-Boot binaries for GXL/GXM/G12A/G12B/SM1 boards: https://github.com/repk/gxlimg + +Licensing +--------- + +The licence of Amlogic provided binaries was not historically clear but has now been +clarified. The current Amlogic distribution licence is below: .. code-block:: C @@ -56,38 +129,3 @@ is the following: // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The following files are generated from the Amlogic U-Boot fork: - -- acs.bin: contains the PLL & DDR parameters for the board -- bl301.bin: contains the DVFS & suspend-resume handling code for the board -- bl33.bin: U-boot binary image - -The acs.bin & bl301.bin uses the U-Boot GPL-2.0+ headers & build systems, thus those -are considered issued from GPL-2.0+ source code. - -The tools used to sign & package those binary files are delivered in binary format -for Intel x86-64 and Python 2.x only. - -A collection of pre-built with the corresponding Amlogic binaries for the common -commercially available boards were collected in the https://github.com/LibreELEC/amlogic-boot-fip -repository. - -Using this collection for a commercially available board is very easy. - -Here considering the Libre Computer AML-S905X-CC, which codename is `lepotato`: - -.. code-block:: bash - - $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1 - $ cd amlogic-boot-fip - $ mkdir my-output-dir - $ ./build-fip.sh lepotato /path/to/u-boot/u-boot.bin my-output-dir - -and then write the image to SD with: - -.. code-block:: bash - - $ DEV=/dev/your_sd_device - $ dd if=my-output-dir/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1 - $ dd if=my-output-dir/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444 -- 2.34.1