From 2df6b1fc43ab3cc7b07688a7c8d18f377a754c82 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Sun, 1 Jan 2017 20:46:16 +0100 Subject: imxtools: rework sb file production The old code had some annoying way of dealing with padding by adding explicit instructions to the stream, which is 1) ugly 2) not in par with freescale tools. The trick, which this new version implements, is to put the useful length of the section in the section header, and the actual (with padding) length in the boot tag. This way the tools can just ignore padding instruction by reading the section header, and the bootloader can still load the image because it uses the boot tags. Also correctly handle the case where the first section does not start right after the header (there is a bug in freescale tools for this case by the way). There is an ambiguity in the way the padding instructions should be encrypted: the bootloader should logically treat them as regular instruction of the section stream, but it appears the freescale tools do not generate them as part of the stream and instead encrypt them like boot tags, which is stupid because there is no way the bootloader could decrypt them, and anyway we don't care because the bootloader doesn't decrypt them at all. Change-Id: Iabdc1d1f9f82d374779bf03efb75c2c3998f5b5d --- utils/imxtools/sbtools/sb.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'utils/imxtools/sbtools/sb.h') diff --git a/utils/imxtools/sbtools/sb.h b/utils/imxtools/sbtools/sb.h index cf826362de..9ab7fe7aba 100644 --- a/utils/imxtools/sbtools/sb.h +++ b/utils/imxtools/sbtools/sb.h @@ -195,7 +195,8 @@ struct sb_section_t struct sb_inst_t *insts; /* for production use */ uint32_t file_offset; /* in blocks */ - uint32_t sec_size; /* in blocks */ + uint32_t sec_size; /* in blocks, without padding */ + uint32_t pad_size; /* padding size after the section until next section */ }; struct sb_file_t @@ -217,6 +218,7 @@ struct sb_file_t struct sb_version_t product_ver; struct sb_version_t component_ver; /* for production use */ + int first_boot_sec; /* index in sections[] */ uint32_t image_size; /* in blocks */ }; -- cgit v1.2.3