Rockchip Create Upgrade

  1. Rockchip Create Upgrade Disk Tool
  2. Rockchip Create Upgrade Disk Tool Writing Mbr Failed
  3. Rockchip Create Upgrade Disk Tool 1.62
  4. Rockchip Create Upgrade Disk Tool V1.4

Boot Mode¶

eMMC flash is commonly soldered directly to the board. Some eMMC flash are pluggable, but it is hard to find a reader to use on PC. Therefore, eMMC is generally flashed onboard, that is, running to tiny system on the obard, which reads firmware data from PC and flashes to eMMC.

As we said at the beginning, the firmware is available as a PC upgrade /.img file version (you must do a flash method to update the firmware). New firmware for HK1 Mini with Rockchip RK3229 SoC (update 20190418) can be downloaded here. There is no information about the changes.

Depending on the existing data on the eMMC flash, there are two special boot modes: Rockusb Mode and Maskrom Mode.

  • Aug 30, 2021 Rockchip create upgrade disk tool v1.4 helps you to install firmware on rockchip device from micro sd card. You can write firmware image on micro sd card and restore or update your rockchip devices. Upgrade or restore any rockchip device without computer or flashing tools. Before proceeding you have to make surethat you have right firmware.
  • Install driver from rockchip package. Optional: Shutdown tablet (not necessary in my case, since I can see the device stays connected in Windows Device Manager) 7. Start Rockbatchtool after correcting the config.ini file = see below 8.
  • G: Rockchip create upgrade disk tool v1.4 Rockchip create upgrade disk tool v1.4 Rockchip create upgrade disk tool v1.4 SDFirmwareTool SDFirmwareTool.exe SDFirmwareTool Rockchip.
  • Rockchip Create Upgrade Disk Tool v1.53.rar. Rockchip Create Upgrade Disk Tool v1.53.rar.

You usually just need to enter Rockusb Mode for upgrading an existing Android OS or Firefly Ubuntu OS, which is packed with RK Firmware format.

Maskrom Mode is the last resort when Rockusb Mode is not available due to bootloader damage, or you need to flash Raw Firmware to eMMC.

Rockusb Mode¶

If the board powers on and finds a valid IDB (IDentity Block) in the eMMC, it will continue to load the bootloader from the eMMC and pass execution control to it. If the bootloader checks that the Recovery button is pressed and USB connection is made, then it enters the so-called Rockusb Mode, waiting for further instructions from the host.

Requirement:

  • 5V2A power adapter.
  • Micro USB cable to connect power adapter and board.
  • Male to male USB cable to connect host PC and board.
  • eMMC.

Steps:

  1. Pull all the USB cables (including micro USB cable and male to male USB cable) out of the board, to keep the board powering off.

  2. Install the eMMC and pull out the SD card.

  3. Use the male to male USB cable to connect the host PC with the USB 2.0 OTG port (the lower one in the double-decker ports) of the board.

  4. Keep the RECOVERY button on the board pressed.

  5. Plug in the micro USB cable to the board to power up.

  6. Wait about 3 seconds before releasing the RECOVERY button.

Maskrom Mode¶

If anyone of the following conditions is met when the board powers on:

  • eMMC is empty.
  • The bootloader on eMMC is damaged.
  • eMMC read data failed by connecting eMMC data/clock pin to ground.

then no valid IDB (IDentity Block) will be found in the eMMC. The CPU will execute a small ROM code, waiting for the host to upload via USB a small DDR blob to initialize the DDR memory, and later a full bootloader to handle further firmware upgrading. This mode is called Maskrom Mode.

It involves hardware operation to force into MaskRom Mode, which has certain risk and should be carried out VERY CAREFULLY.

Requirement:

  • 5V2A power adapter.
  • Micro USB cable to connect power adapter and board.
  • Male to male USB cable to connect host PC and board.
  • Metal tweezers to connect eMMC clock pin to ground.
  • eMMC.

