From: Peizhao Ou Date: Tue, 20 Nov 2018 00:54:32 +0000 (-0800) Subject: Adds documentation about how to rebuild the kernel and Ubuntu filesystem to Firefly... X-Git-Url: http://plrg.eecs.uci.edu/git/?p=FireflyDocs.git;a=commitdiff_plain;h=6cdb03350404b2001dea487f593d9133582cd783 Adds documentation about how to rebuild the kernel and Ubuntu filesystem to Firefly RK3399 boards --- 6cdb03350404b2001dea487f593d9133582cd783 diff --git a/BootMode/265.html b/BootMode/265.html new file mode 100644 index 0000000..a5e868e --- /dev/null +++ b/BootMode/265.html @@ -0,0 +1,3167 @@ + + + + + Firefly | Make technology more simple , Make life more intellingent. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+ + + + + +
+
+ + + + + + + + + +
+
+ + + + +
+
+ +
+
+ + + +
+ +
+ +
+ +
+ + +
+ +
+
+

+ Firefly-RK3399 + Six-Core 64-Bit Platform + Buy + Spec

+

Equipped with a six-core 64-bit "server class" processor Rockchip RK3399, and with 2GB/4GB DDR3 and 16G/32GB eMMC, as well as increases PCIe 2.1 M.2, DP 1.2, Type-C, USB3.0 and other high-performance data transmission and display interface.

+
+
+ +
+
+

Boot Mode

+

+ Update time:2018-01-29 + Views:2750 + +

+
+
+
+

Introduction

+

RK3399 has flexible boot modes. Under normal circumstances, unless hardware is damaged, Firefly-RK3399 development board will never become brick (brick means not able to boot or flash).

+

If accident happens during upgrading firmware, bootloader is broken, making it impossible to upgrade again. The device can enter into MaskRom mode as the last resort.

+

Load Methods

+

RK3399 has 32KB BootRom and 200KB internal SRAM, which supports booting from following devices:

+
    +
  • SPI

  • +
  • eMMC

  • +
  • SDMMC

  • +
+

That is to say, besides Nand, SPI and eMMC flash, RK3288 also supports booting from SD card.

+

Moreover, RK3399 can download system code from USB Type-C.

+

Boot Sequence

+

The boot sequence is:

+
    +
  1. Soc powers up and initializes.

  2. +
  3. BootRom code runs in SRAM, loads and verifies bootloader's bootstrap code from storage device.

  4. +
  5. If the verification passes, run the bootloader bootstrap code.

  6. +
  7. The bootloader initializes DDR RAM, loads the complete bootloader into DDR RAM and runs it.

  8. +
  9. Bootloader loads Linux kernel from storage device, then executes it.

  10. +
  11. Linux kernel takes control of everything now.

  12. +
+

Boot Mode

+

RK3399 has three boot modes:

+
    +
  • Normal mode

  • +
  • Loader mode

  • +
  • MaskRom mode

  • +
+

Normal Mode

+

Normal mode, that is the normal boot procedure, load every components subsequently, and boot into operation system normally.

+

Loader Mode

+

In Loader mode, bootloader will enter into upgrade state, waiting for commands from host, which is used in firmware upgrading.

+

To enter Loader mode, make the bootloader aware that the RECOVERY key is pressed and USB cable is connected:

+
    +
  1. Keep device power on.

  2. +
  3. Use micro USB Type-C cable to connect host and device together.

  4. +
  5. Press and hold RECOVERY key.

  6. +
  7. Shortly press RESET key.

  8. +
  9. Release RECOVERY key.

  10. +
  11. Note:If device still can not be found after pressing "RESET", then try this: long press "PWRKEY" after short pressing of "RESET", before finally releasing "RECOVERY".

  12. +
+

MaskRom Mode

+

MaskRom mode is used to fix system when bootloader is broken.

+

