Skip to contentSkip to conversation

board: amlogic: document alternative libretech-cc installation methods

PATCH New Daniel Drake 4 participants 6 messages Aug 6, 2019 – Aug 28, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board: amlogic: document alternative libretech-cc installation methods

As already documented in this README, several binaries must be glued together in order to boot the device.

Extend the documentation to cover the prebuilt binaries (saving you the hassle of installing ancient cross-compilers), and also mention the open source replacements for the encryption tool (which is especially useful if you want to avoid requiring 32-bit x86 binaries in your build system).

Cc Neil Armstrong <[email protected]>
---
 board/amlogic/p212/README.libretech-cc | 41 +++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 4 deletions(-)
board/amlogic/p212/README.libretech-cc +37 -4
index d007f58764..6af7de3cfa 100644
@@ -38,9 +38,28 @@ U-Boot compilation
 Image creation
 ==============
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+To boot the system, u-boot must be combined with several earlier stage
+bootloaders:
+
+* bl2.bin: vendor-provided binary blob
+* bl21.bin: built from vendor u-boot source
+* bl30.bin: vendor-provided binary blob
+* bl301.bin: built from vendor u-boot source
+* bl31.bin: vendor-provided binary blob
+* acs.bin: built from vendor u-boot source
+
+These binaries and the tools required below have been collected and prebuilt
+for convenience at <https://github.com/BayLibre/u-boot/releases/>
+
+Download and extract the libretech-cc release from there, and set FIPDIR to
+point to the `fip` subdirectory.
+
+ > export FIPDIR=/path/to/extracted/fip
+
+Alternatively, you can obtain the original vendor u-boot tree which
+contains the required blobs and sources, and build yourself.
+Note that old compilers are required for this to build. The compilers here
+are suggested by Amlogic, and they are 32-bit x86 binaries.
 
  > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
  > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
@@ -53,7 +72,10 @@ the git tree published by the board vendor:
  > make
  > export FIPDIR=$PWD/fip
 
-Go back to mainline U-Boot source tree then :
+Once you have the binaries available (either through the prebuilt download,
+or having built the vendor u-boot yourself), you can then proceed to glue
+everything together. Go back to mainline U-Boot source tree then :
+
  > mkdir fip
 
  > cp $FIPDIR/gxl/bl2.bin fip/
@@ -100,3 +122,14 @@ and then write the image to SD with:
  > DEV=/dev/your_sd_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=444
+
+Note that Amlogic provides aml_encrypt_gxl as a 32-bit x86 binary with no
+source code. Should you prefer to avoid that, there are open source reverse
+engineered versions available:
+
+1. gxlimg <https://github.com/repk/gxlimg>, which comes with a handy
+   Makefile that automates the whole process.
+2. meson-tools <https://github.com/afaerber/meson-tools>
+
+However, these community-developed alternatives are not endorsed by or
+supported by Amlogic.
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 board: amlogic: document alternative libretech-cc installation methods

Hi Daniel,

Quoted 25 lines · Daniel Drake

As already documented in this README, several binaries must be glued together in order to boot the device.

Extend the documentation to cover the prebuilt binaries (saving you the hassle of installing ancient cross-compilers), and also mention the open source replacements for the encryption tool (which is especially useful if you want to avoid requiring 32-bit x86 binaries in your build system).

Cc Neil Armstrong <[email protected]>
---
 board/amlogic/p212/README.libretech-cc | 41 +++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 4 deletions(-)
board/amlogic/p212/README.libretech-cc +0 -2
index d007f58764..6af7de3cfa 100644
@@ -38,9 +38,28 @@ U-Boot compilation
 Image creation
 ==============
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from

board/amlogic/p212/README.libretech-cc U-Boot compilation · line 49

Quoted 10 lines
board/amlogic/p212/README.libretech-cc +9 -1
-the git tree published by the board vendor:
+To boot the system, u-boot must be combined with several earlier stage
+bootloaders:
+
+* bl2.bin: vendor-provided binary blob
+* bl21.bin: built from vendor u-boot source
+* bl30.bin: vendor-provided binary blob
+* bl301.bin: built from vendor u-boot source
+* bl31.bin: vendor-provided binary blob
+* acs.bin: built from vendor u-boot source

I don't know if it worth being mentioned here, but there is also a reverse engineered effort on bl31 for gxl.

Thus it should be possible to use a bl31 built from mainline branch of
https://github.com/ARM-software/arm-trusted-firmware.

