public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: Athira Rajeev <atrajeev@in.ibm.com>
To: horms@verge.net.au
Cc: suzuki@in.ibm.com, kexec@lists.infradead.org
Subject: [PATCH] kexec/ppc: Add nodes for initrd in dtb
Date: Tue, 24 Sep 2013 10:52:54 +0530	[thread overview]
Message-ID: <20130924052240.4517.85639.stgit@localhost.localdomain> (raw)

From: Suzuki K. Poulose <suzuki@in.ibm.com>

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.

Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Signed-off-by: Athira Rajeev<atrajeev@in.ibm.com>
---

 kexec/arch/ppc/fs2dt.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/kexec/arch/ppc/fs2dt.c b/kexec/arch/ppc/fs2dt.c
index a49f85e..4121c7d 100644
--- a/kexec/arch/ppc/fs2dt.c
+++ b/kexec/arch/ppc/fs2dt.c
@@ -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
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

             reply	other threads:[~2013-09-25  5:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-24  5:22 Athira Rajeev [this message]
2013-09-24 10:22 ` [PATCH] kexec/ppc: Add nodes for initrd in dtb Suzuki K. Poulose
2013-09-25  0:58   ` Simon Horman
2013-09-25  7:02 ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130924052240.4517.85639.stgit@localhost.localdomain \
    --to=atrajeev@in.ibm.com \
    --cc=horms@verge.net.au \
    --cc=kexec@lists.infradead.org \
    --cc=suzuki@in.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox