Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 1 | Description |
| 2 | =========== |
| 3 | |
| 4 | HiKey is one of 96boards. Hisilicon Kirin6220 processor is installed on HiKey. |
| 5 | |
| 6 | More information are listed in `link`_. |
| 7 | |
| 8 | How to build |
| 9 | ============ |
| 10 | |
| 11 | Code Locations |
| 12 | -------------- |
| 13 | |
Dan Handley | 610e7e1 | 2018-03-01 18:44:00 +0000 | [diff] [blame] | 14 | - Trusted Firmware-A: |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 15 | `link <https://github.com/ARM-software/arm-trusted-firmware>`__ |
| 16 | |
Victor Chong | b9a8db2 | 2017-05-28 00:14:25 +0900 | [diff] [blame] | 17 | - OP-TEE |
| 18 | `link <https://github.com/OP-TEE/optee_os>`__ |
| 19 | |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 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: |
Victor Chong | 98eea37 | 2017-07-12 16:13:43 +0900 | [diff] [blame] | 30 | `link <https://git.linaro.org/uefi/uefi-tools.git>`__ |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 31 | |
| 32 | - atf-fastboot: |
| 33 | `link <https://github.com/96boards-hikey/atf-fastboot/tree/master>`__ |
| 34 | |
| 35 | Build Procedure |
| 36 | --------------- |
| 37 | |
| 38 | - Fetch all the above repositories into local host. |
| 39 | Make all the repositories in the same ${BUILD\_PATH}. |
| 40 | |
Victor Chong | 7f47e74 | 2017-09-29 19:56:39 +0100 | [diff] [blame] | 41 | .. code:: shell |
| 42 | |
| 43 | git clone https://github.com/ARM-software/arm-trusted-firmware -b integration |
| 44 | git clone https://github.com/OP-TEE/optee_os |
| 45 | git clone https://github.com/96boards-hikey/edk2 -b testing/hikey960_v2.5 |
| 46 | git clone https://github.com/96boards-hikey/OpenPlatformPkg -b testing/hikey960_v1.3.4 |
| 47 | git clone https://github.com/96boards-hikey/l-loader -b testing/hikey960_v1.2 |
| 48 | git clone https://git.linaro.org/uefi/uefi-tools |
| 49 | git clone https://github.com/96boards-hikey/atf-fastboot |
| 50 | |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 51 | - Create the symbol link to OpenPlatformPkg in edk2. |
| 52 | |
| 53 | .. code:: shell |
| 54 | |
| 55 | $cd ${BUILD_PATH}/edk2 |
| 56 | $ln -sf ../OpenPlatformPkg |
| 57 | |
| 58 | - Prepare AARCH64 && AARCH32 toolchain. Prepare python. |
| 59 | |
| 60 | - If your hikey hardware is built by CircuitCo, update *uefi-tools/platform.config* first. *(optional)* |
| 61 | **Uncomment the below sentence. Otherwise, UEFI can't output messages on serial |
| 62 | console on hikey.** |
| 63 | |
| 64 | .. code:: shell |
| 65 | |
| 66 | BUILDFLAGS=-DSERIAL_BASE=0xF8015000 |
| 67 | |
Andreas Färber | bd519e5 | 2018-01-29 02:47:10 +0100 | [diff] [blame] | 68 | If your hikey hardware is built by LeMaker, nothing to do. |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 69 | |
| 70 | - Build it as debug mode. Create your own build script file or you could refer to **build\_uefi.sh** in l-loader git repository. |
| 71 | |
| 72 | .. code:: shell |
| 73 | |
| 74 | BUILD_OPTION=DEBUG |
| 75 | export AARCH64_TOOLCHAIN=GCC5 |
| 76 | export UEFI_TOOLS_DIR=${BUILD_PATH}/uefi-tools |
| 77 | export EDK2_DIR=${BUILD_PATH}/edk2 |
| 78 | EDK2_OUTPUT_DIR=${EDK2_DIR}/Build/HiKey/${BUILD_OPTION}_${AARCH64_TOOLCHAIN} |
Dan Handley | 610e7e1 | 2018-03-01 18:44:00 +0000 | [diff] [blame] | 79 | # Build fastboot for Trusted Firmware-A. It's used for recovery mode. |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 80 | cd ${BUILD_PATH}/atf-fastboot |
| 81 | CROSS_COMPILE=aarch64-linux-gnu- make PLAT=hikey DEBUG=1 |
| 82 | # Convert DEBUG/RELEASE to debug/release |
| 83 | FASTBOOT_BUILD_OPTION=$(echo ${BUILD_OPTION} | tr '[A-Z]' '[a-z]') |
| 84 | cd ${EDK2_DIR} |
Dan Handley | 610e7e1 | 2018-03-01 18:44:00 +0000 | [diff] [blame] | 85 | # Build UEFI & Trusted Firmware-A |
Victor Chong | b9a8db2 | 2017-05-28 00:14:25 +0900 | [diff] [blame] | 86 | ${UEFI_TOOLS_DIR}/uefi-build.sh -b ${BUILD_OPTION} -a ../arm-trusted-firmware -s ../optee_os hikey |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 87 | |
Victor Chong | 7f47e74 | 2017-09-29 19:56:39 +0100 | [diff] [blame] | 88 | - 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. |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 89 | |
| 90 | .. code:: shell |
| 91 | |
Victor Chong | 7f47e74 | 2017-09-29 19:56:39 +0100 | [diff] [blame] | 92 | cd ${BUILD_PATH}/l-loader |
| 93 | ln -sf ${EDK2_OUTPUT_DIR}/FV/bl1.bin |
Haojian Zhuang | b755da3 | 2018-01-25 16:10:14 +0800 | [diff] [blame] | 94 | ln -sf ${EDK2_OUTPUT_DIR}/FV/bl2.bin |
Victor Chong | 7f47e74 | 2017-09-29 19:56:39 +0100 | [diff] [blame] | 95 | ln -sf ${BUILD_PATH}/atf-fastboot/build/hikey/${FASTBOOT_BUILD_OPTION}/bl1.bin fastboot.bin |
| 96 | make hikey PTABLE_LST=aosp-8g |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 97 | |
| 98 | Setup Console |
| 99 | ------------- |
| 100 | |
| 101 | - 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.** |
| 102 | |
| 103 | .. code:: shell |
| 104 | |
| 105 | $sudo apt-get install ser2net |
| 106 | |
| 107 | - Configure ser2net. |
| 108 | |
| 109 | .. code:: shell |
| 110 | |
| 111 | $sudo vi /etc/ser2net.conf |
| 112 | |
| 113 | Append one line for serial-over-USB in below. |
| 114 | *#ser2net.conf* |
| 115 | |
| 116 | .. code:: shell |
| 117 | |
| 118 | 2004:telnet:0:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner |
| 119 | |
Victor Chong | 98eea37 | 2017-07-12 16:13:43 +0900 | [diff] [blame] | 120 | - Start ser2net |
| 121 | |
| 122 | .. code:: shell |
| 123 | |
| 124 | $sudo killall ser2net |
| 125 | $sudo ser2net -u |
| 126 | |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 127 | - Open the console. |
| 128 | |
| 129 | .. code:: shell |
| 130 | |
| 131 | $telnet localhost 2004 |
| 132 | |
| 133 | And you could open the console remotely, too. |
| 134 | |
Victor Chong | e46fa92 | 2017-08-27 17:46:03 +0900 | [diff] [blame] | 135 | Flash images in recovery mode |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 136 | ----------------------------- |
| 137 | |
| 138 | - Make sure Pin3-Pin4 on J15 are connected for recovery mode. Then power on HiKey. |
| 139 | |
| 140 | - Remove the modemmanager package. This package may cause the idt tool failure. |
| 141 | |
| 142 | .. code:: shell |
| 143 | |
| 144 | $sudo apt-get purge modemmanager |
| 145 | |
Haojian Zhuang | b755da3 | 2018-01-25 16:10:14 +0800 | [diff] [blame] | 146 | - Run the command to download recovery.bin into HiKey. |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 147 | |
| 148 | .. code:: shell |
| 149 | |
Haojian Zhuang | b755da3 | 2018-01-25 16:10:14 +0800 | [diff] [blame] | 150 | $sudo python hisi-idt.py -d /dev/ttyUSB1 --img1 recovery.bin |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 151 | |
Paul Beesley | 2437ddc | 2019-02-08 16:43:05 +0000 | [diff] [blame] | 152 | - Update images. All aosp or debian images could be fetched from `link <http://releases.linaro.org/96boards/>`__. |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 153 | |
| 154 | .. code:: shell |
| 155 | |
| 156 | $sudo fastboot flash ptable prm_ptable.img |
Haojian Zhuang | b755da3 | 2018-01-25 16:10:14 +0800 | [diff] [blame] | 157 | $sudo fastboot flash loader l-loader.bin |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 158 | $sudo fastboot flash fastboot fip.bin |
| 159 | $sudo fastboot flash boot boot.img |
| 160 | $sudo fastboot flash cache cache.img |
| 161 | $sudo fastboot flash system system.img |
| 162 | $sudo fastboot flash userdata userdata.img |
| 163 | |
| 164 | Boot UEFI in normal mode |
| 165 | ------------------------ |
| 166 | |
| 167 | - Make sure Pin3-Pin4 on J15 are open for normal boot mode. Then power on HiKey. |
| 168 | |
| 169 | - Reference `link <https://github.com/96boards-hikey/tools-images-hikey960/blob/master/build-from-source/README-ATF-UEFI-build-from-source.md>`__ |
| 170 | |
Paul Beesley | 2437ddc | 2019-02-08 16:43:05 +0000 | [diff] [blame] | 171 | .. _link: https://www.96boards.org/documentation/consumer/hikey/ |