In most cases, there are no need to enter MaskRom mode. When the BootRom code fails to verify bootloader (cannot read IDR block, or bootloader is broken), it will boot into MaskRom mode, which waits for host to send bootloader code through USB, then runs it, so that bootload can take control again.

+

To enforce device into MaskRom mode, please check this.

+ +
+ + + +
+
+
+
+
+ + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BuildUbuntuRootFS/291.html b/BuildUbuntuRootFS/291.html new file mode 100644 index 0000000..5953966 --- /dev/null +++ b/BuildUbuntuRootFS/291.html @@ -0,0 +1,3171 @@ + + + + + Firefly | Make technology more simple , Make life more intellingent. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+ + + + + +
+
+ + + + + + + + + +
+
+ + + + +
+
+ +
+
+ + + +
+ +
+ +
+ +
+ + +
+ +
+
+

+ Firefly-RK3399 + Six-Core 64-Bit Platform + Buy + Spec

+

Equipped with a six-core 64-bit "server class" processor Rockchip RK3399, and with 2GB/4GB DDR3 and 16G/32GB eMMC, as well as increases PCIe 2.1 M.2, DP 1.2, Type-C, USB3.0 and other high-performance data transmission and display interface.

+
+
+ +
+
+

Build Ubuntu Rfs

+

+ Update time:2018-04-13 + Views:2151 + +

+
+
+
+

Before You Start
+

+

install qemu

+

intall qemu in your computer

+
sudo apt-get install qemu-user-static
+

Download & Decompression the ubuntu-core

+

Firefly-rk3399 create the root-file-system by the Ubuntu base 16.04. You can download from here ubuntu cdimg download. please choose this one : ubuntu-base-16.04.1-base-arm64.tar.gz 。

+

after download,create a temporary folder for decompression.

+
 mkdir temp
+sudo tar -xpf ubuntu-base-16.04.1-base-arm64.tar.gz -C temp
+

Optimized the rootfs

+

Preparations

+

get your network readyː

+
 sudo cp -b /etc/resolv.conf temp/etc/resolv.conf
+

prepare qemu

+
 sudo cp /usr/bin/qemu-aarch64-static temp/usr/bin/
+

Change root

+
 sudo chroot temp
+

update & install

+

update:

+
 apt update
+apt upgrade
+

install you need

+
 apt install vim git...(something you like)
+

install xubuntu

+
 apt install xubuntu-desktop
+

user & password

+
 useradd -s '/bin/bash' -m -G adm,sudo firefly
+

set user's password

+
 passwd firefly
+

set the root user's password

+
 passwd root
+

After all the work is done,exit

+
 exit
+

make the rootfs

+

make the rootfs,notice that you need change the "count" value according to the size of the "temp" folder.

+
 dd if=/dev/zero of=linuxroot.img bs=1M count=2048
