Blame 0050-add-xz-compression-for-kernel-modules.patch

Harald Hoyer 83ebbb
From 7fffc9f11f836d6e19414f0c0f23e7e8fb4f17c4 Mon Sep 17 00:00:00 2001
Harald Hoyer 83ebbb
From: James Buren <ryuo@frugalware.org>
Harald Hoyer 83ebbb
Date: Sun, 22 Jan 2012 13:02:47 -0600
Harald Hoyer 83ebbb
Subject: [PATCH] add xz compression for kernel modules
Harald Hoyer 83ebbb
Harald Hoyer 83ebbb
---
Harald Hoyer 83ebbb
 dracut-functions                           |   11 ++++++++---
Harald Hoyer 83ebbb
 modules.d/40network/module-setup.sh        |    1 +
Harald Hoyer 83ebbb
 modules.d/90kernel-modules/module-setup.sh |    1 +
Harald Hoyer 83ebbb
 modules.d/90multipath/module-setup.sh      |    1 +
Harald Hoyer 83ebbb
 modules.d/95iscsi/module-setup.sh          |    1 +
Harald Hoyer 83ebbb
 5 files changed, 12 insertions(+), 3 deletions(-)
Harald Hoyer 83ebbb
Harald Hoyer 83ebbb
diff --git a/dracut-functions b/dracut-functions
Harald Hoyer 83ebbb
index a9b15cc..3852478 100755
Harald Hoyer 83ebbb
--- a/dracut-functions
Harald Hoyer 83ebbb
+++ b/dracut-functions
Harald Hoyer 83ebbb
@@ -364,7 +364,7 @@ inst_simple() {
Harald Hoyer 83ebbb
         inst "${_src%/*}/.${_src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
Harald Hoyer 83ebbb
     fi
Harald Hoyer 83ebbb
     ddebug "Installing $_src"
Harald Hoyer 83ebbb
-    cp --sparse=always -pfL "$_src" "${initdir}/$target" 
Harald Hoyer 83ebbb
+    cp --sparse=always -pfL "$_src" "${initdir}/$target"
Harald Hoyer 83ebbb
 }
Harald Hoyer 83ebbb
 
Harald Hoyer 83ebbb
 # find symlinks linked to given library file
Harald Hoyer 83ebbb
@@ -508,7 +508,7 @@ inst_symlink() {
Harald Hoyer 83ebbb
     if [[ -d $_realsrc ]]; then
Harald Hoyer 83ebbb
         inst_dir "$_realsrc"
Harald Hoyer 83ebbb
     else
Harald Hoyer 83ebbb
-        inst "$_realsrc" && mkdir -m 0755 -p "${_target%/*}" 
Harald Hoyer 83ebbb
+        inst "$_realsrc" && mkdir -m 0755 -p "${_target%/*}"
Harald Hoyer 83ebbb
     fi
Harald Hoyer 83ebbb
     if [[ -e "${_src}" ]]; then
Harald Hoyer 83ebbb
         ln -sfn $(convert_abs_rel "${_src}" "${_realsrc}") "$_target"
Harald Hoyer 83ebbb
@@ -984,6 +984,7 @@ filter_kernel_modules_by_path () (
Harald Hoyer 83ebbb
     if ! [[ $hostonly ]]; then
Harald Hoyer 83ebbb
         _filtercmd='find "$srcmods/kernel/$1" "$srcmods/extra"'
Harald Hoyer 83ebbb
         _filtercmd+=' "$srcmods/weak-updates" -name "*.ko" -o -name "*.ko.gz"'
Harald Hoyer 83ebbb
+        _filtercmd+=' -o -name "*.ko.xz"'
Harald Hoyer 83ebbb
         _filtercmd+=' 2>/dev/null'
Harald Hoyer 83ebbb
     else
Harald Hoyer 83ebbb
         _filtercmd='cut -d " " -f 1 
Harald Hoyer 83ebbb
@@ -996,13 +997,17 @@ filter_kernel_modules_by_path () (
Harald Hoyer 83ebbb
                 $2 $initdir/$$.ko && echo "$_modname"
Harald Hoyer 83ebbb
                 rm -f $initdir/$$.ko
Harald Hoyer 83ebbb
                 ;;
Harald Hoyer 83ebbb
+            *.ko.xz) xz -dc "$_modname" > $initdir/$$.ko
Harald Hoyer 83ebbb
+                $2 $initdir/$$.ko && echo "$_modname"
Harald Hoyer 83ebbb
+                rm -f $initdir/$$.ko
Harald Hoyer 83ebbb
+                ;;
Harald Hoyer 83ebbb
         esac
Harald Hoyer 83ebbb
     done
Harald Hoyer 83ebbb
 )
Harald Hoyer 83ebbb
 find_kernel_modules_by_path () (
Harald Hoyer 83ebbb
     if ! [[ $hostonly ]]; then
Harald Hoyer 83ebbb
         find "$srcmods/kernel/$1" "$srcmods/extra" "$srcmods/weak-updates" \
Harald Hoyer 83ebbb
-          -name "*.ko" -o -name "*.ko.gz" 2>/dev/null
Harald Hoyer 83ebbb
+          -name "*.ko" -o -name "*.ko.gz" -o -name "*.ko.xz" 2>/dev/null
Harald Hoyer 83ebbb
     else
Harald Hoyer 83ebbb
         cut -d " " -f 1 
Harald Hoyer 83ebbb
         | xargs modinfo -F filename -k $kernel 2>/dev/null
Harald Hoyer 83ebbb
diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh
Harald Hoyer 83ebbb
index fbf6f34..6c4ae92 100755
Harald Hoyer 83ebbb
--- a/modules.d/40network/module-setup.sh
Harald Hoyer 83ebbb
+++ b/modules.d/40network/module-setup.sh
Harald Hoyer 83ebbb
@@ -36,6 +36,7 @@ installkernel() {
Harald Hoyer 83ebbb
                 case "$_fname" in
Harald Hoyer 83ebbb
                     *.ko)    _fcont="$(<        $_fname)" ;;
Harald Hoyer 83ebbb
                     *.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
Harald Hoyer 83ebbb
+                    *.ko.xz) _fcont="$(xz -dc   $_fname)" ;;
Harald Hoyer 83ebbb
                 esac
Harald Hoyer 83ebbb
                 [[   $_fcont =~ $_net_drivers
Harald Hoyer 83ebbb
                 && ! $_fcont =~ iw_handler_get_spy ]] \
Harald Hoyer 83ebbb
diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh
Harald Hoyer 83ebbb
index 7888428..46d8591 100755
Harald Hoyer 83ebbb
--- a/modules.d/90kernel-modules/module-setup.sh
Harald Hoyer 83ebbb
+++ b/modules.d/90kernel-modules/module-setup.sh
Harald Hoyer 83ebbb
@@ -13,6 +13,7 @@ installkernel() {
Harald Hoyer 83ebbb
                 while read _f; do case "$_f" in
Harald Hoyer 83ebbb
                     *.ko)    [[ $(<         $_f) =~ $_blockfuncs ]] && echo "$_f" ;;
Harald Hoyer 83ebbb
                     *.ko.gz) [[ $(gzip -dc <$_f) =~ $_blockfuncs ]] && echo "$_f" ;;
