Need linux kernel headers for ethernet driver update

DangerIsGo

2[H]4U
Joined
Apr 16, 2005
Messages
3,000
I've been running smoothwall 3.0 for the past 7-8 years and I love it. Recently, I upgraded my Verizon FiOS account to ditch TV and just have internet which would finally let me get rid of the coax/Verizon router and use the ONT's ethernet jack directly to my firewall. Well, long story short, I believe the ethernet's drivers to be the issue so I wanted to update them. I have two Realtek 8110SC ports in my mini ITX MB. I went to Realtek's site and got the latest. When I went to do a 'make clean modules', I was presented with:

/lib/modules/3.4.104/build: No such file or directory

Now comes the part where I am unsure of. I googled that and I was missing the linux kernel headers necessary. I downloaded the entire kernel package from:

https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.4.104.tar.xz

and put that in </usr/src/linux-headers-3.4.104> and made a symbolic link to </lib/modules/3.4.104/build>. Trying the 'make clean modules' again, I got:

make -C /lib/modules/3.4.104/build SUBDIRS=/tmp/r8169/src/ clean
make[1]: Entering directory `/lib/modules/3.4.104/build`
make[1]: *** No rule to make target 'clean'. Stop.
make[1]: Leaving directory `/lib/modules/3.4.104/build`
make: *** [clean] Error 2

Another google search told me that this is probably a make file issue. The drivers have 3 make files. A main one, one for kernel 2.x and one for kernel 3.x. Here is the main one:

KFLAG := 2$(shell uname -r | sed -ne 's/^2\.[4]\..*/4/p')x

all: clean modules install

modules:
ifeq ($(KFLAG),24x)
$(MAKE) -C src/ -f Makefile_linux24x modules
else
$(MAKE) -C src/ modules
endif

clean:
ifeq ($(KFLAG),24x)
$(MAKE) -C src/ -f Makefile_linux24x clean
else
$(MAKE) -C src/ clean
endif

install:
ifeq ($(KFLAG),24x)
$(MAKE) -C src/ -f Makefile_linux24x install
else
$(MAKE) -C src/ install
endif

And here is the 3.x:

ifneq ($(KERNELRELEASE),)
obj-m := r8169.o
r8169-objs := r8169_n.o
EXTRA_CFLAGS += -DCONFIG_R8169_NAPI
EXTRA_CFLAGS += -DCONFIG_R8169_VLAN
else
BASEDIR := /lib/modules/$(shell uname -r)
KERNELDIR ?= $(BASEDIR)/build
PWD :=$(shell pwd)
DRIVERDIR := $(shell find $(BASEDIR)/kernel/drivers/net -name realtek -type d)
ifeq ($(DRIVERDIR),)
DRIVERDIR := $(BASEDIR)/kernel/drivers/net
endif
RTKDIR := $(subst $(BASEDIR)/,,$(DRIVERDIR))

.PHONY: all
all: clean modules install

.PHONY:modules
modules:
$(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modules

.PHONY:clean
clean:
$(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) clean

.PHONY:install
install:
$(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) INSTALL_MOD_DIR=$(RTKDIR) modules_install

endif

So now I'm stuck. What do I do? Did I do anything wrong? Did I get the wrong headers? Is there something wrong with the make files? I don't have apt-get or yum or any package manager since its a stripped down linux version. Thanks!
 
What distro is that? the one that came with the device?

Could you type uname -a to find out the exact version?

Make clean is I think the wrong one. Normally, one enters the source dir and either punches 'make all' immediatelly, or types './configure' first. It spits out missing dependec sometimes.

The package with the source headers was usually named 'kernal-headers' or 'build-essentials'.

What made you think it's the NIC driver? does it show up in ifconfig? what does it spit out when you type ethtool <iface name> ?
 
Its Smoothwall 3.1. I couldn't find if they base it off of any specific distro.
The kernel version is 3.4.104.

This is the instruction steps from the realtek doc:

<Linux device driver for Realtek Ethernet controllers>

This is the Linux device driver released for RealTek RTL8169S/8110S, RTL8169SB/8110SB, and RTL8110SC.

<Requirements>

- kernel source tree (supported Linux kernel 2.6.x/2.4.20 and latter)
- compiler/binutils for kernel compilation

<Quick install with proper kernel settings>
Check whether the built-in driver, r8169.ko(or r8169.o for linux kernel 2.4.x), is installed.
# lsmod | grep r8169

If it is installed, please remove it.
# rmmod r8169
note: If the built-in driver cannot removed by rmmod, please edit /etc/modprobe.conf and comment 'alias eth0 r8169'. Then, remove it again or reboot your computer.

Unpack the tarball :
# tar vjxf r8169-6.aaa.bb.tar.bz2

Change to the directory:
# cd r8169-6.aaa.bb

If you are running the target kernel, then you should be able to do :

# make clean modules (as root or with sudo)
# make install
# depmod -a
# modprobe r8169

You can check whether the driver is loaded by using following commands.

# lsmod | grep r8169
# ifconfig -a

If there is a device name, ethX, shown on the monitor, the linux
driver is loaded. Then, you can use the following command to activate
the ethX.

# ifconfig ethX up

, where X=0,1,2,...

There isn't any config included.
I think it's the NIC drivers as I installed windows on the same machine and within windows, I got connection to the ONT with no issues.

ethtool spits out:

Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised auto-negotiation: Yes
Speed: 10Mb/s
Duplex: Half
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000033 (51)
Link detected: no

Is it also possible to build these on a full distro and then transfer the output to this machine? If so, how do I build to a specific kernel version?
 
Last edited:
I wonder what flavour is it.

- kernel source tree (supported Linux kernel 2.6.x/2.4.20 and latter)
- compiler/binutils for kernel compilation

Tried with a 2.x kernel source? Maybe they didn't expect to live until Linux 3.

Do you have developer tools, like the gcc compiler?

# lsmod | grep r8169

does this find a running module?

I'm literally afraid to lead you down the yellow brick road. I don't want to kill your device.

But, other stuff that I've noticed:
/lib/modules/3.4.104/build - is this even a directory? what's in it?

Typing 'make all' would rebuild the whole kernel... I see you want the module only.
Tried doing all of this as root?

Somehow I doubt this is what you need to do. What's your ifconfig /all?
Ethtool shows there's no cable plugged into the problematic NIC. Can you confirm?

Oh, yes you can test compiling other trees - check this out http://linuxdeveloper.blogspot.com/2012/10/building-linux-kernel-clean-way.html
 
Please post uname -a so we know what build you're on, exactly, and whether it's x86 or x64. As far as I can tell, it should be as easy as installing the dev tools, building the precondition stuff, and modifying the makefile slightly to get that driver working.
 
Confirmed that I can build. In fact, with kernel-headers extracted somewhere, you should be able to do this:

ln -s /lib/modules/<kernelversion>/build /path/to/headers
cd /lib/modules/<kernelversion>/build
make modules_prepare
make -C /lib/modules/<kernelversion>/build M=/path/to/extracted/driver modules
 
Back
Top