Hi team,
I am trying to sign the u-boot and kernel image and dtb file together using the csf file.
So u-boot signing is done and working except getting one warning . but on kernel signing i am getting error like below.
> hab_auth_img 0x12000000 0x933348
hab fuse not enabled
Authenticate image from DDR location 0x12000000...
bad magic magic=0x0 length=0xa000 version=0xe1
bad length magic=0x0 length=0xa000 version=0xe1
bad version magic=0x0 length=0xa000 version=0xe1
Error: Invalid IVT structure
Allowed IVT structure:
IVT HDR = 0x4X2000D1
IVT ENTRY = 0xXXXXXXXX
IVT RSV1 = 0x0
IVT DCD = 0x0
IVT BOOT_DATA = 0xXXXXXXXX
IVT SELF = 0xXXXXXXXX
IVT CSF = 0xXXXXXXXX
IVT RSV2 = 0x0
MX6 HORIZON U-Boot >
Here my kernel vmlinuz size is
hexdump -C vmlinuz-5.10.158-cip22+mel2 | tail -n 1
00932348
so i padded this to 0x1000 and made it
##objcopy -I binary -O binary --pad-to 0x933348 --gap-fill=0x00 vmlinuz-5.10.158-cip22+mel2 vmlinuz_pad.bin
then create the ivt using genivt.pl
below is content of my
#! /usr/bin/perl -w
use strict;
open(my $out, '>:raw', 'ivt.bin') or die "Unable to open: $!";
print $out pack("V", 0x412000D1); # Signature
print $out pack("V", 0x12000000); # Load Address (*load_address)
print $out pack("V", 0x0); # Reserved
print $out pack("V", 0x0); # DCD pointer
print $out pack("V", 0x0); # Boot Data
#print $out pack("V", 0x80EEA000); # Self Pointer (*ivt)
print $out pack("V", 0x12933348); # Self Pointer (*ivt)
print $out pack("V", 0x12933368); # CSF Pointer (*csf)
print $out pack("V", 0x0); # Reserved
close($out);
Self pointer (ivt) calculate as Load address + padded_image_size(vmlinuxz)
CSF Pointer calculated as Load address + padded_img_size + 0x20
then used below cmd
cat zImage_pad.bin ivt.bin > zImage_pad_ivt.bin
below is my csf-uboot-txt Authentication data content.
[Authenticate Data]
# Key slot index used to authenticate the image data
Verification index = 2
# Authenticate Start Address, Offset, Length and file
# Blocks = 0x877ff400 0x00000000 0x0009ec00 "u-boot-dtb.imx"
Blocks = 0x177ff400 0x00 0x00092c00 "u-boot-dtb.imx", \
0x12000000 0x00 0x00932348 "vmlinuz_pad_ivt.bin"
./cst --i csf_additional_images.txt --o csf_zImage.bin
Attach the CSF binary to the end of the image: $ cat zImage_pad_ivt.bin csf_zImage.bin > zImage_signed.bin
I am loading the kernel image as below.
U-Boot > load mmc 3:1 0x12000000 /boot/zImage_uboot-signed.bin
9650864 bytes read in 298 ms (30.9 MiB/s)
MX6 HORIZON U-Boot >
U-Boot > hab_auth_img 0x12000000 0x933348
hab fuse not enabled
Authenticate image from DDR location 0x12000000...
bad magic magic=0x0 length=0xa000 version=0xe1
bad length magic=0x0 length=0xa000 version=0xe1
bad version magic=0x0 length=0xa000 version=0xe1
Error: Invalid IVT structure
Allowed IVT structure:
IVT HDR = 0x4X2000D1
IVT ENTRY = 0xXXXXXXXX
IVT RSV1 = 0x0
IVT DCD = 0x0
IVT BOOT_DATA = 0xXXXXXXXX
IVT SELF = 0xXXXXXXXX
IVT CSF = 0xXXXXXXXX
IVT RSV2 = 0x0
MX6 HORIZON U-Boot >
Could someone please check this issue, any input would be appreciable.
Regards,
Rk