Export device system¶
When the user has completed the deployment of the working environment on one device, the current environment needs to be exported completely to deploy to other devices in batches. The current development environment can be backed up by exporting the device file system.
Exporting the device system is divided into two steps:
Export the Ubuntu root file system rootfs on the device;
Repackage the complete firmware, combine Ubuntu rootfs with other partitions where the firmware is released, complete the secondary packaging, and generate a new complete firmware.
Export device rootfs¶
Note that the following operations are all performed on the device side.
In the Ubuntu environment of the device, install
fireflydev
:sudo apt update sudo apt install fireflydev
After installing
fireflydev
, you can use theff_export_rootfs
script to export the root file systemIt is recommended to use a mobile hard disk with a larger capacity
The exporter does things like
apt clean
to reduce the filesystem sizeExport the root file system, for example, to the
/media/firefly/AC91-C4AE/
directory (it takes a while):
ff_export_rootfs /media/firefly/AC91-C4AE/
Compress the file system, delete unnecessary blank space to reduce memory resource usage:
# Some customers said that the size of the exported rootfs is 3.3G, but actually only 3G is used, because the rootfs is not compressed e2fsck -p -f Firefly_Ubuntu_18.04.6_rootfs.img resize2fs -M Firefly_Ubuntu_18.04.6_rootfs.img
Second package complete firmware¶
Note that the following operations are all performed on the PC (x86-64 architecture).
Install the necessary packages:
sudo apt-get install lib32stdc++6
Download the secondary packaging tool: firefly-linux-repack
Unzip the secondary packaging tool:
tar -xzf firefly-linux-repack.tgz cd firefly-linux-repack
The directory is as follows:
firefly-linux-repack ├── bin │ ├── afptool │ └── rkImageMaker ├── pack.sh # packaging script ├── Readme_en.md ├── Readme.md └── unpack.sh # unpack script
Unpacking operation: Copy the official Ubuntu firmware to the
firefly-linux-repack
root directory, rename it toupdate.img
, and execute the unpacking scriptunpack.sh
. After the unpacking is complete, the partition files are in theoutput
directory.mv /path/to/ROC-RK3566-PC_Ubuntu18.04-r21156_v1.2.4a_220519.img update.img ./unpack.sh
Packaging operation: Keep the current directory structure and file name unchanged, connect the mobile hard disk to the PC, replace
output/Image/rootfs.img
with the Ubuntu rootfs exported earlier, and then execute the packaging scriptpack.sh
.cp /media/customer/1878-4615/Firefly_Ubuntu_18.04.6_rootfs.img /path/to/firefly-linux-repack/output/Image/rootfs.img ./pack.sh
The new full firmware is
new_update.img
in the current directory.