Preparation:
Concrete steps:
Board enters recovery mode.
sudo reboot recovery
Mount the u-disk to the udisk directory.
mount /path/to/SDCARD /udisk
Back up the root filesystem using the dd command
# These paths can be excluded if needed (choose your own as needed)
/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/boot
root@rk3588:/# dd if=/dev/mmcblk0p6 of=/udisk/youyeetoo-rootfs.img
29360128+0 records in
29360128+0 records out
Go to the /udisk directory to check the image and slim it down
root@rk3588:/udisk# e2fsck -f youyeetoo-rootfs.img
e2fsck 1.46.5 (30-Dec-2021)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
youyeetoo-rootfs.img: 73422/904960 files (0.3% non-contiguous),
889075/3670016 blocks
root@rk3588:/udisk# resize2fs -M youyeetoo-rootfs.img
resize2fs 1.46.5 (30-Dec-2021)
Resizing the filesystem on youyeetoo-rootfs.img to 1046578 (4k) blocks.
The filesystem on youyeetoo-rootfs.img is now 1046578 (4k) blocks long.
After synchronizing, you get the root filesystem as follows
root@rk3588:/udisk# sync
root@rk3588:/udisk# ls -lh
total 4G
-rw-r--r-- 1 root root 4.0G Dec 22 16:00 youyeetoo-rootfs.img
The backed up root filesystem can be repackaged with other partitions to become a full image for batch deployment.
For some customers who need to retain the current board-level configuration information, please follow the following process;
sudo apt-get install lib32stdc++6
tar -xzf yytRepack.tar.gz
# Directory is as follows
$ tree
.
├── bin
│ ├── afptool
│ └── rkImageMaker
├── pack.sh
└── unpack.sh
1 directory, 4 files
cd path/to/yytRepack
mv <sourceDir>/***.img update.img
./unpack.sh
The directory after unpacking is as follows, and each partition file is in the output directory.
$ ls
bin pack.sh unpack.sh update.img
$ ./unpack.sh
start to unpack update.img...
********RKImageMaker ver 1.67********
Unpacking image, please wait...
Exporting boot.bin
Exporting firmware.img
Unpacking image success.
Android Firmware Package Tool v1.67
Check file... OK
------- UNPACK ------
package-file 0x0000000000000800 0x000000000000028B
Image/MiniLoaderAll.bin 0x0000000000001000 0x000000000006F1C0
Image/parameter.txt 0x0000000000070800 0x0000000000000217
Image/uboot.img 0x0000000000071000 0x0000000000400000
Image/misc.img 0x0000000000471000 0x000000000000C000
Image/boot.img 0x000000000047D000 0x00000000022CEC00
Image/recovery.img 0x000000000274C000 0x0000000002BBBC00
Image/rootfs.img 0x0000000005308000 0x00000000F79F7000
Image/oem.img 0x00000000FCCFF000 0x00000000010A6000
Image/userdata.img 0x00000000FDDA5000 0x0000000000444000
Unpack firmware OK!
------ OK ------
Unpacking update.img OK.
Press any key to quit:
$ tree
.
├── bin
│ ├── afptool
│ └── rkImageMaker
├── output
│ ├── Image
│ │ ├── boot.img
│ │ ├── misc.img
│ │ ├── oem.img
│ │ ├── recovery.img
│ │ ├── rootfs.img
│ │ ├── uboot.img
│ │ └── userdata.img
│ ├── MiniLoaderAll.bin
│ ├── package-file
│ └── parameter.txt
├── pack.sh
├── unpack.sh
└── update.img
3 directories, 15 files
Before packaging, back up the root file system with the configured environment from the development board and replace the rootfs.img in the output directory.
cd path/to/yytRepack
cp <sourceDir>/BAK_roots.img ./output/Image/rootfs.img
./pack.sh
After packaging, the directory is as follows
$ ls
bin output pack.sh unpack.sh
$ ./pack.sh
start to make update.img...
Resize rootfs partition
dumpe2fs 1.46.5 (30-Dec-2021)
RK3588
Android Firmware Package Tool v1.67
------ PACKAGE ------
Add file: ./package-file
package-file,Add file: ./package-file
done,offset=0x800,size=0x28b,userspace=0x1
Add file: ./Image/MiniLoaderAll.bin
bootloader,Add file: ./Image/MiniLoaderAll.bin
done,offset=0x1000,size=0x6f1c0,userspace=0xdf
Add file: ./Image/parameter.txt
parameter,Add file: ./Image/parameter.txt
done,offset=0x70800,size=0x21f,userspace=0x1
Add file: ./Image/uboot.img
uboot,Add file: ./Image/uboot.img
done,offset=0x71000,size=0x400000,userspace=0x800
Add file: ./Image/misc.img
misc,Add file: ./Image/misc.img
done,offset=0x471000,size=0xc000,userspace=0x18
Add file: ./Image/boot.img
boot,Add file: ./Image/boot.img
done,offset=0x47d000,size=0x22cec00,userspace=0x459e
Add file: ./Image/recovery.img
recovery,Add file: ./Image/recovery.img
done,offset=0x274c000,size=0x2bbbc00,userspace=0x5778
Add file: ./Image/rootfs.img
rootfs,Add file: ./Image/rootfs.img
done,offset=0x5308000,size=0xf79f7000,userspace=0x1ef3ee
Add file: ./Image/oem.img
oem,Add file: ./Image/oem.img
done,offset=0xfccff000,size=0x10a6000,userspace=0x214c
Add file: ./Image/userdata.img
userdata,Add file: ./Image/userdata.img
done,offset=0xfdda5000,size=0x444000,userspace=0x888
Add CRC...
Make firmware OK!
------ OK ------
********RKImageMaker ver 1.67********
Generating new image, please wait...
Writing head info...
Writing boot file...
Writing firmware...
Generating MD5 data...
MD5 data generated successfully!
New image generated successfully!
Making update.img OK.
/home/.../yytRepack
Press any key to quit:
$ tree
.
├── bin
│ ├── afptool
│ └── rkImageMaker
├── new_update.img
├── output
│ ├── Image
│ │ ├── boot.img
│ │ ├── MiniLoaderAll.bin
│ │ ├── misc.img
│ │ ├── oem.img
│ │ ├── parameter.txt
│ │ ├── parameter.txt.orig
│ │ ├── recovery.img
│ │ ├── rootfs.img
│ │ ├── uboot.img
│ │ └── userdata.img
│ ├── MiniLoaderAll.bin
│ └── package-file
├── pack.sh
└── unpack.sh
3 directories, 17 files