[PATCH] imx-image: Fix uninitialized add_barebox_header

Trent Piepho tpiepho at gmail.com
Tue May 25 23:58:56 PDT 2021


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.

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.

Signed-off-by: Trent Piepho <tpiepho at gmail.com>
---
 scripts/imx/imx-image.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c
index 3e277e82f..b97f56189 100644
--- a/scripts/imx/imx-image.c
+++ b/scripts/imx/imx-image.c
@@ -770,7 +770,7 @@ int main(int argc, char *argv[])
 	int outfd;
 	int dcd_only = 0;
 	int now = 0;
-	int add_barebox_header;
+	int add_barebox_header = 0;
 	uint32_t barebox_image_size = 0;
 	struct config_data data = {
 		.image_ivt_offset = 0xffffffff,
-- 
2.26.2




More information about the barebox mailing list