[PATCH v2 13/23] scripts: imx-image: header_v2: factor out offset parameter

Marco Felsch m.felsch at pengutronix.de
Mon Mar 13 06:41:52 PDT 2023


Make the offset variable a parameter to make it possible to write
multiple ivt headers on multiple offsets. While on it use uint32_t
to match the data.image_ivt_offset type.

Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
 scripts/imx/imx-image.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c
index 3da2b81841..fd8dc23cf9 100644
--- a/scripts/imx/imx-image.c
+++ b/scripts/imx/imx-image.c
@@ -295,11 +295,11 @@ static int write_mem_v1(uint32_t addr, uint32_t val, int width, int set_bits, in
  * ============================================================================
  */
 
-static size_t add_header_v2(const struct config_data *data, void *buf)
+static size_t
+add_header_v2(const struct config_data *data, void *buf, uint32_t offset)
 {
 	struct imx_flash_header_v2 *hdr;
 	int dcdsize = curdcd * sizeof(uint32_t);
-	int offset = data->image_ivt_offset;
 	uint32_t loadaddr = data->image_load_addr;
 	uint32_t imagesize = data->load_size;
 
@@ -905,7 +905,8 @@ int main(int argc, char *argv[])
 		}
 
 		barebox_image_size += add_header_v2(&data, buf +
-						    signed_hdmi_firmware_size);
+						    signed_hdmi_firmware_size,
+						    data.image_ivt_offset);
 		break;
 	default:
 		fprintf(stderr, "Congratulations! You're welcome to implement header version %d\n",

-- 
2.30.2




More information about the barebox mailing list