libretech-cc.rst 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. .. SPDX-License-Identifier: GPL-2.0+
  2. U-Boot for LibreTech CC
  3. =======================
  4. LibreTech CC is a single board computer manufactured by Libre Technology
  5. with the following specifications:
  6. - Amlogic S905X ARM Cortex-A53 quad-core SoC @ 1.5GHz
  7. - ARM Mali 450 GPU
  8. - 2GB DDR3 SDRAM
  9. - 10/100 Ethernet
  10. - HDMI 2.0 4K/60Hz display
  11. - 40-pin GPIO header
  12. - 4 x USB 2.0 Host
  13. - eMMC, microSD
  14. - Infrared receiver
  15. Schematics are available on the manufacturer website.
  16. U-Boot compilation
  17. ------------------
  18. .. code-block:: bash
  19. $ export CROSS_COMPILE=aarch64-none-elf-
  20. $ make libretech-cc_defconfig
  21. $ make
  22. Image creation
  23. --------------
  24. To boot the system, u-boot must be combined with several earlier stage
  25. bootloaders:
  26. * bl2.bin: vendor-provided binary blob
  27. * bl21.bin: built from vendor u-boot source
  28. * bl30.bin: vendor-provided binary blob
  29. * bl301.bin: built from vendor u-boot source
  30. * bl31.bin: vendor-provided binary blob
  31. * acs.bin: built from vendor u-boot source
  32. These binaries and the tools required below have been collected and prebuilt
  33. for convenience at <https://github.com/BayLibre/u-boot/releases/>
  34. Download and extract the libretech-cc release from there, and set FIPDIR to
  35. point to the `fip` subdirectory.
  36. .. code-block:: bash
  37. $ export FIPDIR=/path/to/extracted/fip
  38. Alternatively, you can obtain the original vendor u-boot tree which
  39. contains the required blobs and sources, and build yourself.
  40. Note that old compilers are required for this to build. The compilers here
  41. are suggested by Amlogic, and they are 32-bit x86 binaries.
  42. .. code-block:: bash
  43. $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
  44. $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
  45. $ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
  46. $ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
  47. $ export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
  48. $ git clone https://github.com/BayLibre/u-boot.git -b libretech-cc amlogic-u-boot
  49. $ cd amlogic-u-boot
  50. $ make libretech_cc_defconfig
  51. $ make
  52. $ export FIPDIR=$PWD/fip
  53. Once you have the binaries available (either through the prebuilt download,
  54. or having built the vendor u-boot yourself), you can then proceed to glue
  55. everything together. Go back to mainline U-Boot source tree then :
  56. .. code-block:: bash
  57. $ mkdir fip
  58. $ cp $FIPDIR/gxl/bl2.bin fip/
  59. $ cp $FIPDIR/gxl/acs.bin fip/
  60. $ cp $FIPDIR/gxl/bl21.bin fip/
  61. $ cp $FIPDIR/gxl/bl30.bin fip/
  62. $ cp $FIPDIR/gxl/bl301.bin fip/
  63. $ cp $FIPDIR/gxl/bl31.img fip/
  64. $ cp u-boot.bin fip/bl33.bin
  65. $ $FIPDIR/blx_fix.sh \
  66. fip/bl30.bin \
  67. fip/zero_tmp \
  68. fip/bl30_zero.bin \
  69. fip/bl301.bin \
  70. fip/bl301_zero.bin \
  71. fip/bl30_new.bin \
  72. bl30
  73. $ $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
  74. $ $FIPDIR/blx_fix.sh \
  75. fip/bl2_acs.bin \
  76. fip/zero_tmp \
  77. fip/bl2_zero.bin \
  78. fip/bl21.bin \
  79. fip/bl21_zero.bin \
  80. fip/bl2_new.bin \
  81. bl2
  82. $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl30_new.bin
  83. $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl31.img
  84. $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl33.bin
  85. $ $FIPDIR/gxl/aml_encrypt_gxl --bl2sig --input fip/bl2_new.bin --output fip/bl2.n.bin.sig
  86. $ $FIPDIR/gxl/aml_encrypt_gxl --bootmk \
  87. --output fip/u-boot.bin \
  88. --bl2 fip/bl2.n.bin.sig \
  89. --bl30 fip/bl30_new.bin.enc \
  90. --bl31 fip/bl31.img.enc \
  91. --bl33 fip/bl33.bin.enc
  92. and then write the image to SD with:
  93. .. code-block:: bash
  94. $ DEV=/dev/your_sd_device
  95. $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
  96. $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
  97. Note that Amlogic provides aml_encrypt_gxl as a 32-bit x86 binary with no
  98. source code. Should you prefer to avoid that, there are open source reverse
  99. engineered versions available:
  100. 1. gxlimg <https://github.com/repk/gxlimg>, which comes with a handy
  101. Makefile that automates the whole process.
  102. 2. meson-tools <https://github.com/afaerber/meson-tools>
  103. However, these community-developed alternatives are not endorsed by or
  104. supported by Amlogic.