1*54fd6939SJiyong ParkHiKey 2*54fd6939SJiyong Park===== 3*54fd6939SJiyong Park 4*54fd6939SJiyong ParkHiKey is one of 96boards. Hisilicon Kirin6220 processor is installed on HiKey. 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 Park- atf-fastboot: 30*54fd6939SJiyong Park `link <https://github.com/96boards-hikey/atf-fastboot/tree/master>`__ 31*54fd6939SJiyong Park 32*54fd6939SJiyong ParkBuild Procedure 33*54fd6939SJiyong Park~~~~~~~~~~~~~~~ 34*54fd6939SJiyong Park 35*54fd6939SJiyong Park- Fetch all the above repositories into local host. 36*54fd6939SJiyong Park Make all the repositories in the same ${BUILD\_PATH}. 37*54fd6939SJiyong Park 38*54fd6939SJiyong Park .. code:: shell 39*54fd6939SJiyong Park 40*54fd6939SJiyong Park git clone https://github.com/ARM-software/arm-trusted-firmware -b integration 41*54fd6939SJiyong Park git clone https://github.com/OP-TEE/optee_os 42*54fd6939SJiyong Park git clone https://github.com/96boards-hikey/edk2 -b testing/hikey960_v2.5 43*54fd6939SJiyong Park git clone https://github.com/96boards-hikey/OpenPlatformPkg -b testing/hikey960_v1.3.4 44*54fd6939SJiyong Park git clone https://github.com/96boards-hikey/l-loader -b testing/hikey960_v1.2 45*54fd6939SJiyong Park git clone https://github.com/96boards-hikey/atf-fastboot 46*54fd6939SJiyong Park 47*54fd6939SJiyong Park- Create the symbol link to OpenPlatformPkg in edk2. 48*54fd6939SJiyong Park 49*54fd6939SJiyong Park .. code:: shell 50*54fd6939SJiyong Park 51*54fd6939SJiyong Park $cd ${BUILD_PATH}/edk2 52*54fd6939SJiyong Park $ln -sf ../OpenPlatformPkg 53*54fd6939SJiyong Park 54*54fd6939SJiyong Park- Prepare AARCH64 && AARCH32 toolchain. Prepare python. 55*54fd6939SJiyong Park 56*54fd6939SJiyong Park- If your hikey hardware is built by CircuitCo, update *OpenPlatformPkg/Platforms/Hisilicon/HiKey/HiKey.dsc* first. *(optional)* 57*54fd6939SJiyong Park console on hikey.** 58*54fd6939SJiyong Park 59*54fd6939SJiyong Park .. code:: shell 60*54fd6939SJiyong Park 61*54fd6939SJiyong Park DEFINE SERIAL_BASE=0xF8015000 62*54fd6939SJiyong Park 63*54fd6939SJiyong Park If your hikey hardware is built by LeMaker, nothing to do. 64*54fd6939SJiyong Park 65*54fd6939SJiyong Park- Build it as debug mode. Create your own build script file or you could refer to **build\_uefi.sh** in l-loader git repository. 66*54fd6939SJiyong Park 67*54fd6939SJiyong Park .. code:: shell 68*54fd6939SJiyong Park 69*54fd6939SJiyong Park cd {BUILD_PATH}/arm-trusted-firmware 70*54fd6939SJiyong Park sh ../l-loader/build_uefi.sh hikey 71*54fd6939SJiyong Park 72*54fd6939SJiyong Park- 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. 73*54fd6939SJiyong Park 74*54fd6939SJiyong Park .. code:: shell 75*54fd6939SJiyong Park 76*54fd6939SJiyong Park cd ${BUILD_PATH}/l-loader 77*54fd6939SJiyong Park ln -sf ${EDK2_OUTPUT_DIR}/FV/bl1.bin 78*54fd6939SJiyong Park ln -sf ${EDK2_OUTPUT_DIR}/FV/bl2.bin 79*54fd6939SJiyong Park ln -sf ${BUILD_PATH}/atf-fastboot/build/hikey/${FASTBOOT_BUILD_OPTION}/bl1.bin fastboot.bin 80*54fd6939SJiyong Park make hikey PTABLE_LST=aosp-8g 81*54fd6939SJiyong Park 82*54fd6939SJiyong ParkSetup Console 83*54fd6939SJiyong Park------------- 84*54fd6939SJiyong Park 85*54fd6939SJiyong Park- 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.** 86*54fd6939SJiyong Park 87*54fd6939SJiyong Park .. code:: shell 88*54fd6939SJiyong Park 89*54fd6939SJiyong Park $sudo apt-get install ser2net 90*54fd6939SJiyong Park 91*54fd6939SJiyong Park- Configure ser2net. 92*54fd6939SJiyong Park 93*54fd6939SJiyong Park .. code:: shell 94*54fd6939SJiyong Park 95*54fd6939SJiyong Park $sudo vi /etc/ser2net.conf 96*54fd6939SJiyong Park 97*54fd6939SJiyong Park Append one line for serial-over-USB in below. 98*54fd6939SJiyong Park *#ser2net.conf* 99*54fd6939SJiyong Park 100*54fd6939SJiyong Park .. code:: shell 101*54fd6939SJiyong Park 102*54fd6939SJiyong Park 2004:telnet:0:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner 103*54fd6939SJiyong Park 104*54fd6939SJiyong Park- Start ser2net 105*54fd6939SJiyong Park 106*54fd6939SJiyong Park .. code:: shell 107*54fd6939SJiyong Park 108*54fd6939SJiyong Park $sudo killall ser2net 109*54fd6939SJiyong Park $sudo ser2net -u 110*54fd6939SJiyong Park 111*54fd6939SJiyong Park- Open the console. 112*54fd6939SJiyong Park 113*54fd6939SJiyong Park .. code:: shell 114*54fd6939SJiyong Park 115*54fd6939SJiyong Park $telnet localhost 2004 116*54fd6939SJiyong Park 117*54fd6939SJiyong Park And you could open the console remotely, too. 118*54fd6939SJiyong Park 119*54fd6939SJiyong ParkFlash images in recovery mode 120*54fd6939SJiyong Park----------------------------- 121*54fd6939SJiyong Park 122*54fd6939SJiyong Park- Make sure Pin3-Pin4 on J15 are connected for recovery mode. Then power on HiKey. 123*54fd6939SJiyong Park 124*54fd6939SJiyong Park- Remove the modemmanager package. This package may cause the idt tool failure. 125*54fd6939SJiyong Park 126*54fd6939SJiyong Park .. code:: shell 127*54fd6939SJiyong Park 128*54fd6939SJiyong Park $sudo apt-get purge modemmanager 129*54fd6939SJiyong Park 130*54fd6939SJiyong Park- Run the command to download recovery.bin into HiKey. 131*54fd6939SJiyong Park 132*54fd6939SJiyong Park .. code:: shell 133*54fd6939SJiyong Park 134*54fd6939SJiyong Park $sudo python hisi-idt.py -d /dev/ttyUSB1 --img1 recovery.bin 135*54fd6939SJiyong Park 136*54fd6939SJiyong Park- Update images. All aosp or debian images could be fetched from `link <http://releases.linaro.org/96boards/>`__. 137*54fd6939SJiyong Park 138*54fd6939SJiyong Park .. code:: shell 139*54fd6939SJiyong Park 140*54fd6939SJiyong Park $sudo fastboot flash ptable prm_ptable.img 141*54fd6939SJiyong Park $sudo fastboot flash loader l-loader.bin 142*54fd6939SJiyong Park $sudo fastboot flash fastboot fip.bin 143*54fd6939SJiyong Park $sudo fastboot flash boot boot.img 144*54fd6939SJiyong Park $sudo fastboot flash cache cache.img 145*54fd6939SJiyong Park $sudo fastboot flash system system.img 146*54fd6939SJiyong Park $sudo fastboot flash userdata userdata.img 147*54fd6939SJiyong Park 148*54fd6939SJiyong ParkBoot UEFI in normal mode 149*54fd6939SJiyong Park------------------------ 150*54fd6939SJiyong Park 151*54fd6939SJiyong Park- Make sure Pin3-Pin4 on J15 are open for normal boot mode. Then power on HiKey. 152*54fd6939SJiyong Park 153*54fd6939SJiyong Park- Reference `link <https://github.com/96boards-hikey/tools-images-hikey960/blob/master/build-from-source/README-ATF-UEFI-build-from-source.md>`__ 154*54fd6939SJiyong Park 155*54fd6939SJiyong Park.. _link: https://www.96boards.org/documentation/consumer/hikey/ 156