permanently load module
Posted
by
Radu
on Ask Ubuntu
See other posts from Ask Ubuntu
or by Radu
Published on 2011-02-01T17:31:27Z
Indexed on
2011/02/01
23:34 UTC
Read the original article
Hit count: 429
I have a Compaq Presario CQ-61 320SQ, I am using Ubuntu 10.04 because after update to 10.10 my mouse and touchpad won't work, network won't work, sound won't work ... (I managed to fix most of them after almost a month of googling, but not all, my 2 Desktops have no problem with 10.10) so I decided to switch back to 10.04, where I have a problem:
My broadband speed is very low beacause of the kernel module r8169, I downloaded the good module r8101 and every time the computer boots have a rc.local entry to fix this.
Question:
Can I load the modul permanently from a specific location. I heard about /etc/modules but there I need the module name, but I have to load it from a specific path (where is the default path for that)
Thank you.
So I studied the script:
It creates the file r8101.ko in /lib/modules/uname -r
/kernel/drivers/net so I think as long as nobody will delete that file, and I don't update the kernel, maybe adding r8108 to /etc/modules will work, and add r8169 to blacklist ... I will give it a try.
EDIT2:
So I added r8101
to /etc/modules
and blacklist r8169
to /etc/modprobe.d/blacklist.conf
It still uses the old module, lsmod prints:
radu@adu:~$ lsmod | grep r8
r8101 67626 0
r8169 34108 0
mii 4381 1 r8169
EDIT: the module is loaded using this script that came with it:
#!/bin/sh
# invoke insmod with all arguments we got
# and use a pathname, as insmod doesn't look in . by default
TARGET_PATH=/lib/modules/`uname -r`/kernel/drivers/net
echo
echo "Check old driver and unload it."
check=`lsmod | grep r8169`
if [ "$check" != "" ]; then
echo "rmmod r8169"
/sbin/rmmod r8169
fi
check=`lsmod | grep r8101`
if [ "$check" != "" ]; then
echo "rmmod r8101"
/sbin/rmmod r8101
fi
echo "Build the module and install"
echo "-------------------------------" >> log.txt
date 1>>log.txt
make all 1>>log.txt || exit 1
module=`ls src/*.ko`
module=${module#src/}
module=${module%.ko}
if [ "$module" == "" ]; then
echo "No driver exists!!!"
exit 1
elif [ "$module" != "r8169" ]; then
if test -e $TARGET_PATH/r8169.ko ; then
echo "Backup r8169.ko"
if test -e $TARGET_PATH/r8169.bak ; then
i=0
while test -e $TARGET_PATH/r8169.bak$i
do
i=$(($i+1))
done
echo "rename r8169.ko to r8169.bak$i"
mv $TARGET_PATH/r8169.ko $TARGET_PATH/r8169.bak$i
else
echo "rename r8169.ko to r8169.bak"
mv $TARGET_PATH/r8169.ko $TARGET_PATH/r8169.bak
fi
fi
fi
echo "Depending module. Please wait."
depmod -a
echo "load module $module"
modprobe $module
echo "Completed."
exit 0
© Ask Ubuntu or respective owner