Paul Beesley | 743d088 | 2019-09-25 12:58:36 +0000 | [diff] [blame] | 1 | HiKey |
| 2 | ===== |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 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 |
Paul Beesley | 743d088 | 2019-09-25 12:58:36 +0000 | [diff] [blame] | 9 | ------------ |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 10 | |
| 11 | Code Locations |
Paul Beesley | 743d088 | 2019-09-25 12:58:36 +0000 | [diff] [blame] | 12 | ~~~~~~~~~~~~~~ |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 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 | |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 29 | - atf-fastboot: |
| 30 | `link <https://github.com/96boards-hikey/atf-fastboot/tree/master>`__ |
| 31 | |
| 32 | Build Procedure |
Paul Beesley | 743d088 | 2019-09-25 12:58:36 +0000 | [diff] [blame] | 33 | ~~~~~~~~~~~~~~~ |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 34 | |
| 35 | - Fetch all the above repositories into local host. |
| 36 | Make all the repositories in the same ${BUILD\_PATH}. |
| 37 | |
Victor Chong | 7f47e74 | 2017-09-29 19:56:39 +0100 | [diff] [blame] | 38 | .. code:: shell |
| 39 | |
| 40 | git clone https://github.com/ARM-software/arm-trusted-firmware -b integration |
| 41 | git clone https://github.com/OP-TEE/optee_os |
| 42 | git clone https://github.com/96boards-hikey/edk2 -b testing/hikey960_v2.5 |
| 43 | git clone https://github.com/96boards-hikey/OpenPlatformPkg -b testing/hikey960_v1.3.4 |
| 44 | git clone https://github.com/96boards-hikey/l-loader -b testing/hikey960_v1.2 |
Victor Chong | 7f47e74 | 2017-09-29 19:56:39 +0100 | [diff] [blame] | 45 | git clone https://github.com/96boards-hikey/atf-fastboot |
| 46 | |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 47 | - Create the symbol link to OpenPlatformPkg in edk2. |
| 48 | |
| 49 | .. code:: shell |
| 50 | |
| 51 | $cd ${BUILD_PATH}/edk2 |
| 52 | $ln -sf ../OpenPlatformPkg |
| 53 | |
| 54 | - Prepare AARCH64 && AARCH32 toolchain. Prepare python. |
| 55 | |
Haojian Zhuang | 2e7ec0b | 2020-03-14 10:24:41 +0800 | [diff] [blame] | 56 | - If your hikey hardware is built by CircuitCo, update *OpenPlatformPkg/Platforms/Hisilicon/HiKey/HiKey.dsc* first. *(optional)* |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 57 | console on hikey.** |
| 58 | |
| 59 | .. code:: shell |
| 60 | |
Haojian Zhuang | 2e7ec0b | 2020-03-14 10:24:41 +0800 | [diff] [blame] | 61 | DEFINE SERIAL_BASE=0xF8015000 |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 62 | |
Andreas Färber | bd519e5 | 2018-01-29 02:47:10 +0100 | [diff] [blame] | 63 | If your hikey hardware is built by LeMaker, nothing to do. |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 64 | |
| 65 | - 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 | |
| 67 | .. code:: shell |
| 68 | |
Haojian Zhuang | 2e7ec0b | 2020-03-14 10:24:41 +0800 | [diff] [blame] | 69 | cd {BUILD_PATH}/arm-trusted-firmware |
| 70 | sh ../l-loader/build_uefi.sh hikey |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 71 | |
Victor Chong | 7f47e74 | 2017-09-29 19:56:39 +0100 | [diff] [blame] | 72 | - 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] | 73 | |
| 74 | .. code:: shell |
| 75 | |
Victor Chong | 7f47e74 | 2017-09-29 19:56:39 +0100 | [diff] [blame] | 76 | cd ${BUILD_PATH}/l-loader |
| 77 | ln -sf ${EDK2_OUTPUT_DIR}/FV/bl1.bin |
Haojian Zhuang | b755da3 | 2018-01-25 16:10:14 +0800 | [diff] [blame] | 78 | ln -sf ${EDK2_OUTPUT_DIR}/FV/bl2.bin |
Victor Chong | 7f47e74 | 2017-09-29 19:56:39 +0100 | [diff] [blame] | 79 | ln -sf ${BUILD_PATH}/atf-fastboot/build/hikey/${FASTBOOT_BUILD_OPTION}/bl1.bin fastboot.bin |
| 80 | make hikey PTABLE_LST=aosp-8g |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 81 | |
| 82 | Setup Console |
| 83 | ------------- |
| 84 | |
| 85 | - 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 | |
| 87 | .. code:: shell |
| 88 | |
| 89 | $sudo apt-get install ser2net |
| 90 | |
| 91 | - Configure ser2net. |
| 92 | |
| 93 | .. code:: shell |
| 94 | |
| 95 | $sudo vi /etc/ser2net.conf |
| 96 | |
| 97 | Append one line for serial-over-USB in below. |
| 98 | *#ser2net.conf* |
| 99 | |
| 100 | .. code:: shell |
| 101 | |
| 102 | 2004:telnet:0:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner |
| 103 | |
Victor Chong | 98eea37 | 2017-07-12 16:13:43 +0900 | [diff] [blame] | 104 | - Start ser2net |
| 105 | |
| 106 | .. code:: shell |
| 107 | |
| 108 | $sudo killall ser2net |
| 109 | $sudo ser2net -u |
| 110 | |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 111 | - Open the console. |
| 112 | |
| 113 | .. code:: shell |
| 114 | |
| 115 | $telnet localhost 2004 |
| 116 | |
| 117 | And you could open the console remotely, too. |
| 118 | |
Victor Chong | e46fa92 | 2017-08-27 17:46:03 +0900 | [diff] [blame] | 119 | Flash images in recovery mode |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 120 | ----------------------------- |
| 121 | |
| 122 | - Make sure Pin3-Pin4 on J15 are connected for recovery mode. Then power on HiKey. |
| 123 | |
| 124 | - Remove the modemmanager package. This package may cause the idt tool failure. |
| 125 | |
| 126 | .. code:: shell |
| 127 | |
| 128 | $sudo apt-get purge modemmanager |
| 129 | |
Haojian Zhuang | b755da3 | 2018-01-25 16:10:14 +0800 | [diff] [blame] | 130 | - Run the command to download recovery.bin into HiKey. |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 131 | |
| 132 | .. code:: shell |
| 133 | |
Haojian Zhuang | b755da3 | 2018-01-25 16:10:14 +0800 | [diff] [blame] | 134 | $sudo python hisi-idt.py -d /dev/ttyUSB1 --img1 recovery.bin |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 135 | |
Paul Beesley | 2437ddc | 2019-02-08 16:43:05 +0000 | [diff] [blame] | 136 | - 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] | 137 | |
| 138 | .. code:: shell |
| 139 | |
| 140 | $sudo fastboot flash ptable prm_ptable.img |
Haojian Zhuang | b755da3 | 2018-01-25 16:10:14 +0800 | [diff] [blame] | 141 | $sudo fastboot flash loader l-loader.bin |
Douglas Raillard | d7c21b7 | 2017-06-28 15:23:03 +0100 | [diff] [blame] | 142 | $sudo fastboot flash fastboot fip.bin |
| 143 | $sudo fastboot flash boot boot.img |
| 144 | $sudo fastboot flash cache cache.img |
| 145 | $sudo fastboot flash system system.img |
| 146 | $sudo fastboot flash userdata userdata.img |
| 147 | |
| 148 | Boot UEFI in normal mode |
| 149 | ------------------------ |
| 150 | |
| 151 | - Make sure Pin3-Pin4 on J15 are open for normal boot mode. Then power on HiKey. |
| 152 | |
| 153 | - Reference `link <https://github.com/96boards-hikey/tools-images-hikey960/blob/master/build-from-source/README-ATF-UEFI-build-from-source.md>`__ |
| 154 | |
Paul Beesley | 2437ddc | 2019-02-08 16:43:05 +0000 | [diff] [blame] | 155 | .. _link: https://www.96boards.org/documentation/consumer/hikey/ |