Prerequisites
Rockchip RK3288 firmware consists of multiple partition images. When system configurations are altered or new applications are deployed, the firmware must be regenerated. Typically, only the root filesystem (rootfs.img) requires updating; the remaining partitions can remain untouched. The official Rockchip flashing tool often fails to export images exceeding specific sector limits (such as a rootfs sector count of 0x700000 defined in parameter.txt), making alternative extraction methods necessary.
Synchronizing the Live Filesystem Over Network
Transferring the active filesystem to a host machine via rsync allows for accurate replication. This requires both the target board and the Ubuntu host to share the same local network.
Establishing Network Connectivity
If a physical display is unavailable, configure the wireless interface directly from the serial or SSH terminal. Scan for available access points:
nmcli dev wifi listAuthenticate and connect to a network:
nmcli dev wifi connect "WIFI_SSID" password "WIFI_PASSWORD"Verify the assigned IP address to ensure network access:
ip addr showEnsure the rsync utility and SSH daemon are correctly configured on the board to permit incoming transfers from the host machine.
Constructing the Rootfs Image
Create a directory on the host to receive the board's filesystem data, then pull the files using rsync. Once the data is localized, generate an empty image file using dd:
dd if=/dev/zero of=custom_rootfs.img bs=1M count=3000Format the newly created file and assign a volume label:
mkfs.ext4 -L linuxroot custom_rootfs.imgMount this image to a temporary directory and populate it with the synchronized filesystem files. After the copy completes, unmount the image and minimize its footprint:
e2fsck -f custom_rootfs.img
resize2fs -M custom_rootfs.imgAssembling the Final Firmware
Move the generated custom_rootfs.img into the unpacked Rockchip firmware directory (replacing the old rootfs). Execute the Rockchip packaging script to merge the partitions:
./mkupdate.batThis yields the final update.img, ready to be flashed onto the device using the Rockchip flashing utility.
Modifying an Existing Image Offline
For minor configuration adjustments, manipulating an existing rootfs image directly is more efficient than a full network sync.
Create a mount point and attach the original image:
mkdir -p /media/rootfs_mount
sudo mount -o loop,rw /path/to/original_rootfs.img /media/rootfs_mountNavigate to the mounted directory, apply the necessary file modifications, and unmount:
sudo umount /media/rootfs_mountProceed to rebuild and shrink the image using the same resize2fs process detailed above, followed by the final firmware packaging step.