Steps:

  1. Pull all the USB cables (including micro USB cable and male to male USB cable) out of the board, to keep the board power off.

  2. Install the eMMC and pull out the SD card.

  3. Use a male to male USB cable to connect your host PC and USB OTG port of the board:

  4. Find the reserved eMMC CLK and GND pads on the board, as shown below:

  5. Connect the eMMC CLK and GND pads with metal tweezers and keep holding steadily.

  6. Plug in the micro USB cable to the board to power on.

  7. Wait about 1 seconds before releasing the metal tweezers.

Flashing Tools¶

Please use the eMMC flashing tools according to your OS:

  • To flash to the eMMC:
    • GUI
      • AndroidTool (Windows)
    • CLI
      • upgrade_tool (Linux)
      • rkdeveloptool (Linux)

AndroidTool¶

AndroidTool is used to flash Raw Firmware, RK Firmware and Partition Image to eMMC.

Rockchip Create Upgrade Disk Tool

To use AndroidTool, you need to install Rockusb Driver first.

Installing Rockusb Driver¶

Download DriverAssistant, extract the archive and run DriverInstall.exe inside.

Click the “驱动安装” button to install the driver. If you want to uninstall the driver, click the “驱动卸载” button.

If your device is in Rockusb Mode or Maskrom Mode, you’ll find a RockusbDevice in the device manager:

Installing AndroidTool¶

Download AndroidTool, extract it. Locate the file named config.ini, and edit it by changing the 4th line from Selected=1 to Selected=2, in order to select English as the default user interface language.

Launch AndroidTool.exe:

If your device is in Rockusb Mode, the status line will be “Found One LOADER Device”.

If your device is in Maskrom Mode, the status line will be “Found One MASKROM Device”.

Flashing Raw Firmware¶

Raw Firmware needs to be flashed to offset 0 of eMMC storage. However, in Rockusb Mode, all LBA writes are offset by 0x2000 sectors. Therefore, the device has to be forced into Maskrom Mode.

To flash Raw Firmware to the eMMC using AndroidTool, follow the steps below:

  1. Force the device into Maskrom Mode.
  2. Run AndroidTool.
  3. Switch to the “Download Image” tab page.
  4. Keep the first line of the table unchanged, using the default loader file.
  5. Click the right blank cell on the second line, which will pop up a file dialog to open the Raw Firmware file.
  6. Click the “Run” button to flash.

Flashing RK Firmware¶

To flash RK Firmware to the eMMC using AndroidTool, follow the steps below:

  1. Force the device into Rockusb Mode or Maskrom Mode.
  2. Run AndroidTool.
  3. Switch to the “Upgrade Firmware” tab page.
  4. Click the “Firmware” button, which will pop up a file dialog to open the RK Firmware file.
  5. The firmware version, loader version and chip info will be read and displayed.
  6. Click the “Upgrade” button to flash.

Flashing Partition Image¶

Rockchip Create Upgrade

To flash Partition Image to the eMMC using AndroidTool, follow the steps below:

  1. Force the device into Rockusb Mode or Maskrom Mode.

  2. Run AndroidTool.

  3. Switch to the “Download Image” tab page.

  4. Keep the first line of the table unchanged.

  5. Delete all others unused rows by selecting “Delete Item” from the right-click popup menu.

  6. Add partition image to flash by selection “Add Item” from the right-click popup menu.

    • Check on the checkbox on the first cell.
    • Fill in the address with the sector offset (plus 0x2000 if in Maskrom Mode) of partition in parameter.txt file.
    • Click the right blank cell to browse to the Partition Image file.
  7. Click the “Run” button to flash.

Note:

  • You can add multiple partitions to flash by repeating step 6.
  • You can skip the partition flashing by checking off the checkbox in front of the address cell.
  • In Maskrom Mode, you must add 0x2000 to the sector offset of the partition in parameter.txt. See Partition Offset for more detail.

upgrade_tool¶

upgrade_tool is a close-sourced command line tool provided by Rockchip, which supports flashing Raw Firmware, RK Firmware and Partition Image to the eMMC.

Installing upgrade_tool¶

Download upgrade_tool, and install it to your Linux host:

