1f1e0f152SPaul BeesleyHiKey 2f1e0f152SPaul Beesley===== 36f625747SDouglas Raillard 46f625747SDouglas RaillardHiKey is one of 96boards. Hisilicon Kirin6220 processor is installed on HiKey. 56f625747SDouglas Raillard 66f625747SDouglas RaillardMore information are listed in `link`_. 76f625747SDouglas Raillard 86f625747SDouglas RaillardHow to build 9f1e0f152SPaul Beesley------------ 106f625747SDouglas Raillard 116f625747SDouglas RaillardCode Locations 12f1e0f152SPaul Beesley~~~~~~~~~~~~~~ 136f625747SDouglas Raillard 144def07d5SDan Handley- Trusted Firmware-A: 156f625747SDouglas Raillard `link <https://github.com/ARM-software/arm-trusted-firmware>`__ 166f625747SDouglas Raillard 173b6e88a2SVictor Chong- OP-TEE 183b6e88a2SVictor Chong `link <https://github.com/OP-TEE/optee_os>`__ 193b6e88a2SVictor Chong 206f625747SDouglas Raillard- edk2: 216f625747SDouglas Raillard `link <https://github.com/96boards-hikey/edk2/tree/testing/hikey960_v2.5>`__ 226f625747SDouglas Raillard 236f625747SDouglas Raillard- OpenPlatformPkg: 246f625747SDouglas Raillard `link <https://github.com/96boards-hikey/OpenPlatformPkg/tree/testing/hikey960_v1.3.4>`__ 256f625747SDouglas Raillard 266f625747SDouglas Raillard- l-loader: 276f625747SDouglas Raillard `link <https://github.com/96boards-hikey/l-loader/tree/testing/hikey960_v1.2>`__ 286f625747SDouglas Raillard 296f625747SDouglas Raillard- atf-fastboot: 306f625747SDouglas Raillard `link <https://github.com/96boards-hikey/atf-fastboot/tree/master>`__ 316f625747SDouglas Raillard 326f625747SDouglas RaillardBuild Procedure 33f1e0f152SPaul Beesley~~~~~~~~~~~~~~~ 346f625747SDouglas Raillard 356f625747SDouglas Raillard- Fetch all the above repositories into local host. 366f625747SDouglas Raillard Make all the repositories in the same ${BUILD\_PATH}. 376f625747SDouglas Raillard 3837c21657SVictor Chong .. code:: shell 3937c21657SVictor Chong 4037c21657SVictor Chong git clone https://github.com/ARM-software/arm-trusted-firmware -b integration 4137c21657SVictor Chong git clone https://github.com/OP-TEE/optee_os 4237c21657SVictor Chong git clone https://github.com/96boards-hikey/edk2 -b testing/hikey960_v2.5 4337c21657SVictor Chong git clone https://github.com/96boards-hikey/OpenPlatformPkg -b testing/hikey960_v1.3.4 4437c21657SVictor Chong git clone https://github.com/96boards-hikey/l-loader -b testing/hikey960_v1.2 4537c21657SVictor Chong git clone https://github.com/96boards-hikey/atf-fastboot 4637c21657SVictor Chong 476f625747SDouglas Raillard- Create the symbol link to OpenPlatformPkg in edk2. 486f625747SDouglas Raillard 496f625747SDouglas Raillard .. code:: shell 506f625747SDouglas Raillard 516f625747SDouglas Raillard $cd ${BUILD_PATH}/edk2 526f625747SDouglas Raillard $ln -sf ../OpenPlatformPkg 536f625747SDouglas Raillard 546f625747SDouglas Raillard- Prepare AARCH64 && AARCH32 toolchain. Prepare python. 556f625747SDouglas Raillard 56*3888c2d4SHaojian Zhuang- If your hikey hardware is built by CircuitCo, update *OpenPlatformPkg/Platforms/Hisilicon/HiKey/HiKey.dsc* first. *(optional)* 576f625747SDouglas Raillard console on hikey.** 586f625747SDouglas Raillard 596f625747SDouglas Raillard .. code:: shell 606f625747SDouglas Raillard 61*3888c2d4SHaojian Zhuang DEFINE SERIAL_BASE=0xF8015000 626f625747SDouglas Raillard 631b9e79e8SAndreas Färber If your hikey hardware is built by LeMaker, nothing to do. 646f625747SDouglas Raillard 656f625747SDouglas Raillard- Build it as debug mode. Create your own build script file or you could refer to **build\_uefi.sh** in l-loader git repository. 666f625747SDouglas Raillard 676f625747SDouglas Raillard .. code:: shell 686f625747SDouglas Raillard 69*3888c2d4SHaojian Zhuang cd {BUILD_PATH}/arm-trusted-firmware 70*3888c2d4SHaojian Zhuang sh ../l-loader/build_uefi.sh hikey 716f625747SDouglas Raillard 7237c21657SVictor Chong- Generate l-loader.bin and partition table for aosp. The eMMC capacity is either 8GB or 4GB. Just change "aosp-8g" to "linux-8g" for debian. 736f625747SDouglas Raillard 746f625747SDouglas Raillard .. code:: shell 756f625747SDouglas Raillard 7637c21657SVictor Chong cd ${BUILD_PATH}/l-loader 7737c21657SVictor Chong ln -sf ${EDK2_OUTPUT_DIR}/FV/bl1.bin 78a628b1abSHaojian Zhuang ln -sf ${EDK2_OUTPUT_DIR}/FV/bl2.bin 7937c21657SVictor Chong ln -sf ${BUILD_PATH}/atf-fastboot/build/hikey/${FASTBOOT_BUILD_OPTION}/bl1.bin fastboot.bin 8037c21657SVictor Chong make hikey PTABLE_LST=aosp-8g 816f625747SDouglas Raillard 826f625747SDouglas RaillardSetup Console 836f625747SDouglas Raillard------------- 846f625747SDouglas Raillard 856f625747SDouglas Raillard- Install ser2net. Use telnet as the console since UEFI fails to display Boot Manager GUI in minicom. **If you don't need Boot Manager GUI, just ignore this section.** 866f625747SDouglas Raillard 876f625747SDouglas Raillard .. code:: shell 886f625747SDouglas Raillard 896f625747SDouglas Raillard $sudo apt-get install ser2net 906f625747SDouglas Raillard 916f625747SDouglas Raillard- Configure ser2net. 926f625747SDouglas Raillard 936f625747SDouglas Raillard .. code:: shell 946f625747SDouglas Raillard 956f625747SDouglas Raillard $sudo vi /etc/ser2net.conf 966f625747SDouglas Raillard 976f625747SDouglas Raillard Append one line for serial-over-USB in below. 986f625747SDouglas Raillard *#ser2net.conf* 996f625747SDouglas Raillard 1006f625747SDouglas Raillard .. code:: shell 1016f625747SDouglas Raillard 1026f625747SDouglas Raillard 2004:telnet:0:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner 1036f625747SDouglas Raillard 104367456dfSVictor Chong- Start ser2net 105367456dfSVictor Chong 106367456dfSVictor Chong .. code:: shell 107367456dfSVictor Chong 108367456dfSVictor Chong $sudo killall ser2net 109367456dfSVictor Chong $sudo ser2net -u 110367456dfSVictor Chong 1116f625747SDouglas Raillard- Open the console. 1126f625747SDouglas Raillard 1136f625747SDouglas Raillard .. code:: shell 1146f625747SDouglas Raillard 1156f625747SDouglas Raillard $telnet localhost 2004 1166f625747SDouglas Raillard 1176f625747SDouglas Raillard And you could open the console remotely, too. 1186f625747SDouglas Raillard 119a87a1fb3SVictor ChongFlash images in recovery mode 1206f625747SDouglas Raillard----------------------------- 1216f625747SDouglas Raillard 1226f625747SDouglas Raillard- Make sure Pin3-Pin4 on J15 are connected for recovery mode. Then power on HiKey. 1236f625747SDouglas Raillard 1246f625747SDouglas Raillard- Remove the modemmanager package. This package may cause the idt tool failure. 1256f625747SDouglas Raillard 1266f625747SDouglas Raillard .. code:: shell 1276f625747SDouglas Raillard 1286f625747SDouglas Raillard $sudo apt-get purge modemmanager 1296f625747SDouglas Raillard 130a628b1abSHaojian Zhuang- Run the command to download recovery.bin into HiKey. 1316f625747SDouglas Raillard 1326f625747SDouglas Raillard .. code:: shell 1336f625747SDouglas Raillard 134a628b1abSHaojian Zhuang $sudo python hisi-idt.py -d /dev/ttyUSB1 --img1 recovery.bin 1356f625747SDouglas Raillard 136dd4e9a7dSPaul Beesley- Update images. All aosp or debian images could be fetched from `link <http://releases.linaro.org/96boards/>`__. 1376f625747SDouglas Raillard 1386f625747SDouglas Raillard .. code:: shell 1396f625747SDouglas Raillard 1406f625747SDouglas Raillard $sudo fastboot flash ptable prm_ptable.img 141a628b1abSHaojian Zhuang $sudo fastboot flash loader l-loader.bin 1426f625747SDouglas Raillard $sudo fastboot flash fastboot fip.bin 1436f625747SDouglas Raillard $sudo fastboot flash boot boot.img 1446f625747SDouglas Raillard $sudo fastboot flash cache cache.img 1456f625747SDouglas Raillard $sudo fastboot flash system system.img 1466f625747SDouglas Raillard $sudo fastboot flash userdata userdata.img 1476f625747SDouglas Raillard 1486f625747SDouglas RaillardBoot UEFI in normal mode 1496f625747SDouglas Raillard------------------------ 1506f625747SDouglas Raillard 1516f625747SDouglas Raillard- Make sure Pin3-Pin4 on J15 are open for normal boot mode. Then power on HiKey. 1526f625747SDouglas Raillard 1536f625747SDouglas Raillard- Reference `link <https://github.com/96boards-hikey/tools-images-hikey960/blob/master/build-from-source/README-ATF-UEFI-build-from-source.md>`__ 1546f625747SDouglas Raillard 155dd4e9a7dSPaul Beesley.. _link: https://www.96boards.org/documentation/consumer/hikey/ 156