Skip to contentSkip to conversation

kexec/ppc: Add nodes for initrd in dtb

PATCH Applied Athira Rajeev 3 participants 4 messages Sep 24, 2013 – Sep 25, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kexec/ppc: Add nodes for initrd in dtb

From: Suzuki K. Poulose <[email protected]>

If the primary kernel doesn't use an initrd, we may not have linux,initrd-* entries in the device-tree, and hence the initial flat tree may not contain them.

Make sure we add the entries in the dtb if the second kernel needs an initrd.

---

 kexec/arch/ppc/fs2dt.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
kexec/arch/ppc/fs2dt.c +14 -4
index a49f85e..4121c7d 100644
@@ -342,8 +342,17 @@ static void putnode(void)
 
 	putprops(dn, namelist, numlist);
 
-	/* Add initrd entries to the second kernel */
-	if (initrd_base && !strcmp(basename, "chosen/")) {
+	/* 
+	 * Add initrd entries to the second kernel
+	 * if
+	 * 	a) a ramdisk is specified in cmdline
+	 * 	 OR
+	 * 	b) reuseinitrd is specified and a initrd is
+	 * 	   used by the kernel.
+	 *
+	 */
+	if ((ramdisk || (initrd_base && reuse_initrd))
+		&& !strcmp(basename, "chosen/")) {
 		int len = 8;
 		unsigned long long initrd_end;
 		*dt++ = 3;
@@ -362,8 +371,9 @@ static void putnode(void)
 
 		memcpy(dt, &initrd_end, len);
 		dt += (len + 3)/4;
-
-		reserve(initrd_base, initrd_size);
+		/* reserve the existing initrd image in case of reuse_initrd */
+		if (initrd_base && initrd_size && reuse_initrd)
+			reserve(initrd_base, initrd_size);
 	}
 
 	for (i = 0; i < numlist; i++) {

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#1 lore raw
Quoted 9 lines · Athira Rajeev

From: Suzuki K. Poulose <[email protected]>

If the primary kernel doesn't use an initrd, we may not have linux,initrd-* entries in the device-tree, and hence the initial flat tree may not contain them.

Make sure we add the entries in the dtb if the second kernel needs an initrd.

Simon,

Without this patch, one cannot use an initrd with kexec on a machine which is booted without an initrd. (e.g, network booted boards.)

Please pull this one.

Thanks
Suzuki

Quoted 35 lines

---

 kexec/arch/ppc/fs2dt.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
kexec/arch/ppc/fs2dt.c +11 -2
index a49f85e..4121c7d 100644
@@ -342,8 +342,17 @@ static void putnode(void)
 
 	putprops(dn, namelist, numlist);
 
-	/* Add initrd entries to the second kernel */
-	if (initrd_base && !strcmp(basename, "chosen/")) {
+	/* 
+	 * Add initrd entries to the second kernel
+	 * if
+	 * 	a) a ramdisk is specified in cmdline
+	 * 	 OR
+	 * 	b) reuseinitrd is specified and a initrd is
+	 * 	   used by the kernel.
+	 *
+	 */
+	if ((ramdisk || (initrd_base && reuse_initrd))
+		&& !strcmp(basename, "chosen/")) {
 		int len = 8;
 		unsigned long long initrd_end;
 		*dt++ = 3;
@@ -362,8 +371,9 @@ static void putnode(void)
 

kexec/arch/ppc/fs2dt.c static void putnode(void) · line 379

Quoted 10 lines
kexec/arch/ppc/fs2dt.c +3 -2
 		memcpy(dt, &initrd_end, len);
 		dt += (len + 3)/4;
-
-		reserve(initrd_base, initrd_size);
+		/* reserve the existing initrd image in case of reuse_initrd */
+		if (initrd_base && initrd_size && reuse_initrd)
+			reserve(initrd_base, initrd_size);
 	}
 
 	for (i = 0; i < numlist; i++) {

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#2 lore raw
Quoted 8 lines · Suzuki K. Poulose
Quoted 7 lines · Athira Rajeev

From: Suzuki K. Poulose <[email protected]>

If the primary kernel doesn't use an initrd, we may not have linux,initrd-* entries in the device-tree, and hence the initial flat tree may not contain them.

Quoted 8 lines
Quoted 2 lines

Make sure we add the entries in the dtb if the second kernel needs an initrd.

Simon,

Without this patch, one cannot use an initrd with kexec on a machine which is booted without an initrd. (e.g, network booted boards.)

Please pull this one.

For some reason I don't seem to have the original post of the patch in my inbox. Could either you or Athira send it to me with [email protected] CCed (again?).

Quoted 47 lines

Thanks
Suzuki

Quoted 43 lines

---

 kexec/arch/ppc/fs2dt.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
kexec/arch/ppc/fs2dt.c +14 -4
index a49f85e..4121c7d 100644
@@ -342,8 +342,17 @@ static void putnode(void)
 
 	putprops(dn, namelist, numlist);
 
-	/* Add initrd entries to the second kernel */
-	if (initrd_base && !strcmp(basename, "chosen/")) {
+	/* 
+	 * Add initrd entries to the second kernel
+	 * if
+	 * 	a) a ramdisk is specified in cmdline
+	 * 	 OR
+	 * 	b) reuseinitrd is specified and a initrd is
+	 * 	   used by the kernel.
+	 *
+	 */
+	if ((ramdisk || (initrd_base && reuse_initrd))
+		&& !strcmp(basename, "chosen/")) {
 		int len = 8;
 		unsigned long long initrd_end;
 		*dt++ = 3;
@@ -362,8 +371,9 @@ static void putnode(void)
 
 		memcpy(dt, &initrd_end, len);
 		dt += (len + 3)/4;
-
-		reserve(initrd_base, initrd_size);
+		/* reserve the existing initrd image in case of reuse_initrd */
+		if (initrd_base && initrd_size && reuse_initrd)
+			reserve(initrd_base, initrd_size);
 	}
 
Quoted 3 lines

kexec/arch/ppc/fs2dt.c static void putnode(void) · line 379

Quoted 2 lines
kexec/arch/ppc/fs2dt.c +0 -0
 	for (i = 0; i < numlist; i++) {

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Applied
#3 lore raw
In reply to Athira Rajeev
Quoted 7 lines · Athira Rajeev

From: Suzuki K. Poulose <[email protected]>

If the primary kernel doesn't use an initrd, we may not have linux,initrd-* entries in the device-tree, and hence the initial flat tree may not contain them.

Quoted 5 lines

Make sure we add the entries in the dtb if the second kernel needs an initrd.

Thanks, applied.

Quoted 43 lines

---

 kexec/arch/ppc/fs2dt.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
kexec/arch/ppc/fs2dt.c +14 -4
index a49f85e..4121c7d 100644
@@ -342,8 +342,17 @@ static void putnode(void)
 
 	putprops(dn, namelist, numlist);
 
-	/* Add initrd entries to the second kernel */
-	if (initrd_base && !strcmp(basename, "chosen/")) {
+	/* 
+	 * Add initrd entries to the second kernel
+	 * if
+	 * 	a) a ramdisk is specified in cmdline
+	 * 	 OR
+	 * 	b) reuseinitrd is specified and a initrd is
+	 * 	   used by the kernel.
+	 *
+	 */
+	if ((ramdisk || (initrd_base && reuse_initrd))
+		&& !strcmp(basename, "chosen/")) {
 		int len = 8;
 		unsigned long long initrd_end;
 		*dt++ = 3;
@@ -362,8 +371,9 @@ static void putnode(void)
 
 		memcpy(dt, &initrd_end, len);
 		dt += (len + 3)/4;
-
-		reserve(initrd_base, initrd_size);
+		/* reserve the existing initrd image in case of reuse_initrd */
+		if (initrd_base && initrd_size && reuse_initrd)
+			reserve(initrd_base, initrd_size);
 	}
 
 	for (i = 0; i < numlist; i++) {
Quoted 5 lines

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec