Introduction

rkflashtool is a open source tool used to flash image through Rockusb protocol.It maintained by linux-rockchip community. Here is a simple Howto. Please refer to here for more detail.

Build

rkflashtool depend on libusb-1.0. So we have to install libusb-1.0-0-dev first

$ sudo apt-get install libusb-1.0-0-dev

Then run:
$ make

For cross-compilation for win32/64 you need to install libusb-1.0.
See at the end of this document for more information.
After that, you can run:

$ make MACH=mingw CROSSPREFIX=i686-w64-mingw32-

or

$ make MACH=mingw CROSSPREFIX=x86_64-w64-mingw32-

Usage

All available commands:

    rkflashtool b [flag]                reboot device
    rkflashtool l <file                 load DDR init (MASK ROM MODE)
    rkflashtool L <file                 load USB loader (MASK ROM MODE)
    rkflashtool v                       read chip version
    rkflashtool n                       read NAND flash info
    rkflashtool i offset nsectors >outfile     read IDBlocks
    rkflashtool j offset nsectors <infile      write IDBlocks
    rkflashtool m offset nbytes   >outfile     read SDRAM
    rkflashtool M offset nbytes   <infile      write SDRAM
    rkflashtool B krnl_addr parm_addr          exec SDRAM
    rkflashtool r partname >outfile     read flash partition
    rkflashtool w partname <infile      write flash partition
    rkflashtool r offset nsectors >outfile     read flash
    rkflashtool w offset nsectors <infile      write flash
    rkflashtool p >file                 fetch parameters
    rkflashtool P <file                 write parameters
    rkflashtool e partname              erase flash (fill with 0xff)
    rkflashtool e offset nsectors       erase flash (fill with 0xff)

offset and size are in units (blocks) of 512 bytes (!)

Scripts on windows

To run the bash scripts (rkmisc, rkparameters, etc…) on Windows, you need to install MSYS (part of MinGW). The easiest way is through the MinGW installer. You need at least msys-bash and msys-coreutils (for dd). Make sure you have e.g. C:\MinGW\msys\1.0\bin and C:\rkflashtool in your %PATH% variable. The easiest way to run the scripts is from the bash command line. If you insist on using cmd.exe, you need to call bash with the script's full filename (including its path) as its first argument. You could turn that into a .bat file if you want.