1Description 2=========== 3 4HiKey960 is one of 96boards. Hisilicon Hi3660 processor is installed on HiKey960. 5 6More information are listed in `link`_. 7 8How to build 9============ 10 11Code Locations 12-------------- 13 14- ARM Trusted Firmware: 15 `link <https://github.com/ARM-software/arm-trusted-firmware>`__ 16 17- OP-TEE: 18 `link <https://github.com/OP-TEE/optee_os>`__ 19 20- edk2: 21 `link <https://github.com/96boards-hikey/edk2/tree/testing/hikey960_v2.5>`__ 22 23- OpenPlatformPkg: 24 `link <https://github.com/96boards-hikey/OpenPlatformPkg/tree/testing/hikey960_v1.3.4>`__ 25 26- l-loader: 27 `link <https://github.com/96boards-hikey/l-loader/tree/testing/hikey960_v1.2>`__ 28 29- uefi-tools: 30 `link <https://git.linaro.org/uefi/uefi-tools.git>`__ 31 32Build Procedure 33--------------- 34 35- Fetch all the above 5 repositories into local host. 36 Make all the repositories in the same ${BUILD\_PATH}. 37 38 .. code:: shell 39 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 46 47- Create the symbol link to OpenPlatformPkg in edk2. 48 49 .. code:: shell 50 51 $cd ${BUILD_PATH}/edk2 52 $ln -sf ../OpenPlatformPkg 53 54- Prepare AARCH64 toolchain. 55 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.** 59 60 .. code:: shell 61 62 BUILDFLAGS=-DSERIAL_BASE=0xFDF05000 63 64 If your hikey960 hardware is v2 or newer, nothing to do. 65 66- Build it as debug mode. Create script file for build. 67 68 .. code:: shell 69 70 BUILD_OPTION=DEBUG 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} 75 cd ${EDK2_DIR} 76 # Build UEFI & ARM Trust Firmware 77 ${UEFI_TOOLS_DIR}/uefi-build.sh -b ${BUILD_OPTION} -a ../arm-trusted-firmware -s ../optee_os hikey960 78 79- Generate l-loader.bin and partition table. 80 *Make sure that you're using the sgdisk in the l-loader directory.* 81 82 .. code:: shell 83 84 cd ${BUILD_PATH}/l-loader 85 ln -sf ${EDK2_OUTPUT_DIR}/FV/bl1.bin 86 ln -sf ${EDK2_OUTPUT_DIR}/FV/fip.bin 87 ln -sf ${EDK2_OUTPUT_DIR}/FV/BL33_AP_UEFI.fd 88 make hikey960 89 90Setup Console 91------------- 92 93- Install ser2net. Use telnet as the console since UEFI will output window 94 that fails to display in minicom. 95 96 .. code:: shell 97 98 $sudo apt-get install ser2net 99 100- Configure ser2net. 101 102 .. code:: shell 103 104 $sudo vi /etc/ser2net.conf 105 106 Append one line for serial-over-USB in *#ser2net.conf* 107 108 :: 109 110 2004:telnet:0:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner 111 112- Start ser2net 113 114 .. code:: shell 115 116 $sudo killall ser2net 117 $sudo ser2net -u 118 119- Open the console. 120 121 .. code:: shell 122 123 $telnet localhost 2004 124 125 And you could open the console remotely, too. 126 127Boot UEFI in recovery mode 128-------------------------- 129 130- Fetch that are used in recovery mode. The code location is in below. 131 `link <https://github.com/96boards-hikey/tools-images-hikey960>`__ 132 133- Generate l-loader.bin. 134 135 .. code:: shell 136 137 $cd tools-images-hikey960 138 $ln -sf ${BUILD_PATH}/l-loader/l-loader.bin 139 $ln -sf ${BUILD_PATH}/l-loader/fip.bin 140 141- Prepare config file. 142 143 .. code:: shell 144 145 $vi config 146 # The content of config file 147 ./sec_usb_xloader.img 0x00020000 148 ./sec_uce_boot.img 0x6A908000 149 ./l-loader.bin 0x1AC00000 150 151- Remove the modemmanager package. This package may causes hikey\_idt tool failure. 152 153 .. code:: shell 154 155 $sudo apt-get purge modemmanager 156 157- Run the command to download l-loader.bin into HiKey960. 158 159 .. code:: shell 160 161 $sudo ./hikey_idt -c config -p /dev/ttyUSB1 162 163- UEFI running in recovery mode. 164 When prompt '.' is displayed on console, press hotkey 'f' in keyboard. Then Android fastboot app is running. 165 The timeout of prompt '.' is 10 seconds. 166 167- Update images. 168 169 .. code:: shell 170 171 $sudo fastboot flash ptable prm_ptable.img 172 $sudo fastboot flash xloader sec_xloader.img 173 $sudo fastboot flash fastboot l-loader.bin 174 $sudo fastboot flash fip fip.bin 175 $sudo fastboot flash boot boot.img 176 $sudo fastboot flash cache cache.img 177 $sudo fastboot flash system system.img 178 $sudo fastboot flash userdata userdata.img 179 180- Notice: UEFI could also boot kernel in recovery mode, but BL31 isn't loaded in 181 recovery mode. 182 183Boot UEFI in normal mode 184------------------------ 185 186- Make sure "Boot Mode" switch is OFF for normal boot mode. Then power on HiKey960. 187 188- Reference `link <https://github.com/96boards-hikey/tools-images-hikey960/blob/master/build-from-source/README-ATF-UEFI-build-from-source.md>`__ 189 190.. _link: http://www.96boards.org/documentation/ConsumerEdition/HiKey960/README.md 191