准备工作:
具体步骤:
开发板进入 recovery 模式
sudo reboot recovery
将u盘挂载到 udisk 目录
mount /path/to/SDCARD /udisk
使用 dd 命令备份出来根文件系统
#如有需要,这些路径可以排除(根据需要自己选择)
/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
进入 /udisk 目录检查镜像并瘦身
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.
同步之后得到根文件系统如下
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
备份出来的根文件系统可以再次和其他分区二次打包成为完整镜像进行批量部署。
针对部分客户需要保留当前板级配置信息,请按照如下流程操作
sudo apt-get install lib32stdc++6
tar -xzf yytRepack.tar.gz
# 目录如下
$ tree
.
├── bin
│ ├── afptool
│ └── rkImageMaker
├── pack.sh
└── unpack.sh
1 directory, 4 files
cd path/to/yytRepack
mv <sourceDir>/***.img update.img
./unpack.sh
解包之后目录如下,各分区文件在 output 目录
$ 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
打包之前将已经配置好环境的根文件系统从开发板备份出来替换掉 output 目录中的 rootfs.img
cd path/to/yytRepack
cp <sourceDir>/BAK_roots.img ./output/Image/rootfs.img
./pack.sh
打包之后目录如下
$ 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