• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
11、本工具用于HVB格式的镜像签名
2
3 - hvbtool.py  镜像签名脚本,是签名工具的执行脚本
4
5
6
72、使用方法
8
9 - hash类镜像签名
10
11   ./hvbtool.py make_hash_footer --image xxx.img                             //待签名镜像
12
13   ​                                                        --partition xxx                                 //分区名
14
15   ​                                                        --partition_size 31457280             //分区大小
16
17   ​                                                        --salt xxxxxxxxxxxxxxxx                //盐值
18
19   ​                                                        --pubkey xxx_pub.pem                 //公钥key
20
21   ​                                                        --privkey xxx_priv.pem                  //私钥key
22
23   ​                                                        --algorithm SHA256_RSA2048     //签名算法
24
25   ​                                                        --rollback_index                             //防回滚号
26
27   ​                                                        --rollback_location                         //防回滚号存放位置
28
29   ​                                                        --output xxx.img                            //签名后镜像
30
31   e.g.    ./hvbtool.py make_hash_footer --image boot.img --partition boot --partition_size 31457280 --salt 9f3a79b7f2bad5adb086bcb8cf37f991733f2696 --pubkey boot_pub.pem --privkey boot_priv.pem --algorithm SHA256_RSA2048 --rollback_index 0 --rollback_location 1 --output ./signed_boot.img
32
33
34
35 - hashtree类镜像签名
36
37   ./hvbtool.py make_hashtree_footer --image xxx.img                       //待签名镜像
38
39   ​                                                        --partition xxx                                  //分区名
40
41   ​                                                        --partition_size 3724541952         //分区大小
42
43   ​                                                        --salt xxxxxxxxxxxxxxxx                //盐值
44
45   ​                                                        --pubkey xxx_pub.pem                 //公钥key
46
47   ​                                                        --privkey xxx_priv.pem                  //私钥key
48
49   ​                                                        --algorithm SHA256_RSA2048     //签名算法
50
51   ​                                                        --rollback_index                             //防回滚号
52
53   ​                                                        --rollback_location                         //防回滚号存放位置
54
55   ​                                                        --output xxx.img                            //签名后镜像
56
57   e.g.    ./hvbtool.py make_hashtree_footer --image system.img --partition system --partition_size 3724541952 --salt 9f3a79b7f2bad5adb086bcb8cf37f991733f2696 --pubkey system_pub.pem --privkey system_priv.pem --algorithm SHA256_RSA2048  --rollback_index 0 --rollback_location 1 --output ./signed_system.img
58
59
60
61 - 制作rvt镜像
62
63   ./hvbtool.py mak_rvt_image --partition rvt                                       //rvt分区
64
65   ​                                                  --partition_size 4194304                    //分区大小
66
67   ​                                                  --salt xxxxxxxxxxxxxxxxx                   //盐值
68
69   ​                                                  --pubkey xxx_pub.pem                      //公钥key
70
71   ​                                                  --privkey xxx_priv.pem                       //私钥key
72
73   ​                                                  --algorithm SHA256_RSA2048           //签名算法
74
75   ​                                                  --rollback_index                                   //防回滚号
76
77   ​                                                  --rollback_location                              //防回滚号存放位置
78
79   ​                                                  --chain_partition xxx:xxx_pubkey.pem
80
81   ​                                                                                                                 //校验链路的分区:公钥,可以有多个,
82
83   ​                                                                                                                 //每个chain_partition表示一个分区
84
85   ​                                                  --output rvt.img                                   //输出rvt镜像
86
87
88
89   e.g.    ./hvbtool.py make_rvt_image --salt 9f3a79b7f2bad5adb086bcb8cf37f991733f2696 --pubkey test_pub.pem --privkey test_priv.pem --partition rvt --partition_size 4194304 --algorithm SHA256_RSA2048 --rollback_index 0 --rollback_location 1 --chain_partition boot:boot_pub.pem --chain_partition ramdisk:ramdisk_pub.pem --chain_partition eng_vendor:eng_vendor_pub.pem  --chain_partition eng_system:eng_system_pub.pem --output ./rvt.img
90
91
92
93 - 解析hvb镜像
94
95   ./hvbtool.py parse_image --image xxx.img                  //待解析的hvb签名镜像
96
97   e.g.    ./hvbtool.py parse_image --image odm.img
98
99
100
101 - 擦除签名镜像的footer及签名内容
102
103   ./hvbtool.py erase_image --image xxx.img                //待擦除的hvb签名镜像
104
105   e.g.    ./hvbtool.py erase_image --image odm.img
106
1073、注意事项
108
109 - 需要python3. 0.0以上的版本
110 - 待签名镜像可以放在任意目录,执行脚本时,传入绝对路径或相对路径皆可
111 - 执行hvbtool.py脚本时,各参数间用空格隔开,不能换行
112