From Bugzilla Helper: User-Agent: Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322) Description of problem: The following patch adds support to mkinitrd for compressed modules with the 2.6 kernel. Any chance this can be added to the standard rpm? --- mkinitrd.orig 2004-11-18 14:58:36.000000000 -0700 +++ mkinitrd 2004-11-18 16:36:14.000000000 -0700 @@ -71,7 +71,7 @@ [ -n "$verbose" ] && echo -n "Looking for deps of module $1" deps=$(awk 'BEGIN { searched=ARGV[2]; ARGV[2]=""; rc=1 } \ - function modname(filename) { match(filename, /\/([^\/]+)\.k?o:?$/, ret); return ret[1] } \ + function modname(filename) { match(filename, /\/([^\/]+)\.k?o(.gz):?$/, ret); return ret[1] } \ function show() { if (orig == searched) { print dep; orig=""; rc=0; exit } } \ /^\/lib/ { show(); \ orig=modname($1); dep=""; \ @@ -121,12 +121,13 @@ modName="sbp2" else moduledep $modName + [ -n "$verbose" ] && echo "deps for $modName: $deps" for i in $deps; do findmodule $i done fi - for modExt in o.gz o ko ; do + for modExt in o.gz o ko ko.gz ; do if [ -d /lib/modules/$kernel/updates ]; then fmPath=`(cd /lib/modules/$kernel/updates; echo find . -name $modName.$modExt -type f | /sbin/nash --quiet) | /bin/awk {'print $1; exit;'}` fi @@ -589,7 +590,21 @@ for MODULE in $MODULES; do if [ -x /usr/bin/strip ]; then + case $MODULE in + *.gz) + m=${MODULE##*/} + cp /lib/modules/$kernel/$MODULE /tmp + gunzip /tmp/$m + m=${m%.gz} + /usr/bin/strip -g $verbose /tmp/$m -o $MNTIMAGE/lib/$m + #gzip $MNTIMAGE/lib/$m + rm -f /tmp/$m + ;; + + *) /usr/bin/strip -g $verbose /lib/modules/$kernel/$MODULE -o $MNTIMAGE/lib/$(basename $MODULE) + ;; + esac else cp $verbose -a /lib/modules/$kernel/$MODULE $MNTIMAGE/lib fi @@ -658,6 +673,7 @@ fi for MODULE in $MODULES; do + MODULE=${MODULE%.gz} text="" module=`echo $MODULE | sed "s|.*/||" | sed "s/.k\?o$//"` fullmodule=`echo $MODULE | sed "s|.*/||"` Version-Release number of selected component (if applicable): mkinitrd-4.1.18-2 How reproducible: Always Steps to Reproduce: 1. compress modules in /lib/modules/<kernel ver>/... 2. build dependency file for it 3. attempt to run mkinitrd Additional info:
The module loading infrastructure in 2.6 doesn't natively support compressed modules, so adding them involves adding a lot of calls to gunzip before you could ever load a module which is cumbersome at best. Better question... Why are you wanting to compress the modules?
The module-init-tools rpm has zlib support enabled, so insmod and modprobe both support compressed modules. This mkinitrd change was the only change needed to get a system working with compressed modules. One of our new products will have very limited disk space. Using compressed modules saves ~50M of disk space and it allows us to have a single kernel rpm for all of our server types.
Unfortunately, at this point, it's too late to get enhancements into RHEL4. That doesn't seem unreasonable (although, the patch is a little bit ugly), so will leave on the table for an update or similar.
What about the patch do you consider ugly? If it is a matter of cleanup, I can re-do the patch.
Internal RFE bug #142028 entered; will be considered for future releases.
A '?' was missing from one of the lines. The following is an updated patch that has been tested with compressed and uncompressed modules: --- mkinitrd.orig 2004-11-18 14:58:36.000000000 -0700 +++ mkinitrd 2004-11-18 16:36:14.000000000 -0700 @@ -71,7 +71,7 @@ [ -n "$verbose" ] && echo -n "Looking for deps of module $1" deps=$(awk 'BEGIN { searched=ARGV[2]; ARGV[2]=""; rc=1 } \ - function modname(filename) { match(filename, /\/([^\/]+)\.k?o:?$/, ret); return ret[1] } \ + function modname(filename) { match(filename, /\/([^\/]+)\.k?o(.gz)?:?$/, ret); return ret[1] } \ function show() { if (orig == searched) { print dep; orig=""; rc=0; exit } } \ /^\/lib/ { show(); \ orig=modname($1); dep=""; \ @@ -121,12 +121,13 @@ modName="sbp2" else moduledep $modName + [ -n "$verbose" ] && echo "deps for $modName: $deps" for i in $deps; do findmodule $i done fi - for modExt in o.gz o ko ; do + for modExt in o.gz o ko ko.gz ; do if [ -d /lib/modules/$kernel/updates ]; then fmPath=`(cd /lib/modules/$kernel/updates; echo find . -name $modName.$modExt -type f | /sbin/nash --quiet) | /bin/awk {'print $1; exit;'}` fi @@ -589,7 +590,21 @@ for MODULE in $MODULES; do if [ -x /usr/bin/strip ]; then + case $MODULE in + *.gz) + m=${MODULE##*/} + cp /lib/modules/$kernel/$MODULE /tmp + gunzip /tmp/$m + m=${m%.gz} + /usr/bin/strip -g $verbose /tmp/$m -o $MNTIMAGE/lib/$m + #gzip $MNTIMAGE/lib/$m + rm -f /tmp/$m + ;; + + *) /usr/bin/strip -g $verbose /lib/modules/$kernel/$MODULE -o $MNTIMAGE/lib/$(basename $MODULE) + ;; + esac else cp $verbose -a /lib/modules/$kernel/$MODULE $MNTIMAGE/lib fi @@ -658,6 +673,7 @@ fi for MODULE in $MODULES; do + MODULE=${MODULE%.gz} text="" module=`echo $MODULE | sed "s|.*/||" | sed "s/.k\?o$//"` fullmodule=`echo $MODULE | sed "s|.*/||"`