Flash Image

来自Firefly wiki
跳转至: 导航搜索

Introduction

This page describes how to flash the image file from the host to the development board's NAND flash memory, via the Micro USB OTG cable.

Please choose the right way according to the host OS and image file type.

Before Start

What you need:

  • FirePrime development board
  • Image file
  • Host PC
  • Good Micro USB OTG Cable

There are two types of image file:

  • Monolithic image, often known as update.img, which contains the bootloader, parameter and all the partition image files. It is used for firmware distribution.
  • Multiple partition image, like kernel.img, boot.img, recovery.img, etc, which are created during development.

You can download compiled update.img, or you can reference Build Android to compile your own image file.

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.

Later, Rockchip release new tool: AndroidTool. It is based on RKDevelopTool, but adds flashing support for update.img. Therefore, one utility is sufficient.

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).

Rk3288 driverassistant install.png

Connect Device

There are two ways to put the device into upgrade mode.

The first one, device is cut off all the power sources, such as power adapter and Micro USB OTG connection:

  1. Keep micro USB OTG cable connected with host PC.
  2. Press and hold RECOVERY key.
  3. Connect micro USB OTG cable to the device.
  4. After around two seconds, release RECOVERY key.

The other way:

  1. Use micro USB OTG 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.

Rk3288 xp devicemanager.png

Flash Image

Download AndroidTool_Release_v2.33.rar. Uncompress it and change to directory AndroidTool_Release_v2.33.

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(中文);Selected=2(英文)
[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)

Fireprime android tool startup en.png

Flash update.img

Steps of flashing update.img:

  1. Switch to "Upgrade Firmware" tab page.
  2. Click "Firmware" button and open the image file. Detail information of the image file, like version and chip, is shown.
  3. Click "Upgrade" button to start flash.
  4. 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.

Fireprime android tool burn update en.png

Flash Partition Images

Steps of flashing partition images:

  1. Switch to "Download Image" tab page.
  2. Check the partitions you want.
  3. Make sure the image file's path is correct. Click the rightmost empty table cell to select new path if needed.
  4. Click "Run" button to start flashing. Device will reboot automatically when finish.

Fireprime android tool burn partition en.png

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:

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_v1.2.tar.gz, and install it to host filesystem:

   tar xf Linux_UpgradeTool_v1.2.tar.gz
   cd Linux_UpgradeTool_v1.2
   sudo mv upgrade_tool /usr/local/bin
   sudo chown root:root /usr/local/bin/upgrade_tool

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

If errors occur due to flash problem, you can try to low format, or erase the flash:

   upgrade_tool lf   # low format flash
   upgrade_tool ef   # erase flash

rkflashkit

Install:

   sudo apt-get install build-essential fakeroot 
   git clone https://github.com/TeeFirefly/rkflashkit
   cd rkflashkit
   ./waf debian
   sudo apt-get install python-gtk2
   sudo dpkg -i rkflashkit_0.1.4_all.deb
  • GUI:
   sudo rkflashkit

Rk3288 rkflashkit.png

  • Command line:
$ rkflashkit --help
Usage: <cmd> [args] [<cmd> [args]...]

part                              List partition
flash @<PARTITION> <IMAGE FILE>   Flash partition with image file
cmp @<PARTITION> <IMAGE FILE>     Compare partition with image file
backup @<PARTITION> <IMAGE FILE>  Backup partition to image file
erase  @<PARTITION>               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.

FAQ

How to Enter MaskRom Mode

If Loader mode is not available and SD card boot also fails, you might need to enforce the device into MaskRom mode. Please check here.