blob: 982c2c8547094e118cab54ead717080e1e25a872 [file] [log] [blame]
Paul Beesley743d0882019-09-25 12:58:36 +00001HiKey960
2========
Douglas Raillardd7c21b72017-06-28 15:23:03 +01003
4HiKey960 is one of 96boards. Hisilicon Hi3660 processor is installed on HiKey960.
5
6More information are listed in `link`_.
7
8How to build
Paul Beesley743d0882019-09-25 12:58:36 +00009------------
Douglas Raillardd7c21b72017-06-28 15:23:03 +010010
11Code Locations
Paul Beesley743d0882019-09-25 12:58:36 +000012~~~~~~~~~~~~~~
Douglas Raillardd7c21b72017-06-28 15:23:03 +010013
Dan Handley610e7e12018-03-01 18:44:00 +000014- Trusted Firmware-A:
Douglas Raillardd7c21b72017-06-28 15:23:03 +010015 `link <https://github.com/ARM-software/arm-trusted-firmware>`__
16
Victor Chong91287682017-05-28 00:14:37 +090017- OP-TEE:
18 `link <https://github.com/OP-TEE/optee_os>`__
19
Douglas Raillardd7c21b72017-06-28 15:23:03 +010020- 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 Raillardd7c21b72017-06-28 15:23:03 +010029Build Procedure
Paul Beesley743d0882019-09-25 12:58:36 +000030~~~~~~~~~~~~~~~
Douglas Raillardd7c21b72017-06-28 15:23:03 +010031
32- Fetch all the above 5 repositories into local host.
33 Make all the repositories in the same ${BUILD\_PATH}.
34
Victor Chong7f47e742017-09-29 19:56:39 +010035 .. 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 Chong7f47e742017-09-29 19:56:39 +010042
Douglas Raillardd7c21b72017-06-28 15:23:03 +010043- 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 Zhuang2e7ec0b2020-03-14 10:24:41 +080052- If your hikey960 hardware is v1, update *OpenPlatformPkg/Platforms/Hisilicon/HiKey960/HiKey960.dsc* first. *(optional)*
Douglas Raillardd7c21b72017-06-28 15:23:03 +010053
54 .. code:: shell
55
Haojian Zhuang2e7ec0b2020-03-14 10:24:41 +080056 DEFINE SERIAL_BASE=0xFDF05000
Douglas Raillardd7c21b72017-06-28 15:23:03 +010057
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 Zhuang2e7ec0b2020-03-14 10:24:41 +080064 cd {BUILD_PATH}/arm-trusted-firmware
65 sh ../l-loader/build_uefi.sh hikey960
Douglas Raillardd7c21b72017-06-28 15:23:03 +010066
Victor Chong7f47e742017-09-29 19:56:39 +010067- Generate l-loader.bin and partition table.
Douglas Raillardd7c21b72017-06-28 15:23:03 +010068 *Make sure that you're using the sgdisk in the l-loader directory.*
69
70 .. code:: shell
71
Victor Chong7f47e742017-09-29 19:56:39 +010072 cd ${BUILD_PATH}/l-loader
73 ln -sf ${EDK2_OUTPUT_DIR}/FV/bl1.bin
Haojian Zhuang1b4b4122018-01-25 16:13:05 +080074 ln -sf ${EDK2_OUTPUT_DIR}/FV/bl2.bin
Victor Chong7f47e742017-09-29 19:56:39 +010075 ln -sf ${EDK2_OUTPUT_DIR}/FV/fip.bin
76 ln -sf ${EDK2_OUTPUT_DIR}/FV/BL33_AP_UEFI.fd
77 make hikey960
Douglas Raillardd7c21b72017-06-28 15:23:03 +010078
79Setup 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 Chong1acb3e12017-07-11 23:48:39 +0900101- Start ser2net
102
103 .. code:: shell
104
105 $sudo killall ser2net
106 $sudo ser2net -u
107
Douglas Raillardd7c21b72017-06-28 15:23:03 +0100108- Open the console.
109
110 .. code:: shell
111
112 $telnet localhost 2004
113
114 And you could open the console remotely, too.
115
116Boot 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 Zhuang1b4b4122018-01-25 16:13:05 +0800122- Prepare recovery binary.
Douglas Raillardd7c21b72017-06-28 15:23:03 +0100123
124 .. code:: shell
125
126 $cd tools-images-hikey960
127 $ln -sf ${BUILD_PATH}/l-loader/l-loader.bin
Victor Chong7f47e742017-09-29 19:56:39 +0100128 $ln -sf ${BUILD_PATH}/l-loader/fip.bin
Haojian Zhuang1b4b4122018-01-25 16:13:05 +0800129 $ln -sf ${BUILD_PATH}/l-loader/recovery.bin
Douglas Raillardd7c21b72017-06-28 15:23:03 +0100130
131- Prepare config file.
132
133 .. code:: shell
134
135 $vi config
136 # The content of config file
Victor Chong1acb3e12017-07-11 23:48:39 +0900137 ./sec_usb_xloader.img 0x00020000
Douglas Raillardd7c21b72017-06-28 15:23:03 +0100138 ./sec_uce_boot.img 0x6A908000
Haojian Zhuang1b4b4122018-01-25 16:13:05 +0800139 ./recovery.bin 0x1AC00000
Douglas Raillardd7c21b72017-06-28 15:23:03 +0100140
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 Zhuang1b4b4122018-01-25 16:13:05 +0800147- Run the command to download recovery.bin into HiKey960.
Douglas Raillardd7c21b72017-06-28 15:23:03 +0100148
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
173Boot 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 Beesley2437ddc2019-02-08 16:43:05 +0000180.. _link: https://www.96boards.org/documentation/consumer/hikey/hikey960