All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix flags for initramfs LZ4 compression
@ 2014-02-15 23:14 Daniel M. Weeks
  2014-02-19  0:06 ` Andrew Morton
  2014-02-19  0:08 ` Andrew Morton
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel M. Weeks @ 2014-02-15 23:14 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel

LZ4 as implemented in the kernel differs from the default method now
used by the reference implementation of LZ4. Until the in-kernel method
is updated to support the new default, passing the legacy flag (-l) to
the compressor is necessary. Without this flag the kernel-generated,
LZ4-compressed initramfs is junk.

Signed-off-by: Daniel M. Weeks <dan@danweeks.net>
---
 scripts/gen_initramfs_list.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
index ef47409..17fa901 100644
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -257,7 +257,7 @@ case "$arg" in
                 && compr="lzop -9 -f"
 		echo "$output_file" | grep -q "\.lz4$" \
                 && [ -x "`which lz4 2> /dev/null`" ] \
-                && compr="lz4 -9 -f"
+                && compr="lz4 -l -9 -f"
 		echo "$output_file" | grep -q "\.cpio$" && compr="cat"
 		shift
 		;;
-- 
Daniel M. Weeks

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

* Re: [PATCH] Fix flags for initramfs LZ4 compression
  2014-02-15 23:14 [PATCH] Fix flags for initramfs LZ4 compression Daniel M. Weeks
@ 2014-02-19  0:06 ` Andrew Morton
  2014-02-19  0:08 ` Andrew Morton
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2014-02-19  0:06 UTC (permalink / raw)
  To: Daniel M. Weeks; +Cc: Michal Marek, linux-kbuild, linux-kernel, Kyungsik Lee

On Sat, 15 Feb 2014 18:14:57 -0500 "Daniel M. Weeks" <dan@danweeks.net> wrote:

> LZ4 as implemented in the kernel differs from the default method now
> used by the reference implementation of LZ4. Until the in-kernel method
> is updated to support the new default, passing the legacy flag (-l) to
> the compressor is necessary. Without this flag the kernel-generated,
> LZ4-compressed initramfs is junk.

Well that's bad.  Kyungsik, cuold you please comment?

> --- a/scripts/gen_initramfs_list.sh
> +++ b/scripts/gen_initramfs_list.sh
> @@ -257,7 +257,7 @@ case "$arg" in
>                  && compr="lzop -9 -f"
>  		echo "$output_file" | grep -q "\.lz4$" \
>                  && [ -x "`which lz4 2> /dev/null`" ] \
> -                && compr="lz4 -9 -f"
> +                && compr="lz4 -l -9 -f"
>  		echo "$output_file" | grep -q "\.cpio$" && compr="cat"
>  		shift
>  		;;


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

* Re: [PATCH] Fix flags for initramfs LZ4 compression
  2014-02-15 23:14 [PATCH] Fix flags for initramfs LZ4 compression Daniel M. Weeks
  2014-02-19  0:06 ` Andrew Morton
@ 2014-02-19  0:08 ` Andrew Morton
  2014-02-19  7:51     ` Kyungsik Lee
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2014-02-19  0:08 UTC (permalink / raw)
  To: Daniel M. Weeks; +Cc: Michal Marek, linux-kbuild, linux-kernel, Kyungsik Lee

On Sat, 15 Feb 2014 18:14:57 -0500 "Daniel M. Weeks" <dan@danweeks.net> wrote:

> LZ4 as implemented in the kernel differs from the default method now
> used by the reference implementation of LZ4. Until the in-kernel method
> is updated to support the new default, passing the legacy flag (-l) to
> the compressor is necessary. Without this flag the kernel-generated,
> LZ4-compressed initramfs is junk.
> 
> ...
>
> --- a/scripts/gen_initramfs_list.sh
> +++ b/scripts/gen_initramfs_list.sh
> @@ -257,7 +257,7 @@ case "$arg" in
>                  && compr="lzop -9 -f"
>  		echo "$output_file" | grep -q "\.lz4$" \
>                  && [ -x "`which lz4 2> /dev/null`" ] \
> -                && compr="lz4 -9 -f"
> +                && compr="lz4 -l -9 -f"
>  		echo "$output_file" | grep -q "\.cpio$" && compr="cat"
>  		shift
>  		;;

What happens is the user is running an old version of /bin/lz4?  A
version which predates this switch to a new format?  Do those earlier
versions accept -l, even though they don't need it?  Or will the kernel
build fail?


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

* Re: [PATCH] Fix flags for initramfs LZ4 compression
  2014-02-19  0:08 ` Andrew Morton
