linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mkinitrd fix for 2.5 modutils
@ 2003-02-18 22:25 Stephen Hemminger
  0 siblings, 0 replies; only message in thread
From: Stephen Hemminger @ 2003-02-18 22:25 UTC (permalink / raw)
  To: Rusty Russell, carbonated beverage; +Cc: Linux Kernel Mailing List

The following patch to mkinitrd allows it to correctly construct
a ram disk with modules for both 2.4 and 2.5 kernels.  The problem is
that the change in extension from .o to .ko confused it. Without the
patch it is impossible to boot kernels that have ext3 as a module with
an ext3 root file system.

Not sure who the owner of mkinitrd is.
Wonder what other utilities got busted as well?
Patch is agains RHAT 8.0 other distro's may vary.

--- mkinitrd.orig	2002-09-04 22:07:04.000000000 -0700
+++ mkinitrd	2003-02-18 14:15:16.000000000 -0800
@@ -35,6 +35,7 @@
 builtins=""
 pivot=1
 modulefile=/etc/modules.conf
+modext="o"
 rc=0
 
 if [ `uname -m` = "ia64" ]; then
@@ -128,7 +129,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.$modext | /sbin/nash --quiet)`
 
     if [ ! -f /lib/modules/$kernel/$fmPath ]; then
 	if [ -n "$skiperrors" ]; then
@@ -276,6 +277,11 @@
     exit 1
 fi
 
+# Hack for module extension change in 2.5
+if [[ $kernel = 2.[56].* ]]; then
+    modext="ko"
+fi
+
 # find a temporary directory which doesn't use tmpfs
 TMPDIR=""
 for t in /tmp /var/tmp /root ${PWD}; do
@@ -461,7 +467,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.$modext | /sbin/nash --quiet)
 
 if [ -z "$LODEV" ]; then
     rm -rf $MNTPOINT $IMAGE
@@ -536,7 +542,7 @@
 
 for MODULE in $MODULES; do
     text=""
-    module=`echo $MODULE | sed "s|.*/||" | sed "s/.o$//"`
+    module=`echo $MODULE | sed "s|.*/||" | sed "s/.$modext$//"`
 
     options=`sed -n -e "s/^options[ 	][ 	]*$module[ 	][ 	]*//p" $modulefile 2>/dev/null`
 
@@ -547,7 +553,7 @@
         echo "Loading module $module$text"
     fi
     echo "echo \"Loading $module module\"" >> $RCFILE
-    echo "insmod /lib/$module.o $options" >> $RCFILE
+    echo "insmod /lib/$module.$modext $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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-02-18 22:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-18 22:25 [PATCH] mkinitrd fix for 2.5 modutils Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).