bananapi-m2s.rst 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. .. SPDX-License-Identifier: GPL-2.0+
  2. U-Boot for BananaPi M2S (A311D & S922X)
  3. =======================================
  4. BananaPi BPI-M2S ships is a Single Board Computer manufactured by Sinovoip that ships in
  5. two variants with Amlogic S922X or A311D SoC and the following common specification:
  6. - 16GB eMMC
  7. - HDMI 2.1a video
  8. - 2x 10/100/1000 Base-T Ethernet (1x RTL8211F, 1x RTL811H)
  9. - 2x USB 2.0 ports
  10. - 2x Status LED's (green/blue)
  11. - 1x Power/Reset button
  12. - 1x micro SD card slot
  13. - 40-pin GPIO header
  14. - PWM fan header
  15. - UART header
  16. The S992X variant has:
  17. - 2GB LPDDR4 RAM
  18. The A311D variant has:
  19. - 4GB LPDDR4 RAM
  20. - NPU (5.0 TOPS)
  21. - MIPI DSI header
  22. - MIPI CSI header
  23. An optional RTL8822CS SDIO WiFi/BT mezzanine is available for both board variants.
  24. Schematics are available from the manufacturer: https://wiki.banana-pi.org/Banana_Pi_BPI-M2S
  25. U-Boot Compilation
  26. ------------------
  27. .. code-block:: bash
  28. $ export CROSS_COMPILE=aarch64-none-elf-
  29. $ make bananapi-m2s_defconfig
  30. $ make
  31. U-Boot Signing with Pre-Built FIP repo
  32. --------------------------------------
  33. .. code-block:: bash
  34. $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
  35. $ cd amlogic-boot-fip
  36. $ mkdir my-output-dir
  37. $ ./build-fip.sh bananapi-m2s /path/to/u-boot/u-boot.bin my-output-dir
  38. U-Boot Manual Signing
  39. ---------------------
  40. Amlogic does not provide sources for the firmware and tools needed to create a bootloader
  41. image so it is necessary to obtain binaries from sources published by the board vendor:
  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. $ DIR=bananapi-m2s
  49. $ git clone --depth 1 https://github.com/Dangku/amlogic-u-boot.git -b khadas-g12b-v2015.01-m2s $DIR
  50. $ cd $DIR
  51. $ make bananapi_m2s_defconfig
  52. $ make
  53. $ export UBDIR=$PWD
  54. Go back to the mainline U-Boot source tree then:
  55. .. code-block:: bash
  56. $ mkdir fip
  57. $ wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
  58. $ cp $UBDIR/build/scp_task/bl301.bin fip/
  59. $ cp $UBDIR/build/board/bananapi/bananpi_m2s/firmware/acs.bin fip/
  60. $ cp $UBDIR/fip/g12a/bl2.bin fip/
  61. $ cp $UBDIR/fip/g12a/bl30.bin fip/
  62. $ cp $UBDIR/fip/g12a/bl31.img fip/
  63. $ cp $UBDIR/fip/g12a/ddr3_1d.fw fip/
  64. $ cp $UBDIR/fip/g12a/ddr4_1d.fw fip/
  65. $ cp $UBDIR/fip/g12a/ddr4_2d.fw fip/
  66. $ cp $UBDIR/fip/g12a/diag_lpddr4.fw fip/
  67. $ cp $UBDIR/fip/g12a/lpddr3_1d.fw fip/
  68. $ cp $UBDIR/fip/g12a/lpddr4_1d.fw fip/
  69. $ cp $UBDIR/fip/g12a/lpddr4_2d.fw fip/
  70. $ cp $UBDIR/fip/g12a/piei.fw fip/
  71. $ cp $UBDIR/fip/g12a/aml_ddr.fw fip/
  72. $ cp u-boot.bin fip/bl33.bin
  73. $ sh fip/blx_fix.sh \
  74. fip/bl30.bin \
  75. fip/zero_tmp \
  76. fip/bl30_zero.bin \
  77. fip/bl301.bin \
  78. fip/bl301_zero.bin \
  79. fip/bl30_new.bin \
  80. bl30
  81. $ sh fip/blx_fix.sh \
  82. fip/bl2.bin \
  83. fip/zero_tmp \
  84. fip/bl2_zero.bin \
  85. fip/acs.bin \
  86. fip/bl21_zero.bin \
  87. fip/bl2_new.bin \
  88. bl2
  89. $ $UBDIR/fip/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
  90. --output fip/bl30_new.bin.g12a.enc \
  91. --level v3
  92. $ $UBDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
  93. --output fip/bl30_new.bin.enc \
  94. --level v3 --type bl30
  95. $ $UBDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
  96. --output fip/bl31.img.enc \
  97. --level v3 --type bl31
  98. $ $UBDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
  99. --output fip/bl33.bin.enc \
  100. --level v3 --type bl33 --compress lz4
  101. $ $UBDIR/fip/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
  102. --output fip/bl2.n.bin.sig
  103. $ $UBDIR/fip/g12b/aml_encrypt_g12b --bootmk \
  104. --output fip/u-boot.bin \
  105. --bl2 fip/bl2.n.bin.sig \
  106. --bl30 fip/bl30_new.bin.enc \
  107. --bl31 fip/bl31.img.enc \
  108. --bl33 fip/bl33.bin.enc \
  109. --ddrfw1 fip/ddr4_1d.fw \
  110. --ddrfw2 fip/ddr4_2d.fw \
  111. --ddrfw3 fip/ddr3_1d.fw \
  112. --ddrfw4 fip/piei.fw \
  113. --ddrfw5 fip/lpddr4_1d.fw \
  114. --ddrfw6 fip/lpddr4_2d.fw \
  115. --ddrfw7 fip/diag_lpddr4.fw \
  116. --ddrfw8 fip/aml_ddr.fw \
  117. --ddrfw9 fip/lpddr3_1d.fw \
  118. --level v3
  119. Then write the image to SD or eMMC with:
  120. .. code-block:: bash
  121. $ DEV=/dev/boot_device
  122. $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
  123. $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440