4 HiKey960 is one of 96boards. Hisilicon Hi3660 processor is installed on HiKey960.
6 More information are listed in `link`_.
15 `link <https://github.com/ARM-software/arm-trusted-firmware>`__
18 `link <https://github.com/OP-TEE/optee_os>`__
21 `link <https://github.com/96boards-hikey/edk2/tree/testing/hikey960_v2.5>`__
24 `link <https://github.com/96boards-hikey/OpenPlatformPkg/tree/testing/hikey960_v1.3.4>`__
27 `link <https://github.com/96boards-hikey/l-loader/tree/testing/hikey960_v1.2>`__
30 `link <https://git.linaro.org/uefi/uefi-tools.git>`__
35 - Fetch all the above 5 repositories into local host.
36 Make all the repositories in the same ${BUILD\_PATH}.
40 git clone https://github.com/ARM-software/arm-trusted-firmware -b integration
41 git clone https://github.com/OP-TEE/optee_os
42 git clone https://github.com/96boards-hikey/edk2 -b testing/hikey960_v2.5
43 git clone https://github.com/96boards-hikey/OpenPlatformPkg -b testing/hikey960_v1.3.4
44 git clone https://github.com/96boards-hikey/l-loader -b testing/hikey960_v1.2
45 git clone https://git.linaro.org/uefi/uefi-tools
47 - Create the symbol link to OpenPlatformPkg in edk2.
51 $cd ${BUILD_PATH}/edk2
52 $ln -sf ../OpenPlatformPkg
54 - Prepare AARCH64 toolchain.
56 - If your hikey960 hardware is v1, update *uefi-tools/platform.config* first. *(optional)*
57 **Uncomment the below sentence. Otherwise, UEFI can't output messages on serial
58 console on hikey960 v1.**
62 BUILDFLAGS=-DSERIAL_BASE=0xFDF05000
64 If your hikey960 hardware is v2 or newer, nothing to do.
66 - Build it as debug mode. Create script file for build.
71 export AARCH64_TOOLCHAIN=GCC5
72 export UEFI_TOOLS_DIR=${BUILD_PATH}/uefi-tools
73 export EDK2_DIR=${BUILD_PATH}/edk2
74 EDK2_OUTPUT_DIR=${EDK2_DIR}/Build/HiKey960/${BUILD_OPTION}_${AARCH64_TOOLCHAIN}
76 # Build UEFI & Trusted Firmware-A
77 ${UEFI_TOOLS_DIR}/uefi-build.sh -b ${BUILD_OPTION} -a ../arm-trusted-firmware -s ../optee_os hikey960
79 - Generate l-loader.bin and partition table.
80 *Make sure that you're using the sgdisk in the l-loader directory.*
84 cd ${BUILD_PATH}/l-loader
85 ln -sf ${EDK2_OUTPUT_DIR}/FV/bl1.bin
86 ln -sf ${EDK2_OUTPUT_DIR}/FV/bl2.bin
87 ln -sf ${EDK2_OUTPUT_DIR}/FV/fip.bin
88 ln -sf ${EDK2_OUTPUT_DIR}/FV/BL33_AP_UEFI.fd
94 - Install ser2net. Use telnet as the console since UEFI will output window
95 that fails to display in minicom.
99 $sudo apt-get install ser2net
105 $sudo vi /etc/ser2net.conf
107 Append one line for serial-over-USB in *#ser2net.conf*
111 2004:telnet:0:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner
117 $sudo killall ser2net
124 $telnet localhost 2004
126 And you could open the console remotely, too.
128 Boot UEFI in recovery mode
129 --------------------------
131 - Fetch that are used in recovery mode. The code location is in below.
132 `link <https://github.com/96boards-hikey/tools-images-hikey960>`__
134 - Prepare recovery binary.
138 $cd tools-images-hikey960
139 $ln -sf ${BUILD_PATH}/l-loader/l-loader.bin
140 $ln -sf ${BUILD_PATH}/l-loader/fip.bin
141 $ln -sf ${BUILD_PATH}/l-loader/recovery.bin
143 - Prepare config file.
148 # The content of config file
149 ./sec_usb_xloader.img 0x00020000
150 ./sec_uce_boot.img 0x6A908000
151 ./recovery.bin 0x1AC00000
153 - Remove the modemmanager package. This package may causes hikey\_idt tool failure.
157 $sudo apt-get purge modemmanager
159 - Run the command to download recovery.bin into HiKey960.
163 $sudo ./hikey_idt -c config -p /dev/ttyUSB1
165 - UEFI running in recovery mode.
166 When prompt '.' is displayed on console, press hotkey 'f' in keyboard. Then Android fastboot app is running.
167 The timeout of prompt '.' is 10 seconds.
173 $sudo fastboot flash ptable prm_ptable.img
174 $sudo fastboot flash xloader sec_xloader.img
175 $sudo fastboot flash fastboot l-loader.bin
176 $sudo fastboot flash fip fip.bin
177 $sudo fastboot flash boot boot.img
178 $sudo fastboot flash cache cache.img
179 $sudo fastboot flash system system.img
180 $sudo fastboot flash userdata userdata.img
182 - Notice: UEFI could also boot kernel in recovery mode, but BL31 isn't loaded in
185 Boot UEFI in normal mode
186 ------------------------
188 - Make sure "Boot Mode" switch is OFF for normal boot mode. Then power on HiKey960.
190 - Reference `link <https://github.com/96boards-hikey/tools-images-hikey960/blob/master/build-from-source/README-ATF-UEFI-build-from-source.md>`__
192 .. _link: https://www.96boards.org/documentation/consumer/hikey/hikey960