IVT offset in hab_auth_img - i.MX 8MQ

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

IVT offset in hab_auth_img - i.MX 8MQ

跳至解决方案
3,083 次查看
kanimozhi_t
Contributor V

Hi,

    I signed Linux kernel with HAB by following mx8m_secure_boot.txt and trying to authenticate the signing by,

hab_auth_img <Load Address> <Image Size> <IVT Offset>

    This returns "Invalid IVT Structure" Error.

u-boot=> hab_auth_img
hab_auth_img - authenticate image via HAB

Usage:
hab_auth_img addr length ivt_offset
addr - image hex address
length - image hex length
ivt_offset - hex offset of IVT in the image
u-boot=> hab_auth_img 0x40480000 0x1C21020 0x1C21000
hab fuse not enabled

Authenticate image from DDR location 0x40480000...
bad magic magic=0xd5 length=0x4828 version=0x45
bad length magic=0xd5 length=0x4828 version=0x45
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

I want to know,

  1. How to calculate IVT Offset?
  2. Image size for hab_auth_img includes IVT size (0x20)?

Thanks in advance.

标记 (1)
0 项奖励
1 解答
3,024 次查看
kanimozhi_t
Contributor V

To answer my own questions:

  1. How to calculate IVT Offset? - IVT's offset is img_size
  2. Image size for hab_auth_img includes IVT size (0x20)? - Yes

Elaborate answer:

The correct way to use hab_auth_img is as follows,

u-boot=> hab_auth_img <loadaddr> <img_size + ivt_size> <img_size>

1. loadaddr

(in uboot console)

u-boot=> printenv loadaddr

2. img_size

(in host pc's terminal)

hexdump -e '/4 "%X"' -s 12 -n <path_to_kernel_Image>

3. ivt_size - 0x20 (fixed)

在原帖中查看解决方案

0 项奖励
4 回复数
3,025 次查看
kanimozhi_t
Contributor V

To answer my own questions:

  1. How to calculate IVT Offset? - IVT's offset is img_size
  2. Image size for hab_auth_img includes IVT size (0x20)? - Yes

Elaborate answer:

The correct way to use hab_auth_img is as follows,

u-boot=> hab_auth_img <loadaddr> <img_size + ivt_size> <img_size>

1. loadaddr

(in uboot console)

u-boot=> printenv loadaddr

2. img_size

(in host pc's terminal)

hexdump -e '/4 "%X"' -s 12 -n <path_to_kernel_Image>

3. ivt_size - 0x20 (fixed)

0 项奖励
2,375 次查看
flobro
Contributor III

question about solution...


hexdump: invalid number '/media/my-kernel-image'

 So I do :

hexdump -e '/4 "%X"' -s 12 -n my-kernel-image

but hexdump says:
hexdump: invalid number 'my-kernel-image'.

 

Posted solution has some issues.

 

THanks

 

0 项奖励
2,327 次查看
flobro
Contributor III

nevermind... The posted solution should read:

hexdump -e '/4 "%X"' -s 12 -n 8 <kernel-image>

 

Or you can do :

echo 0x$(echo `od -t x4 -j0x10 -N4 <kernel-image> ` | cut -d' ' -f2)

3,079 次查看
igorpadykov
NXP Employee
NXP Employee
0 项奖励