-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
139 lines (88 loc) · 3.56 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
Hikey Snappy 16 Guide
Prepare enviroment
------------------
install ubuntu xenial 16.04 and install below packages:
$ apt-get install snapcraft parted kpartx \
dosfstools squashfs-tools android-tools-fsutils \
gcc-aarch64-linux-gnu
Get source of hikey snaps
-------------------------
- Export PATH to build snappy image
$ export SNAPPY_PATH=/path/snap
- Get hikey meta:
$ cd $SNAPPY_PATH
$ git clone git//github.com/LeMaker-HiKey/hikey_snappy_meta.git
- Get hikey kernel snap:
$ cd $SNAPPY_PATH
$ git clone git//github.com/LeMaker-HiKey/hikey_linux.git
- Get hikey gadget snap:
$ cd $SNAPPY_PATH
$ git clone git//github.com/LeMaker-HiKey/hikey_gadget_snap.git
Build and install u-boot to hikey
---------------------------------
Because snappy only supports u-boot on arm platform, but hikey now uses UEFI as its default
bootloader, we have to switch hikey to u-boot.
- Get mainline u-boot source:
$ cd $SNAPPY_PATH
$ git clone git//github.com/LeMaker-HiKey/hikey_u-boot.git u-boot
$ cd u-boot
$ git checkout -b hikey_snappy.test origin/hikey_snappy
- Get other source code:
$ cd $SNAPPY_PATH
$ git clone https://github.com/96boards/edk2.git
$ git clone https://github.com/96boards/arm-trusted-firmware.git
$ git clone https://github.com/96boards/burn-boot.git
$ git clone git://github.com/96boards/l-loader.git
And follow u-boot/board/hisilicon/hikey/README to compile and burn to hikey board.
Note: before generate l-load.bin. please modify generate_ptable.sh, replace "system" with
"writable" in the following line.
sgdisk -n -E -t 9:8300 -u 9:FC56E345-2E8E-49AE-B2F8-5B9D263FE377 -c 9:"system" ${TEMP_FILE}
After all are done successfully, we have a hikey board running u-boot.
Build hikey kernel snap
-----------------------
- Build the kernel snap:
$ cd $SNAPPY_PATH
$ cd hikey_linux
$ git checkout -b snappy_v4.4 origin/snappy_v4.4
$ snapcraft --target-arch arm64 snap
$ ls hikey-kernel_4.4.0_arm64.snap
$ cp hikey-kernel_4.4.0_arm64.snap ../
Build hikey gadget snap
-----------------------
- Build the gadget snap:
$ cd $SNAPPY_PATH
$ rm -rf hikey_gadget_snap/.git
$ snapcraft snap hikey_gadget_snap
If we want to change uboot.env, please use mkenvimage to re-generate uboot.env
after modify hikey_gadget_snap/uboot.env.in:
$ ./u-boot/tools/mkenvimage -s 0x20000 -o hikey_gadget_snap/uboot.env \
-r hikey_gadget_snap/uboot.env.in
Build snappy image
------------------
$ cd $SNAPPY_PATH
$ sudo ./hikey_meta_github/ubuntu-device-flash core 16 --developer-mode --channel edge \
--os ubuntu-core --kernel ./hikey-kernel_4.4.0_arm64.snap \
--gadget ./hikey-snappy-gadget_0.1_arm64.snap -o hikey-snappy.img
Burn snappy image to SD card
----------------------------
Insert a sd card to PC linux and burn snappy image to SD card:
$ sudo dd if=hikey-snappy.img of=/dev/sdx bs=32M
Please replace /dev/sdx with your SD card device file.
Burn snappy rootfs to EMMC FLASH
--------------------------------
- Generate writable image from snappy image:
$ cd $SNAPPY_PATH
$ mkdir writable
$ sudo kpartx -av hikey-snappy.img
$ sudo mount /dev/mapper/loop0p2 writable
$ sudo make_ext4fs -L writable -l 1500M -s writable.img writable/
$ sudo umount writable
$ sudo kpartx -d hikey-snappy.img
Note:
1. loop0p2 is the loop device of the second partition of hikey-snappy.img, it should
be replaced with your loop device of kpartx mapping.
- Burn writable image to EMMC FLASH:
$ cd $SNAPPY_PATH
$ sudo ./burn-boot/hisi-idt.py -d /dev/ttyUSB1 --img1=l-loader/l-loader.bin
$ sudo fastboot flash ptable l-loader/ptable-linux-8g.img
$ sudo fastboot flash writable writable.img