Flash Image
Update time:2018-11-14 Views:25634
Introduction
This page describes how to flash the image file from the host to the development board's eMMC, via the Type-C cable or USB OTG + Type-C adapter(Hereinafter referred as Type-C).
Please choose the right way according to the host OS and the type of image file .
Before Start
What you need:
Firefly RK3399 development board / AIO-3399J MainBoard
Image file
Host PC
Type-C Cable / Dual male usb data cable
There are two types of image file:
Packed image, often known as update.img, which contains the bootloader, parameter and all the partition image files. It is used for firmware release.
Non-packed image, like kernel.img, boot.img, recovery.img, etc, which are created during development.
You can download firmwares on compiled update.img, uncompress them after download. Or you can compile firmware by yourself according to Build Android .
Supported host OS:
Windows XP (32/64bit
Windows 7 (32/64bit)
Windows 8 (32/64bit)
Linux (32/64bit)
Windows
We used to need two utilities to flash rockchip image file:
RKBatchTool, used to flash update.img
RKDevelopTool, used to flash partition image file separately.
After that, Rockchip release new tool: AndroidTool. It is based on RKDevelopTool, but adds flashing support for update.img. So you can use this tool instead.
Before using the flashing utility, you need to install RK USB driver. If the driver is already installed, you can skip to next step.
Install RK USB Driver
Download Release_DriverAssistant.zip, uncompress it, then run DriverInstall.exe inside.
In order to use new driver for all the rockchip devices, please select "驱动卸载"(Driver uninstall), then "驱动安装"(Driver install).
Connect Device
Firefly-RK3399
There are two ways to switch the device to upgrade mode.
The first one, device is cut off all the power sources, such as power adapter and Type-C connection:
1.Keep Type-A cable connected with host PC.
2.Press and hold RECOVERY key.
3.Connect Type-C cable to the device.
4.After around two seconds, release RECOVERY key.
The other way:
1.Use Type-C cable to connect host and device together.
2.Press and hold RECOVERY key.
3.Shortly press RESET key.
4.After around two seconds, release RECOVERY key.
The host will prompt to have new device detected and configured. Open the Device Management, you'll find a new device name "Rockusb Device", as shown below. Return to previous step to reinstall driver if it is not shown.
Flash Image
Download AndroidTool(Android8.1 need AndroidTool_Relase_v2.54 or higher version). Uncompress it and change to directory AndroidTool_Release_v2.38.
AndroidTool defaults to display in Chinese. We need to change it to English. Open config.ini with an text editor (like notepad). The starting lines are:
#选择工具语言:Selected=1(Chinese);Selected=2(English) [Language] Kinds=2 Selected=1 LangPath=Language\
Change "Selected=1" to "Selected=2", and save. From now on, AndroidTool will display in English.
Now, run AndroidTool.exe: (Note: If using Windows 7/8, you'll need to right click it, select to run it as Administrator)
Flash update.img
Steps of flashing update.img:
Switch to "Upgrade Firmware" tab page.
Click "Firmware" button and open the image file. Detail information of the image file, like version and chip, is shown.
Click "Upgrade" button to start flash.
If upgrade fails, please try "LowerFormat" in the "Download Image" tab page first, then try again.
WARNING: If you flash firmware laoder different version of the original machine, please click "Erase Flash" before upgrading the firmware.
Steps of flashing partition images:
Switch to "Download Image" tab page.
Check the partitions you want.
Make sure the image file's path is correct. Click the rightmost empty table cell to select new path if needed.
Click "Run" button to start flashing. Device will reboot automatically when finish.
Linux
Rockchip provides a command line utility named "upgrade_tool" under Linux, which support flashing of both update.img and partition images.
We have two choices with regard to open source tools:
rkflashtool https://github.com/Galland/rkflashtool_rk3066
rkflashkit https://github.com/linuxerwang/rkflashkit
Both of them only support flashing partition images, not update.img. rkflashtool is a command line tool, and flashkit has a nice and easy to use GUI with command line support lately added. We only introduce rkflashkit below.
There is no need to install device driver. Just connect the device and host as described in the Windows section.
upgrade_tool
Download Linux_Upgrade_Tool(Android8.1 need Linux_Upgrade_Tool_for_android8.1), and install it to host filesystem:
tar -xzvf upgrade_tool_v1_26.tar.gz sudo mv upgrade_tool /usr/local/bin sudo chown root:root /usr/local/bin/upgrade_tool
NOTE: If you are prompted with the following error:
upgrade_tool: error while loading shared libraries: libudev.so.1: cannot open shared object file: No such file or directory
You can use the following command to solve:
sudo ln -sf /lib/i386-linux-gnu/libudev.so.1 /lib/i386-linux-gnu/libudev.so.0
or you can use the lib of Linux_Upgrade_Tool ,copy it to the /lib/i386-linux-gnu/ directory
sudo cp lib/i386-linux-gnu/* /lib/i386-linux-gnu/
Flash update.img:
sudo upgrade_tool uf update.img
Flash partition images
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 #flash parameter sudo upgrade_tool ul bootloader.bin #flash bootloader sudo upgrade_tool di trust /path/to/trust.img #flash trust
If errors occur due to flash problem, you can try to low format, or erase the flash:
upgrade_tool lf update.img # low format flash upgrade_tool ef update.img # erase flash
rkflashkit
Install:
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
GUI:
sudo rkflashkit
Command line:
$ 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
See the example above, which is really handy to flash multiple images then reboot device in one command, especially good for developers who will compile and flash kernel again and again.
FAQs
Q1: How to Enter MaskRom Mode?
A1: If Loader mode is not available , you might need to enforce the device into MaskRom mode. Please check here.