大家好,
我正在使用 imx6q 设备来实现安全启动。我已经签署了 u-boot 并按照以下步骤操作。但是出现 6 个错误..
安全启动已禁用
HAB 配置:0xf0,HAB 状态:0x66
---------- HAB 事件 1 --------------
事件数据:
0xdb 0x00 0x24 0x42 0x69 0x30 0xe1 0x1d
0x00 0x04 0x00 0x02 0x40 0x00 0x36 0x06
0x55 0x55 0x00 0x03 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x01
STS = HAB_WARNING (0x69)
RSN = HAB_ENG_FAIL (0x30)
CTX = HAB_CTX_ENTRY (0xE1)
ENG = HAB_ENG_CAAM (0x1D)
---------- HAB 事件 2 ------------------
事件数据:
0xdb 0x00 0x08 0x42 0x33 0x22 0x0a 0x00
STS = HAB_FAILURE (0x33)
RSN = HAB_INV_ADDRESS (0x22)
CTX = HAB_CTX_AUTHEN
tiCATE (0x0A)
ENG = HAB_ENG_ANY (0x00)
---------- HAB 事件 3 --------------
事件数据:
0xdb 0x00 0x14 0x42 0x33 0x0c 0xa0 0x00
0x00 0x00 0x00 0x00 0x17 0x7f 0xf4 0x00
0x00 0x00 0x00 0x20
STS = HAB_FAILURE (0x33)
RSN = HAB_INV_ASSERTION (0x0C)
CTX = HAB_CTX_ASSERT (0xA0)
ENG = HAB_ENG_ANY (0x00)
---------- HAB 事件 4 --------------
事件数据:
0xdb 0x00 0x14 0x42 0x33 0x0c 0xa0 0x00
0x00 0x00 0x00 0x00 0x17 0x7f 0xf4 0x2c
0x00 0x00 0x02 0x90
STS = HAB_FAILURE (0x33)
RSN = HAB_INV_ASSERTION (0x0C)
CTX = HAB_CTX_ASSERT (0xA0)
ENG = HAB_ENG_ANY (0x00)
---------- HAB 事件 5 --------------
事件数据:
0xdb 0x00 0x14 0x42 0x33 0x0c 0xa0 0x00
0x00 0x00 0x00 0x00 0x17 0x7f 0xf4 0x20
0x00 0x00 0x00 0x01
STS = HAB_FAILURE (0x33)
RSN = HAB_INV_ASSERTION (0x0C)
CTX = HAB_CTX_ASSERT (0xA0)
ENG = HAB_ENG_ANY (0x00)
---------- HAB 事件 6 --------------
事件数据:
0xdb 0x00 0x14 0x42 0x33 0x0c 0xa0 0x00
0x00 0x00 0x00 0x00 0x17 0x80 0x00 0x00
0x00 0x00 0x00 0x04
STS = HAB_FAILURE (0x33)
RSN = HAB_INV_ASSERTION (0x0C)
CTX = HAB_CTX_ASSERT (0xA0)
ENG = HAB_ENG_ANY (0x00)
实际上有两种事件(HAB_ENG_FAIL 和 HAB_INV_ADDRESS )。HAB事件1我不是很了解, 如果我用u-boot官网的u-boot-2018.05,会有HAB事件2到6,HAB事件1没有了。我真的很担心 HAB_INV_ADDRESS。我通过 od 命令在 u-boot.imx 图像上检查 CSF PTR,它与目标板 eMMC 区域上的值匹配。
$ od -X -N 0x20 u-boot.imx
0000000 402000d1 17800000 00000000 177ff42c
0000020 177ff420 177ff400 178b4000 00000000
0000040
=> MD 0x177ff400
177FF400:402000D1 17800000 00000000 177FF42C .. @....................................................................
177ff410:177ff420 177ff400 178b4000 0000000000000000000000000000000000000000000000 ff42. @.....
177ff420:1777FF420:177FF000 000B500C 000000C 000000000000000409002D2 .. ……P…………@
177ff430:048c02cc 68400c02 3f3fc000 6c400c02……@h..??..@l
177ff440:30fc3000 70400c02 00c0ff0f 74400c02.0.0..@p.. ....@t
177ff450: 0ff0f03f 78400c02 00f3ff00 7c400c02 ?.....@x ......@|
177ff460: c300000f 80400c02 ff030000 60400c02 ......@......@`
177ff470: fb000000 10000e02 cf0000f0 18000e02 ..................
...
=> MD 0x178b400
178b4000: 425000d4 000c00be 00001703 50000000 ..PB......P
178b4010: 020c00be 01000009 90040000 000c00ca ............
178b4020: 001dc501 e40002000 000702000 0 ............
178b4030: e8090000 001400ca 001dc502 3c0d0000 ...............<
178b4040: 00f47f17 004c0b00 1d0800b2 02000000 ......L .........
178b4050: 404004d7 210f01e1 80000000 03000001 ..@@...!......
178b4060: c9a7d4b7 bd2d20b5 31fbf7ac 747d2c6b ...... -....1k,} t
178b4070: 671958b5 783295ec c87a6b80 43432646 .Xg.2x.kz.F&CC
...
此外,您还可以看到目标板上的 CSF 部分中存在有效数据。我在 imximage.cfg 中将 CSF 文件的大小设置为 0x2000。我附上了 csf 文件供您参考。
#Illustrative 命令序列文件说明
[Header]
2 Version = 4.2
3 Hash Algorithm = sha256
4 Engine Configuration = 0
5 Certificate Format = X509
6 Signature Format = CMS
7 Engine = CAAM
8
9 [Install SRK]
10 # SRK表中关键位置的索引installed
11 File = "../../crts/SRK_1_2_3_4_table.bin"
12 Source index = 0
13
14 [Install CSFK]
15 # Key used to authentication the CSF data
16 File = "../../crts/CSF1_1_sha256_4096_65537_v3_usr_crt .pem"
17
18 [Authenticate CSF]
19
20 [Install Key]
21 # key slot index 用于验证要安装的key
22 Verification index = 0
23 # 将安装密钥的 HAB 密钥存储中的目标密钥槽
24 Target Index = 2
25 # 要安装的密钥
26 File= "../../crts/IMG1_1_sha256_4096_65537_v3_usr_crt.pem"
27
28 [Authenticate Data]
29 # Key slot用于验证图像数据的
索引 30 Verification index = 2
31 # Authenticate Start Address, Offset, Length and file
32 #Blocks = 0x177ff400 0x00000000 0x00091c00 "u-boot-dtb.imx"
33 Blocks = 0x177ff400 0x00000000 0x00092c00 "u-boot dtb.imx",
34 0x00910000 0x0000002c 0x000002f8 "u-boot-dtb.imx"
35
36 [解锁]
37 引擎 = CAAM
38 功能 = RNG
以下是生成 u-boot 签名映像文件的几个命令
$ ../linux64/bin/cst --o u-boot_csf.bin --i u-boot.csf
$ objcopy -I binary -O binary --pad-to 0x2000 --gap-fill=0x00 u-boot_csf。 bin u-boot_csf_pad.bin
$ cat u-boot.imx u-boot_csf_pad.bin > u-boot-signed.imx
请就此问题提出建议。