Signature · 1 line
Remi
Quoted 46 lines
board/amlogic/p212/README.libretech-cc +28 -1
+
+These binaries and the tools required below have been collected and prebuilt
+for convenience at <https://github.com/BayLibre/u-boot/releases/>
+
+Download and extract the libretech-cc release from there, and set FIPDIR to
+point to the `fip` subdirectory.
+
+ > export FIPDIR=/path/to/extracted/fip
+
+Alternatively, you can obtain the original vendor u-boot tree which
+contains the required blobs and sources, and build yourself.
+Note that old compilers are required for this to build. The compilers here
+are suggested by Amlogic, and they are 32-bit x86 binaries.
 
  > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
  > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
@@ -53,7 +72,10 @@ the git tree published by the board vendor:
  > make
  > export FIPDIR=$PWD/fip
 
-Go back to mainline U-Boot source tree then :
+Once you have the binaries available (either through the prebuilt download,
+or having built the vendor u-boot yourself), you can then proceed to glue
+everything together. Go back to mainline U-Boot source tree then :
+
  > mkdir fip
 
  > cp $FIPDIR/gxl/bl2.bin fip/
@@ -100,3 +122,14 @@ and then write the image to SD with:
  > DEV=/dev/your_sd_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=444
+
+Note that Amlogic provides aml_encrypt_gxl as a 32-bit x86 binary with no
+source code. Should you prefer to avoid that, there are open source reverse
+engineered versions available:
+
+1. gxlimg <https://github.com/repk/gxlimg>, which comes with a handy
+   Makefile that automates the whole process.
+2. meson-tools <https://github.com/afaerber/meson-tools>
+
+However, these community-developed alternatives are not endorsed by or
+supported by Amlogic.
Signature · 1 line
2.20.1
#2 lore raw

PATCH 1/1 board: amlogic: document alternative libretech-cc installation methods

Quoted 5 lines · Remi Pommarel

I don't know if it worth being mentioned here, but there is also a reverse engineered effort on bl31 for gxl.

Thus it should be possible to use a bl31 built from mainline branch of
https://github.com/ARM-software/arm-trusted-firmware.

That's really cool! I think I'll leave it for another day though, and leave this patch just about the alternative/easier installation of the existing blobs.

Separately, it would be great to have an arm-trusted-firmware release that includes this new gxl work so that distros like Debian pick it up.

Daniel

#3 lore raw

PATCH 1/1 board: amlogic: document alternative libretech-cc installation methods

Quoted 7 lines · On Wed, 7 Aug 2019, 04:25 Daniel Drake, <[email protected]> wrote:
Quoted 5 lines · Remi Pommarel

I don't know if it worth being mentioned here, but there is also a reverse engineered effort on bl31 for gxl.

Thus it should be possible to use a bl31 built from mainline branch of
https://github.com/ARM-software/arm-trusted-firmware.

Quoted 8 lines

That's really cool! I think I'll leave it for another day though, and leave this patch just about the alternative/easier installation of the existing blobs.

Separately, it would be great to have an arm-trusted-firmware release that includes this new gxl work so that distros like Debian pick it up.

They release every 6 months or so, I would expect the next one around September. It's unrelated to U-Boot thought.

Quoted 2 lines
#4 lore raw

PATCH 1/1 board: amlogic: document alternative libretech-cc installation methods

In reply to Daniel Drake

Hi Daniel,

Quoted 8 lines · Daniel Drake

As already documented in this README, several binaries must be glued together in order to boot the device.

Extend the documentation to cover the prebuilt binaries (saving you the hassle of installing ancient cross-compilers), and also mention the open source replacements for the encryption tool (which is especially useful if you want to avoid requiring 32-bit x86 binaries in your build system).

Looks fine, could also be added to other board's README files. Waiting a few more days until we have more comments on it by Andreas and others.

Thanks,

Neil

Quoted 71 lines
Cc Neil Armstrong <[email protected]>
---
 board/amlogic/p212/README.libretech-cc | 41 +++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 4 deletions(-)
board/amlogic/p212/README.libretech-cc +37 -4
index d007f58764..6af7de3cfa 100644
@@ -38,9 +38,28 @@ U-Boot compilation
 Image creation
 ==============
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+To boot the system, u-boot must be combined with several earlier stage
+bootloaders:
+
+* bl2.bin: vendor-provided binary blob
+* bl21.bin: built from vendor u-boot source
+* bl30.bin: vendor-provided binary blob
+* bl301.bin: built from vendor u-boot source
+* bl31.bin: vendor-provided binary blob
+* acs.bin: built from vendor u-boot source
+
+These binaries and the tools required below have been collected and prebuilt
+for convenience at <https://github.com/BayLibre/u-boot/releases/>
+
+Download and extract the libretech-cc release from there, and set FIPDIR to
+point to the `fip` subdirectory.
+
+ > export FIPDIR=/path/to/extracted/fip
+
+Alternatively, you can obtain the original vendor u-boot tree which
+contains the required blobs and sources, and build yourself.
+Note that old compilers are required for this to build. The compilers here
+are suggested by Amlogic, and they are 32-bit x86 binaries.
 
  > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
  > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
