Skip to contentSkip to conversation

module-init-tools vs. mkinitrd

PATCH In review Boszormenyi Zoltan 2 participants 2 messages Feb 11, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 module-init-tools vs. mkinitrd

Hi Rusty, Alan,

I am using RedHat 8.0 and experimenting sometimes with 2.5.x. Some time ago I installed modutils-2.4.21-12 from Rusty's directory from kernel.org and yesterday I upgraded to the latest RH errata kernel. What surprised me was that the upgraded kernel did not boot up. The problem is that mkinitrd does not copy /sbin/insmod.static.old to the initrd image. Using the attached patch or downgrading to the RH8 modutils before upgrading the kernel fixes it.

Best regards,
Zoltán Böszörményi

sbin/mkinitrd renamed from sbin/mkinitrd.old +4 -0
@@ -501,6 +501,10 @@
 
 inst /sbin/nash "$MNTIMAGE/bin/nash"
 inst /sbin/insmod.static "$MNTIMAGE/bin/insmod"
+if [ -x /sbin/insmod.static.old ]
+then
+  inst /sbin/insmod.static.old "$MNTIMAGE/bin/insmod.old"
+fi
 ln -s /sbin/nash $MNTIMAGE/sbin/modprobe
 
 for MODULE in $MODULES; do
#1 lore raw

This patch is a bit more useful.

sbin/mkinitrd renamed from mkinitrd +15 -5
@@ -128,7 +128,7 @@
 	modName="sbp2"
     fi
     
-    fmPath=`(cd /lib/modules/$kernel; echo find . -name $modName.o | /sbin/nash --quiet)`
+    fmPath=`(cd /lib/modules/$kernel; echo find . -name $modName$o | /sbin/nash --quiet)`
 
     if [ ! -f /lib/modules/$kernel/$fmPath ]; then
 	if [ -n "$skiperrors" ]; then
@@ -276,6 +276,9 @@
     exit 1
 fi
 
+# 2.5.48 changed the module extension from o to ko
+o=`echo $kernel | awk 'BEGIN { FS="."}; { if ( $2 >= 5 && $3 >= 48 ) print ".ko"; else print ".o"; }'`
+
 # find a temporary directory which doesn't use tmpfs
 TMPDIR=""
 for t in /tmp /var/tmp /root ${PWD}; do
@@ -461,7 +464,7 @@
 
 dd if=/dev/zero of=$IMAGE bs=1k count=$IMAGESIZE 2> /dev/null || exit 1
 
-LODEV=$(echo findlodev $modName.o | /sbin/nash --quiet)
+LODEV=$(echo findlodev $modName$o | /sbin/nash --quiet)
 
 if [ -z "$LODEV" ]; then
     rm -rf $MNTPOINT $IMAGE
@@ -500,7 +503,14 @@
 rm -rf $MNTPOINT/lost+found
 
 inst /sbin/nash "$MNTIMAGE/bin/nash"
-inst /sbin/insmod.static "$MNTIMAGE/bin/insmod"
+
+# use the old insmod (when necessary)
+old=""
+if [ $o = ".o" -a -x /sbin/insmod.static.old ]; then
+    old=".old";
+fi
+inst /sbin/insmod.static$old "$MNTIMAGE/bin/insmod"
+
 ln -s /sbin/nash $MNTIMAGE/sbin/modprobe
 
 for MODULE in $MODULES; do
@@ -536,7 +546,7 @@
 
 for MODULE in $MODULES; do
     text=""
-    module=`echo $MODULE | sed "s|.*/||" | sed "s/.o$//"`
+    module=`echo $MODULE | sed "s|.*/||" | sed "s/$o$//"`
 
     options=`sed -n -e "s/^options[ 	][ 	]*$module[ 	][ 	]*//p" $modulefile 2>/dev/null`
 
@@ -547,7 +557,7 @@
         echo "Loading module $module$text"
     fi
     echo "echo \"Loading $module module\"" >> $RCFILE
-    echo "insmod /lib/$module.o $options" >> $RCFILE
+    echo "insmod /lib/$module$o $options" >> $RCFILE
 
     # Hack - we need a delay after loading usb-storage to give things
     #        time to settle down before we start looking a block devices