+sudo  mkfs.ext4  linuxroot.img
+mkdir  rootfs
+sudo mount linuxroot.img rootfs/
+sudo cp -rfp temp/*  rootfs/
+sudo umount rootfs/
+e2fsck -p -f linuxroot.img
+resize2fs  -M linuxroot.img
+

The final root filesystem linuxroot.img is ready to serve.

+

Something more

+

when the system is ready, remember resize the rootfs partition by

+
 resize2fs /dev/mtd/by-name/linuxroot
+ +
+ + + +
+
+
+
+
+ + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BuildUbuntuRootFS/334.html b/BuildUbuntuRootFS/334.html new file mode 100644 index 0000000..fbaa722 --- /dev/null +++ b/BuildUbuntuRootFS/334.html @@ -0,0 +1,3707 @@ + + + + + Firefly | 让科技更简单,让生活更智能 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + + + + +
+
+ + + + + + + + + + +
+
+ + + + + +
+ +
+ + +
+ +
+
+

+ AIO-3399J + 六核64位高性能主板 + 立即购买 产品规格书

+

采用RK3399六核(A72x2+A53x4)64位处理器,主频高达2.0GHz,集成四核Mali-T864 GPU,性能优异。板载M.2 PCIe 、4G LTE扩展接口、多种显示接口和通信串口。支持Android/Linux/Ubuntu系统,开放源代码方便企业二次开发。AIO-3399J的高性能、高可靠性、高扩展性,多系统等优势,让其可以快速应用于各种行业中。

+
+ + +
+ +
+
+

创建 Ubuntu 根文件系统

+

+ 更新时间:2017-12-18 + 阅读:6673 + +

+
+
+
+

准备工作

+

安装qemu

+

在Linux PC主机上安装模拟器:

+
sudo apt-get install qemu-user-static
+

下载和解压 ubuntu-core

+

Firefly-rk3399 ubuntu根文件系统是基于Ubuntu base 16.04来创建的。用户可以到ubuntu cdimg 下载,选择下载ubuntu-base-16.04.1-base-arm64.tar.gz 。

+

下载完之后,创建临时文件夹并解压根文件系统:

+
mkdir temp
+sudo tar -xpf ubuntu-base-16.04.1-base-arm64.tar.gz -C temp
+

修改根文件系统

+

准备工作

+

准备网络:

+
sudo cp -b /etc/resolv.conf temp/etc/resolv.conf
+

准备qemu

+
sudo cp /usr/bin/qemu-aarch64-static temp/usr/bin/
+

进入根文件系统进行操作:

+
sudo chroot temp
+

更新及安装

+

更新:

+
apt update 
+apt upgrade
+

安装自己需要的功能

+
apt install vim git ....(根据自己需求添加)
+

安装xubuntu

+
apt install xubuntu-desktop
+

添加用户及设置密码

+

添加用户

+
useradd -s '/bin/bash' -m -G adm,sudo firefly
+

给用户设置密码:

+
passwd firefly
+

给root用户设置密码:

+
passwd root
+

修改完自己的根文件系统就可以退出了。

+
exit
+

制作根文件系统

+

制作自己的根文件系统,大小依据自己的根文件系统而定,注意依据temp文件夹的大小来修改count值

+
dd if=/dev/zero of=linuxroot.img bs=1M count=2048
+sudo  mkfs.ext4  linuxroot.img
+mkdir  rootfs
+sudo mount linuxroot.img rootfs/
+sudo cp -rfp temp/*  rootfs/
+sudo umount rootfs/
+e2fsck -p -f linuxroot.img
+resize2fs  -M linuxroot.img
+

这样 linuxroot.img 就是最终的根文件系统映像文件了。

+

FAQs

+

Q1:根文件系统加载后,大小不正常,未占满整个分区:

+

A1:在系统正确加载后执行扩展文件系统命令:

+
 resize2fs /dev/mtd/by-name/linuxroot
+ +
+ + + +
+
+
+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FlashImage/310.html b/FlashImage/310.html new file mode 100644 index 0000000..5865350 --- /dev/null +++ b/FlashImage/310.html @@ -0,0 +1,3802 @@ + + + + + Firefly | 让科技更简单,让生活更智能 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + + + + +
+
+ + + + + + + + + + +
+
+ + + + + +
+ +
+ + +
+ +
+
+

+ AIO-3399J + 六核64位高性能主板 + 立即购买 产品规格书

+

采用RK3399六核(A72x2+A53x4)64位处理器,主频高达2.0GHz,集成四核Mali-T864 GPU,性能优异。板载M.2 PCIe 、4G LTE扩展接口、多种显示接口和通信串口。支持Android/Linux/Ubuntu系统,开放源代码方便企业二次开发。AIO-3399J的高性能、高可靠性、高扩展性,多系统等优势,让其可以快速应用于各种行业中。

+
+ + +
+ +
+
+

升级固件

+

+ 更新时间:2018-03-05 + 阅读:11568 + +

+
+
+ +

前言

+

本文介绍了如何将主机上的固件文件,通过双公头USB数据线烧录到开发板的闪存中。 +升级时,需要根据主机操作系统和固件类型来选择合适的升级方式。

+

准备工作

+
    +
  • AIO-3399J一体机

  • +
  • 固件

  • +
  • 主机

  • +
  • 双公头USB数据线

  • +
+

固件文件一般有两种:

+
    +
  • 单个统一固件 update.img, 将启动加载器、参数和所有分区镜像都打包到一起,用于固件发布。

  • +
  • 多个分区镜像,如 kernel.img, boot.img, recovery.img 等,在开发阶段生成。

  • +
+

这里可以找到已编译好的统一固件,下载后解压。也可以参考编译固件的说明自行编译。

+

主机操作系统支持:

+
    +
  • Windows XP (32/64位)

  • +
  • Windows 7 (32/64位)

  • +
  • Windows 8 (32/64位)

  • +
  • Linux (32/64位)

  • +
+


+

Windows

+

之前烧写 RK 的固件,需要用到以下两种工具:

+
    +
  • 量产工具 RKBatchTool,用于烧写统一固件(update.img)

  • +
  • 开发者工具 RKDevelopTool,可单独烧写分区固件

  • +
+

后来 RK 发布了 AndroidTool 工具,在 RKDevelopTool 的基础上增加了统一固件(update.img)的烧写支持,因此现在仅需要这个工具即可。

+

使用烧写工具前需要安装 RK USB 驱动。如果驱动已经安装好,可以跳过这步。

+

安装 RK USB 驱动

+

下载 Release_DriverAssistant.zip ,解压,然后运行里面的 DriverInstall.exe 。

+

为了所有设备都使用更新的驱动,请先选择"驱动卸载",然后再选择"驱动安装"。

+

安装驱动

+

连接设备

+

AIO-3399J 一体机

+

有两种方法可以使设备进入升级模式

+
  • 一种方法是设备先断开电源适配器和双公头USB数据线的连接:

+
    +
  1. 1.USB数据线一端连接主机,一端连接开发板

  2. +
  3. 2.量产版:连接双层USB3.0上层口 / 工程样机:连接双层USB3.0下层口。

  4. +
  5. 3.按住设备上的 RECOVERY (恢复)键并保持。

  6. +
  7. 4.接上电源

  8. +
  9. 5.大约两秒钟后,松开 RECOVERY 键。

  10. +
+
  • 另一种方法,无需断开电源适配器和双公头USB数据线的连接:

+
    +
  1. 1.USB数据线一端连接主机,一端连接开发板。

  2. +
  3. 2.量产版:连接双层USB3.0上层口 / 工程样机:连接双层USB3.0下层口。

  4. +
  5. 3.按住设备上的 RECOVERY (恢复)键并保持。

  6. +
  7. 4.短按一下 RESET(复位)键。

  8. +
  9. 5.大约两秒钟后,松开 RECOVERY 键

  10. +
+

连接方法如图示

+

3399J-otg.JPG

+

主机应该会提示发现新硬件并配置驱动。打开设备管理器,会见到新设备"Rockusb Device" 出现,如下图。如果没有,则需要返回上一步重新安装驱动。

+

资源管理器

+

烧写固件

+

在SDK中的FFTools/AndroidTool/AndroidTool.rar获取最新版本或者直接下载 AndroidTool,解压,运行 AndroidTool_Release_v2.38 目录里面的 AndroidTool.exe(注意,如果是 Windows 7/8,需要按鼠标右键,选择以管理员身份运行),如下图:

+

AndroidTool

+

烧写统一固件 update.img

+

烧写统一固件 update.img 的步骤如下:

+
    +
  1. 切换至"升级固件"页。

  2. +
  3. 按"固件"按钮,打开要升级的固件文件。升级工具会显示详细的固件信息。

  4. +
  5. 按"升级"按钮开始升级。

  6. +
  7. 如果升级失败,可以尝试先按"擦除Flash"按钮来擦除 Flash,然后再升级。

  8. +
+

注意:如果你烧写的固件laoder版本与原来的机器的不一致,请在升级固件前先执行"擦除Flash"。

+

Android_Tool_burn

+

烧写分区映像

+

烧写分区映像的步骤如下:

+
    +
  1. 切换至"下载镜像"页。

  2. +
  3. 勾选需要烧录的分区,可以多选。

  4. +
  5. 确保映像文件的路径正确,需要的话,点路径右边的空白表格单元格来重新选择。

  6. +
  7. 点击"执行"按钮开始升级,升级结束后设备会自动重启。

  8. +
+

烧写分区

+

Linux

+

RK 提供了一个 Linux 下的命令行工具 upgrade_tool,支持统一固件 update.img 和分区镜像的烧写。

+

开源工具则有两个选择:

+ +

它们都仅支持分区映像烧写,不支持统一固件。rkflashtool 是命令行工具,rkflashkit 有图形界面,后加了命令行支持,更是好用。以下仅对 rkflashkit 做介绍。

+

Linux 下无须安装设备驱动,参照 连接设备 则可。

+

upgrade_tool

+

在SDK中的RKTools/linux/Linux_Upgrade_Tool/获取最新版本或者下载 Linux_Upgrade_Tool, 并按以下方法安装到系统中,方便调用:

+
   unzip Linux_Upgrade_Tool_v1.24.zip
+   cd Linux_Upgrade_Tool_v1.24/
+   sudo mv upgrade_tool /usr/local/bin
+   sudo chown root:root /usr/local/bin/upgrade_tool
+

注意:如果提示以下错误:

+
   upgrade_tool: error while loading shared libraries: libudev.so.1: cannot open shared object file: No such file or directory
+

ubuntu 下可使用下面命令解决:

+
   sudo ln -sf /lib/i386-linux-gnu/libudev.so.0 /lib/i386-linux-gnu/libudev.so.1
+

烧写统一固件 update.img:

+
   sudo upgrade_tool uf update.img
+

烧写分区镜像:

+
   sudo upgrade_tool di -b /path/to/boot.img
+   sudo upgrade_tool di -k /path/to/kernel.img
+   sudo upgrade_tool di -s /path/to/system.img
+   sudo upgrade_tool di -r /path/to/recovery.img
+   sudo upgrade_tool di -m /path/to/misc.img
+   sudo upgrade_tool di resource /path/to/resource.img
+   sudo upgrade_tool di -p paramater   #烧写 parameter
+   sudo upgrade_tool ul bootloader.bin # 烧写 bootloader
+   sudo upgrade_tool di trust /path/to/trust.img #烧写 trust
+

如果因 flash 问题导致升级时出错,可以尝试低级格式化、擦除 flash:

+
   sudo upgrade_tool lf   # 低级格式化
+   sudo upgrade_tool ef   # 擦除
+

rkflashkit

+

安装:

+
   sudo apt-get install build-essential fakeroot 
+   git clone https://github.com/linuxerwang/rkflashkit
+   cd rkflashkit
+   ./waf debian
+   sudo apt-get install python-gtk2
+   sudo dpkg -i rkflashkit_0.1.4_all.deb
+
  • 图形界面:

+
   sudo rkflashkit
+

rkflashkit

+
  • 命令行:

+
$ rkflashkit --help
+Usage:  [args] [ [args]...]
+
+part                              List partition
+flash @    Flash partition with image file
+cmp @      Compare partition with image file
+backup @   Backup partition to image file
+erase  @               Erase partition
+reboot                            Reboot device
+
+For example, flash device with boot.img and kernel.img, then reboot:
+
+sudo rkflashkit flash @boot boot.img @kernel.img kernel.img reboot
+

帮助信息里有使用示例,可以看出,一条命令就可以烧写多个映像文件并重启设备,对需要经常编译和烧写内核的开发者来说,是一大福音。

+

FAQs

+

Q1: 如何强行进入 MaskRom 模式?

+

A1: 如果板子进入不了 Loader 模式,此时可以尝试强行进入 MaskRom 模式。操作方法见《如何进入 MaskRom 模式》。

+

+
+ + + +
+
+
+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/update_system.txt b/update_system.txt new file mode 100644 index 0000000..9326bfd --- /dev/null +++ b/update_system.txt @@ -0,0 +1,89 @@ +This file will talk about how we can update the kernel image on the Firefly +RK3399 boards. The easiest thing would be to download the existing unified +firmware image and then just burn that to the board, which you can easily find +useful information on the Firefly official documents. The following shows the +links to the unified firmware images: + +Download the unified Firmware image from +http://en.t-firefly.com/doc/download/3.html. Try Google Drive +https://drive.google.com/drive/folders/0B7HO8lbGgAqAdXBsaG9NMEl5bm8 for Ubuntu +16.04. + +The unfortunate part is that we used the Linux kernel 4.4.55, which is a +slightly older version than the Firefly official website has, so we need to +rebuild the kernel with the right version and then burn it to the board. The +following steps show how you can do it: + +1. Burn the unified Ubuntu firmware image that you can download with the +previously mentioned links. To burn that to the board, you need to use the +"upgrade_tool" (http://en.t-firefly.com/doc/product/info/263.html). Note that we +need to enter Loader mode first --- plug the type-C cable to the host machine, +and enter Loader mode (http://en.t-firefly.com/doc/product/info/265.html). You +can also see the html file "BootMode/265.html". + +2. Build the Firefly RK3399 kernel, which generates the kernel.img & +resource.img (http://en.t-firefly.com/doc/product/info/id/290.html). The kernel +git repo is at +https://gitlab.com/TeeFirefly/linux-kernel/tree/firefly_0821_release. +We use kernel 4.4.55. Specifically, we build the kernel with the follwing +commit: + +* 70b6d4f (HEAD -> 4.4.55, tag: firefly_0821_release)(1 year, 3 months ago) + account@t-firefly.com ARM64: DTS: Add rk3399-firefly uart4 device, node as /dev/ttyS1 + +To do that, do the following in command line (don't forget to install the +AArch64 cross compile environment on your host machine first): + + git clone https://gitlab.com/TeeFirefly/linux-kernel/tree/firefly_0821_release + git reset --hard 70b6d4f + export ARCH=arm64 + export CROSS_COMPILE=aarch64-linux-gnu- + make firefly_linux_defconfig + make rk3399-firefly-linux.img -j4 + +You will find the generated kernel.img & resource.img files after the +compilation. + + +3. Create an Ubuntu root filesystem. The point of this step is to create a file +called "rootfs.img" that is the ubuntu file system. You will need to burn this +file system along with the kernel to the board in later steps. The link that you +will find useful and will follow is this link: +http://en.t-firefly.com/doc/product/info/id/291.html. +Just in case, we made local copies of the instructions in +"BuildUbuntuRootFS/291.html" & "BuildUbuntuRootFS/334.html" + +A few caveats: +a. Try to give the root system 4GBs of space. + +b. It will be good to set up the following config/softwares when you create the +Ubuntu file system: + /etc/network/interfaces -> IP, etc + /etc/hostname -> dw-*, etc + /etc/fstab -> If mounted with external hard drive + +c. It's also good to install the following necessary applications on the host +machine. It's a lot faster than installing them on the board natively. + + sudo apt install vim git cmake libtool software-properties-common autoconf \ + libboost-all-dev \ + libevent-dev \ + libdouble-conversion-dev \ + libiberty-dev \ + liblz4-dev \ + liblzma-dev \ + libsnappy-dev \ + zlib1g-dev \ + binutils-dev \ + libjemalloc-dev \ + libssl-dev \ + pkg-config + + sudo add-apt-repository universe + sudo apt update + sudo apt upgrade + +4. Use upgrade_tool to ONLY burn the kernel.img, resource.img, and rootfs.img. +Useful local copy of instruction can be found in "FlashImage/310.html". + +5. Restart the board and all should be good.