I am working on i.MX 6UltraLite and get the following event:
Secure boot disabled
HAB Configuration: 0xf0, HAB State: 0x66
--------- HAB Event 1 -----------------
event data:
0xdb 0x00 0x08 0x42 0x33 0x05 0x0a 0x00
--------- HAB Event 2 -----------------
event data:
0xdb 0x00 0x1c 0x42 0x33 0x18 0xc0 0x00
0xca 0x00 0x14 0x00 0x00 0xc5 0x1d 0x00
0x00 0x00 0x09 0xd0 0x87 0x7f 0xf4 0x00
0x00 0x03 0x7c 0x00
--------- HAB Event 3 -----------------
event data:
0xdb 0x00 0x14 0x42 0x33 0x0c 0xa0 0x00
0x00 0x00 0x00 0x00 0x87 0x7f 0xf4 0x00
0x00 0x00 0x00 0x20
--------- HAB Event 4 -----------------
event data:
0xdb 0x00 0x14 0x42 0x33 0x0c 0xa0 0x00
0x00 0x00 0x00 0x00 0x87 0x7f 0xf4 0x20
0x00 0x00 0x00 0x01
--------- HAB Event 5 -----------------
event data:
0xdb 0x00 0x14 0x42 0x33 0x0c 0xa0 0x00
0x00 0x00 0x00 0x00 0x87 0x80 0x00 0x00
0x00 0x00 0x00 0x04
--------- HAB Event 6 -----------------
event data:
0xdb 0x00 0x14 0x42 0x33 0x0c 0xa0 0x00
0x00 0x00 0x00 0x00 0x00 0x91 0x00 0x00
0x00 0x00 0x01 0xe8
This is my Usage environment:
CST TOOLS: cst-3.3.2
$ ./hab4_pki_tree.sh
...
Do you want to use an existing CA key (y/n)?: n
Key type options (confirm targeted device supports desired key type):
Select the key type (possible values: rsa, rsa-pss, ecc)?: rsa
Enter key length in bits for PKI tree: 2048
Enter PKI tree duration (years): 20
How many Super Root Keys should be generated? 4
Do you want the SRK certificates to have the CA flag set? (y/n)?:n
U-boot-imge:
Image Type: Freescale IMX Boot Image
Image Ver: 2 (i.MX53/6 compatible)
Mode: DCD
Data Size: 245760 Bytes = 240.00 kB = 0.23 MB
Load Address: 877ff420
Entry Point: 87800000
HAB Blocks: 877ff400 00000000 00037c00
csf.text:
[Header]
Version = 4.2
Hash Algorithm = sha256
Engine Configuration = 0
Certificate Format = X509
Signature Format = CMS
Engine = CAAM
[Install SRK]
# Index of the key location in the SRK table to be installed
File = "../crts/SRK_1_2_3_4_table.bin"
Source index = 0
[Install NOCAK]
File = "../crts/SRK1_sha256_2048_65537_v3_usr_crt.pem"
[Authenticate CSF]
[Authenticate Data]
# Key slot index 0 used to authenticate the image data
Verification index = 0
# Authenticate Start Address, Offset, Length and file
Blocks = 0x877ff400 0x00000000 0x00037c00 "u-boot.imx"
instructions:
../linux64/bin/cst -i uboot-fast.csf -o csf_uboot.bin
cat u-boot.imx csf_uboot.bin > u-boot-signed-mfg.bin
Can you help me see where the problem is?
Hi @Bluelllrrr
Please refer to the document from the link (i.MX6UL bootloader code signing method for UUU too... - NXP Community).
Best regards
Harvey
If I download an unsigned uboot to nandflash first, I can download the new firmware directly through the mfg tool because it is in the close device state, but the tool gets stuck at the loading uboot.Is this due to the signature information verification failing?
But if I download a signed uboot to nandflash, and then enter the download through boot_mode_apply(1), everything is normal at this time.
Why is this?
Is this due to the signature information verification failing?
-> Not signed image can't be loaded in closed device.
Best regards
Harvey
Can you help answer this question?
Only signed images can be loaded in a closed device. use hab_status or hab_auth_img to verify hab events before closing device. we can't restore device once closed.
Reference as below for you.
uboot-imx/doc/imx/habv4/guides/mx6_mx7_secure_boot.txt at lf_v2022.04 · nxp-imx/uboot-imx · GitHub
Best regards
Harvey
How to rewrite data to NandFlash after the u-boot signature verification fails in NANDFLASH. At first, data was written to the specified mtd partition through mfgtool, but after the authentication failed, mfgtool could not be used
mfgtool is a legacy of uuu. To use it, you need to add DCD REMOVE/RESTORE and then add the OCRAM area when signing.
It is recommended to use uuu tool. Releases · nxp-imx/mfgtools · GitHub
Best regards
Harvey
The u-boot image is signed, in recovery mode, I can successfully download to RAM through the mfg tool and run successfully, but if the image signature verification in Nandflash fails, boot failure enters the USB serial download mode, I cannot successfully download it, and the mfs tool stops loading u-boot.
How to solve this problem?
For NAND boot, ROM will read boot_data.size from NAND flash.
Try to dump u-boot layout to check boot_data.size, as its size is larger than u-boot image length.
Then try to objcopy -I binary -O binary --pad-to boot_data.size --gap-fill=0xff u-boot-signed.bin u-boot-signed-pad.bin
boot the u-boot-signed-pad.bin.
Best regards
Harvey
I know how to sign normally, and now I'm more concerned about how to recover from abnormal situations. How do I recover if the firmware in Nandflash is incomplete or the signature is wrong.
In this error case, I use the mfg tool, but I cannot download the new firmware into RAM。
hab_status in two cases:
1、
Secure boot enabled
HAB Configuration: 0xcc, HAB State: 0x99
--------- HAB Event 1 -----------------
event data:
0xdb 0x00 0x08 0x42 0x33 0x05 0x0a 0x00
2、
Secure boot enabled
HAB Configuration: 0xcc, HAB State: 0x99
No HAB Events Found!
The same u-boot firmware, the same board, why are there two hab_status?
Sign u-boot for nandflash and Sign u-boot for mfgtools firmware , Is there a difference between these two signature methods?
I Sign a uboot, If I launch from nandflash, and use boot_mode_apply(1) , wait to download from MFG Tool, Hab Status will have an event. But if launched directly from the mfg tool after downloading, there will be no event.