Skip to content
Opensource Tools for flashing Rockchip devices
C Shell Makefile
Branch: master
Clone or download
Pull request Compare This branch is 10 commits ahead, 4 commits behind linux-rockchip:master.
eddiecailinux Merge pull request #1 from omegamoon/master
flashtool: add pid for rk3229 and rk3328
Latest commit e0df607 Jul 6, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc
examples add arnova 10 g1 (resistive) sample partitions file Dec 13, 2013
.gitignore ignore rkunpack binary Dec 14, 2013
Makefile build: use pkg-config to find libusb-1.0 if available Oct 22, 2015
README Add read/write flash by partition name Mar 27, 2014
fixversion.sh increase version number to 5.2 and start new cycle Dec 30, 2013
flashuboot
release.sh add missing version.h to release tarballs Jan 8, 2014
rkcrc.c rkflashtool: support mask rom mode Oct 7, 2014
rkcrc.h rkcrc: use table-driven version by default Oct 7, 2014
rkflashall add board parameter support to rkflashall script Jan 8, 2016
rkflashloader rkflashloader: add support for rk3399evb Jul 14, 2016
rkflashtool.c flashtool: add pid for rk3229 and rk3328 Jul 5, 2017
rkflashtool.h
rkmisc increase version number to 5.2 and start new cycle Dec 30, 2013
rkpad increase version number to 5.2 and start new cycle Dec 30, 2013
rkparameters increase version number to 5.2 and start new cycle Dec 30, 2013
rkparametersblock increase version number to 5.2 and start new cycle Dec 30, 2013
rkunpack.c Added RK3368 to known chip list Nov 10, 2015
rkunsign increase version number to 5.2 and start new cycle Dec 30, 2013
version.h increase version number to 5.2 and start new cycle Dec 30, 2013

README

BUILD
=====

Install libusb-1.0 and its development files and 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
=====

Read parameters:

sudo ./rkflashtool p > parm.bin
cat parm.bin

The output will show 2 hex numbers and the partition name.
(....,0x00008000@0x00010000(recovery),....)
The first number is the size of the partition, the second number is the
offset. So, to write the recovery image, use:

sudo ./rkflashtool w 0x10000 0x8000 < recovery.img


All available commands:

rkflashtool b                         reboot device
rkflashtool r partname >file          read flash partition
rkflashtool w partname <file          write flash partition
rkflashtool r offset size >file       read flash
rkflashtool w offset size <file       write flash

rkflashtool m offset size >file       read 0x80 bytes DRAM
rkflashtool i offset blocks >file     read IDB flash
rkflashtool p >file                   fetch parameters

rkflashtool e partname                erase flash (fill with 0xff)
rkflashtool e offset size             erase flash (fill with 0xff)

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



Also included:



rkcrc           sign files with a cyclic redundency code and optionally
                add a KRNL or PARM + size header

usage: rkcrc [-k|-p] infile outfile



rkparameters    generate a parameter file

usage: rkparameters model fw_version partitionsfile > outfile

    model is found in the large case statement, e.g. arnova7g2
    you can add your own and please send the information back to me
    (ivop@euronet.nl) for inclusion in future versions.

    fw_version is the version number, e.g. 1.2.3

    partitionsfile is a file that specifies the kernel command line on the
    first line and describes all the partitions and their sizes. It skips
    the parameters block and starts with misc. See the example mtdparts.txt
    for details.



rkparametersblock   generate the parameters block

usage: rkparametersblock parametersfile outfile

    parametersfile is the file you have generated with rkparameters.
    outfile is the file to be written, which can later be flashed to your
    device.
    rkparametersblock needs rkcrc to sign the parameter file. After that,
    it generates an empty 4MB file and pastes in the rkcrc'd file five times
    at the start of the first five NAND pages (it assumes the NAND page size
    is always 4096. Let me know if you run into something different).



rkunpack        unpack update.img files (not partition.img (!))

usage: rkunpack file

    supports both RKAF and RKFW (which contains an embedded RKAF file)



rkpad           pad file with zeroes

usage: rkpad size infile outfile

    Copy infile to outfile and pad with zeroes up to the specified size.
    size is in blocks of 512 bytes (!) i.e. equal to the partition sizes.



rkunsign        remove KRNL/PARM header and crc footer

usage: rkunsign infile outfile



Notes on cross-compiling libusb-1.0 and mman-win32 on debian wheezy:

sudo apt-get install mingw-w64

git clone http://git.libusb.org/libusb.git
cd libusb
./autogen.sh
make clean
./configure --host i686-w64-mingw32 --prefix=/usr/i686-w64-mingw32
make
sudo make install

Replace i686-w64-mingw32 with x86_64-w64-mingw32 to do a win64 build.



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.

You can’t perform that action at this time.