odroid-c4.rst 5.4 KB

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