Then add udev rules by instructions here, in order to have permission for the normal user to flash Rockchip devices. If you skip this, you must prefix the following commands with sudo to have the right permission.

Flashing Raw Firmware¶

Raw Firmware needs to be flashed to offset 0 of eMMC storage. However, in Rockusb Mode, all LBA writes are offset by 0x2000 sectors. Therefore, the device has to be forced into Maskrom Mode.

To flash Raw Firmware to the eMMC using upgrade_tool, follow the steps below:

  1. Force the device into Maskrom Mode.

  2. Run:

Rockchip Create Upgrade Disk Tool Writing Mbr Failed

Note:

  • rk3328_loader_ddr786_v1.06.243.bin is the copied loader file after compiling U-Boot. It can also be downloaded from here (choose rk3328_loader_xxx.bin file).
  • system.img is Raw Firmware after packing, which can also be Raw Firmware downloaded from official site (decompress first).

Flashing RK Firmware¶

To flash RK Firmware to the eMMC using upgrade_tool, follow the steps below:

  1. Force the device into Rockusb Mode or Maskrom Mode.

  2. Run:

Flashing Partition Image¶

You can write individual Partition Image to the eMMC. Depending on the original content of the eMMC, the instructions can be somewhat different.

Raw Firmware

If the original firmware format is raw, chances are that it is using the GPT partition scheme, and the predefined offset and size of each partition can be found in build/partitions.sh in the SDK. See Partition Offset for more detail.

To flash Partition Image to the eMMC using upgrade_tool, follow the steps below:

  1. Force the device into Maskrom Mode.

  2. Use upgrade_tool to flash the Partition Image:

RK Firmware

If the original firmware format is Rockchip, it is using the parameter file for partition scheme, and you can use the partition name to flash Partition Image directly.

To flash the Partition Image to the eMMC using upgrade_tool, follow the steps below:

  1. Force the device into Rockusb Mode.

  2. Use upgrade_tool to flash the Partition Image:

Note:

  • -b is a predefined shortcut for boot partition. If no shortcuts are available, use partition name instead (resource in above example).
  • You can customize kernel parameters and partition layout according to Parameter file format. Once the partition layout is changed, you must flash the parameter file first, before reflashing other changed partitions.

FAQ¶

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

rkdeveloptool¶

rkdeveloptool is an open-source command line flashing tool developed by Rockchip, which is an alternative to the close-source upgrade_tool.

rkdeveloptoolDOES NOT support proprietary RK Firmware.

Installing rkdeveloptool¶

First, download, compile and install rkdeveloptool:

Then add udev rules by instructions here, in order to have permission for the normal user to flash Rockchip devices. If you skip this, you must prefix the following commands with sudo to have the right permission.

Flashing Raw Firmware¶

Raw Firmware needs to be flashed to offset 0 of eMMC storage. However, in Rockusb Mode, all LBA writes are offset by 0x2000 sectors. Therefore, the device has to be forced into Maskrom Mode.

To flash Raw Firmware to the eMMC using rkdeveloptool, follow the steps below:

  1. Force the device into Maskrom Mode.

  2. Run:

Note:

Rockchip Create Upgrade Disk Tool 1.62

  • rk3328_loader_ddr786_v1.06.243.bin is the copied loader file after compiling U-Boot. It can also be downloaded from here (choose rk3328_loader_xxx.bin file).
  • system.img is Raw Firmware after packing, which can also be the Raw Firmware downloaded from official site (decompress it first).

Flashing Partition Image¶

The following instructions ONLY APPLIY to boards which are flashed with Raw Firmware and use GPT partition scheme. The predefined offset and size of each partition can be found in build/partitions.sh in the SDK. See Partition Offset for more detail.

To flash Partition Image to the eMMC using rkdeveloptool, follow the steps below:

  1. Force the device into Maskrom Mode.

  2. Run:

udev¶

Create /etc/udev/rules.d/99-rk-rockusb.rules with following content1. Replace the group users with your actual Linux group if neccessary:

Reload the udev rules to take effect without reboot:

Partition Offset¶

GPT Partition¶

