Skip to contentSkip to conversation

powerpc: Fix bootm to boot up again with a Ramdisk

PATCH Superseded Heiko Schocher 3 participants 5 messages Sep 10, 2008 – Sep 13, 2008

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powerpc: Fix bootm to boot up again with a Ramdisk

Patch
http://git.denx.de/?p=u-boot.git;a=commitdiff;h=2a1a2cb6e2b87ee550e6f27b647d23331dfd5e1b#patch3

didnt remove the dummy mem reservation in fdt_chosen, and this stopped Linux from booting with a Ramdisk. This patch fixes this, by deleting the useless dummy mem reservation.

When booting with a Ramdisk, a fix offset FDT_RAMDISK_OVERHEAD is now added to of_size, so we dont need anymore a dummy mem reservation.

---

changes sinse last patch:

- added comments from Wolfgang Denk

 common/cmd_fdt.c      |    3 ++-
 common/fdt_support.c  |    4 +---
 include/fdt.h         |    2 ++
 include/fdt_support.h |    2 +-
 lib_ppc/bootm.c       |    5 +++--
 5 files changed, 9 insertions(+), 7 deletions(-)
common/cmd_fdt.c +2 -1
index 0593bad..288a5c4 100644
@@ -450,7 +450,8 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 			initrd_end = simple_strtoul(argv[3], NULL, 16);
 		}
 
-		fdt_chosen(working_fdt, initrd_start, initrd_end, 1);
+		fdt_chosen(working_fdt, 1);
+		fdt_initrd(working_fdt, initrd_start, initrd_end, 1);
 	}
 	/* resize the fdt */
 	else if (strncmp(argv[1], "re", 2) == 0) {
common/fdt_support.c +1 -3
index a7773ab..8ceeb0f 100644
@@ -165,7 +165,7 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 	return 0;
 }
 
-int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
+int fdt_chosen(void *fdt, int force)
 {
 	int   nodeoffset;
 	int   err;
@@ -215,8 +215,6 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 		}
 	}
 
-	fdt_initrd(fdt, initrd_start, initrd_end, force);
-
 #ifdef CONFIG_OF_STDOUT_VIA_ALIAS
 	path = fdt_getprop(fdt, nodeoffset, "linux,stdout-path", NULL);
 	if ((path == NULL) || force)
include/fdt.h +2 -0
index 48ccfd9..c51212e 100644
@@ -57,4 +57,6 @@ struct fdt_property {
 #define FDT_V16_SIZE	FDT_V3_SIZE
 #define FDT_V17_SIZE	(FDT_V16_SIZE + sizeof(uint32_t))
 
+/* adding a ramdisk needs 0x44 bytes in version 2008.10 */
+#define FDT_RAMDISK_OVERHEAD	0x80
 #endif /* _FDT_H */
include/fdt_support.h +1 -1
index 424c3c6..ceaadc2 100644
@@ -28,7 +28,7 @@
 
 #include <fdt.h>
 
-int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force);
+int fdt_chosen(void *fdt, int force);
 int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force);
 void do_fixup_by_path(void *fdt, const char *path, const char *prop,
 		      const void *val, int len, int create);
