xref: /arm-trusted-firmware/docs/plat/hikey.rst (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1*91f16700SchasingluluHiKey
2*91f16700Schasinglulu=====
3*91f16700Schasinglulu
4*91f16700SchasingluluHiKey is one of 96boards. Hisilicon Kirin6220 processor is installed on HiKey.
5*91f16700Schasinglulu
6*91f16700SchasingluluMore information are listed in `link`_.
7*91f16700Schasinglulu
8*91f16700SchasingluluHow to build
9*91f16700Schasinglulu------------
10*91f16700Schasinglulu
11*91f16700SchasingluluCode Locations
12*91f16700Schasinglulu~~~~~~~~~~~~~~
13*91f16700Schasinglulu
14*91f16700Schasinglulu-  Trusted Firmware-A:
15*91f16700Schasinglulu   `link <https://github.com/ARM-software/arm-trusted-firmware>`__
16*91f16700Schasinglulu
17*91f16700Schasinglulu-  OP-TEE
18*91f16700Schasinglulu   `link <https://github.com/OP-TEE/optee_os>`__
19*91f16700Schasinglulu
20*91f16700Schasinglulu-  edk2:
21*91f16700Schasinglulu   `link <https://github.com/96boards-hikey/edk2/tree/testing/hikey960_v2.5>`__
22*91f16700Schasinglulu
23*91f16700Schasinglulu-  OpenPlatformPkg:
24*91f16700Schasinglulu   `link <https://github.com/96boards-hikey/OpenPlatformPkg/tree/testing/hikey960_v1.3.4>`__
25*91f16700Schasinglulu
26*91f16700Schasinglulu-  l-loader:
27*91f16700Schasinglulu   `link <https://github.com/96boards-hikey/l-loader/tree/testing/hikey960_v1.2>`__
28*91f16700Schasinglulu
29*91f16700Schasinglulu-  atf-fastboot:
30*91f16700Schasinglulu   `link <https://github.com/96boards-hikey/atf-fastboot/tree/master>`__
31*91f16700Schasinglulu
32*91f16700SchasingluluBuild Procedure
33*91f16700Schasinglulu~~~~~~~~~~~~~~~
34*91f16700Schasinglulu
35*91f16700Schasinglulu-  Fetch all the above repositories into local host.
36*91f16700Schasinglulu   Make all the repositories in the same ${BUILD\_PATH}.
37*91f16700Schasinglulu
38*91f16700Schasinglulu  .. code:: shell
39*91f16700Schasinglulu
40*91f16700Schasinglulu       git clone https://github.com/ARM-software/arm-trusted-firmware -b integration
41*91f16700Schasinglulu       git clone https://github.com/OP-TEE/optee_os
42*91f16700Schasinglulu       git clone https://github.com/96boards-hikey/edk2 -b testing/hikey960_v2.5
43*91f16700Schasinglulu       git clone https://github.com/96boards-hikey/OpenPlatformPkg -b testing/hikey960_v1.3.4
44*91f16700Schasinglulu       git clone https://github.com/96boards-hikey/l-loader -b testing/hikey960_v1.2
45*91f16700Schasinglulu       git clone https://github.com/96boards-hikey/atf-fastboot
46*91f16700Schasinglulu
47*91f16700Schasinglulu-  Create the symbol link to OpenPlatformPkg in edk2.
48*91f16700Schasinglulu
49*91f16700Schasinglulu   .. code:: shell
50*91f16700Schasinglulu
51*91f16700Schasinglulu       $cd ${BUILD_PATH}/edk2
52*91f16700Schasinglulu       $ln -sf ../OpenPlatformPkg
53*91f16700Schasinglulu
54*91f16700Schasinglulu-  Prepare AARCH64 && AARCH32 toolchain. Prepare python.
55*91f16700Schasinglulu
56*91f16700Schasinglulu-  If your hikey hardware is built by CircuitCo, update *OpenPlatformPkg/Platforms/Hisilicon/HiKey/HiKey.dsc* first. *(optional)*
57*91f16700Schasinglulu   console on hikey.**
58*91f16700Schasinglulu
59*91f16700Schasinglulu   .. code:: shell
60*91f16700Schasinglulu
61*91f16700Schasinglulu       DEFINE SERIAL_BASE=0xF8015000
62*91f16700Schasinglulu
63*91f16700Schasinglulu   If your hikey hardware is built by LeMaker, nothing to do.
64*91f16700Schasinglulu
65*91f16700Schasinglulu-  Build it as debug mode. Create your own build script file or you could refer to **build\_uefi.sh** in l-loader git repository.
66*91f16700Schasinglulu
67*91f16700Schasinglulu   .. code:: shell
68*91f16700Schasinglulu
69*91f16700Schasinglulu       cd {BUILD_PATH}/arm-trusted-firmware
70*91f16700Schasinglulu       sh ../l-loader/build_uefi.sh hikey
71*91f16700Schasinglulu
72*91f16700Schasinglulu-  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.
73*91f16700Schasinglulu
74*91f16700Schasinglulu   .. code:: shell
75*91f16700Schasinglulu
76*91f16700Schasinglulu       cd ${BUILD_PATH}/l-loader
77*91f16700Schasinglulu       ln -sf ${EDK2_OUTPUT_DIR}/FV/bl1.bin
78*91f16700Schasinglulu       ln -sf ${EDK2_OUTPUT_DIR}/FV/bl2.bin
79*91f16700Schasinglulu       ln -sf ${BUILD_PATH}/atf-fastboot/build/hikey/${FASTBOOT_BUILD_OPTION}/bl1.bin fastboot.bin
80*91f16700Schasinglulu       make hikey PTABLE_LST=aosp-8g
81*91f16700Schasinglulu
82*91f16700SchasingluluSetup Console
83*91f16700Schasinglulu-------------
84*91f16700Schasinglulu
85*91f16700Schasinglulu-  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.**
86*91f16700Schasinglulu
87*91f16700Schasinglulu   .. code:: shell
88*91f16700Schasinglulu
89*91f16700Schasinglulu       $sudo apt-get install ser2net
90*91f16700Schasinglulu
91*91f16700Schasinglulu-  Configure ser2net.
92*91f16700Schasinglulu
93*91f16700Schasinglulu   .. code:: shell
94*91f16700Schasinglulu
95*91f16700Schasinglulu       $sudo vi /etc/ser2net.conf
96*91f16700Schasinglulu
97*91f16700Schasinglulu   Append one line for serial-over-USB in below.
98*91f16700Schasinglulu   *#ser2net.conf*
99*91f16700Schasinglulu
100*91f16700Schasinglulu   .. code:: shell
101*91f16700Schasinglulu
102*91f16700Schasinglulu       2004:telnet:0:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner
103*91f16700Schasinglulu
104*91f16700Schasinglulu-  Start ser2net
105*91f16700Schasinglulu
106*91f16700Schasinglulu   .. code:: shell
107*91f16700Schasinglulu
108*91f16700Schasinglulu       $sudo killall ser2net
109*91f16700Schasinglulu       $sudo ser2net -u
110*91f16700Schasinglulu
111*91f16700Schasinglulu-  Open the console.
112*91f16700Schasinglulu
113*91f16700Schasinglulu   .. code:: shell
114*91f16700Schasinglulu
115*91f16700Schasinglulu       $telnet localhost 2004
116*91f16700Schasinglulu
117*91f16700Schasinglulu   And you could open the console remotely, too.
118*91f16700Schasinglulu
119*91f16700SchasingluluFlash images in recovery mode
120*91f16700Schasinglulu-----------------------------
121*91f16700Schasinglulu
122*91f16700Schasinglulu-  Make sure Pin3-Pin4 on J15 are connected for recovery mode. Then power on HiKey.
123*91f16700Schasinglulu
124*91f16700Schasinglulu-  Remove the modemmanager package. This package may cause the idt tool failure.
125*91f16700Schasinglulu
126*91f16700Schasinglulu   .. code:: shell
127*91f16700Schasinglulu
128*91f16700Schasinglulu       $sudo apt-get purge modemmanager
129*91f16700Schasinglulu
130*91f16700Schasinglulu-  Run the command to download recovery.bin into HiKey.
131*91f16700Schasinglulu
132*91f16700Schasinglulu   .. code:: shell
133*91f16700Schasinglulu
134*91f16700Schasinglulu       $sudo python hisi-idt.py -d /dev/ttyUSB1 --img1 recovery.bin
135*91f16700Schasinglulu
136*91f16700Schasinglulu-  Update images. All aosp or debian images could be fetched from `link <http://releases.linaro.org/96boards/>`__.
137*91f16700Schasinglulu
138*91f16700Schasinglulu   .. code:: shell
139*91f16700Schasinglulu
140*91f16700Schasinglulu       $sudo fastboot flash ptable prm_ptable.img
141*91f16700Schasinglulu       $sudo fastboot flash loader l-loader.bin
142*91f16700Schasinglulu       $sudo fastboot flash fastboot fip.bin
143*91f16700Schasinglulu       $sudo fastboot flash boot boot.img
144*91f16700Schasinglulu       $sudo fastboot flash cache cache.img
145*91f16700Schasinglulu       $sudo fastboot flash system system.img
146*91f16700Schasinglulu       $sudo  fastboot flash userdata userdata.img
147*91f16700Schasinglulu
148*91f16700SchasingluluBoot UEFI in normal mode
149*91f16700Schasinglulu------------------------
150*91f16700Schasinglulu
151*91f16700Schasinglulu-  Make sure Pin3-Pin4 on J15 are open for normal boot mode. Then power on HiKey.
152*91f16700Schasinglulu
153*91f16700Schasinglulu-  Reference `link <https://github.com/96boards-hikey/tools-images-hikey960/blob/master/build-from-source/README-ATF-UEFI-build-from-source.md>`__
154*91f16700Schasinglulu
155*91f16700Schasinglulu.. _link: https://www.96boards.org/documentation/consumer/hikey/
156