On Mon, Aug 27, 2018 at 12:21 AM Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> wrote: > > On Thu, Aug 23, 2018 at 08:23:01PM -0700, Andrey Smirnov wrote: > > When booting images that have HDMI firmware embedded we need to skip > > the first v2 header we encounter and get all of the necessary data > > from the next one. Add code implementing that. > > > > Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx> > > --- > > arch/arm/mach-imx/xload-esdhc.c | 43 +++++++++++++++++++++++++-------- > > 1 file changed, 33 insertions(+), 10 deletions(-) > > > > diff --git a/arch/arm/mach-imx/xload-esdhc.c b/arch/arm/mach-imx/xload-esdhc.c > > index 55d6c6929..cab024cfe 100644 > > --- a/arch/arm/mach-imx/xload-esdhc.c > > +++ b/arch/arm/mach-imx/xload-esdhc.c > > @@ -224,24 +224,47 @@ esdhc_start_image(struct esdhc *esdhc, ptrdiff_t address, ptrdiff_t entry, u32 o > > { > > > > void *buf = (void *)address; > > - struct imx_flash_header_v2 *hdr = buf + offset + SZ_1K; > > + struct imx_flash_header_v2 *hdr; > > int ret, len; > > void __noreturn (*bb)(void); > > unsigned int ofs; > > + int i, header_count = 1; > > > > len = imx_image_size(); > > len = ALIGN(len, SECTOR_SIZE); > > > > - ret = esdhc_read_blocks(esdhc, buf, offset + SZ_1K + SECTOR_SIZE); > > - if (ret) > > - return ret; > > + for (i = 0; i < header_count; i++) { > > + ret = esdhc_read_blocks(esdhc, buf, > > + offset + SZ_1K + SECTOR_SIZE); > > + if (ret) > > + return ret; > > > > - if (!is_imx_flash_header_v2(hdr)) { > > - pr_debug("IVT header not found on SD card. " > > - "Found tag: 0x%02x length: 0x%04x version: %02x\n", > > - hdr->header.tag, hdr->header.length, > > - hdr->header.version); > > - return -EINVAL; > > + hdr = buf + offset + SZ_1K; > > + > > + if (!is_imx_flash_header_v2(hdr)) { > > + pr_debug("IVT header not found on SD card. " > > + "Found tag: 0x%02x length: 0x%04x " > > + "version: %02x\n", > > + hdr->header.tag, hdr->header.length, > > + hdr->header.version); > > + return -EINVAL; > > + } > > + > > + if (IS_ENABLED(CONFIG_ARCH_IMX8MQ) && > > + hdr->boot_data.plugin & PLUGIN_HDMI_IMAGE) { > > + /* > > + * In images that include signed HDMI > > + * firmware, first v2 header would be > > + * dedicated to that and would not contain any > > + * useful for us information. In order for us > > + * to pull the rest of the bootloader image > > + * in, we need to re-read header from SD/MMC, > > + * this time skipping anything HDMI firmware > > + * related. > > + */ > > + offset += PLUGIN_HDMI_SIZE; > > + header_count++; > > Wouldn't it be better to get to the second image by reading the size to > skip from the first image rather than adding a fixed offset? Sure, will change in v2. Thanks, Andrey Smirnov _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox