diff options
author | Holger Dengler <dengler@linutronix.de> | 2018-07-06 16:10:00 +0200 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2018-07-23 11:04:22 +0200 |
commit | 7e1a0483c36a8a53c207123262a1d108588517ad (patch) | |
tree | 8ef2c99b95bdb945398b784f3ea8be24abe1427a | |
parent | e16f2de0c48fdaab461ecd4d6f1890fbdaf5ef63 (diff) |
tools/imximage: get HAB information from header
Signing parts of a u-boot imximage for image verification in High
Assurance Boot (HAB) in a post-build process, requires some
information from the imximage header. Currently, this information is
only provided during the image build, which makes the transfer of this
information to the post-build process harder than necessary.
The i.MX HAB information (start and length) can be calculated either
by using information from the image-configuration file, or from the
information in the flash header of the imximage.
The advantage of using information from flash header is, that they are
not only available during image creation, but also available if
existing images are processed.
Example:
$ tools/mkimage -l u-boot.imx
Image Type: Freescale IMX Boot Image
Image Ver: 2 (i.MX53/6/7 compatible)
Mode: DCD
Data Size: 483328 Bytes = 472.00 KiB = 0.46 MiB
Load Address: 877ff420
Entry Point: 87800000
HAB Blocks: 0x877ff400 0x00000000 0x00071c00
DCD Blocks: 0x00910000 0x0000002c 0x00000208
Signed-off-by: Holger Dengler <dengler@linutronix.de>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
-rw-r--r-- | tools/imximage.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/imximage.c b/tools/imximage.c index 5f63bf87594..d7c0b6e883f 100644 --- a/tools/imximage.c +++ b/tools/imximage.c @@ -506,8 +506,7 @@ static void print_hdr_v2(struct imx_header *imx_hdr) genimg_print_size(hdr_v2->boot_data.size); printf("Load Address: %08x\n", (uint32_t)fhdr_v2->boot_data_ptr); printf("Entry Point: %08x\n", (uint32_t)fhdr_v2->entry); - if (fhdr_v2->csf && (imximage_ivt_offset != UNDEFINED) && - (imximage_csf_size != UNDEFINED)) { + if (fhdr_v2->csf) { uint16_t dcdlen; int offs; @@ -515,10 +514,16 @@ static void print_hdr_v2(struct imx_header *imx_hdr) offs = (char *)&hdr_v2->data.dcd_table - (char *)hdr_v2; + /* + * The HAB block is the first part of the image, from + * start of IVT header (fhdr_v2->self) to the start of + * the CSF block (fhdr_v2->csf). So HAB size is + * calculated as: + * HAB_size = fhdr_v2->csf - fhdr_v2->self + */ printf("HAB Blocks: 0x%08x 0x%08x 0x%08x\n", (uint32_t)fhdr_v2->self, 0, - hdr_v2->boot_data.size - imximage_ivt_offset - - imximage_csf_size); + (uint32_t)(fhdr_v2->csf - fhdr_v2->self)); printf("DCD Blocks: 0x00910000 0x%08x 0x%08x\n", offs, be16_to_cpu(dcdlen)); } |