lib_ppc/bootm.c +3 -2
index 348421f..38266e1 100644
@@ -145,8 +145,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 	 * if the user wants it (the logic is in the subroutines).
 	 */
 	if (of_size) {
-		/* pass in dummy initrd info, we'll fix up later */
-		if (fdt_chosen(of_flat_tree, images->rd_start, images->rd_end, 0) < 0) {
+		if (fdt_chosen(of_flat_tree, 0) < 0) {
 			puts ("ERROR: ");
 			puts ("/chosen node create failed");
 			puts (" - must RESET the board to recover.\n");
@@ -169,6 +168,8 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 			goto error;
 		of_size = ret;
 
+		if ((of_flat_tree) && (initrd_start && initrd_end))
+			of_size += FDT_RAMDISK_OVERHEAD;
 		/* Create a new LMB reservation */
 		lmb_reserve(lmb, (ulong)of_flat_tree, of_size);
 	}
Signature · 5 lines
1.5.6.1

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#1 lore raw

PATCH v2 1/1 powerpc: Fix bootm to boot up again with a Ramdisk

Quoted 16 lines · Heiko Schocher

Patch
http://git.denx.de/?p=u-boot.git;a=commitdiff;h=2a1a2cb6e2b87ee550e6f27b647d23331dfd5e1b#patch3

didnt remove the dummy mem reservation in fdt_chosen, and this stopped Linux from booting with a Ramdisk. This patch fixes this, by deleting the useless dummy mem reservation.

When booting with a Ramdisk, a fix offset FDT_RAMDISK_OVERHEAD is now added to of_size, so we dont need anymore a dummy mem reservation.

---

changes sinse last patch:

Quoted 8 lines

- added comments from Wolfgang Denk

common/cmd_fdt.c      |    3 ++-
common/fdt_support.c  |    4 +---
include/fdt.h         |    2 ++
include/fdt_support.h |    2 +-
lib_ppc/bootm.c       |    5 +++--
5 files changed, 9 insertions(+), 7 deletions(-)

it would be nice in either the commit message or a comment how you came to the value of FDT_RAMDISK_OVERHEAD.

- k

#2 lore raw

PATCH v3 1/1 powerpc: Fix bootm to boot up again with a Ramdisk

Patch
http://git.denx.de/?p=u-boot.git;a=commitdiff;h=2a1a2cb6e2b87ee550e6f27b647d23331dfd5e1b#patch3

didnt remove the dummy mem reservation in fdt_chosen, and this stopped Linux from booting with a Ramdisk. This patch fixes this, by deleting the useless dummy mem reservation.

When booting with a Ramdisk, a fix offset FDT_RAMDISK_OVERHEAD is now added to of_size, so we dont need anymore a dummy mem reservation.

I measured the value of FDT_RAMDISK_OVERHEAD on a MPC8270 based system (=0x44 bytes) and rounded it up to 0x80).

---
 common/cmd_fdt.c      |    3 ++-
 common/fdt_support.c  |    4 +---
 include/fdt.h         |    2 ++
 include/fdt_support.h |    2 +-
 lib_ppc/bootm.c       |    5 +++--
 5 files changed, 9 insertions(+), 7 deletions(-)
common/cmd_fdt.c +2 -1
index 0593bad..288a5c4 100644
@@ -450,7 +450,8 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 			initrd_end = simple_strtoul(argv[3], NULL, 16);
 		}
 
-		fdt_chosen(working_fdt, initrd_start, initrd_end, 1);
+		fdt_chosen(working_fdt, 1);
+		fdt_initrd(working_fdt, initrd_start, initrd_end, 1);
 	}
 	/* resize the fdt */
 	else if (strncmp(argv[1], "re", 2) == 0) {
common/fdt_support.c +1 -3
index a7773ab..8ceeb0f 100644
@@ -165,7 +165,7 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 	return 0;
 }
 
-int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
+int fdt_chosen(void *fdt, int force)
 {
 	int   nodeoffset;
 	int   err;
@@ -215,8 +215,6 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 		}
 	}
 
-	fdt_initrd(fdt, initrd_start, initrd_end, force);
-
 #ifdef CONFIG_OF_STDOUT_VIA_ALIAS
 	path = fdt_getprop(fdt, nodeoffset, "linux,stdout-path", NULL);
 	if ((path == NULL) || force)