The offset of partition image can be obained by following command(assuming you are in the directory of Firefly Linux SDK):

which gives result of:

parameter¶

If RK Firmware is used, parameter.txt is used to define partition layout.

Here’s a handy script to list the partition offsets in parameter.txt:

Save it as a script in /usr/local/bin/show_rk_parameter.sh and give the script executing permission.

Here’s an example of showing partition offsets defined in RK3328AndroidSDK:


  • 1Boot introduce
    • 1.2Package option
      • 1.2.1The Pre-bootloader(IDBLoader)
      • 1.2.2U-Boot
      • 1.2.3Trust
  • 2Flash and boot from Media device

First, let's make the concept clear, there are many boot stages when we boot up a Linux OS;

Then we need to know about how the image should packaged, where the image locate;

At last, we will explain how to write to different media and boot from there.

Here is Rockchip pre-released binaries which may be mentioned later:

And Rockcip Linux GPT partition here.

Boot flow

This chapter introduce the generic boot flow for Rockchip Application Processors, including the detail about what image we may use in Rockchip platform for kind of boot path:

- use U-Boot TPL/SPL from upsream or rockchip U-Boot, fully source code;

Upgrade

- use Rockchp idbLoader which is combinded by Rockchip ddr init bin and miniloader bin from Rockchip rkbin project;

Then when we talking about boot from eMMC/SD/U-Disk/net, they are in different concept:

  • Stage 1 is always in boot rom, it loads stage 2 and may load stage 3(when SPL_BACK_TO_BROM option enabled).
  • Boot from SPI flash means firmware for stage 2 and 3(SPL and U-Boot only) in SPI flash and stage 4/5 in other place;
  • Boot from eMMC means all the firmware(including stage 2, 3, 4, 5) in eMMC;
  • Boot from SD card means all the firmware(including stage 2, 3, 4, 5) in SD card;
  • Boot from U-Disk means firmware for stage 4 and 5(not including SPL and U-Boot) in Disk, optionally only including stage 5;
  • Boot from net/tftp means firmeware for stage 4 and 5(not including SPL and U-Boot) on the network;

Boot Flow 1 is typical Rockchip boot flow with Rockchip miniloader;
Boot Flow 2 is used for most SoCs with U-Boot TPL for ddr init and SPL for trust(ATF/OP-TEE) load and run into next stage;
Note 1. If loader1 have more than 1 stage, program will back to bootrom and bootrom load and run into next stage. eg. If loader1 is tpl and spl, the bootrom will run into tpl first, tpl init ddr and back to bootrom, bootrom then load and run into spl.
Note 2. If trust is enabled, loader1 need to load both trust and u-boot, and then run into trust in secure mode(EL3 in armv8), trust do the initialize and run into U-Boot in non-secure mode(EL2 in armv8).
Note 3. For trust(in trust.img or u-boot.itb), armv7 has only one tee.bin with or without ta, armv8 has bl31.elf and option with bl32.
Note 4. In boot.img, content can be zImage and its dtb for Linux, and can optionally be grub.efi, and can be AOSP boot.img, ramdisk is option;

Package option

After we know about the boot stages,

Here are the file list before package for stage 2~4:

  • From source code:
    • From U-Boot: u-boot-spl.bin, u-boot.bin(may use u-boot-nodtb.bin and u-boot.dtb instead),
    • From kernel: kernel Image/zImage file, kernel dtb,
    • From ATF: bl31.elf;
  • From Rockchip binary:
    • ddr, usbplug, miniloader, bl31/op-tee, (all with chip 'rkxx_' prefix and with version '_x.xx.bin' postfix);

We offer two different boot-loader methods for different solutions, the steps and request files are also complete different. But not all the platforms supports the both boot-loader methods. Here are the types to package image from those files:



The Pre-bootloader(IDBLoader)

What is idbloader

idbloader.img is a Rockchip format pre-loader suppose to work at SoC start up, it contains:

- IDBlock header which is known by Rockchip BootRom;

- DRAM init program which is load by MaskRom and running at internal SRAM;

- loader for next stage which is load by MaskRom and running at DDR SDRAM;

