Adds Ubuntu version
[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 version of
55 Ubuntu we used is "Ubuntu 16.04.2 LTS (GNU/Linux 4.4.55 aarch64)". The link that
56 you will find useful and will follow is this link:
57 http://en.t-firefly.com/doc/product/info/id/291.html.  Just in case, we made
58 local copies of the instructions in "BuildUbuntuRootFS/291.html" &
59 "BuildUbuntuRootFS/334.html"
60
61 A few caveats:
62 a. Try to give the root system 4GBs of space.
63
64 b. It will be good to set up the following config/softwares when you create the
65 Ubuntu file system:
66   /etc/network/interfaces  -> IP, etc
67   /etc/hostname -> dw-*, etc
68   /etc/fstab  -> If mounted with external hard drive
69
70 c. It's also good to install the following necessary applications on the host
71 machine. It's a lot faster than installing them on the board natively.
72
73   sudo apt install vim git cmake libtool software-properties-common autoconf \
74       libboost-all-dev \
75       libevent-dev \
76       libdouble-conversion-dev \
77       libiberty-dev \
78       liblz4-dev \
79       liblzma-dev \
80       libsnappy-dev \
81       zlib1g-dev \
82       binutils-dev \
83       libjemalloc-dev \
84       libssl-dev \
85       pkg-config
86
87   sudo add-apt-repository universe
88   sudo apt update
89   sudo apt upgrade
90
91 4. Use upgrade_tool to ONLY burn the kernel.img, resource.img (generated in step
92 2), and rootfs.img (generated in step 3).
93 Useful local copy of instruction can be found in "FlashImage/310.html".
94
95 5. Restart the board and all should be good.