include/fdt.h +2 -0
index 48ccfd9..c51212e 100644
@@ -57,4 +57,6 @@ struct fdt_property {
 #define FDT_V16_SIZE	FDT_V3_SIZE
 #define FDT_V17_SIZE	(FDT_V16_SIZE + sizeof(uint32_t))
 
+/* adding a ramdisk needs 0x44 bytes in version 2008.10 */
+#define FDT_RAMDISK_OVERHEAD	0x80
 #endif /* _FDT_H */
include/fdt_support.h +1 -1
index 424c3c6..ceaadc2 100644
@@ -28,7 +28,7 @@
 
 #include <fdt.h>
 
-int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force);
+int fdt_chosen(void *fdt, int force);
 int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force);
 void do_fixup_by_path(void *fdt, const char *path, const char *prop,
 		      const void *val, int len, int create);
lib_ppc/bootm.c +3 -2
index 348421f..38266e1 100644
@@ -145,8 +145,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 	 * if the user wants it (the logic is in the subroutines).
 	 */
 	if (of_size) {
-		/* pass in dummy initrd info, we'll fix up later */
-		if (fdt_chosen(of_flat_tree, images->rd_start, images->rd_end, 0) < 0) {
+		if (fdt_chosen(of_flat_tree, 0) < 0) {
 			puts ("ERROR: ");
 			puts ("/chosen node create failed");
 			puts (" - must RESET the board to recover.\n");
@@ -169,6 +168,8 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 			goto error;
 		of_size = ret;
 
+		if ((of_flat_tree) && (initrd_start && initrd_end))
+			of_size += FDT_RAMDISK_OVERHEAD;
 		/* Create a new LMB reservation */
 		lmb_reserve(lmb, (ulong)of_flat_tree, of_size);
 	}
Signature · 6 lines
1.5.6.1


-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#3 lore raw

PATCH v3 1/1 powerpc: Fix bootm to boot up again with a Ramdisk

Quoted 14 lines · Heiko Schocher

Patch
http://git.denx.de/?p=u-boot.git;a=commitdiff;h=2a1a2cb6e2b87ee550e6f27b647d23331dfd5e1b#patch3

didnt remove the dummy mem reservation in fdt_chosen, and this stopped Linux from booting with a Ramdisk. This patch fixes this, by deleting the useless dummy mem reservation.

When booting with a Ramdisk, a fix offset FDT_RAMDISK_OVERHEAD is now added to of_size, so we dont need anymore a dummy mem reservation.

I measured the value of FDT_RAMDISK_OVERHEAD on a MPC8270 based system (=0x44 bytes) and rounded it up to 0x80).

Quoted 8 lines

---

common/cmd_fdt.c      |    3 ++-
common/fdt_support.c  |    4 +---
include/fdt.h         |    2 ++
include/fdt_support.h |    2 +-
lib_ppc/bootm.c       |    5 +++--
5 files changed, 9 insertions(+), 7 deletions(-)

- k

#4 lore raw

PATCH v3 1/1 powerpc: Fix bootm to boot up again with a Ramdisk

In reply to Heiko Schocher

Dear Heiko Schocher,

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

Patch
http://git.denx.de/?p=u-boot.git;a=commitdiff;h=2a1a2cb6e2b87ee550e6f27b647d23331dfd5e1b#patch3

didnt remove the dummy mem reservation in fdt_chosen, and this stopped Linux from booting with a Ramdisk. This patch fixes this, by deleting the useless dummy mem reservation.

When booting with a Ramdisk, a fix offset FDT_RAMDISK_OVERHEAD is now added to of_size, so we dont need anymore a dummy mem reservation.

I measured the value of FDT_RAMDISK_OVERHEAD on a MPC8270 based system (=0x44 bytes) and rounded it up to 0x80).

Quoted 8 lines
---
 common/cmd_fdt.c      |    3 ++-
 common/fdt_support.c  |    4 +---
 include/fdt.h         |    2 ++
 include/fdt_support.h |    2 +-
 lib_ppc/bootm.c       |    5 +++--
 5 files changed, 9 insertions(+), 7 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 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 software required `Windows 95 or better', so I installed Linux.