Adds documentation about how to rebuild the kernel and Ubuntu filesystem to Firefly...
[FireflyDocs.git] / update_system.txt
1 This file will talk about how we can update the kernel image on the Firefly
2 RK3399 boards. The easiest thing would be to download the existing unified
3 firmware image and then just burn that to the board, which you can easily find
4 useful information on the Firefly official documents. The following shows the
5 links to the unified firmware images:
6
7 Download the unified Firmware image from
8 http://en.t-firefly.com/doc/download/3.html. Try Google Drive
9 https://drive.google.com/drive/folders/0B7HO8lbGgAqAdXBsaG9NMEl5bm8 for Ubuntu
10 16.04.
11
12 The unfortunate part is that we used the Linux kernel 4.4.55, which is a
13 slightly older version than the Firefly official website has, so we need to
14 rebuild the kernel with the right version and then burn it to the board. The
15 following steps show how you can do it:
16
17 1. Burn the unified Ubuntu firmware image that you can download with the
18 previously mentioned links. To burn that to the board, you need to use the
19 "upgrade_tool" (http://en.t-firefly.com/doc/product/info/263.html). Note that we
20 need to enter Loader mode first --- plug the type-C cable to the host machine,
21 and enter Loader mode (http://en.t-firefly.com/doc/product/info/265.html). You
22 can also see the html file "BootMode/265.html".
23
24 2. Build the Firefly RK3399 kernel, which generates the kernel.img &
25 resource.img (http://en.t-firefly.com/doc/product/info/id/290.html). The kernel
26 git repo is at
27 https://gitlab.com/TeeFirefly/linux-kernel/tree/firefly_0821_release.
28 We use kernel 4.4.55. Specifically, we build the kernel with the follwing
29 commit:
30
31 * 70b6d4f (HEAD -> 4.4.55, tag: firefly_0821_release)(1 year, 3 months ago)
32     account@t-firefly.com ARM64: DTS: Add rk3399-firefly uart4 device, node as /dev/ttyS1
33
34 To do that, do the following in command line (don't forget to install the
35 AArch64 cross compile environment on your host machine first):
36
37   git clone https://gitlab.com/TeeFirefly/linux-kernel/tree/firefly_0821_release
38   git reset --hard 70b6d4f
39   export ARCH=arm64
40   export CROSS_COMPILE=aarch64-linux-gnu-
41   make firefly_linux_defconfig
42   make rk3399-firefly-linux.img -j4
43
44 You will find the generated kernel.img & resource.img files after the
45 compilation.
46
47
48 3. Create an Ubuntu root filesystem. The point of this step is to create a file
49 called "rootfs.img" that is the ubuntu file system. You will need to burn this
50 file system along with the kernel to the board in later steps. The link that you
51 will find useful and will follow is this link:
52 http://en.t-firefly.com/doc/product/info/id/291.html.
53 Just in case, we made local copies of the instructions in
54 "BuildUbuntuRootFS/291.html" & "BuildUbuntuRootFS/334.html"
55
56 A few caveats:
57 a. Try to give the root system 4GBs of space.
58
59 b. It will be good to set up the following config/softwares when you create the
60 Ubuntu file system:
61   /etc/network/interfaces  -> IP, etc
62   /etc/hostname -> dw-*, etc
63   /etc/fstab  -> If mounted with external hard drive
64
65 c. It's also good to install the following necessary applications on the host
66 machine. It's a lot faster than installing them on the board natively.
67
68   sudo apt install vim git cmake libtool software-properties-common autoconf \
69       libboost-all-dev \
70       libevent-dev \
71       libdouble-conversion-dev \
72       libiberty-dev \
73       liblz4-dev \
74       liblzma-dev \
75       libsnappy-dev \
76       zlib1g-dev \
77       binutils-dev \
78       libjemalloc-dev \
79       libssl-dev \
80       pkg-config
81
82   sudo add-apt-repository universe
83   sudo apt update
84   sudo apt upgrade
85
86 4. Use upgrade_tool to ONLY burn the kernel.img, resource.img, and rootfs.img.
87 Useful local copy of instruction can be found in "FlashImage/310.html".
88
89 5. Restart the board and all should be good.