Skip to contentSkip to conversation

tools/imximage: set DCD pointer to NULL when its length is 0

PATCH RESEND Superseded Baruch Siach 2 participants 6 messages Jul 9, 2015 – Aug 3, 2015 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 tools/imximage: set DCD pointer to NULL when its length is 0

When dcd_len is 0 the Write Data command that the set_dcd_rst_v2() routine generates is empty. This causes HAB to complain that the command is invalid.

--------- HAB Event 1 -----------------
event data:

	0xdb 0x00 0x0c 0x41 0x33 0x06 0xc0 0x00
	0xcc 0x00 0x04 0x04

To fix this set the DCD pointer in the IVT to NULL in this case. The DCD header itself is still needed for detect_imximage_version() to determine the image version.

---
Resending with a proper To: header.

 tools/imximage.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/imximage.c +5 -1
index 6f469ae6336c..7b91d09699ad 100644
@@ -250,7 +250,11 @@ static void set_imx_hdr_v2(struct imx_header *imxhdr, uint32_t dcd_len,
 	hdr_base = entry_point - imximage_init_loadsize +
 		flash_offset;
 	fhdr_v2->self = hdr_base;
-	fhdr_v2->dcd_ptr = hdr_base + offsetof(imx_header_v2_t, dcd_table);
+	if (dcd_len > 0)
+		fhdr_v2->dcd_ptr = hdr_base
+			+ offsetof(imx_header_v2_t, dcd_table);
+	else
+		fhdr_v2->dcd_ptr = 0;
 	fhdr_v2->boot_data_ptr = hdr_base
 			+ offsetof(imx_header_v2_t, boot_data);
 	hdr_v2->boot_data.start = entry_point - imximage_init_loadsize;
Signature · 1 line
2.1.4
#1 lore raw

PATCH RESEND 1/1 tools/imximage: set DCD pointer to NULL when its length is 0

Hi Baruch,

Quoted 27 lines · Baruch Siach

When dcd_len is 0 the Write Data command that the set_dcd_rst_v2() routine generates is empty. This causes HAB to complain that the command is invalid.

--------- HAB Event 1 -----------------
event data:

	0xdb 0x00 0x0c 0x41 0x33 0x06 0xc0 0x00
	0xcc 0x00 0x04 0x04

To fix this set the DCD pointer in the IVT to NULL in this case. The DCD header itself is still needed for detect_imximage_version() to determine the image version.

---
Resending with a proper To: header.

 tools/imximage.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/imximage.c +0 -0
index 6f469ae6336c..7b91d09699ad 100644
@@ -250,7 +250,11 @@ static void set_imx_hdr_v2(struct imx_header *imxhdr, uint32_t dcd_len,
 	hdr_base = entry_point - imximage_init_loadsize +
 		flash_offset;

tools/imximage.c static void set_imx_hdr_v2(struct imx_header *imxhdr, uint32_t dcd_len, · line 260

Quoted 10 lines
tools/imximage.c +5 -1
 	fhdr_v2->self = hdr_base;
-	fhdr_v2->dcd_ptr = hdr_base + offsetof(imx_header_v2_t, dcd_table);
+	if (dcd_len > 0)
+		fhdr_v2->dcd_ptr = hdr_base
+			+ offsetof(imx_header_v2_t, dcd_table);
+	else
+		fhdr_v2->dcd_ptr = 0;
 	fhdr_v2->boot_data_ptr = hdr_base
 			+ offsetof(imx_header_v2_t, boot_data);
 	hdr_v2->boot_data.start = entry_point - imximage_init_loadsize;

It looks ok for me.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#2 lore raw

PATCH RESEND 1/1 tools/imximage: set DCD pointer to NULL when its length is 0

Hi Stefano,

Quoted 41 lines · Stefano Babic
Quoted 27 lines · Baruch Siach

When dcd_len is 0 the Write Data command that the set_dcd_rst_v2() routine generates is empty. This causes HAB to complain that the command is invalid.

--------- HAB Event 1 -----------------
event data:

	0xdb 0x00 0x0c 0x41 0x33 0x06 0xc0 0x00
	0xcc 0x00 0x04 0x04

To fix this set the DCD pointer in the IVT to NULL in this case. The DCD header itself is still needed for detect_imximage_version() to determine the image version.

---
Resending with a proper To: header.

 tools/imximage.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/imximage.c +0 -0
index 6f469ae6336c..7b91d09699ad 100644
@@ -250,7 +250,11 @@ static void set_imx_hdr_v2(struct imx_header *imxhdr, uint32_t dcd_len,
 	hdr_base = entry_point - imximage_init_loadsize +
 		flash_offset;

tools/imximage.c static void set_imx_hdr_v2(struct imx_header *imxhdr, uint32_t dcd_len, · line 260

Quoted 10 lines
tools/imximage.c +5 -1
 	fhdr_v2->self = hdr_base;
-	fhdr_v2->dcd_ptr = hdr_base + offsetof(imx_header_v2_t, dcd_table);
+	if (dcd_len > 0)
+		fhdr_v2->dcd_ptr = hdr_base
+			+ offsetof(imx_header_v2_t, dcd_table);
+	else
+		fhdr_v2->dcd_ptr = 0;
 	fhdr_v2->boot_data_ptr = hdr_base
 			+ offsetof(imx_header_v2_t, boot_data);
 	hdr_v2->boot_data.start = entry_point - imximage_init_loadsize;

It looks ok for me.

Quoted 1 line

Thanks.

Which tree is this patch going through?

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#3 lore raw

PATCH RESEND 1/1 tools/imximage: set DCD pointer to NULL when its length is 0

Quoted 44 lines · Baruch Siach

Hi Stefano,

Quoted 41 lines · Stefano Babic
Quoted 27 lines · Baruch Siach

When dcd_len is 0 the Write Data command that the set_dcd_rst_v2() routine generates is empty. This causes HAB to complain that the command is invalid.

--------- HAB Event 1 -----------------
event data:

	0xdb 0x00 0x0c 0x41 0x33 0x06 0xc0 0x00
	0xcc 0x00 0x04 0x04

To fix this set the DCD pointer in the IVT to NULL in this case. The DCD header itself is still needed for detect_imximage_version() to determine the image version.

---
Resending with a proper To: header.

 tools/imximage.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/imximage.c +0 -0
index 6f469ae6336c..7b91d09699ad 100644
@@ -250,7 +250,11 @@ static void set_imx_hdr_v2(struct imx_header *imxhdr, uint32_t dcd_len,
 	hdr_base = entry_point - imximage_init_loadsize +
 		flash_offset;

tools/imximage.c static void set_imx_hdr_v2(struct imx_header *imxhdr, uint32_t dcd_len, · line 260

Quoted 10 lines
tools/imximage.c +5 -1
 	fhdr_v2->self = hdr_base;
-	fhdr_v2->dcd_ptr = hdr_base + offsetof(imx_header_v2_t, dcd_table);
+	if (dcd_len > 0)
+		fhdr_v2->dcd_ptr = hdr_base
+			+ offsetof(imx_header_v2_t, dcd_table);
+	else
+		fhdr_v2->dcd_ptr = 0;
 	fhdr_v2->boot_data_ptr = hdr_base
 			+ offsetof(imx_header_v2_t, boot_data);
 	hdr_v2->boot_data.start = entry_point - imximage_init_loadsize;

It looks ok for me.

Quoted 5 lines
Quoted 1 line

Thanks.

Which tree is this patch going through?

This goes first into u-boot-imx, until I'll send a PR to Tom for inclusion in his tree,

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#4 lore raw

PATCH RESEND 1/1 tools/imximage: set DCD pointer to NULL when its length is 0

Hi Stefano,

Quoted 42 lines · Stefano Babic
Quoted 41 lines · Baruch Siach
Quoted 40 lines · Stefano Babic
Quoted 26 lines · Baruch Siach

When dcd_len is 0 the Write Data command that the set_dcd_rst_v2() routine generates is empty. This causes HAB to complain that the command is invalid.

--------- HAB Event 1 -----------------
event data:

	0xdb 0x00 0x0c 0x41 0x33 0x06 0xc0 0x00
	0xcc 0x00 0x04 0x04

To fix this set the DCD pointer in the IVT to NULL in this case. The DCD header itself is still needed for detect_imximage_version() to determine the image version.

---
Resending with a proper To: header.

 tools/imximage.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/imximage.c +0 -0
index 6f469ae6336c..7b91d09699ad 100644
@@ -250,7 +250,11 @@ static void set_imx_hdr_v2(struct imx_header *imxhdr, uint32_t dcd_len,
 	hdr_base = entry_point - imximage_init_loadsize +
 		flash_offset;

tools/imximage.c static void set_imx_hdr_v2(struct imx_header *imxhdr, uint32_t dcd_len, · line 260

Quoted 10 lines
tools/imximage.c +5 -1
 	fhdr_v2->self = hdr_base;
-	fhdr_v2->dcd_ptr = hdr_base + offsetof(imx_header_v2_t, dcd_table);
+	if (dcd_len > 0)
+		fhdr_v2->dcd_ptr = hdr_base
+			+ offsetof(imx_header_v2_t, dcd_table);
+	else
+		fhdr_v2->dcd_ptr = 0;
 	fhdr_v2->boot_data_ptr = hdr_base
 			+ offsetof(imx_header_v2_t, boot_data);
 	hdr_v2->boot_data.start = entry_point - imximage_init_loadsize;

It looks ok for me.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Which tree is this patch going through?

This goes first into u-boot-imx, until I'll send a PR to Tom for inclusion in his tree,

Thanks again. Is there a reason this patch is not in the u-boot-imx git tree?

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#5 lore raw

PATCH RESEND 1/1 tools/imximage: set DCD pointer to NULL when its length is 0

Hi Baruch,

Quoted 45 lines · Baruch Siach

Hi Stefano,

Quoted 42 lines · Stefano Babic
Quoted 41 lines · Baruch Siach
Quoted 40 lines · Stefano Babic
Quoted 26 lines · Baruch Siach

When dcd_len is 0 the Write Data command that the set_dcd_rst_v2() routine generates is empty. This causes HAB to complain that the command is invalid.

--------- HAB Event 1 -----------------
event data:

	0xdb 0x00 0x0c 0x41 0x33 0x06 0xc0 0x00
	0xcc 0x00 0x04 0x04

To fix this set the DCD pointer in the IVT to NULL in this case. The DCD header itself is still needed for detect_imximage_version() to determine the image version.

---
Resending with a proper To: header.

 tools/imximage.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/imximage.c +0 -0
index 6f469ae6336c..7b91d09699ad 100644
@@ -250,7 +250,11 @@ static void set_imx_hdr_v2(struct imx_header *imxhdr, uint32_t dcd_len,
 	hdr_base = entry_point - imximage_init_loadsize +
 		flash_offset;

tools/imximage.c static void set_imx_hdr_v2(struct imx_header *imxhdr, uint32_t dcd_len, · line 260

Quoted 10 lines
tools/imximage.c +5 -1
 	fhdr_v2->self = hdr_base;
-	fhdr_v2->dcd_ptr = hdr_base + offsetof(imx_header_v2_t, dcd_table);
+	if (dcd_len > 0)
+		fhdr_v2->dcd_ptr = hdr_base
+			+ offsetof(imx_header_v2_t, dcd_table);
+	else
+		fhdr_v2->dcd_ptr = 0;
 	fhdr_v2->boot_data_ptr = hdr_base
 			+ offsetof(imx_header_v2_t, boot_data);
 	hdr_v2->boot_data.start = entry_point - imximage_init_loadsize;

It looks ok for me.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Which tree is this patch going through?

This goes first into u-boot-imx, until I'll send a PR to Tom for inclusion in his tree,

Thanks again. Is there a reason this patch is not in the u-boot-imx git tree?

The reason is that it was not assigned in patchwork as I supposed and this leads to forget it when I rework u-boot-imx - thanks for pointing out !

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================