Hello,
Here are excerpts from build log
Platform: i.MX8M (mScale)
ROM VERSION: v1
Using FIT image
LOADER IMAGE: u-boot-spl-lpddr4-ddr4.bin start addr: 0x007e1000
SECOND LOADER IMAGE: u-boot-lpddr4-ddr4-evk.itb start addr: 0x40200000 offset: 0x00060000
...
========= OFFSET dump =========
Loader IMAGE:
header_image_off 0x0
dcd_off 0x0
image_off 0x40
csf_off 0x3c000
spl hab block: 0x7e0fc0 0x0 0x3c000
Second Loader IMAGE:
sld_header_off 0x57c00
sld_csf_off 0x58c20
sld hab block: 0x401fcdc0 0x57c00 0x1020
...
u-boot-nodtb.bin + imx8mm-var-dart-customboard.dtb are padded to 722544
TEE_LOAD_ADDR=0xbe000000 ATF_LOAD_ADDR=0x00920000 VERSION=v1 ./print_fit_hab.sh 0x60000 imx8mm-var-dart-customboard.dtb
0x40200000 0x5AC00 0xA8D00
0x402A8D00 0x103900 0x7970
0x920000 0x10B270 0x9300
From above build log I extracted and build following variables
TEE_LOAD_ADDR=0xbe000000
ATF_LOAD_ADDR=0x00920000
HAB_BLK='0x401fcdc0 0x57c00 0x1020'
header_image_off='0x0'
dcd_off='0x0'
image_off='0x40'
csf_off='0x3c000'
spl_hab_block='0x7e0fc0 0x0 0x3c000'
sld_header_off='0x57c00'
sld_csf_off='0x58c20'
sld_hab_block='0x401fcdc0 0x57c00 0x1020'
ADDR_1='0x40200000 0x5AC00 0xA8D00'
ADDR_2='0x402A8D00 0x103900 0x7970'
ADDR_3='0x920000 0x10B270 0x9300'
I generated the keys as:
pushd ./secure_boot/CRT/cst-3.3.2/keys
echo "======================================"
pwd
(
echo n
echo rsa
echo 1024
echo 15
echo 4
echo n
) | ./hab4_pki_tree.sh
popd
Then the pem files
pushd secure_boot/CRT/cst-3.3.2/crts/
echo "WF: $(pwd)"
srktool -h 4 -t SRK_1_2_3_4_table.bin -e \
SRK_1_2_3_4_fuse.bin -d sha256 -c \
SRK1_sha256_1024_65537_v3_usr_crt.pem, \
SRK2_sha256_1024_65537_v3_usr_crt.pem, \
SRK3_sha256_1024_65537_v3_usr_crt.pem, \
SRK4_sha256_1024_65537_v3_usr_crt.pem
FUSE_DIR=$(pwd)
popd
have the generated files files SRK_1_2_3_4_table.bin and SRK_1_2_3_4_fuse.bin
I copied all generated files in a folder called secure_boot
-rwxrwxr-x 1 marius marius 37632 Jun 26 17:17 bl31.bin
drwxrwxr-x 3 marius marius 4096 Jun 24 21:56 CRT
drwxrwxr-x 2 marius marius 4096 Jun 24 21:56 CSF
-rw-rw-r-- 1 marius marius 1150 Jun 26 17:17 csf_fit.txt
-rw-rw-r-- 1 marius marius 1112 Jun 26 17:17 csf_spl.txt
-rw-rw-r-- 1 marius marius 1163384 Jun 26 17:17 flash.bin
-rwxrwxr-x 1 marius marius 404 Jun 26 17:17 gen_addr.sh
-rw-rw-r-- 1 marius marius 297 Jun 24 21:56 gen_addr.txt
-rwxrwxr-x 1 marius marius 2378 Jun 26 15:45 print_fit_hab.sh
-rw-rw-r-- 1 marius marius 32 Jun 26 17:17 SRK_1_2_3_4_fuse.bin
-rw-rw-r-- 1 marius marius 147 Jun 26 17:17 SRK_1_2_3_4_table.bin
-rwxrwxr-x 1 marius marius 691456 Jun 26 17:17 u-boot-nodtb.bin
Ans compiled the csf_fit.txt and csf_spl.txt
#################### csf_spl.txt ###########################
[Header]
Version = 4.3
Hash Algorithm = sha256
Engine = CAAM
Engine Configuration = 0
Certificate Format = X509
Signature Format = CMS
[Install SRK]
# Index of the key location in the SRK table to be installed
File = "./SRK_1_2_3_4_table.bin"
Source index = 0
[Install CSFK]
# Key used to authenticate the CSF data
File = "./CRT/cst-3.3.2/crts/CSF1_1_sha256_1024_65537_v3_usr_crt.pem"
[Authenticate CSF]
[Unlock]
# Leave Job Ring and DECO master ID registers Unlocked
Engine = CAAM
Features = MID
[Install Key]
# Key slot index used to authenticate the key to be installed
Verification index = 0
# Target key slot in HAB key store where key will be installed
Target index = 2
# Key to install
File = "./CRT/cst-3.3.2/crts/IMG1_1_sha256_1024_65537_v3_usr_crt.pem"
[Authenticate Data]
# Key slot index used to authenticate the image data
Verification index = 2
# Authenticate Start Address, Offset, Length and file
# spl hab block: 0x7e0fc0 0x0 0x3c000, from build log
Blocks = 0x7e0fc0 0x0 0x3c000 "flash.bin"
#################### csf_fit.txt ###########################
[Header]
Version = 4.3
Hash Algorithm = sha256
Engine = CAAM
Engine Configuration = 0
Certificate Format = X509
Signature Format = CMS
[Install SRK]
# Index of the key location in the SRK table to be installed
File = "./SRK_1_2_3_4_table.bin"
Source index = 0
[Install CSFK]
# Key used to authenticate the CSF data
File = "./CRT/cst-3.3.2/crts/CSF1_1_sha256_1024_65537_v3_usr_crt.pem"
[Authenticate CSF]
[Install Key]
# Key slot index used to authenticate the key to be installed
Verification index = 0
# Target key slot in HAB key store where key will be installed
Target index = 2
# Key to install
File = "./CRT/cst-3.3.2/crts/IMG1_1_sha256_1024_65537_v3_usr_crt.pem"
[Authenticate Data]
# Key slot index used to authenticate the image data
Verification index = 2
# Authenticate Start Address, Offset, Length and file
# sld hab block: 0x401fcdc0 0x57c00 0x1020, from build log
Blocks = 0x401fcdc0 0x57c00 0x1020 "flash.bin", \
0x40200000 0x5AC00 0xA8D00 "flash.bin", \
0x402A8D00 0x103900 0x7970 "flash.bin", \
0x920000 0x10B270 0x9300 "flash.bin"
- Complied them, or whatever cst does
- cst -i csf_spl.txt -o csf_spl.bin
cst -i csf_fit.txt -o csf_fit.bin
building the signed flash.bin
cd releases
cp ./flash.bin ./signed_flash.bin
dd if=./csf_spl.bin of=signed_flash.bin seek=$((csf_off)) bs=1 conv=notrunc
dd if=./csf_fit.bin of=signed_flash.bin seek=$((sld_csf_off)) bs=1 conv=notrunc
where
csf_off are the one from above as
csf_off=0x3c000
sld_csf_off=0x58c20
Then burned u-boot into emmc dd if=./signed_flash.bin of=${1} bs=1024 seek=33 conv=notrunc
Upon U-boot prompt I get error 33
Secure boot disabled
HAB Configuration: 0xf0, HAB State: 0x66
--------- HAB Event 1 -----------------
event data:
0xdb 0x00 0x14 0x43 0x33 0x1d 0xc0 0x00
0xbe 0x00 0x0c 0x02 0x09 0x00 0x00 0x01
0x00 0x00 0x00 0xfc
STS = HAB_FAILURE (0x33)
RSN = HAB_INV_KEY (0x1D)
CTX = HAB_CTX_COMMAND (0xC0)
ENG = HAB_ENG_ANY (0x00)
--------- HAB Event 2 -----------------
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 3 -----------------
event data:
0xdb 0x00 0x14 0x43 0x33 0x0c 0xa0 0x00
0x00 0x00 0x00 0x00 0x00 0x7e 0x0f 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 4 -----------------
event data:
0xdb 0x00 0x14 0x43 0x33 0x0c 0xa0 0x00
0x00 0x00 0x00 0x00 0x00 0x7e 0x0f 0xe0
0x00 0x00 0x00 0x01
STS = HAB_FAILURE (0x33)
RSN = HAB_INV_ASSERTION (0x0C)
CTX = HAB_CTX_ASSERT (0xA0)
ENG = HAB_ENG_ANY (0x00)
--------- HAB Event 5 -----------------
event data:
0xdb 0x00 0x14 0x43 0x33 0x0c 0xa0 0x00
0x00 0x00 0x00 0x00 0x00 0x7e 0x10 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 Event 6 -----------------
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 7 -----------------
event data:
0xdb 0x00 0x14 0x43 0x33 0x1d 0xc0 0x00
0xbe 0x00 0x0c 0x02 0x09 0x00 0x00 0x01
0x00 0x00 0x00 0xec
STS = HAB_FAILURE (0x33)
RSN = HAB_INV_KEY (0x1D)
Any help would be appreciated