Skip to contentSkip to conversation

powerpc: Fix device tree padding associated with ramdisk

PATCH New Kumar Gala 3 participants 4 messages Jul 7, 2011 – Jul 26, 2011 PowerPC

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 powerpc: Fix device tree padding associated with ramdisk

When booting with a ramdisk we bump the amount of memory reserved for the device tree by FDT_RAMDISK_OVERHEAD. However we did not increase the actual size in the device tree blob to match.

Its possible on boundary cases that we dont have enough memory according to the device tree blob and get errors like:

WARNING: could not set linux,initrd-end FDT_ERR_NOSPACE

We can easily fix this by setting the device tree size at the same time we bump the amount of memory reserved for the device tree.

---
 arch/powerpc/lib/bootm.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
arch/powerpc/lib/bootm.c +3 -1
index e01787d..4e0cb8f 100644
@@ -288,8 +288,10 @@ static int boot_body_linux(bootm_headers_t *images)
 			return ret;
 		of_size = ret;
 
-		if (*initrd_start && *initrd_end)
+		if (*initrd_start && *initrd_end) {
 			of_size += FDT_RAMDISK_OVERHEAD;
+			fdt_set_totalsize(*of_flat_tree, of_size);
+		}
 		/* Create a new LMB reservation */
 		lmb_reserve(lmb, (ulong)*of_flat_tree, of_size);
 
Signature · 1 line
1.7.3.4
author
#1 lore raw

PATCH 1/1 powerpc: Fix device tree padding associated with ramdisk

Quoted 9 lines · Kumar Gala

When booting with a ramdisk we bump the amount of memory reserved for the device tree by FDT_RAMDISK_OVERHEAD. However we did not increase the actual size in the device tree blob to match.

Its possible on boundary cases that we dont have enough memory according to the device tree blob and get errors like:

WARNING: could not set linux,initrd-end FDT_ERR_NOSPACE

Quoted 7 lines

We can easily fix this by setting the device tree size at the same time we bump the amount of memory reserved for the device tree.

---
arch/powerpc/lib/bootm.c | 4 +++-

1 files changed, 3 insertions(+), 1 deletions(-)

Jerry,

Any comments on this.

- k

Quoted 24 lines
arch/powerpc/lib/bootm.c +3 -1
index e01787d..4e0cb8f 100644
@@ -288,8 +288,10 @@ static int boot_body_linux(bootm_headers_t *images)
 			return ret;
 		of_size = ret;
 
-		if (*initrd_start && *initrd_end)
+		if (*initrd_start && *initrd_end) {
 			of_size += FDT_RAMDISK_OVERHEAD;
+			fdt_set_totalsize(*of_flat_tree, of_size);
+		}
 		/* Create a new LMB reservation */
 		lmb_reserve(lmb, (ulong)*of_flat_tree, of_size);
 
Signature · 6 lines
1.7.3.4

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
#2 lore raw

PATCH 1/1 powerpc: Fix device tree padding associated with ramdisk

In reply to Kumar Gala

Hi Kumar, Wolfgang

Quoted 22 lines · Kumar Gala

When booting with a ramdisk we bump the amount of memory reserved for the device tree by FDT_RAMDISK_OVERHEAD. However we did not increase the actual size in the device tree blob to match.

Its possible on boundary cases that we dont have enough memory according to the device tree blob and get errors like:

WARNING: could not set linux,initrd-end FDT_ERR_NOSPACE

We can easily fix this by setting the device tree size at the same time we bump the amount of memory reserved for the device tree.

---
  arch/powerpc/lib/bootm.c |    4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)
arch/powerpc/lib/bootm.c +0 -0
index e01787d..4e0cb8f 100644

arch/powerpc/lib/bootm.c static int boot_body_linux(bootm_headers_t *images) · line 296

Quoted 10 lines
arch/powerpc/lib/bootm.c +3 -1
@@ -288,8 +288,10 @@ static int boot_body_linux(bootm_headers_t *images)
  			return ret;
  		of_size = ret;
 
-		if (*initrd_start&&  *initrd_end)
+		if (*initrd_start&&  *initrd_end) {
  			of_size += FDT_RAMDISK_OVERHEAD;
+			fdt_set_totalsize(*of_flat_tree, of_size);
+		}
  		/* Create a new LMB reservation */
  		lmb_reserve(lmb, (ulong)*of_flat_tree, of_size);

This looks good to me. Since it is in bootm.c and not in libfdt, I'll let Wolfgang pick it up unless I hear otherwise.

Thanks,
gvb

#3 lore raw

PATCH 1/1 powerpc: Fix device tree padding associated with ramdisk

In reply to Kumar Gala

Dear Kumar Gala,

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

When booting with a ramdisk we bump the amount of memory reserved for the device tree by FDT_RAMDISK_OVERHEAD. However we did not increase the actual size in the device tree blob to match.

Its possible on boundary cases that we dont have enough memory according to the device tree blob and get errors like:

WARNING: could not set linux,initrd-end FDT_ERR_NOSPACE

Quoted 7 lines

We can easily fix this by setting the device tree size at the same time we bump the amount of memory reserved for the device tree.

---
 arch/powerpc/lib/bootm.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 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
"A great many people think they are thinking when they are merely re-
arranging their prejudices."                          - William James