hikey960.rst 4.68 KB
Newer Older
1
2
HiKey960
========
3
4
5
6
7
8

HiKey960 is one of 96boards. Hisilicon Hi3660 processor is installed on HiKey960.

More information are listed in `link`_.

How to build
9
------------
10
11

Code Locations
12
~~~~~~~~~~~~~~
13

Dan Handley's avatar
Dan Handley committed
14
-  Trusted Firmware-A:
15
16
   `link <https://github.com/ARM-software/arm-trusted-firmware>`__

17
18
19
-  OP-TEE:
   `link <https://github.com/OP-TEE/optee_os>`__

20
21
22
23
24
25
26
27
28
29
-  edk2:
   `link <https://github.com/96boards-hikey/edk2/tree/testing/hikey960_v2.5>`__

-  OpenPlatformPkg:
   `link <https://github.com/96boards-hikey/OpenPlatformPkg/tree/testing/hikey960_v1.3.4>`__

-  l-loader:
   `link <https://github.com/96boards-hikey/l-loader/tree/testing/hikey960_v1.2>`__

Build Procedure
30
~~~~~~~~~~~~~~~
31
32
33
34

-  Fetch all the above 5 repositories into local host.
   Make all the repositories in the same ${BUILD\_PATH}.

Victor Chong's avatar
Victor Chong committed
35
36
37
38
39
40
41
42
  .. code:: shell

       git clone https://github.com/ARM-software/arm-trusted-firmware -b integration
       git clone https://github.com/OP-TEE/optee_os
       git clone https://github.com/96boards-hikey/edk2 -b testing/hikey960_v2.5
       git clone https://github.com/96boards-hikey/OpenPlatformPkg -b testing/hikey960_v1.3.4
       git clone https://github.com/96boards-hikey/l-loader -b testing/hikey960_v1.2

43
44
45
46
47
48
49
50
51
-  Create the symbol link to OpenPlatformPkg in edk2.

   .. code:: shell

       $cd ${BUILD_PATH}/edk2
       $ln -sf ../OpenPlatformPkg

-  Prepare AARCH64 toolchain.

52
-  If your hikey960 hardware is v1, update *OpenPlatformPkg/Platforms/Hisilicon/HiKey960/HiKey960.dsc* first. *(optional)*
53
54
55

   .. code:: shell

56
       DEFINE SERIAL_BASE=0xFDF05000
57
58
59
60
61
62
63

   If your hikey960 hardware is v2 or newer, nothing to do.

-  Build it as debug mode. Create script file for build.

   .. code:: shell

64
65
       cd {BUILD_PATH}/arm-trusted-firmware
       sh ../l-loader/build_uefi.sh hikey960
66

Victor Chong's avatar
Victor Chong committed
67
-  Generate l-loader.bin and partition table.
68
69
70
71
   *Make sure that you're using the sgdisk in the l-loader directory.*

   .. code:: shell

Victor Chong's avatar
Victor Chong committed
72
73
       cd ${BUILD_PATH}/l-loader
       ln -sf ${EDK2_OUTPUT_DIR}/FV/bl1.bin
Haojian Zhuang's avatar
Haojian Zhuang committed
74
       ln -sf ${EDK2_OUTPUT_DIR}/FV/bl2.bin
Victor Chong's avatar
Victor Chong committed
75
76
77
       ln -sf ${EDK2_OUTPUT_DIR}/FV/fip.bin
       ln -sf ${EDK2_OUTPUT_DIR}/FV/BL33_AP_UEFI.fd
       make hikey960
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100

Setup Console
-------------

-  Install ser2net. Use telnet as the console since UEFI will output window
   that fails to display in minicom.

   .. code:: shell

       $sudo apt-get install ser2net

-  Configure ser2net.

   .. code:: shell

       $sudo vi /etc/ser2net.conf

   Append one line for serial-over-USB in *#ser2net.conf*

   ::

       2004:telnet:0:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner

Victor Chong's avatar
Victor Chong committed
101
102
103
104
105
106
107
-  Start ser2net

   .. code:: shell

       $sudo killall ser2net
       $sudo ser2net -u

108
109
110
111
112
113
114
115
116
117
118
119
120
121
-  Open the console.

   .. code:: shell

       $telnet localhost 2004

   And you could open the console remotely, too.

Boot UEFI in recovery mode
--------------------------

-  Fetch that are used in recovery mode. The code location is in below.
   `link <https://github.com/96boards-hikey/tools-images-hikey960>`__

Haojian Zhuang's avatar
Haojian Zhuang committed
122
-  Prepare recovery binary.
123
124
125
126
127

   .. code:: shell

       $cd tools-images-hikey960
       $ln -sf ${BUILD_PATH}/l-loader/l-loader.bin
Victor Chong's avatar
Victor Chong committed
128
       $ln -sf ${BUILD_PATH}/l-loader/fip.bin
Haojian Zhuang's avatar
Haojian Zhuang committed
129
       $ln -sf ${BUILD_PATH}/l-loader/recovery.bin
130
131
132
133
134
135
136

-  Prepare config file.

   .. code:: shell

       $vi config
       # The content of config file
Victor Chong's avatar
Victor Chong committed
137
       ./sec_usb_xloader.img 0x00020000
138
       ./sec_uce_boot.img 0x6A908000
Haojian Zhuang's avatar
Haojian Zhuang committed
139
       ./recovery.bin 0x1AC00000
140
141
142
143
144
145
146

-  Remove the modemmanager package. This package may causes hikey\_idt tool failure.

   .. code:: shell

       $sudo apt-get purge modemmanager

Haojian Zhuang's avatar
Haojian Zhuang committed
147
-  Run the command to download recovery.bin into HiKey960.
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179

   .. code:: shell

       $sudo ./hikey_idt -c config -p /dev/ttyUSB1

-  UEFI running in recovery mode.
   When prompt '.' is displayed on console, press hotkey 'f' in keyboard. Then Android fastboot app is running.
   The timeout of prompt '.' is 10 seconds.

-  Update images.

   .. code:: shell

       $sudo fastboot flash ptable prm_ptable.img
       $sudo fastboot flash xloader sec_xloader.img
       $sudo fastboot flash fastboot l-loader.bin
       $sudo fastboot flash fip fip.bin
       $sudo fastboot flash boot boot.img
       $sudo fastboot flash cache cache.img
       $sudo fastboot flash system system.img
       $sudo fastboot flash userdata userdata.img

-  Notice: UEFI could also boot kernel in recovery mode, but BL31 isn't loaded in
   recovery mode.

Boot UEFI in normal mode
------------------------

-  Make sure "Boot Mode" switch is OFF for normal boot mode. Then power on HiKey960.

-  Reference `link <https://github.com/96boards-hikey/tools-images-hikey960/blob/master/build-from-source/README-ATF-UEFI-build-from-source.md>`__

Paul Beesley's avatar
Paul Beesley committed
180
.. _link: https://www.96boards.org/documentation/consumer/hikey/hikey960