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