[rockchip] resource.img 解压及打包

resource_tool

resource_tool 源码位于 /u-boot/tools/resource_tool, 编译uboot后即可生成对应的二进制文件。

解压resource.img

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
sudo resource_tool --verbose --unpack --image=resource.img

[10:35:14][gyl]~/tmp/resource
@ sudo ./resource_tool --verbose --unpack --image=resource.img
Dump header:
partition version:0.0
header size:1
index tbl:
offset:1 entry size:1 entry num:2
Dump Index table:
entry(0):
path:rk-kernel.dtb
offset:3 size:82316
D/dump_file(187): try to dump entry:rk-kernel.dtb
D/mkdirs(175): mkdir:out
entry(1):
path:logo.bmp
offset:164 size:127818
D/dump_file(187): try to dump entry:logo.bmp
D/mkdirs(175): mkdir:out
Unack resource.img to out successed!

生成out目录访问需要root权限

1
2
3
4
5
6
7
8
9
10
11
12
@ ll
total 728
drwxrwxr-x 3 gyl gyl 4096 Nov 22 10:35 ./
drwxrwxr-x 6 gyl gyl 12288 Nov 22 10:34 ../
d--------- 2 root root 4096 Nov 22 10:35 out/
-rw-rw-r-- 1 gyl gyl 211968 Nov 21 15:23 resource.img
-rwxrwxr-x 1 gyl gyl 511440 Nov 15 16:08 resource_tool*

d--------- 2 root root 4096 Nov 22 10:35 ./
drwxrwxr-x 3 gyl gyl 4096 Nov 22 10:35 ../
-rw-r--r-- 1 root root 127818 Nov 22 10:35 logo.bmp
-rw-r--r-- 1 root root 82316 Nov 22 10:35 rk-kernel.dtb

其中logo.bmp 为开机logo, rk-kernel.dtb 为dts的二进制文件

解压dtb

解压dtb需要工具dtc,该工具位于 kernel/scripts/dtc 目录下,编译kernel后即可生成。

1
dtc -I dtb -O dts -o xxx.dts xxx.dtb

##resource.img 打包

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
resource_tool --verbose --pack out/logo.bmp out/rk-kernel.dtb resource.img

D/main(107): try to pack 3 files.
D/write_header(370): try to write header...
D/write_index_tbl(386): try to write index table...
D/get_file_size(322): try to get size(out/rk-kernel.dtb)...
D/get_file_size(328): path:out/rk-kernel.dtb, size:82316
D/write_file(333): try to write file(out/rk-kernel.dtb) to offset:3...
D/get_file_size(322): try to get size(out/rk-kernel.dtb)...
D/get_file_size(328): path:out/rk-kernel.dtb, size:82316
D/write_index_tbl(404): try to write index entry(out/rk-kernel.dtb)...
D/write_index_tbl(422): mod fdt path:out/rk-kernel.dtb -> rk-kernel.dtb...
D/get_file_size(322): try to get size(out/logo.bmp)...
D/get_file_size(328): path:out/logo.bmp, size:127818
D/write_file(333): try to write file(out/logo.bmp) to offset:164...
D/get_file_size(322): try to get size(out/logo.bmp)...
D/get_file_size(328): path:out/logo.bmp, size:127818
D/write_index_tbl(404): try to write index entry(out/logo.bmp)...
Pack to resource.img successed!
您的支持将鼓励我继续创作!