PDA

View Full Version : module and modprobe tutorial



MALDATA
27th May 2007, 08:05 PM
I've been using Fedora for a year or so now with a fair amount of success. One of the things that still escapes me is the proper use of modprobe and how one loads kernel modules.

I was just helping a friend set up Fedora on his new Toshiba tablet and I had this problem trying to get his wireless (ipw3945) to work. I installed Fedora 6 from the DVD and then ran the upgrade and rebooted.

I then tried compiling the ipw3945 drivers, but it would error out, claiming that the 80211 subsystem module wasn't present. I did "modprobe ieee80211" and it was fine... but every time I would reboot, lsmod would not show the module. I had to add "modprobe 80211" to the /etc/rc.d/rc.local file to get it to load on boot. I can't imagine that's the right way to do it.

So what it comes down to really is a complete lack of understanding on my part of how kernel modules are supposed to work. In general, I assume you can just download the source, do a make/make install... then what? I remember something about doing "make modules_install" in the kernel source directory... what does that do? How do you get a module to load on boot? Is it even necessary? What of this "depmod -a" that I see everywhere?

I'm sure the answers are all out there on Google somewhere, but I haven't been able to break it down into key words very well. I'd appreciate it if someone could give me the rundown on this stuff or point me at something useful so I can learn a little more.

Thanks

Brian1
27th May 2007, 08:33 PM
depmod -a rewrites a new system map that is stored in /boot for the kernel version. It is used so the kernel knows what modules do exist and are accessible from the modprobe command. insmod does not require the module to be in the kernel tree since you need to point to the module directly. That is my understanding of that part.

You run the command ' man depmod ' to learn a bit more about depmod. Same applies to many commands.
man ls
man dd
man grep

make install would have placed the modules in the kernel tree under /lib/modules/`uname -r`.

Normally in the /etc/modprobe.conf ones does things like
alias eth0 8139too

Like for a Atheros based nic I use this.
alias ath0 ath_pci

Post your modprobe.conf for more input.

Brian

MALDATA
28th May 2007, 02:37 AM
My modprobe.conf looks like this


alias eth0 e100
alias snd-card-0 snd-intel8x0
options snd-card-0 index=0
options snd-intel8x0 index=0
remove snd-intel8x0 { /usr/sbin/alsactl store 0 >/dev/null 2>&1 || : ; }; /sbin/
modprobe -r --ignore-remove snd-intel8x0

It was all set up for me, I haven't done anything to it. My question really is, how do I get a module to load on boot other than how I did it in my first post? There has to be a way to do it without explicitly calling modprobe on every boot.

Thanks for the help!

Brian1
28th May 2007, 03:20 PM
Never used ipw3945 so I do not know the name reference for the interface like eth0, ath0, wlan0. Once you have the setup of the nic then do a /sbin/ifconfig and get the name of the interface. Line add a line like your ' alias eth0 e100 ' and reboot. Just change eth0 to the interface name and e100 to the modules name.

Brian

MALDATA
28th May 2007, 08:19 PM
OK, but aside from getting the ipw3945 to work, how do you load a module automatically at boot? As I said, the way I did it was just by sticking "modprobe ieee80211" in a script that runs on boot, but that doesn't seem right to me. What IS the right way?

Brian1
28th May 2007, 11:42 PM
Well from reading the install docs from the site. http://ipw3945.sourceforge.net/INSTALL
It mentions using these two lines.

echo install ipw3945 /sbin/modprobe --ignore-install ipw3945 ; sleep 0.5 ; /sbin/ipw3945d --quiet >> etc/modules.d/ipw3945
and
echo remove ipw3945 /sbin/ipw3945d --kill ; /sbin/modprobe -r --ignore-remove ipw3945 >> /etc/modules.d/ipw3945

And from what i read it should load the ieee80211 itself when the ipw3945 module is loaded.
About all I know about the module. There are few other things mention in the doc.
Brian