[PATCH] imx-image: Fix uninitialized add_barebox_header

Sascha Hauer sha at pengutronix.de
Thu May 27 00:11:05 PDT 2021


On Tue, May 25, 2021 at 11:58:56PM -0700, Trent Piepho wrote:
> From: Trent Piepho <tpiepho at gmail.com>
> 
> It's set to 1 if the -b option is used, but is neither initialized nor
> set to 0 if not.  Since the barebox image building recipies only uses -b
> with this tool, it wasn't noticed.

Applied to master, thanks.

> 
> Note that ommiting -b, so as to not add a barebox header, still adds a
> 1024 byte header, it's just blank.  I think it would be better if it was
> not added at all.  If flashing to an SD card or eMMC main block, this
> header overlaps the partition table, and so needs to not be flashed.
> It's not part of the imx image.  It's just padding to place the imx
> image at the correct location w.r.t. the start of flash.

The idea is that you can put the imx image at the beginning of an SD/MMC
card without knowing any offsets. Yes, you'll overwrite the partition
table in that case, but once you know that you can skip/seek 512 bytes
on both the image and the card and be done. Note that with newer i.MX
SoCs like i.MX8 the offset was changed to 33k to support GPT partition
tables. With i.MX8MP they changed the offset again to 32k. I think
Having to know all these offsets is not better than the current
situation.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list