All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch] to add support for lzop(1), lz4(1) & INITRD_COMPRESS
@ 2013-10-11 16:45 P J P
       [not found] ` <alpine.LFD.2.03.1310112043070.4392-L4k/hFI9D5Ym7TDOsKvhyg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: P J P @ 2013-10-11 16:45 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: TEXT/PLAIN, Size: 765 bytes --]

   Hello,

Attached herein is a patch for the dracut(8) tool. It adds support for the 
lzop(1) & lz4(1) compression algorithms for creating initramfs images. Both 
algorithms are supported by the Linux kernel.

Linux kernel also exports user's choice of initramfs compression algorithm to 
a shell environment variable: INITRD_COMPRESS.

  -> http://www.spinics.net/lists/mm-commits/msg100054.html

The attached patch recognises this variable, but sets it at lower precedence 
than the command line options. Ie. dracut(8) command line options --gzip, 
--bzip2 etc. would override the compression algorithm defined by the 
$INITRD_COMPRESS environment variable.

Could someone please review this patch?

Thank you.
--
Prasad J Pandit / Red Hat Security Response Team

[-- Attachment #2: Type: TEXT/PLAIN, Size: 3268 bytes --]

From 7e4cb9c5440c37b3d66c8144e884d005d96f49a5 Mon Sep 17 00:00:00 2001
From: P J P <ppandit@redhat.com>
Date: Fri, 11 Oct 2013 19:26:51 +0530
Subject: Add lzo, lz4 compression and read INITRD_COMPRESS

This patch adds support for lzop(1) & lz4(1) compression
algorithms to compress iniramfs image file. Both are supported
by the Linux kernel.

Linux kernel exports user's choice of initramfs compression
algorithm as a shell environment variable: INITRD_COMPRESS.
This patch adds support to read this variable and duly compress
the initramfs image file.

Environment variable INITRD_COMPRESS has less precedence than the
command line options --gzip, etc. Ie. command line options could
override the compression algorithm defined by $INITRD_COMPRESS.

Signed-off-by: P J P <ppandit@redhat.com>

diff --git a/dracut.sh b/dracut.sh
index d9533dd..173a259 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -165,6 +165,12 @@ Creates initial ramdisk images for preloading modules
   --xz                  Compress the generated initramfs using xz.
                          Make sure that your kernel has xz support compiled
                          in, otherwise you will not be able to boot.
+  --lzo                  Compress the generated initramfs using lzop.
+                         Make sure that your kernel has lzo support compiled
+                         in, otherwise you will not be able to boot.
+  --lz4                  Compress the generated initramfs using lz4.
+                         Make sure that your kernel has lz4 support compiled
+                         in, otherwise you will not be able to boot.
   --compress [COMPRESSION] Compress the generated initramfs with the
                          passed compression program.  Make sure your kernel
                          knows how to decompress the generated initramfs,
@@ -342,6 +348,8 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
     --long bzip2 \
     --long lzma \
     --long xz \
+    --long lzo \
+    --long lz4 \
     --long no-compress \
     --long gzip \
     --long list-modules \
@@ -430,6 +438,8 @@ while :; do
         --bzip2)       compress_l="bzip2";;
         --lzma)        compress_l="lzma";;
         --xz)          compress_l="xz";;
+        --lzo)         compress_l="lzo";;
+        --lz4)         compress_l="lz4";;
         --no-compress) _no_compress_l="cat";;
         --gzip)        compress_l="gzip";;
         --list-modules) do_list="yes";;
@@ -673,6 +683,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
 [[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware"
 [[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
 [[ $tmpdir ]] || tmpdir=/var/tmp
+[[ $INITRD_COMPRESS ]] && compress=$INITRD_COMPRESS
 [[ $compress_l ]] && compress=$compress_l
 [[ $show_modules_l ]] && show_modules=$show_modules_l
 [[ $nofscks_l ]] && nofscks="yes"
@@ -689,6 +700,8 @@ case $compress in
     lzma)  compress="lzma -9";;
     xz)    compress="xz --check=crc32 --lzma2=dict=1MiB";;
     gzip)  compress="gzip -9"; command -v pigz > /dev/null 2>&1 && compress="pigz -9";;
+    lzo)   compress="lzop -9";;
+    lz4)   compress="lz4 -9";;
 esac
 if [[ $_no_compress_l = "cat" ]]; then
     compress="cat"
-- 
1.8.3.1


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

* Re: [Patch] to add support for lzop(1), lz4(1) & INITRD_COMPRESS
       [not found] ` <alpine.LFD.2.03.1310112043070.4392-L4k/hFI9D5Ym7TDOsKvhyg@public.gmane.org>
@ 2013-10-14  7:39   ` Harald Hoyer
       [not found]     ` <525B9FA4.3020707-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Harald Hoyer @ 2013-10-14  7:39 UTC (permalink / raw)
  To: P J P, initramfs-u79uwXL29TY76Z2rM5mHXA

On 10/11/2013 06:45 PM, P J P wrote:
>   Hello,
> 
> Attached herein is a patch for the dracut(8) tool. It adds support for the
> lzop(1) & lz4(1) compression algorithms for creating initramfs images. Both
> algorithms are supported by the Linux kernel.
> 
> Linux kernel also exports user's choice of initramfs compression algorithm to a
> shell environment variable: INITRD_COMPRESS.
> 
>  -> http://www.spinics.net/lists/mm-commits/msg100054.html
> 
> The attached patch recognises this variable, but sets it at lower precedence
> than the command line options. Ie. dracut(8) command line options --gzip,
> --bzip2 etc. would override the compression algorithm defined by the
> $INITRD_COMPRESS environment variable.
> 
> Could someone please review this patch?
> 
> Thank you.

Thanks! Applied, added documentation to dracut.8.asc and pushed

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

* Re: [Patch] to add support for lzop(1), lz4(1) & INITRD_COMPRESS
       [not found]     ` <525B9FA4.3020707-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2013-10-15  6:25       ` P J P
  0 siblings, 0 replies; 3+ messages in thread
From: P J P @ 2013-10-15  6:25 UTC (permalink / raw)
  To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

+-- On Mon, 14 Oct 2013, Harald Hoyer wrote --+
| Thanks! Applied, added documentation to dracut.8.asc and pushed

  Aha, that's cool! Thanks so much!! :)

Thank you.
--
Prasad J Pandit / Red Hat Security Response Team

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

end of thread, other threads:[~2013-10-15  6:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-11 16:45 [Patch] to add support for lzop(1), lz4(1) & INITRD_COMPRESS P J P
     [not found] ` <alpine.LFD.2.03.1310112043070.4392-L4k/hFI9D5Ym7TDOsKvhyg@public.gmane.org>
2013-10-14  7:39   ` Harald Hoyer
     [not found]     ` <525B9FA4.3020707-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-10-15  6:25       ` P J P

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.