Harald Hoyer 83ebbb
+                    *.ko.xz) [[ $(xz -dc   <$_f) =~ $_blockfuncs ]] && echo "$_f" ;;
Harald Hoyer 83ebbb
                     esac
Harald Hoyer 83ebbb
                 done
Harald Hoyer 83ebbb
             }
Harald Hoyer 83ebbb
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
Harald Hoyer 83ebbb
index 43f0a3d..1502f59 100755
Harald Hoyer 83ebbb
--- a/modules.d/90multipath/module-setup.sh
Harald Hoyer 83ebbb
+++ b/modules.d/90multipath/module-setup.sh
Harald Hoyer 83ebbb
@@ -40,6 +40,7 @@ installkernel() {
Harald Hoyer 83ebbb
         while read _f; do case "$_f" in
Harald Hoyer 83ebbb
             *.ko)    [[ $(<         $_f) =~ $_mpfuncs ]] && echo "$_f" ;;
Harald Hoyer 83ebbb
             *.ko.gz) [[ $(gzip -dc <$_f) =~ $_mpfuncs ]] && echo "$_f" ;;
Harald Hoyer 83ebbb
+            *.ko.xz) [[ $(xz -dc   <$_f) =~ $_mpfuncs ]] && echo "$_f" ;;
Harald Hoyer 83ebbb
             esac
Harald Hoyer 83ebbb
         done
Harald Hoyer 83ebbb
     }
Harald Hoyer 83ebbb
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
Harald Hoyer 83ebbb
index 8caaf73..560507c 100755
Harald Hoyer 83ebbb
--- a/modules.d/95iscsi/module-setup.sh
Harald Hoyer 83ebbb
+++ b/modules.d/95iscsi/module-setup.sh
Harald Hoyer 83ebbb
@@ -48,6 +48,7 @@ installkernel() {
Harald Hoyer 83ebbb
         while read _f; do case "$_f" in
Harald Hoyer 83ebbb
             *.ko)    [[ $(<         $_f) =~ $_iscsifuncs ]] && echo "$_f" ;;
Harald Hoyer 83ebbb
             *.ko.gz) [[ $(gzip -dc <$_f) =~ $_iscsifuncs ]] && echo "$_f" ;;
Harald Hoyer 83ebbb
+            *.ko.xz) [[ $(xz -dc   <$_f) =~ $_iscsifuncs ]] && echo "$_f" ;;
Harald Hoyer 83ebbb
             esac
Harald Hoyer 83ebbb
         done
Harald Hoyer 83ebbb
     }