LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   How to load a network driver during boot? (https://www.linuxquestions.org/questions/slackware-14/how-to-load-a-network-driver-during-boot-411092/)

Z038 02-02-2006 09:42 PM

How to load a network driver during boot?
 
I installed Slackware 10.2 on /dev/hda3. My ABIT KV8-MAX3 system has a builtin gigabit NIC from 3COM. I think it is a 3C940. Fedora recognizes it and supports it, but there doesn't appear to be support for this card in Slackware.

I downloaded the 3c2000 driver source from 3COM and compiled it. I've got a 3c2000.o driver module now that I'd like to load during boot up.

I think I need to put the driver binary somewhere and add an INSMOD instruction somewhere in one of the rc initialization scripts in /etc, but I don't know where to put it.

So, where should I put the driver? What is the insmod command I need to use, and where do I put it?

mdarby 02-02-2006 10:31 PM

I'd put the compiled file into /lib/modules/<kernel version>/...
You can put the insmod command in /etc/rc.d/rc.local

gbonvehi 02-03-2006 12:17 AM

rc.local is a good choice, you also have rc.modules which is used to load modules as the name says :)

mdarby 02-03-2006 05:54 AM

Ah yes, rc.modules is the best place. I almost always compile drivers into the kernel ;)

Z038 02-04-2006 12:05 AM

I downloaded the latest version of the SK98LIN driver from the 3Com driver downloads web site. It came with an installation shell script that I ran. It compiled the driver source and stuck the object module in /lib/modules/2.4.31/kernel/drivers/net/sk98lin

I can't see where the install script stuck an insmod command anywhere to load the driver, but the eth0 interface now comes up during boot. It's not in rc.local or rc.modules. So I don't understand exactly why it works, but it does.

If anyone could explain it to me, I'd love understand why it works without the insmod.

bathory 02-04-2006 02:13 AM

if the insmod or modprobe command are not in those files then it should be in /etc/modprobe.conf. Something like that:
Code:

alias eth0 sk98lin
so the module is loaded when eth0 is to be configured from /etc/rc.inet1

Z038 02-04-2006 01:57 PM

bathory, the /etc/modprobe.conf and /etc/modules.conf are both empty files with 0 blocks.

I cut this from dmesg output:

sk98lin: Network Device Driver v8.23.1.3
(C)Copyright 1999-2005 Marvell(R).
PCI: Found IRQ 5 for device 00:0e.0
eth0: 3Com Gigabit LOM (3C940)
PrefPort:A RlmtMode:Check Link State

Then later in dmesg output I see this:

eth0: network connection up using port A
speed: 100
autonegotiation: yes
duplex mode: full
flowctrl: symmetric
irq moderation: disabled
scatter-gather: enabled
tx-checksum: enabled
rx-checksum: enabled

I want the speed to be set to 1000, so I think I need to issue an ifconfig or set an option on the modprobe or insmod somewhere during boot up. That's another reason why I'd like to track down how and where the driver is being loaded during boot.

bathory 02-04-2006 05:45 PM

Why don't you
Code:

grep sk98lin /etc/rc.d/rc.*
to see what file loads the module.

Z038 02-04-2006 10:54 PM

That grep for sk98lin didn't turn up anything, bathory.

The installation shell script for the driver compiled several programs extracted from the driver tar file then linked them as module sk98lin.o. I found it using
Code:

find / -type f -name sk98lin.o -print
here
/lib/modules/2.4.31/kernel/drivers/net/sk98lin/sk98lin.o
And as I mentioned before, /etc/modprobe.conf and /etc/modules.conf are empty files, but
Code:

modprobe -c | grep -i eth
finds
alias eth0 off
I just don't know where all the configuration settings for modprobe come from if not from /etc/modprobe.conf.

Anyway, then I found this logic in /etc/rc.d/rc.inet1

Code:

  # If the interface isn't in the kernel yet (but there's an alias for it in
  # modules.conf), then it should be loaded first:
  if ! grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; then # no interface yet
    if /sbin/modprobe -c | grep -w "alias ${1}" | grep -vw "alias ${1} off" > /dev/null ; then
      echo "/etc/rc.d/rc.inet1:  /sbin/modprobe ${1}" | $LOGGER
      /sbin/modprobe ${1}
    fi

I don't entirely understand that, but I'm wondering if this would result in a modprobe eth0 or something like that if the output from the 'modprobe -c' finds the 'alias eth0 off'?

Hey, I still totally clueless, but at least I'm learning a little bit about the initialization process.

bathory 02-05-2006 04:11 AM

If it's none of these methods, then it should be hotplug. So check under /etc/hotplug for a net.agent script which controls the network interface.

Z038 02-05-2006 09:19 PM

Could be, but the eth0 messages come out before any messages about hotplugging in dmesg output.

I think I will modify rc.inet1 and rc.hotplug to write some messages during boot up so I can see where they are invoked relative to the eth0 messages...

Will let you know how it goes.

gbonvehi 02-05-2006 10:00 PM

Maybe it's recognized first as a PCI device, then hotplug loads the driver for it. Try adding the module on hotplug blacklist to see if it comes up: /etc/hotplug/blacklist


All times are GMT -5. The time now is 08:43 PM.