public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] kexec/ppc: Add nodes for initrd in dtb
@ 2013-09-24  5:22 Athira Rajeev
  2013-09-24 10:22 ` Suzuki K. Poulose
  2013-09-25  7:02 ` Simon Horman
  0 siblings, 2 replies; 4+ messages in thread
From: Athira Rajeev @ 2013-09-24  5:22 UTC (permalink / raw)
  To: horms; +Cc: suzuki, kexec

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] kexec/ppc: Add nodes for initrd in dtb
  2013-09-24  5:22 [PATCH] kexec/ppc: Add nodes for initrd in dtb Athira Rajeev
@ 2013-09-24 10:22 ` Suzuki K. Poulose
  2013-09-25  0:58   ` Simon Horman
  2013-09-25  7:02 ` Simon Horman
  1 sibling, 1 reply; 4+ messages in thread
From: Suzuki K. Poulose @ 2013-09-24 10:22 UTC (permalink / raw)
  To: Athira Rajeev; +Cc: horms, kexec

On 09/24/2013 10:52 AM, Athira Rajeev wrote:
> 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.
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

> 
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kexec/ppc: Add nodes for initrd in dtb
  2013-09-24 10:22 ` Suzuki K. Poulose
@ 2013-09-25  0:58   ` Simon Horman
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2013-09-25  0:58 UTC (permalink / raw)
  To: Suzuki K. Poulose; +Cc: kexec, Athira Rajeev

On Tue, Sep 24, 2013 at 03:52:44PM +0530, Suzuki K. Poulose wrote:
> On 09/24/2013 10:52 AM, Athira Rajeev wrote:
> > 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.
> 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
kexec@lists.infradead.org CCed (again?).

> 
> Thanks
> Suzuki
> 
> > 
> > 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kexec/ppc: Add nodes for initrd in dtb
  2013-09-24  5:22 [PATCH] kexec/ppc: Add nodes for initrd in dtb Athira Rajeev
  2013-09-24 10:22 ` Suzuki K. Poulose
@ 2013-09-25  7:02 ` Simon Horman
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Horman @ 2013-09-25  7:02 UTC (permalink / raw)
  To: Athira Rajeev; +Cc: kexec, suzuki

On Tue, Sep 24, 2013 at 10:52:54AM +0530, Athira Rajeev wrote:
> 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>

Thanks, applied.

> ---
> 
>  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
> 

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-25  7:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-24  5:22 [PATCH] kexec/ppc: Add nodes for initrd in dtb Athira Rajeev
2013-09-24 10:22 ` Suzuki K. Poulose
2013-09-25  0:58   ` Simon Horman
2013-09-25  7:02 ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox