All of lore.kernel.org
 help / color / mirror / Atom feed
* problems with external initramfs passed to device tree kernel
@ 2012-06-12 23:12 John Linn
  2012-08-06  9:25 ` Ben Peddell
  0 siblings, 1 reply; 5+ messages in thread
From: John Linn @ 2012-06-12 23:12 UTC (permalink / raw)
  To: linux-arm-kernel

I'm not sure this is specific to ARM, but that's what I'm on so I
thought I'd ask.  I'm also running a device tree kernel.  I've tried
it on 3.0 and 3.3 kernels.

I'm seeing where I have to remove CONFIG_BLK_DEV_RAM from the kernel
to get it to boot with an external initramfs image. It says the image
is not?good (junk in it), but it boots.  The same image boots fine
when built into the kernel using INITRAMFS_SOURCE, even with
BLK_DEV_RAM in the kernel.

I've done quite a bit of digging at the init/initramfs.c and it's not
obvious to me where the issue lies (user error probably).

Any thoughts would be appreciated.

Thanks,
John

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

* problems with external initramfs passed to device tree kernel
  2012-06-12 23:12 problems with external initramfs passed to device tree kernel John Linn
@ 2012-08-06  9:25 ` Ben Peddell
  2012-08-06  9:32   ` [PATCH] initramfs: handle trailing junk after valid image Ben Peddell
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Peddell @ 2012-08-06  9:25 UTC (permalink / raw)
  To: linux-arm-kernel

On 13/06/2012 9:12 AM, John Linn wrote:
> I'm not sure this is specific to ARM, but that's what I'm on so I 
> thought I'd ask.  I'm also running a device tree kernel.  I've
> tried it on 3.0 and 3.3 kernels.
> 
> I'm seeing where I have to remove CONFIG_BLK_DEV_RAM from the
> kernel to get it to boot with an external initramfs image. It says
> the image is not?good (junk in it), but it boots.  The same image
> boots fine when built into the kernel using INITRAMFS_SOURCE, even
> with BLK_DEV_RAM in the kernel.
> 
> I've done quite a bit of digging at the init/initramfs.c and it's
> not obvious to me where the issue lies (user error probably).
> 
> Any thoughts would be appreciated.

If the size of the initramfs image is set in either devicetree or the
initrd= kernel parameter, and is larger than the actual initramfs
image is, then the kernel throws the image away if it's followed by
anything other than null bytes.  U-boot doesn't initialize the RAM to
zeroes, so the initramfs will be followed by whatever was in RAM -
usually 0xFF with zero bits here and there, or the decayed contents
before the previous shutdown if the machine was off for a very short time.

I will follow up with a patch that should remedy this issue.  Please
let me know if there's a better way to do this.

-- 
Ben Peddell
IT Support Bowen, Collinsville and Proserpine Catholic schools
http://klightspeed.killerwolves.net/

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

* [PATCH] initramfs: handle trailing junk after valid image
  2012-08-06  9:25 ` Ben Peddell
@ 2012-08-06  9:32   ` Ben Peddell
  2012-08-06 19:05     ` Sergei Shtylyov
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Peddell @ 2012-08-06  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

The initramfs handling since commit df37bd15 has been rejecting
valid images that have garbage after them.  For example, on an
architecture where the initramfs address and size are specified
as a kernel parameter (specifically unicore32 and arm), specifying
e.g. initrd=0x01000000,4M will not work unless the image is padded
with nulls to 4MiB.  This is unlikely to occur if the user is using
this parameter to work around a bug in the bootloader.

---
 init/initramfs.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/init/initramfs.c b/init/initramfs.c
index 84c6bf1..26c2cb1 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -467,6 +467,9 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len)
 					 compress_name);
 				message = msg_buf;
 			}
+		} else if (state == Reset) {
+			my_inptr = len;
+			pr_warn("%s: junk at end of compressed archive\n", __func__);
 		} else
 			error("junk in compressed archive");
 		if (state != Reset)
-- 
1.7.3.4

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

* [PATCH] initramfs: handle trailing junk after valid image
  2012-08-06  9:32   ` [PATCH] initramfs: handle trailing junk after valid image Ben Peddell
@ 2012-08-06 19:05     ` Sergei Shtylyov
  2012-08-07  2:02       ` [PATCH 1/1] initramfs: handle trailing junk after valid image (try 2) Ben Peddell
  0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2012-08-06 19:05 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 08/06/2012 01:32 PM, Ben Peddell wrote:

> The initramfs handling since commit df37bd15 has been rejecting

   Please also specify the summary of that commit in parens.

> valid images that have garbage after them.  For example, on an
> architecture where the initramfs address and size are specified
> as a kernel parameter (specifically unicore32 and arm), specifying
> e.g. initrd=0x01000000,4M will not work unless the image is padded
> with nulls to 4MiB.  This is unlikely to occur if the user is using
> this parameter to work around a bug in the bootloader.

   You didn't sign off the patchs, so it can't br applied.

WBR, Sergei

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

* [PATCH 1/1] initramfs: handle trailing junk after valid image (try 2)
  2012-08-06 19:05     ` Sergei Shtylyov
@ 2012-08-07  2:02       ` Ben Peddell
  0 siblings, 0 replies; 5+ messages in thread
From: Ben Peddell @ 2012-08-07  2:02 UTC (permalink / raw)
  To: linux-arm-kernel

The initramfs handling since commit df37bd15 (initramfs: handle 
unrecognised decompressor when unpacking) has been rejecting
valid images that have garbage after them.  For example, on an
architecture where the initramfs address and size are specified
as a kernel parameter (specifically unicore32 and arm), specifying
e.g. initrd=0x01000000,4M will not work unless the image is padded
with nulls to 4MiB.  This is unlikely to occur if the user is using
this parameter to work around a bug in the bootloader.

Signed-off-by: Ben Peddell <klightspeed@killerwolves.net>

---
 init/initramfs.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/init/initramfs.c b/init/initramfs.c
index 84c6bf1..26c2cb1 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -467,6 +467,9 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len)
 					 compress_name);
 				message = msg_buf;
 			}
+		} else if (state == Reset) {
+			my_inptr = len;
+			pr_warn("%s: junk at end of compressed archive\n", __func__);
 		} else
 			error("junk in compressed archive");
 		if (state != Reset)
-- 
1.7.3.4

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

end of thread, other threads:[~2012-08-07  2:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-12 23:12 problems with external initramfs passed to device tree kernel John Linn
2012-08-06  9:25 ` Ben Peddell
2012-08-06  9:32   ` [PATCH] initramfs: handle trailing junk after valid image Ben Peddell
2012-08-06 19:05     ` Sergei Shtylyov
2012-08-07  2:02       ` [PATCH 1/1] initramfs: handle trailing junk after valid image (try 2) Ben Peddell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.