Rock/flash the image
Contents
This page describes how to install an image to the nand flash of Radxa Rock, ie, how to flash the board. You can choose to either flash the whole nand image (ie, update.img) to the board or just flash the selected partitions. You can download the prebuilt images from our server or build your own images.
Before you start
Keep in mind that:
You can always flash the rock, it never bricks (as the name :)) unless some hardware damage occurs.
What you will need to flash the board is:
- a Radxa Rock board (check hardware revision. there are Pro and Full/Lite, firmware is different)
- a PC running Windows (XP 32/64bit, Windows 7 32/64 bit) or Linux (32/64bit)
- a micro USB cable with one side plugged in to the OTG port of Radxa Rock and the other side plugged into the USB port on PC.
Windows
The Windows tool for flashing the image is provided by Rockchip. To flash the update.img(you'd better click this link and read this page,it's very Important for the radxa beginner), you need to use the RKBatchTool and to flash the partitions, you will need to use RKDevelopTool. Both RKBatchTool and RKDevelopTool rely on the RK USB driver so you will need to install it first as below:
Install driver
- install using RKDriverAssistant tools - the easy way(Just for winXp, Vista, Win7,not support Win8)
- install manually (WinXp,Vista,Win7,Win8)
If you have already installed the USB driver please skip this step.
a. Install using RK Driver Assistant tools
Note:The method just support WinXp,Vista,Win7, NOT SUPPORT Win8
There’s no need to connect your Rockchip device during this procedure just download and extract RKDriverAssistant.zip Then double click on DriverInstall.exe in the RKDriverAssistant directory to start the utility. If you've previously tried to install the Rockchip USB drivers for any Rockchip devices make sure you click “Uninstall Driver” first.
Then click “Install Driver” and when the driver has finish installing then shut down radxa board and connect the Radxa Rock board to your computer and let the board go to loader mode, then your computer will detect the board and you will see it within device manager.
Now the driver should have been installed successfully!
b. Install Manually
Download driver file first. For WinXp,Vista,Win7,Download the file (usb_driver_v3.5.zip) from here . For Win8 Download the file(usb_driver_v3.7.zip) from here. shut down the Radxa Rock board then connect the Radxa Rock board to the computer and let the board go to loader mode. After your computer should detect the board and you will see an unknown device within device manager.
Select the Unknown device then right click and select "Update Driver Software".
Select "Browse the computer for driver software".
Find the file unzipped file you downloaded earlier (usb_driver_v3.5.zip) and select either the 32/64bit folder then click "OK" to install.
When the driver is installed successful you will then see a Rockusb Device in the device manager window.
Now the driver is installed successfully.
Flash Image
There are two methods to flash an image.
- use RKBatchTool (Factory upgrading firmware tool, flash update.img only, it will erase everything.)
- use RKAndroidTool (Development tool, can flash by partitions)
Using RKBatchTool to flash update.img
Download RKBatchTool from here. Then unzip it and double click RKBatchTool.exe, you will now see the interface as follows:
Select an image (rockdev/update.img). For information on how to make nand image see update.img
Power down the Radxa Rock board and connect the Radxa Rock board to the computer then let the board go to loader mode after the program should detect the device.
Click the "Upgrade" button to begin flashing and when the flashing process finishes successfully you will see the following interface.
If the flashing has aborted ,it could possibly be an error with the update.img, you can either try to redo the operations above or make the update.img again!
Using RKAndroidTool to flash image by partitions
Download RKAndroidTools from here. Unzip it the file and double click RKAndroidTool.exe, you will then see the interface as follows:
Power down the Radxa Rock board and connect the Radxa Rock board to the computer and let the board go to loader mode then the program will detect it.
There are eight selections to choose from so select the correct row and then select the checkbox to the left of the row to select it. After you must click the column on the right side for the path of the file you want to flash. You can then select one or more files and flash them at once. Finally Click "Run" to flash images to the device (the right most selection shows the log of the progress).
If successful the board will disconnect from the tool and boot into the system.
Please Note:
- The kernel is contained within the boot.img when you package the image by "./mkimage.sh ota" please see Rock/Android_Build for more information.
- you can flash one of more image at one time as needed
Troubleshooting
RKBatchTool can not recognize the board
1.Loader mode : USB device HW: VID_2207&PID_310B
2.Boot into Android: USB device HW: VID_2207&PID_0006
For loader mode
I have use manual install within loader mode for PID_310B.
The "Rockusb device" driver installed successfully on Vista but the RKBatchTool can not connect to the RK3188 board for img flashing.
For loader mode cannot connect issue [Solved]
Root Cause: RK3188 board is connected to laptop via USB 3.0 PMMCIA card.
It's a USB2.0 to USB3.0 compatibility issue so switch USB 3.0 port to a USB 2.0 then the RKBatchTool should connect to the RK3188 board for img flashing.
Flashing failed
After flashing, the uart print
DDR Version 1.04 20130517 In DDR3 300MHz Bus Width=32 Col=10 Bank=8 Row=15 CS=2 Die Bus-Width=16 Size=2048MB Memory OK OUT BUILD=====6 SdmmcInit=0 20 F:32 1061 0 0 40 FlashReadRetry error!!,row = fff000 FlashReadRetry error!!,row = fff000
and not boot.
If flashing failed, try to format the nand flash before flashing it.
- RKAndroid tool - click "Erease IDB" button to format the nand flash
- RK Batch tool - click "Restore" to format and then flash the image
Preparing IDB failed
This happens at upgrading bootloader, if you need to upgrade the bootloader or the update.img contains a new bootloader, you probably will meet this. The rock is "bricked". Follow this unbrick instructions to unbrick it.
Linux
Rockchip has provided tools for upgrading within Linux (closed source) since Android 4.4. It's called upgrade_tool. It supports update.img, parameter, bootloader and other partitions, and it's command line based.
rkflashkit is an open source GUI version flashing tool for rockchip devices. It can not flash bootloader or parameter, only supports kernel and other partitions, but it supports backup the partitions.
For developers:
The initial RE work of the Rockchip bootloader updating protocol is by naobsd and has been improved by some in rkflashtool. linuxerwang has made a GUI version of the rkflashtool called rkflashkit. Please note: both rkflashtool and rkflashkit can not flash the rock/update.img and can only flash within rock/bootloader mode and not rock/mask rom mode because the rock/mask rom updating protocol is not RE yet. If you are interested in the RE protocol ping naobsd at #radxa on IRC. Since the rock/bootloader has remained unchanged for a long time it's enough for normal usage. If you don't know what this means, just ignore it.
Upgrade_tool from Rockchip
Download the Rockchip linux upgrade tool here. Unzip it and you will get a file called upgrade_tool which is a binary executable file under Linux.
Flash update.img
Let the board go to loader mode and run the following command to flash the update.img:
sudo ./upgrade_tool uf /path/to/update.img #(UF Upgrade Flash)
If you have an error with upgrading you can low level format the nand flash first with the following command:
sudo ./upgrade_tool lf #(LF Lowlevel Format) This will erase everything on nand
Flash parameter
sudo ./upgrade_tool di -p /path/to/parameter #(DI Download Image)
Flash bootloader
sudo ./upgrade_tool ul /path/to/bootloader #(UL Upgrade Loader)
Flash the kernel(boot.img)
sudo ./upgrade_tool di -b /path/to/boot.img #(DI Download Image)
Others
There are other commands in the upgrade_tool, such as:
UL: upgrade the loader EF: erease the nand flash
Flash with rkflashtool
rkflashtool is an open source tool to write nand flash via the loader mode for rockchip platform.
To install rkflashtool:
sudo apt-get install build-essential libusb-1.0-0-dev git clone https://github.com/linux-rockchip/rkflashtool cd rkflashtool make sudo cp rkflashtool rkcrc rkunpack rkunsign /usr/local/bin
To read/write parameter:
rkflashtool p > param rkflashtool P < param
To read/write partitions:
rkflashtool r boot > boot.img rkflashtool w boot < boot.img
rkflashtool r linuxroot > linuxroot.ext4 rkflashtool w linuxroot < linuxroot.ext4
Rkflashkit with GUI
You can download the pre-built rkflashkit here or build it yourself with the following command:
git clone https://github.com/linuxerwang/rkflashkit cd rkflashkit ./waf debian
And install it with the following command
sudo apt-get install python-gtk2 sudo dpkg -i rkflashkit_0.1.1_all.deb
Run it with the following command
sudo rkflashkit
You can see the interface looks like this:
Connect the Radxa Rock board to the computer and let the board go into loader mode you will then see the the program detect the board in loader mode.
- Click the Nand partition and you will see the partitions of the board listed then choose the one you want to flash.
- Choose the location of the image you want to flash to that partition.
- Click the "Flash image" button and it will start flashing
- After it's finished click "Reboot Device" button to reboot the board.
Troubleshooting
Creating Comm Object failed!
that's udev issues… You can solve this by creating a new file in /etc/udev/rules.d/ with the rule for the rock.
To do that, copy and paste these commands:
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="2207", MODE="0666", GROUP="plugdev"' | sudo tee /etc/udev/rules.d/51-android.rules
Finally, just remove and reinsert the USB cable.
What's verision of My board and Which Image should I flash!
refer to update.img
Install the image on RR without PC
If you want to write the image on RR without any other host PC, you can download the image and write with dd:
sudo dd if=XXX.img of=/dev/block/mtd/by-name/XXX bs=16384 conv=sync,fsync
Videos tutorial
- Flashing the image to nand flash https://www.youtube.com/watch?v=r20lOKu2E1s&feature=youtu.be