Skip to main content

Flashing Firmware

Use this procedure when you need to reflash an Omega4 completely (bootloader, kernel, and rootfs). It assumes you have the official image set for your hardware revision and a host machine with upgrade_tool available. Official firmware builds are published at https://github.com/OnionIoT/openwrt-omega4/releases.

Risk of data loss

This flow rewrites all partitions. Back up any calibration or custom data first and double-check that the offsets below match the release notes for your image set.

Before you start

  • A serial console connected so you can watch boot messages.
  • The BOOT button reachable on your board.

Step 1: Enter flashing mode

  1. Hold the BOOT button while powering on the Omega4.

  2. Watch the serial console; you should see:

    RKUART

    This confirms the device is ready to accept images.

Step 2: Flash the firmware

Run the commands below from the directory containing your images. Always load download.bin after each time you enter flashing mode, even if you only plan to rewrite one partition.

./upgrade_tool db download.bin
./upgrade_tool wl 0x0 0x200 env.img
./upgrade_tool wl 0xa00 0x800 uboot.img
./upgrade_tool wl 0x1200 0x4000 boot.img
./upgrade_tool wl 0x5200 -1 rootfs.img
./upgrade_tool rd
  • Offsets and sizes are in LBAs (512-byte blocks) and match the table below; confirm against the release notes for your board and adjust if the layout changes.
  • You can flash partitions individually, but download.bin must be loaded every session.

UBI rootfs mount errors

If the boot log shows a UBI attach failure similar to:

[    3.982794] ubi0 error: ubi_read_volume_table: bad attaching information, error 1
[ 3.991208] Volume attaching information dump:
[ 3.996177] vol_id 0
[ 3.999491] highest_lnum 59
[ 4.002901] leb_count 60
[ 4.006311] compat 0
[ 4.009624] vol_type 3
[ 4.012937] used_ebs 0
[ 4.016250] last_data_size 0
[ 4.019561] data_pad 0
[ 4.022875] Volume information dump:
[ 4.026867] vol_id 0
[ 4.030277] reserved_pebs 59
[ 4.033783] alignment 1
[ 4.037194] data_pad 0
[ 4.040603] vol_type 3
[ 4.044014] name_len 6
[ 4.047422] usable_leb_size 126976
[ 4.051320] used_ebs 59
[ 4.054826] used_bytes 7491584
[ 4.058820] last_eb_bytes 126976
[ 4.062715] corrupted 0
[ 4.066124] upd_marker 0
[ 4.069533] skip_check 0
[ 4.072944] name rootfs
[ 4.077298] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd4, error -22

Erase the UBI region before reflashing the rootfs to clear stale metadata:

./upgrade_tool db download.bin
./upgrade_tool el 0x5200 0x80000

Then rerun the rootfs write command from the table above. This forces a clean UBI attach on the next boot.

Partition Info:

NOLBASizeNameSize (MB)
010x000000000x00000200env0.25
020x000002000x00000800idblock1
030x00000a000x00000800uboot1
040x000012000x00004000boot8
050x000052000x0007ae00ubi245.75