bananapi-m5.rst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. .. SPDX-License-Identifier: GPL-2.0+
  2. U-Boot for BananaPi BPI-M5 (S905X3)
  3. ===================================
  4. BananaPi BPI-M5 is a Single Board Computer manufactured by Sinovoip with the following
  5. specification:
  6. - Amlogic S905X3 Arm Cortex-A55 quad-core SoC
  7. - 4GB DDR4 SDRAM
  8. - 16GB eMMC
  9. - Gigabit Ethernet
  10. - HDMI 2.1 display
  11. - 40-pin GPIO header
  12. - 4x USB 3.0 Host
  13. - 1x USB-C (power)
  14. - microSD
  15. - UART serial
  16. - Infrared receiver
  17. Schematics are available from the manufacturer: https://wiki.banana-pi.org/Banana_Pi_BPI-M5
  18. U-Boot Compilation
  19. ------------------
  20. .. code-block:: bash
  21. $ export CROSS_COMPILE=aarch64-none-elf-
  22. $ make bananapi-m5_defconfig
  23. $ make
  24. U-Boot Signing with Pre-Built FIP repo
  25. --------------------------------------
  26. .. code-block:: bash
  27. $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
  28. $ cd amlogic-boot-fip
  29. $ mkdir my-output-dir
  30. $ ./build-fip.sh bananapi-m5 /path/to/u-boot/u-boot.bin my-output-dir
  31. U-Boot Manual Signing
  32. ---------------------
  33. Amlogic does not provide sources for the firmware and tools needed to create a bootloader
  34. image so it is necessary to obtain binaries from sources published by the board vendor:
  35. .. code-block:: bash
  36. $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
  37. $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
  38. $ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
  39. $ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
  40. $ 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
  41. $ DIR=bananapi-m5
  42. $ git clone --depth 1 https://github.com/Dangku/amlogic-u-boot.git -b odroidg12-v2015.01-c4-m5 $DIR
  43. $ cd $DIR
  44. $ make bananapi_m5_defconfig
  45. $ make
  46. $ export UBOOTDIR=$PWD
  47. Go back to the mainline U-Boot source tree then:
  48. .. code-block:: bash
  49. $ mkdir fip
  50. $ wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
  51. $ cp $UBOOTDIR/build/scp_task/bl301.bin fip/
  52. $ cp $UBOOTDIR/build/board/bananapi/bananpi_m5/firmware/acs.bin fip/
  53. $ cp $UBOOTDIR/fip/g12a/bl2.bin fip/
  54. $ cp $UBOOTDIR/fip/g12a/bl30.bin fip/
  55. $ cp $UBOOTDIR/fip/g12a/bl31.img fip/
  56. $ cp $UBOOTDIR/fip/g12a/ddr3_1d.fw fip/
  57. $ cp $UBOOTDIR/fip/g12a/ddr4_1d.fw fip/
  58. $ cp $UBOOTDIR/fip/g12a/ddr4_2d.fw fip/
  59. $ cp $UBOOTDIR/fip/g12a/diag_lpddr4.fw fip/
  60. $ cp $UBOOTDIR/fip/g12a/lpddr3_1d.fw fip/
  61. $ cp $UBOOTDIR/fip/g12a/lpddr4_1d.fw fip/
  62. $ cp $UBOOTDIR/fip/g12a/lpddr4_2d.fw fip/
  63. $ cp $UBOOTDIR/fip/g12a/piei.fw fip/
  64. $ cp $UBOOTDIR/fip/g12a/aml_ddr.fw fip/
  65. $ cp u-boot.bin fip/bl33.bin
  66. $ sh fip/blx_fix.sh \
  67. fip/bl30.bin \
  68. fip/zero_tmp \
  69. fip/bl30_zero.bin \
  70. fip/bl301.bin \
  71. fip/bl301_zero.bin \
  72. fip/bl30_new.bin \
  73. bl30
  74. $ sh fip/blx_fix.sh \
  75. fip/bl2.bin \
  76. fip/zero_tmp \
  77. fip/bl2_zero.bin \
  78. fip/acs.bin \
  79. fip/bl21_zero.bin \
  80. fip/bl2_new.bin \
  81. bl2
  82. $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \
  83. --output fip/bl30_new.bin.g12a.enc \
  84. --level v3
  85. $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl30_new.bin.g12a.enc \
  86. --output fip/bl30_new.bin.enc \
  87. --level v3 --type bl30
  88. $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img \
  89. --output fip/bl31.img.enc \
  90. --level v3 --type bl31
  91. $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl33.bin --compress lz4 \
  92. --output fip/bl33.bin.enc \
  93. --level v3 --type bl33 --compress lz4
  94. $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl2sig --input fip/bl2_new.bin \
  95. --output fip/bl2.n.bin.sig
  96. $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bootmk \
  97. --output fip/u-boot.bin \
  98. --bl2 fip/bl2.n.bin.sig \
  99. --bl30 fip/bl30_new.bin.enc \
  100. --bl31 fip/bl31.img.enc \
  101. --bl33 fip/bl33.bin.enc \
  102. --ddrfw1 fip/ddr4_1d.fw \
  103. --ddrfw2 fip/ddr4_2d.fw \
  104. --ddrfw3 fip/ddr3_1d.fw \
  105. --ddrfw4 fip/piei.fw \
  106. --ddrfw5 fip/lpddr4_1d.fw \
  107. --ddrfw6 fip/lpddr4_2d.fw \
  108. --ddrfw7 fip/diag_lpddr4.fw \
  109. --ddrfw8 fip/aml_ddr.fw \
  110. --ddrfw9 fip/lpddr3_1d.fw \
  111. --level v3
  112. Then write the image to SD or eMMC with:
  113. .. code-block:: bash
  114. $ DEV=/dev/boot_device
  115. $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
  116. $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440