Re: 2.4.21 doesn't boot: /bin/insmod.old: file not found

Stephen Hemminger (shemminger@osdl.org)
Tue, 24 Jun 2003 09:13:01 -0700


On 24 Jun 2003 08:35:52 +0200
Ronald Bultje <rbultje@ronald.bitfreak.net> wrote:

> Hi Keith,
>
> On Tue, 2003-06-24 at 02:37, Keith Owens wrote:
> > initrd needs the static version of insmod. Copy /sbin/insmod.static.old
> > to the ramdisk and rename it as /bin/insmod.old to suit the 2.5 modutils.
>
> Ah, right, insmod.static.old was indeed missing, I basically assumed
> it'd copy that one in automatically (since it worked for 2.4.20), but
> apparently, 2.4.20 just worked for no apparent reason while it shouldn't
> have.
>
> Adding insmod.static.old to the ramdisk image (add the line 'inst
> /sbin/insmod.static.old "$MNTIMAGE/bin/insmod.old"' in /sbin/mkinitrd)
> fixed the issue for me. Thanks for the pointer!
>
> Ronald

The modutils install doesn't save insmod.static (it should). Assuming
you save the original 2.4 version as insmod.static.old, then the following
change to mkinitrd should correctly handle both 2.4 and 2.5 kernels.

--- /sbin/mkinitrd.orig 2003-06-24 09:08:21.000000000 -0700
+++ /sbin/mkinitrd 2003-05-14 14:55:55.000000000 -0700
@@ -35,6 +35,8 @@
builtins=""
pivot=1
modulefile=/etc/modules.conf
+modext="o"
+insmod="/sbin/insmod.static.old"
rc=0

if [ `uname -m` = "ia64" ]; then
@@ -128,7 +130,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 +278,12 @@
exit 1
fi

+# Hack for module extension change in 2.5
+if [[ $kernel = 2.[56].* ]]; then
+ modext="ko"
+ insmod="/sbin/insmod.static"
+fi
+
# find a temporary directory which doesn't use tmpfs
TMPDIR=""
for t in /tmp /var/tmp /root ${PWD}; do
@@ -461,7 +469,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
@@ -500,7 +508,7 @@
rm -rf $MNTPOINT/lost+found

inst /sbin/nash "$MNTIMAGE/bin/nash"
-inst /sbin/insmod.static "$MNTIMAGE/bin/insmod"
+inst $insmod "$MNTIMAGE/bin/insmod"
ln -s /sbin/nash $MNTIMAGE/sbin/modprobe

for MODULE in $MODULES; do
@@ -536,7 +544,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 +555,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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/