It’s been possible to flash firmware to Rockchip devices in Linux with upgrade_tool command line tool for many years, but the utility is closed-source and only supports “RK Firmware” files that are also used for OTA firmware updates, but not “raw firmware” that you’d flash directly to micro SD cards for example.
This week-end as I played with ROC-RK3328-CC board, I encountered some instability issues with micro SD cards, so I instead relied on an eMMC flash module. The only problem was that Firefly Team only releases “raw firmware” files, so I was unable to use upgrade_tool, and instead found out rkdeveloptool open source utility was used to flash raw firmware images in Firefly’s Wiki.
The first step is to connect a male to male USB Type A cable (like that one on eBay) between the board and the host computer, and connect a USB power adapter to the board. At least that’s what I had to do here, because it may be a little mode complicated in some cases. The important part is that the board must in the “maskrom mode”, and it happens automatically if:
- The eMMC is empty.
- The bootloader on eMMC is damaged.
In my case, the eMMC flash module contained Amlogic firmware, which obviously is not recognized by the Rockchip processor, so it went to maskrom mode automatically, but if your board/device can still partially boot then you need to enter maskrom mode manually by making sure eMMC read data fails by shorting eMMC data/clock pin to the ground. The exact location of those pins will depend on the hardware design, and you may have to read the hardware’s schematics to find out.
They’ve made it easy on ROC-RK3328-CC board with CLK and GND test points as shown above, but again I did not have to do this since the board was already in maskrom mode.
Now we need to get rkdeveloptool source code to build and install it in our computer. Those are the instructions in Ubuntu/Debian operating systems:
1 2 3 4 5 6 7 |
sudo apt-get install pkg-config libusb-1.0 libudev-dev libusb-1.0-0-dev dh-autoreconf git clone https://github.com/rockchip-linux/rkdeveloptool cd rkdeveloptool autoreconf -i ./configure make sudo make install |
You should now see the option when typing the command in a terminal:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
rkdeveloptool ---------------------Tool Usage --------------------- Help: -h or --version Version: -v or --version DownloadBoot: db <Loader> UpgradeLoader: ul <Loader> ReadLBA: rl <BeginSec> <SectorLen> <File> WriteLBA: wl <BeginSec> <File> WriteGPT: gpt <gpt partition table> EraseFlash: ef TestDevice: td ResetDevice: rd [subcode] ReadFlashID: rid ReadFlashInfo: rfi ReadChipInfo: rci PackBootLoader: pack UnpackBootLoader: unpack <boot loader> TagSPL: tagspl <tag> <U-Boot SPL> ------------------------------------------------------- |
After downloading a raw firmware image, let’s call it raw-firmware.img, we can start flashing it to the board / device. Rockchip open source website has a slightly different set of commands since they flash each partition (bootloader/u-boot/kernel/rootfs) individually, but here’s what I had to do with ROC-RK3328-CC board to flash the firmware to the eMMC flash module.
- Download the bootloader binary @ https://github.com/rockchip-linux/rkbin/tree/master/rk33 which will depend on your board. In my case:
1wget https://github.com/rockchip-linux/rkbin/raw/master/rk33/rk3328_loader_ddr786_v1.06.243.bin - Flash the bootloader and raw firmware image
12rkdeveloptool db rk3328_loader_ddr786_v1.06.243.binrkdeveloptool wl 0x0 raw-firmware.img - Reboot the board
1rkdeveloptool rd - Have fun with your new firmware!
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
Nice find!
Than you for the information, this is very useful!
Thanks for the sharing~
Check how we flash Z28 Pro … https://www.armbian.com/z28-pro There are even better ways, but you need to have a proper u-boot support. Tinkerboard S, for example, can be flashed without any special tool, U-boot automatically exposes eMMC or SD (as usb mass storage) if you power the board from the computer. I hope this will be easy to implement also on RK3328 and perhaps other boards.
Noted. So flash_tools looks to be a script that handles all steps in the post above using a pre-built rkdeveloptool and the necessary bootloader file. I suppose it can work with any Rockchip device/board, not only Z28 Pro TV box. People just need to make sure they pass the right parameters (e.g. bootloader file).
hi igor, i didn’t know armbian provided some “no support” images , can you tell me what’s the “state/status” of those images ?
Are they updated or is it a one time build ? Is there some info about what’s working / not working on the device ?
I guess following the armbian forum thread should be good enough.
thx
Good to know RK chips have the same ability the Allwinner chips do with their FEL mode. It makes life much easier for developers when things go wrong.