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