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