Skip to contentSkip to conversation

fdt: Fix fdt padding issue for initrd mem_rsv

PATCH New Kumar Gala 3 participants 3 messages Oct 22, 2009 – Oct 24, 2009

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 fdt: Fix fdt padding issue for initrd mem_rsv

Its possible that we end up with a device tree that happens to be a particular size that after we call fdt_resize() we don't have any space left for the initrd mem_rsv.

Fix this be adding a second mem_rsv into the size calculation. We had one to cover the fdt itself and we have the potential of adding a second for the initrd.

---
Wolfgang, this has been a long standing bug but only shows up if the fdt blob happens to be a particular size. Please include this for the v2009.11 release.

- k

 common/fdt_support.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
common/fdt_support.c +3 -2
index 89164a1..fecd904 100644
@@ -604,10 +604,11 @@ int fdt_resize(void *blob)
 
 	/*
 	 * Calculate the actual size of the fdt
-	 * plus the size needed for fdt_add_mem_rsv
+	 * plus the size needed for two fdt_add_mem_rsv, one
+	 * for the fdt itself and one for a possible initrd
 	 */
 	actualsize = fdt_off_dt_strings(blob) +
-		fdt_size_dt_strings(blob) + sizeof(struct fdt_reserve_entry);
+		fdt_size_dt_strings(blob) + 2*sizeof(struct fdt_reserve_entry);
 
 	/* Make it so the fdt ends on a page boundary */
 	actualsize = ALIGN(actualsize + ((uint)blob & 0xfff), 0x1000);
Signature · 1 line
1.6.0.6
#1 lore raw

PATCH 1/1 fdt: Fix fdt padding issue for initrd mem_rsv

Quoted 9 lines · Kumar Gala

Its possible that we end up with a device tree that happens to be a particular size that after we call fdt_resize() we don't have any space left for the initrd mem_rsv.

Fix this be adding a second mem_rsv into the size calculation. We had one to cover the fdt itself and we have the potential of adding a second for the initrd.

Quoted 6 lines

---
Wolfgang, this has been a long standing bug but only shows up if the fdt blob happens to be a particular size. Please include this for the v2009.11 release.

- k

Thanks,
gvb

#2 lore raw

PATCH 1/1 fdt: Fix fdt padding issue for initrd mem_rsv

In reply to Kumar Gala

Dear Kumar Gala,

Quoted 14 lines · In message <[email protected]> you…

Its possible that we end up with a device tree that happens to be a particular size that after we call fdt_resize() we don't have any space left for the initrd mem_rsv.

Fix this be adding a second mem_rsv into the size calculation. We had one to cover the fdt itself and we have the potential of adding a second for the initrd.

---
Wolfgang, this has been a long standing bug but only shows up if the fdt blob happens to be a particular size. Please include this for the v2009.11 release.

Quoted 4 lines

- k

 common/fdt_support.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"The bad reputation UNIX has gotten is totally undeserved, laid on by
people who don't understand, who have not gotten in there  and  tried
anything."          -- Jim Joyce, owner of Jim Joyce's UNIX Bookstore