hikey.rst 5.15 KB
Newer Older
1
2
HiKey
=====
3
4
5
6
7
8

HiKey is one of 96boards. Hisilicon Kirin6220 processor is installed on HiKey.

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>`__

-  uefi-tools:
Victor Chong's avatar
Victor Chong committed
30
   `link <https://git.linaro.org/uefi/uefi-tools.git>`__
31
32
33
34
35

-  atf-fastboot:
   `link <https://github.com/96boards-hikey/atf-fastboot/tree/master>`__

Build Procedure
36
~~~~~~~~~~~~~~~
37
38
39
40

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

Victor Chong's avatar
Victor Chong committed
41
42
43
44
45
46
47
48
49
50
  .. 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
       git clone https://git.linaro.org/uefi/uefi-tools
       git clone https://github.com/96boards-hikey/atf-fastboot

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
-  Create the symbol link to OpenPlatformPkg in edk2.

   .. code:: shell

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

-  Prepare AARCH64 && AARCH32 toolchain. Prepare python.

-  If your hikey hardware is built by CircuitCo, update *uefi-tools/platform.config* first. *(optional)*
   **Uncomment the below sentence. Otherwise, UEFI can't output messages on serial
   console on hikey.**

   .. code:: shell

       BUILDFLAGS=-DSERIAL_BASE=0xF8015000

Andreas Färber's avatar
Andreas Färber committed
68
   If your hikey hardware is built by LeMaker, nothing to do.
69
70
71
72
73
74
75
76
77
78

-  Build it as debug mode. Create your own build script file or you could refer to **build\_uefi.sh** in l-loader git repository.

   .. code:: shell

       BUILD_OPTION=DEBUG
       export AARCH64_TOOLCHAIN=GCC5
       export UEFI_TOOLS_DIR=${BUILD_PATH}/uefi-tools
       export EDK2_DIR=${BUILD_PATH}/edk2
       EDK2_OUTPUT_DIR=${EDK2_DIR}/Build/HiKey/${BUILD_OPTION}_${AARCH64_TOOLCHAIN}
Dan Handley's avatar
Dan Handley committed
79
       # Build fastboot for Trusted Firmware-A. It's used for recovery mode.
80
81
82
83
84
       cd ${BUILD_PATH}/atf-fastboot
       CROSS_COMPILE=aarch64-linux-gnu- make PLAT=hikey DEBUG=1
       # Convert DEBUG/RELEASE to debug/release
       FASTBOOT_BUILD_OPTION=$(echo ${BUILD_OPTION} | tr '[A-Z]' '[a-z]')
       cd ${EDK2_DIR}
Dan Handley's avatar
Dan Handley committed
85
       # Build UEFI & Trusted Firmware-A
86
       ${UEFI_TOOLS_DIR}/uefi-build.sh -b ${BUILD_OPTION} -a ../arm-trusted-firmware -s ../optee_os hikey
87

Victor Chong's avatar
Victor Chong committed
88
-  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.
89
90
91

   .. code:: shell

Victor Chong's avatar
Victor Chong committed
92
93
       cd ${BUILD_PATH}/l-loader
       ln -sf ${EDK2_OUTPUT_DIR}/FV/bl1.bin
Haojian Zhuang's avatar
Haojian Zhuang committed
94
       ln -sf ${EDK2_OUTPUT_DIR}/FV/bl2.bin
Victor Chong's avatar
Victor Chong committed
95
96
       ln -sf ${BUILD_PATH}/atf-fastboot/build/hikey/${FASTBOOT_BUILD_OPTION}/bl1.bin fastboot.bin
       make hikey PTABLE_LST=aosp-8g
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119

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

-  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.**

   .. code:: shell

       $sudo apt-get install ser2net

-  Configure ser2net.

   .. code:: shell

       $sudo vi /etc/ser2net.conf

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

   .. code:: shell

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

Victor Chong's avatar
Victor Chong committed
120
121
122
123
124
125
126
-  Start ser2net

   .. code:: shell

       $sudo killall ser2net
       $sudo ser2net -u

127
128
129
130
131
132
133
134
-  Open the console.

   .. code:: shell

       $telnet localhost 2004

   And you could open the console remotely, too.

Victor Chong's avatar
Victor Chong committed
135
Flash images in recovery mode
136
137
138
139
140
141
142
143
144
145
-----------------------------

-  Make sure Pin3-Pin4 on J15 are connected for recovery mode. Then power on HiKey.

-  Remove the modemmanager package. This package may cause the idt tool failure.

   .. code:: shell

       $sudo apt-get purge modemmanager

Haojian Zhuang's avatar
Haojian Zhuang committed
146
-  Run the command to download recovery.bin into HiKey.
147
148
149

   .. code:: shell

Haojian Zhuang's avatar
Haojian Zhuang committed
150
       $sudo python hisi-idt.py -d /dev/ttyUSB1 --img1 recovery.bin
151

Paul Beesley's avatar
Paul Beesley committed
152
-  Update images. All aosp or debian images could be fetched from `link <http://releases.linaro.org/96boards/>`__.
153
154
155
156

   .. code:: shell

       $sudo fastboot flash ptable prm_ptable.img
Haojian Zhuang's avatar
Haojian Zhuang committed
157
       $sudo fastboot flash loader l-loader.bin
158
159
160
161
162
163
164
165
166
167
168
169
170
       $sudo fastboot flash fastboot 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

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

-  Make sure Pin3-Pin4 on J15 are open for normal boot mode. Then power on HiKey.

-  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
171
.. _link: https://www.96boards.org/documentation/consumer/hikey/