@ 2014-02-19  7:51     ` Kyungsik Lee
  0 siblings, 0 replies; 5+ messages in thread
From: Kyungsik Lee @ 2014-02-19  7:51 UTC (permalink / raw)
  To: Andrew Morton, Daniel M. Weeks
  Cc: Daniel M. Weeks, Michal Marek, linux-kbuild, linux-kernel,
	hyojun.im, chan.jeong

Hello,

On Tue, Feb 18, 2014 at 04:08:56PM -0800, Andrew Morton wrote:
> On Sat, 15 Feb 2014 18:14:57 -0500 "Daniel M. Weeks" <dan@danweeks.net> wrote:
> 
> > LZ4 as implemented in the kernel differs from the default method now
> > used by the reference implementation of LZ4. Until the in-kernel method
> > is updated to support the new default, passing the legacy flag (-l) to
> > the compressor is necessary. Without this flag the kernel-generated,
> > LZ4-compressed initramfs is junk.
> > 
> > ...
> >
> > --- a/scripts/gen_initramfs_list.sh
> > +++ b/scripts/gen_initramfs_list.sh
> > @@ -257,7 +257,7 @@ case "$arg" in
> >                  && compr="lzop -9 -f"
> >  		echo "$output_file" | grep -q "\.lz4$" \
> >                  && [ -x "`which lz4 2> /dev/null`" ] \
> > -                && compr="lz4 -9 -f"
> > +                && compr="lz4 -l -9 -f"
> >  		echo "$output_file" | grep -q "\.cpio$" && compr="cat"
> >  		shift
> >  		;;
> 
> What happens is the user is running an old version of /bin/lz4?  A
> version which predates this switch to a new format?  Do those earlier
> versions accept -l, even though they don't need it?  Or will the kernel
> build fail?

It seems that lz4 supports legacy format with the same option as lz4c
does. Just looking at the first few bytes of lz4 compressed image, we
can see whether it is new format or not.

It shows new format magic number without this patch. New format magic
number is 0x184d2204.

$ hexdump -C ./initramfs_data.cpio.lz4 |more
00000000  04 22 4d 18 64 70 b9 69 (Little Endian)
...

Currently Kernel supports legacy format only.

Acked-by: Kyungsik Lee <kyungsik.lee@lge.com>

Thanks,
Kyungsik


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

* Re: [PATCH] Fix flags for initramfs LZ4 compression
@ 2014-02-19  7:51     ` Kyungsik Lee
  0 siblings, 0 replies; 5+ messages in thread
From: Kyungsik Lee @ 2014-02-19  7:51 UTC (permalink / raw)
  To: Andrew Morton, Daniel M. Weeks
  Cc: Michal Marek, linux-kbuild, linux-kernel, hyojun.im, chan.jeong

Hello,

On Tue, Feb 18, 2014 at 04:08:56PM -0800, Andrew Morton wrote:
> On Sat, 15 Feb 2014 18:14:57 -0500 "Daniel M. Weeks" <dan@danweeks.net> wrote:
> 
> > LZ4 as implemented in the kernel differs from the default method now
> > used by the reference implementation of LZ4. Until the in-kernel method
> > is updated to support the new default, passing the legacy flag (-l) to
> > the compressor is necessary. Without this flag the kernel-generated,
> > LZ4-compressed initramfs is junk.
> > 
> > ...
> >
> > --- a/scripts/gen_initramfs_list.sh
> > +++ b/scripts/gen_initramfs_list.sh
> > @@ -257,7 +257,7 @@ case "$arg" in
> >                  && compr="lzop -9 -f"
> >  		echo "$output_file" | grep -q "\.lz4$" \
> >                  && [ -x "`which lz4 2> /dev/null`" ] \
> > -                && compr="lz4 -9 -f"
> > +                && compr="lz4 -l -9 -f"
> >  		echo "$output_file" | grep -q "\.cpio$" && compr="cat"
> >  		shift
> >  		;;
> 
> What happens is the user is running an old version of /bin/lz4?  A
> version which predates this switch to a new format?  Do those earlier
> versions accept -l, even though they don't need it?  Or will the kernel
> build fail?

It seems that lz4 supports legacy format with the same option as lz4c
does. Just looking at the first few bytes of lz4 compressed image, we
can see whether it is new format or not.

It shows new format magic number without this patch. New format magic
number is 0x184d2204.

$ hexdump -C ./initramfs_data.cpio.lz4 |more
00000000  04 22 4d 18 64 70 b9 69 (Little Endian)
...

Currently Kernel supports legacy format only.

Acked-by: Kyungsik Lee <kyungsik.lee@lge.com>

Thanks,
Kyungsik


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

end of thread, other threads:[~2014-02-19  7:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-15 23:14 [PATCH] Fix flags for initramfs LZ4 compression Daniel M. Weeks
2014-02-19  0:06 ` Andrew Morton
2014-02-19  0:08 ` Andrew Morton
2014-02-19  7:51   ` Kyungsik Lee
2014-02-19  7:51     ` Kyungsik Lee

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.