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