I am working on a system based on i.MX8M Mini, Yocto kirkstone, U-Boot v2021.04. It is derived from the imx8mm-evk machine (in U-Boot v2021.04, the imx8mm-evk-qca-wifi machine).
I'm using meta-freescale branch kirkstone commit 2e785f257a, which in the imx-boot recipe uses imx-mkimage branch lf-5.15.5_1.0.0 commit 22346a32a8.
I have a complete working system, but I want to enable secure boot for U-Boot etc.
I've been following the instructions in the document doc/imx/habv4/guides/mx8m_secure_boot.txt in the U-Boot v2021.04 source code. As described in my other post i.MX8M Mini secure boot Yocto bbappend, I'm trying to use Yocto to build it.
I've reached the step 1.8 "Verifying HAB events". I do the hab_status command, but I get HAB errors:
U-Boot SPL 2021.04-imx_v2021.04_5.15.5-1.0.0+gf7b43f8b4c (Mar 01 2022 - 07:31:56 +0000)
power_bd71837_init
DDRINFO: start DRAM init
DDRINFO: DRAM rate 3000MTS
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
SEC0: RNG instantiated
Normal Boot
Trying to boot from MMC2
hab fuse not enabled
Authenticate image from DDR location 0x401fcdc0...
NOTICE: BL31: v2.4(release):lf-5.15.5-1.0.0-0-g05f788b9b-dirty
NOTICE: BL31: Built : 05:49:10, Mar 2 2022
U-Boot 2021.04-imx_v2021.04_5.15.5-1.0.0+gf7b43f8b4c (Mar 01 2022 - 07:31:56 +0000)
CPU: i.MX8MMQ rev1.0 1600 MHz (running at 1200 MHz)
CPU: Industrial temperature grade (-40C to 105C) at 42C
Reset cause: POR
Model: ----
DRAM: 2 GiB
MMC: FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... *** Warning - bad CRC, using default environment
Fail to setup video link
In: serial
Out: serial
Err: serial
SEC0: RNG instantiated
BuildInfo:
- ATF 05f788b
flash target is MMC:2
Fastboot: Normal
Normal Boot
Autoboot in 3 seconds; press SPACE to abort
u-boot=> hab_status
Secure boot disabled
HAB Configuration: 0xf0, HAB State: 0x66
--------- HAB Event 1 -----------------
event data:
0xdb 0x00 0x14 0x43 0x33 0x0c 0xa0 0x00
0x00 0x00 0x00 0x00 0x40 0x1f 0xdd 0xc0
0x00 0x00 0x00 0x20
STS = HAB_FAILURE (0x33)
RSN = HAB_INV_ASSERTION (0x0C)
CTX = HAB_CTX_ASSERT (0xA0)
ENG = HAB_ENG_ANY (0x00)
--------- HAB Event 2 -----------------
event data:
0xdb 0x00 0x14 0x43 0x33 0x0c 0xa0 0x00
0x00 0x00 0x00 0x00 0x40 0x1f 0xcd 0xc0
0x00 0x00 0x00 0x04
STS = HAB_FAILURE (0x33)
RSN = HAB_INV_ASSERTION (0x0C)
CTX = HAB_CTX_ASSERT (0xA0)
ENG = HAB_ENG_ANY (0x00)
--------- HAB Event 3 -----------------
event data:
0xdb 0x00 0x3c 0x43 0x33 0x18 0xc0 0x00
0xca 0x00 0x34 0x00 0x02 0xc5 0x1d 0x00
0x00 0x00 0x0a 0x30 0x40 0x1f 0xcd 0xc0
0x00 0x00 0x10 0x20 0x40 0x20 0x00 0x00
0x00 0x0d 0x23 0x70 0x40 0x2d 0x23 0x70
0x00 0x00 0xa3 0xca 0x00 0x92 0x00 0x00
0x00 0x00 0xc0 0xc6 0xfe 0x00 0x00 0x00
0x00 0x00 0x00 0x10
STS = HAB_FAILURE (0x33)
RSN = HAB_INV_SIGNATURE (0x18)
CTX = HAB_CTX_COMMAND (0xC0)
ENG = HAB_ENG_ANY (0x00)
u-boot=>
If I understand what I've read elsewhere, this indicates that it's expecting a data block to be signed which is not. If I'm reading the data right, there are two blocks:
- Address 0x401fddc0, size 0x20
- Address 0x401fcdc0, size 0x04
I've got a csf_fit.txt which ends with the following:
[Authenticate Data]
# Key slot index used to authenticate the image data
Verification index = 2
# Authenticate Start Address, Offset, Length and file
Blocks = \
0x401fcdc0 0x57c00 0x1020 "imx-boot-machine-sd.bin-flash_evk", \
0x40200000 0x5B000 0xD2370 "imx-boot-machine-sd.bin-flash_evk", \
0x402D2370 0x12D370 0xA3CA "imx-boot-machine-sd.bin-flash_evk", \
0x920000 0x13773C 0xC0C6 "imx-boot-machine-sd.bin-flash_evk", \
0xFE000000 0x143804 0x10 "imx-boot-machine-sd.bin-flash_evk"
Those blocks were derived from the mkimage output line sld hab block and print_fit_hab.sh as described in the above documentation.
So, what are these other blocks that the HAB seems to want to be signed too?
I found these other posts that are related, but don't answer my question:
Solved: HAB EVENT: HAB_INV_ASSERTION
How to get HAB Authenticate Data block address for i.MX 8M Mini in Yocto