README.khadas-vim3 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. U-Boot for Khadas VIM3
  2. ======================
  3. Khadas VIM3 is a single board computer manufactured by Shenzhen Wesion
  4. Technology Co., Ltd. with the following specifications:
  5. - Amlogic A311D Arm Cortex-A53 dual-core + Cortex-A73 quad-core SoC
  6. - 4GB LPDDR4 SDRAM
  7. - Gigabit Ethernet
  8. - HDMI 2.1 display
  9. - 40-pin GPIO header
  10. - 1 x USB 3.0 Host, 1 x USB 2.0 Host
  11. - eMMC, microSD
  12. - M.2
  13. - Infrared receiver
  14. Schematics are available on the manufacturer website.
  15. Currently the U-Boot port supports the following devices:
  16. - serial
  17. - eMMC, microSD
  18. - Ethernet
  19. - I2C
  20. - Regulators
  21. - Reset controller
  22. - Clock controller
  23. - ADC
  24. u-boot compilation
  25. ==================
  26. > export CROSS_COMPILE=aarch64-none-elf-
  27. > make khadas-vim3_defconfig
  28. > make
  29. Image creation
  30. ==============
  31. Amlogic doesn't provide sources for the firmware and for tools needed
  32. to create the bootloader image, so it is necessary to obtain them from
  33. the git tree published by the board vendor:
  34. > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
  35. > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
  36. > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
  37. > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
  38. > 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
  39. > DIR=vim3-u-boot
  40. > git clone --depth 1 \
  41. https://github.com/khadas/u-boot.git -b khadas-vims-v2015.01 \
  42. $DIR
  43. > cd vim3-u-boot
  44. > make kvim3_defconfig
  45. > make
  46. > export UBOOTDIR=$PWD
  47. Go back to mainline U-Boot source tree then :
  48. > mkdir fip
  49. > cp $UBOOTDIR/build/scp_task/bl301.bin fip/
  50. > cp $UBOOTDIR/build/board/khadas/kvim3/firmware/acs.bin fip/
  51. > cp $UBOOTDIR/fip/g12b/bl2.bin fip/
  52. > cp $UBOOTDIR/fip/g12b/bl30.bin fip/
  53. > cp $UBOOTDIR/fip/g12b/bl31.img fip/
  54. > cp $UBOOTDIR/fip/g12b/ddr3_1d.fw fip/
  55. > cp $UBOOTDIR/fip/g12b/ddr4_1d.fw fip/
  56. > cp $UBOOTDIR/fip/g12b/ddr4_2d.fw fip/
  57. > cp $UBOOTDIR/fip/g12b/diag_lpddr4.fw fip/
  58. > cp $UBOOTDIR/fip/g12b/lpddr3_1d.fw fip/
  59. > cp $UBOOTDIR/fip/g12b/lpddr4_1d.fw fip/
  60. > cp $UBOOTDIR/fip/g12b/lpddr4_2d.fw fip/
  61. > cp $UBOOTDIR/fip/g12b/piei.fw fip/
  62. > cp $UBOOTDIR/fip/g12b/aml_ddr.fw fip/
  63. > cp u-boot.bin fip/bl33.bin
  64. > sh fip/blx_fix.sh \
  65. fip/bl30.bin \
  66. fip/zero_tmp \
  67. fip/bl30_zero.bin \
  68. fip/bl301.bin \
  69. fip/bl301_zero.bin \
  70. fip/bl30_new.bin \
  71. bl30
  72. > sh fip/blx_fix.sh \
  73. fip/bl2.bin \
  74. fip/zero_tmp \
  75. fip/bl2_zero.bin \
  76. fip/acs.bin \
  77. fip/bl21_zero.bin \
  78. fip/bl2_new.bin \
  79. bl2
  80. > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
  81. --output fip/bl30_new.bin.g12a.enc \
  82. --level v3
  83. > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
  84. --output fip/bl30_new.bin.enc \
  85. --level v3 --type bl30
  86. > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
  87. --output fip/bl31.img.enc \
  88. --level v3 --type bl31
  89. > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
  90. --output fip/bl33.bin.enc \
  91. --level v3 --type bl33 --compress lz4
  92. > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
  93. --output fip/bl2.n.bin.sig
  94. > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bootmk \
  95. --output fip/u-boot.bin \
  96. --bl2 fip/bl2.n.bin.sig \
  97. --bl30 fip/bl30_new.bin.enc \
  98. --bl31 fip/bl31.img.enc \
  99. --bl33 fip/bl33.bin.enc \
  100. --ddrfw1 fip/ddr4_1d.fw \
  101. --ddrfw2 fip/ddr4_2d.fw \
  102. --ddrfw3 fip/ddr3_1d.fw \
  103. --ddrfw4 fip/piei.fw \
  104. --ddrfw5 fip/lpddr4_1d.fw \
  105. --ddrfw6 fip/lpddr4_2d.fw \
  106. --ddrfw7 fip/diag_lpddr4.fw \
  107. --ddrfw8 fip/aml_ddr.fw \
  108. --ddrfw9 fip/lpddr3_1d.fw \
  109. --level v3
  110. and then write the image to SD with:
  111. > DEV=/dev/your_sd_device
  112. > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
  113. > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444