You can get idbloader with below methods.

Get idbloader for eMMC from Rockchip release loader

No need to package a idbloader.img for eMMC if you are using Rockchip release loader, you can get idbloader on eMMC with below command:

Package the idbloader.img from Rockchip binary:

For SD boot or eMMC(update with rockusb wl cmd), you need a idbloader(combinded with ddr and miniloader) .

Package the idbloader.img from U-Boot TPL/SPL(which is fully open source):

Flash the idbloader.img to offset 0x40 which including stage 2, and you will need a uboot.img for boot stage 3.

U-Boot

uboot.img

When using idbLoader from Rockchip miniloader, need package u-boot.bin into miniloader loadable format by Rockchip tool loaderimage.

Where SoCs may have different $SYS_TEXT_BASE.

u-boot.itb

When using SPL to load the ATF/OP-TEE, package the bl31.bin, u-boot-nodtb.bin and uboot.dtb into one FIT image. You can skip the step to package the Trust image and flash that image in the next section.

Note: please copy the trust binary() to u-boot root directory and rename it to tee.bin(armv7) or bl31.elf(armv8).

Trust

trust.img

When using idbLoader from Rockchip miniloader, need package bl31.bin into miniloader loadable format by Rockchip tool trustmerge.

Flash the trust.img to offset 0x6000 which is for using Rockchip miniloader

boot.img

This image is package the kernel Image and dtb file into a know filesystem(FAT or EXT2) image for distro boot.

See Install kernel for detail about generate boot.img from kernel zImage/Image, dtb.

Flash the boot.img to offset 0x8000 which is stage 4.

rootfs.img

Flash the rootfs.img to offset 0x40000 which is stage 5. As long as the kernel you chosen can support that filesystem, there is not limit in the format of the image.

rkxx_loader_vx.xx.xxx.bin

This is provide by Rockchip in binary mode, which is used for firmware upgrade to eMMC with rkdeveloptool, can not be wirte to media device directly.

This is a package from ddr.bin, usbplug.bin, miniloader.bin, Rockchip tool DB command will make usbplug.bin running in target which perform as a Rockusb device. You can skip to package this image, Rockchip will offer this image at the most of time.

Here we introduce how to write image to different Medeia device.

Get image Ready:

  • For with SPL:
    • idbloader.img
    • u-boot.itb
    • boot.img or boot folder with Image, dtb and exitlinulx inside
    • rootfs.img
  • For with miniloader
    • idbloader.img
    • uboot.img
    • trust.img
    • boot.img or boot folder with Image, dtb and exitlinulx inside
    • rootfs.img

Boot from eMMC

The eMMC is on the hardware board, so we need:

  • Get the board into maskrom mode;
  • Connect the target to PC with USB cable;
  • Flash the image to eMMC with rkdeveloptool

Example commands for flash image to target.

Flash the gpt partition to target:

  • For with SPL:
  • For with miniloader


Boot from SD/TF Card

We can write SD/TF card with Linux PC dd command very easily.

Insert SD card to PC and we assume the /dev/sdb is the SD card device.

  • For with SPL:
  • For with miniloader:

In order to make sure everything has write to SD card before unpluged, recommand to run below command:

Note, when using boot from SD card, need to update the kernel cmdline(which is in extlinux.conf) for the correct root value.

Write GPT partition table to SD card in U-Boot, and then U-Boot can find the boot partition and run into kernel.

Boot from U-Disk

Same as boot-from-sdcard, but please note that U-Disk only support stage 4 and 5, see Boot Stage for detail.

If U-Disk used for stage 4 and 5, format the U-Disk in gpt format and at least 2 partitions, write boot.img and rootfs.img in those partitions;

if U-Dist is only used for stage 5, we can dd the rootfs.img to U-Disk device directly.

Rockchip Create Upgrade Disk Tool V1.4

Note, need to update the kernel cmdline(which is in extlinux.conf) for the correct root value.

Boot from Network

To be continued.

Retrieved from 'http://opensource.rock-chips.com/index.php?title=Boot_option&oldid=2187'