hikey960.rst 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. HiKey960
  2. ========
  3. HiKey960 is one of 96boards. Hisilicon Hi3660 processor is installed on HiKey960.
  4. More information are listed in `link`_.
  5. How to build
  6. ------------
  7. Code Locations
  8. ~~~~~~~~~~~~~~
  9. - Trusted Firmware-A:
  10. `link <https://github.com/ARM-software/arm-trusted-firmware>`__
  11. - OP-TEE:
  12. `link <https://github.com/OP-TEE/optee_os>`__
  13. - edk2:
  14. `link <https://github.com/96boards-hikey/edk2/tree/testing/hikey960_v2.5>`__
  15. - OpenPlatformPkg:
  16. `link <https://github.com/96boards-hikey/OpenPlatformPkg/tree/testing/hikey960_v1.3.4>`__
  17. - l-loader:
  18. `link <https://github.com/96boards-hikey/l-loader/tree/testing/hikey960_v1.2>`__
  19. Build Procedure
  20. ~~~~~~~~~~~~~~~
  21. - Fetch all the above 5 repositories into local host.
  22. Make all the repositories in the same ${BUILD\_PATH}.
  23. .. code:: shell
  24. git clone https://github.com/ARM-software/arm-trusted-firmware -b integration
  25. git clone https://github.com/OP-TEE/optee_os
  26. git clone https://github.com/96boards-hikey/edk2 -b testing/hikey960_v2.5
  27. git clone https://github.com/96boards-hikey/OpenPlatformPkg -b testing/hikey960_v1.3.4
  28. git clone https://github.com/96boards-hikey/l-loader -b testing/hikey960_v1.2
  29. - Create the symbol link to OpenPlatformPkg in edk2.
  30. .. code:: shell
  31. $cd ${BUILD_PATH}/edk2
  32. $ln -sf ../OpenPlatformPkg
  33. - Prepare AARCH64 toolchain.
  34. - If your hikey960 hardware is v1, update *OpenPlatformPkg/Platforms/Hisilicon/HiKey960/HiKey960.dsc* first. *(optional)*
  35. .. code:: shell
  36. DEFINE SERIAL_BASE=0xFDF05000
  37. If your hikey960 hardware is v2 or newer, nothing to do.
  38. - Build it as debug mode. Create script file for build.
  39. .. code:: shell
  40. cd {BUILD_PATH}/arm-trusted-firmware
  41. sh ../l-loader/build_uefi.sh hikey960
  42. - Generate l-loader.bin and partition table.
  43. *Make sure that you're using the sgdisk in the l-loader directory.*
  44. .. code:: shell
  45. cd ${BUILD_PATH}/l-loader
  46. ln -sf ${EDK2_OUTPUT_DIR}/FV/bl1.bin
  47. ln -sf ${EDK2_OUTPUT_DIR}/FV/bl2.bin
  48. ln -sf ${EDK2_OUTPUT_DIR}/FV/fip.bin
  49. ln -sf ${EDK2_OUTPUT_DIR}/FV/BL33_AP_UEFI.fd
  50. make hikey960
  51. Setup Console
  52. -------------
  53. - Install ser2net. Use telnet as the console since UEFI will output window
  54. that fails to display in minicom.
  55. .. code:: shell
  56. $sudo apt-get install ser2net
  57. - Configure ser2net.
  58. .. code:: shell
  59. $sudo vi /etc/ser2net.conf
  60. Append one line for serial-over-USB in *#ser2net.conf*
  61. ::
  62. 2004:telnet:0:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner
  63. - Start ser2net
  64. .. code:: shell
  65. $sudo killall ser2net
  66. $sudo ser2net -u
  67. - Open the console.
  68. .. code:: shell
  69. $telnet localhost 2004
  70. And you could open the console remotely, too.
  71. Boot UEFI in recovery mode
  72. --------------------------
  73. - Fetch that are used in recovery mode. The code location is in below.
  74. `link <https://github.com/96boards-hikey/tools-images-hikey960>`__
  75. - Prepare recovery binary.
  76. .. code:: shell
  77. $cd tools-images-hikey960
  78. $ln -sf ${BUILD_PATH}/l-loader/l-loader.bin
  79. $ln -sf ${BUILD_PATH}/l-loader/fip.bin
  80. $ln -sf ${BUILD_PATH}/l-loader/recovery.bin
  81. - Prepare config file.
  82. .. code:: shell
  83. $vi config
  84. # The content of config file
  85. ./sec_usb_xloader.img 0x00020000
  86. ./sec_uce_boot.img 0x6A908000
  87. ./recovery.bin 0x1AC00000
  88. - Remove the modemmanager package. This package may causes hikey\_idt tool failure.
  89. .. code:: shell
  90. $sudo apt-get purge modemmanager
  91. - Run the command to download recovery.bin into HiKey960.
  92. .. code:: shell
  93. $sudo ./hikey_idt -c config -p /dev/ttyUSB1
  94. - UEFI running in recovery mode.
  95. When prompt '.' is displayed on console, press hotkey 'f' in keyboard. Then Android fastboot app is running.
  96. The timeout of prompt '.' is 10 seconds.
  97. - Update images.
  98. .. code:: shell
  99. $sudo fastboot flash ptable prm_ptable.img
  100. $sudo fastboot flash xloader sec_xloader.img
  101. $sudo fastboot flash fastboot l-loader.bin
  102. $sudo fastboot flash fip fip.bin
  103. $sudo fastboot flash boot boot.img
  104. $sudo fastboot flash cache cache.img
  105. $sudo fastboot flash system system.img
  106. $sudo fastboot flash userdata userdata.img
  107. - Notice: UEFI could also boot kernel in recovery mode, but BL31 isn't loaded in
  108. recovery mode.
  109. Boot UEFI in normal mode
  110. ------------------------
  111. - Make sure "Boot Mode" switch is OFF for normal boot mode. Then power on HiKey960.
  112. - Reference `link <https://github.com/96boards-hikey/tools-images-hikey960/blob/master/build-from-source/README-ATF-UEFI-build-from-source.md>`__
  113. .. _link: https://www.96boards.org/documentation/consumer/hikey/hikey960