blob: 7ddb0b10432ee8dce64eb85ca6a83a8fb711836e [file] [log] [blame]
Douglas Raillardd7c21b72017-06-28 15:23:03 +01001Description
2===========
3
4HiKey960 is one of 96boards. Hisilicon Hi3660 processor is installed on HiKey960.
5
6More information are listed in `link`_.
7
8How to build
9============
10
11Code Locations
12--------------
13
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
29- uefi-tools:
Victor Chong1acb3e12017-07-11 23:48:39 +090030 `link <https://git.linaro.org/uefi/uefi-tools.git>`__
Douglas Raillardd7c21b72017-06-28 15:23:03 +010031
32Build Procedure
33---------------
34
35- Fetch all the above 5 repositories into local host.
36 Make all the repositories in the same ${BUILD\_PATH}.
37
Victor Chong7f47e742017-09-29 19:56:39 +010038 .. 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
45 git clone https://git.linaro.org/uefi/uefi-tools
46
Douglas Raillardd7c21b72017-06-28 15:23:03 +010047- 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 toolchain.
55
56- If your hikey960 hardware is v1, update *uefi-tools/platform.config* first. *(optional)*
57 **Uncomment the below sentence. Otherwise, UEFI can't output messages on serial
58 console on hikey960 v1.**
59
60 .. code:: shell
61
62 BUILDFLAGS=-DSERIAL_BASE=0xFDF05000
63
64 If your hikey960 hardware is v2 or newer, nothing to do.
65
66- Build it as debug mode. Create script file for build.
67
68 .. code:: shell
69
70 BUILD_OPTION=DEBUG
Victor Chong1acb3e12017-07-11 23:48:39 +090071 export AARCH64_TOOLCHAIN=GCC5
Douglas Raillardd7c21b72017-06-28 15:23:03 +010072 export UEFI_TOOLS_DIR=${BUILD_PATH}/uefi-tools
73 export EDK2_DIR=${BUILD_PATH}/edk2
74 EDK2_OUTPUT_DIR=${EDK2_DIR}/Build/HiKey960/${BUILD_OPTION}_${AARCH64_TOOLCHAIN}
75 cd ${EDK2_DIR}
Dan Handley610e7e12018-03-01 18:44:00 +000076 # Build UEFI & Trusted Firmware-A
Victor Chong91287682017-05-28 00:14:37 +090077 ${UEFI_TOOLS_DIR}/uefi-build.sh -b ${BUILD_OPTION} -a ../arm-trusted-firmware -s ../optee_os hikey960
Douglas Raillardd7c21b72017-06-28 15:23:03 +010078
Victor Chong7f47e742017-09-29 19:56:39 +010079- Generate l-loader.bin and partition table.
Douglas Raillardd7c21b72017-06-28 15:23:03 +010080 *Make sure that you're using the sgdisk in the l-loader directory.*
81
82 .. code:: shell
83
Victor Chong7f47e742017-09-29 19:56:39 +010084 cd ${BUILD_PATH}/l-loader
85 ln -sf ${EDK2_OUTPUT_DIR}/FV/bl1.bin
Haojian Zhuang1b4b4122018-01-25 16:13:05 +080086 ln -sf ${EDK2_OUTPUT_DIR}/FV/bl2.bin
Victor Chong7f47e742017-09-29 19:56:39 +010087 ln -sf ${EDK2_OUTPUT_DIR}/FV/fip.bin
88 ln -sf ${EDK2_OUTPUT_DIR}/FV/BL33_AP_UEFI.fd
89 make hikey960
Douglas Raillardd7c21b72017-06-28 15:23:03 +010090
91Setup Console
92-------------
93
94- Install ser2net. Use telnet as the console since UEFI will output window
95 that fails to display in minicom.
96
97 .. code:: shell
98
99 $sudo apt-get install ser2net
100
101- Configure ser2net.
102
103 .. code:: shell
104
105 $sudo vi /etc/ser2net.conf
106
107 Append one line for serial-over-USB in *#ser2net.conf*
108
109 ::
110
111 2004:telnet:0:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner
112
Victor Chong1acb3e12017-07-11 23:48:39 +0900113- Start ser2net
114
115 .. code:: shell
116
117 $sudo killall ser2net
118 $sudo ser2net -u
119
Douglas Raillardd7c21b72017-06-28 15:23:03 +0100120- Open the console.
121
122 .. code:: shell
123
124 $telnet localhost 2004
125
126 And you could open the console remotely, too.
127
128Boot UEFI in recovery mode
129--------------------------
130
131- Fetch that are used in recovery mode. The code location is in below.
132 `link <https://github.com/96boards-hikey/tools-images-hikey960>`__
133
Haojian Zhuang1b4b4122018-01-25 16:13:05 +0800134- Prepare recovery binary.
Douglas Raillardd7c21b72017-06-28 15:23:03 +0100135
136 .. code:: shell
137
138 $cd tools-images-hikey960
139 $ln -sf ${BUILD_PATH}/l-loader/l-loader.bin
Victor Chong7f47e742017-09-29 19:56:39 +0100140 $ln -sf ${BUILD_PATH}/l-loader/fip.bin
Haojian Zhuang1b4b4122018-01-25 16:13:05 +0800141 $ln -sf ${BUILD_PATH}/l-loader/recovery.bin
Douglas Raillardd7c21b72017-06-28 15:23:03 +0100142
143- Prepare config file.
144
145 .. code:: shell
146
147 $vi config
148 # The content of config file
Victor Chong1acb3e12017-07-11 23:48:39 +0900149 ./sec_usb_xloader.img 0x00020000
Douglas Raillardd7c21b72017-06-28 15:23:03 +0100150 ./sec_uce_boot.img 0x6A908000
Haojian Zhuang1b4b4122018-01-25 16:13:05 +0800151 ./recovery.bin 0x1AC00000
Douglas Raillardd7c21b72017-06-28 15:23:03 +0100152
153- Remove the modemmanager package. This package may causes hikey\_idt tool failure.
154
155 .. code:: shell
156
157 $sudo apt-get purge modemmanager
158
Haojian Zhuang1b4b4122018-01-25 16:13:05 +0800159- Run the command to download recovery.bin into HiKey960.
Douglas Raillardd7c21b72017-06-28 15:23:03 +0100160
161 .. code:: shell
162
163 $sudo ./hikey_idt -c config -p /dev/ttyUSB1
164
165- UEFI running in recovery mode.
166 When prompt '.' is displayed on console, press hotkey 'f' in keyboard. Then Android fastboot app is running.
167 The timeout of prompt '.' is 10 seconds.
168
169- Update images.
170
171 .. code:: shell
172
173 $sudo fastboot flash ptable prm_ptable.img
174 $sudo fastboot flash xloader sec_xloader.img
175 $sudo fastboot flash fastboot l-loader.bin
176 $sudo fastboot flash fip fip.bin
177 $sudo fastboot flash boot boot.img
178 $sudo fastboot flash cache cache.img
179 $sudo fastboot flash system system.img
180 $sudo fastboot flash userdata userdata.img
181
182- Notice: UEFI could also boot kernel in recovery mode, but BL31 isn't loaded in
183 recovery mode.
184
185Boot UEFI in normal mode
186------------------------
187
188- Make sure "Boot Mode" switch is OFF for normal boot mode. Then power on HiKey960.
189
190- Reference `link <https://github.com/96boards-hikey/tools-images-hikey960/blob/master/build-from-source/README-ATF-UEFI-build-from-source.md>`__
191
Paul Beesley2437ddc2019-02-08 16:43:05 +0000192.. _link: https://www.96boards.org/documentation/consumer/hikey/hikey960