@@ -53,7 +72,10 @@ the git tree published by the board vendor:
  > make
  > export FIPDIR=$PWD/fip
 
-Go back to mainline U-Boot source tree then :
+Once you have the binaries available (either through the prebuilt download,
+or having built the vendor u-boot yourself), you can then proceed to glue
+everything together. Go back to mainline U-Boot source tree then :
+
  > mkdir fip
 
  > cp $FIPDIR/gxl/bl2.bin fip/
@@ -100,3 +122,14 @@ and then write the image to SD with:
  > DEV=/dev/your_sd_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=444
+
+Note that Amlogic provides aml_encrypt_gxl as a 32-bit x86 binary with no
+source code. Should you prefer to avoid that, there are open source reverse
+engineered versions available:
+
+1. gxlimg <https://github.com/repk/gxlimg>, which comes with a handy
+   Makefile that automates the whole process.
+2. meson-tools <https://github.com/afaerber/meson-tools>
+
+However, these community-developed alternatives are not endorsed by or
+supported by Amlogic.
#5 lore raw

PATCH 1/1 board: amlogic: document alternative libretech-cc installation methods

In reply to Daniel Drake

Hi,

Quoted 8 lines · Daniel Drake

As already documented in this README, several binaries must be glued together in order to boot the device.

Extend the documentation to cover the prebuilt binaries (saving you the hassle of installing ancient cross-compilers), and also mention the open source replacements for the encryption tool (which is especially useful if you want to avoid requiring 32-bit x86 binaries in your build system).

Applied to u-boot-amlogic-next for next u-boot release, feel free to add the same text to other boards..

Neil

Quoted 71 lines
Cc Neil Armstrong <[email protected]>
---
 board/amlogic/p212/README.libretech-cc | 41 +++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 4 deletions(-)
board/amlogic/p212/README.libretech-cc +37 -4
index d007f58764..6af7de3cfa 100644
@@ -38,9 +38,28 @@ U-Boot compilation
 Image creation
 ==============
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+To boot the system, u-boot must be combined with several earlier stage
+bootloaders:
+
+* bl2.bin: vendor-provided binary blob
+* bl21.bin: built from vendor u-boot source
+* bl30.bin: vendor-provided binary blob
+* bl301.bin: built from vendor u-boot source
+* bl31.bin: vendor-provided binary blob
+* acs.bin: built from vendor u-boot source
+
+These binaries and the tools required below have been collected and prebuilt
+for convenience at <https://github.com/BayLibre/u-boot/releases/>
+
+Download and extract the libretech-cc release from there, and set FIPDIR to
+point to the `fip` subdirectory.
+
+ > export FIPDIR=/path/to/extracted/fip
+
+Alternatively, you can obtain the original vendor u-boot tree which
+contains the required blobs and sources, and build yourself.
+Note that old compilers are required for this to build. The compilers here
+are suggested by Amlogic, and they are 32-bit x86 binaries.
 
  > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
  > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
@@ -53,7 +72,10 @@ the git tree published by the board vendor:
  > make
  > export FIPDIR=$PWD/fip
 
-Go back to mainline U-Boot source tree then :
+Once you have the binaries available (either through the prebuilt download,
+or having built the vendor u-boot yourself), you can then proceed to glue
+everything together. Go back to mainline U-Boot source tree then :
+
  > mkdir fip
 
  > cp $FIPDIR/gxl/bl2.bin fip/
@@ -100,3 +122,14 @@ and then write the image to SD with:
  > DEV=/dev/your_sd_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=444
+
+Note that Amlogic provides aml_encrypt_gxl as a 32-bit x86 binary with no
+source code. Should you prefer to avoid that, there are open source reverse
+engineered versions available:
+
+1. gxlimg <https://github.com/repk/gxlimg>, which comes with a handy
+   Makefile that automates the whole process.
+2. meson-tools <https://github.com/afaerber/meson-tools>
+
+However, these community-developed alternatives are not endorsed by or
+supported by Amlogic.