Adding a new PCI-X NIC kernel module

From CoolSolutionsWiki


Contents

How to make the new PCI-e Realtek 8169B on the ASUS P5PL2 - P5KPL and ATTANSIC LAN too

This describes how you can patch your ZENworks Linux Kernel (Novell calls it Imaging OS) for use with newer PCI and PCI-e Network Cards. We needed this for the brand new ASUS P5PL2.

You need a little experience in Kernel-compiling, a BROoooOOADband (really! no modem) internet access and a valid novell-logon. This goes along with the Novell Documentation ZENworks 7 and shows you the quirks.

Preparing ZENworks by using the latest ZENworks-Imaging-kernel

ZENworks uses the SLES 9 SP3 Kernel 2.6.5-7.244. Make sure that you use the newest Zen Kernel in /boot on your PXE-(Proxy)-Server.

(We extracted the /boot directory from the ZENworks 7.01 ISO's and now we're running ZENworks 7.0 with ZENworks 7.01 boot-Directory.)


Note , from ZENworks 7 SP1 HP1 onwards, the kernel is based on SLES10

HP3 is 2.6.16.21-0.25

Obtaining the matching Kernel-Sources for 2.6.5-7.244

This was hard. You can't find a link on the Novell.com pages (until now) that guides you to the right page. There is only a Page called SUSE patch support database (wrongly spelled SuSE) Here!.

But where the hell is the 244 kernel? I had to dive into many links like //Recommended update for Linux kernel//. By testing the link 22 DEC 2005 you are guided to a page with the right kernel. (But you don't know that, because the page tells you something about **Patch:** patch-10727. Until you blindly follow the link provided in links to download packages Here

After that you should download the Kernel-default, the kernel-source and the syms.

By installing these patches you are told that you need a newer mkinitrd. Thats why I tell you now to download the

    • Recommended update for mkinitrd x86 05/27/05** mkinitrd-1.2-27.9.i586.rpm.

Being logged in with your Novell account you can download it here.


for SP1HP2 and higher, use SLES10 to compile

Creating the kernel-compiling environment

For this task I installed a minimal SLES-9 with gcc,make and the MidnightCommander in a VMWare and installed the previously downloaded packages.

 rpm -Uvh mkinit*
 rpm -Uvh kernel-defau*
 rpm -Uvh kernel-sym*
 rpm -ivh kernel-sour*

Getting the PCI-X NIC driver

The sources for the RTL8111B/RTL8168B/RTL8111/RTL8168 Cards (and onboard Cards) are www.realtek.com.tw here.] The brand new Linux driver for kernel 2.4.x and 2.6.x is r1000_v1.05.tgz.

Compiling the kernel module

For this example I use the /opt directory on my virtualized SLES-Server. Unpack the r1000 driver in /opt.

tar -xvzf r1000*

After that you find the directory r1000_v1.05. In this directory you find a Makefile and the subdirectory src. Copy the src directory to the Linux source-tree. (This is necessary because there is a mistake in the drivers Makefile). There is no need for doing this (normally!).

cd /opt/r1000_v1.05
cp -r src/ /usr/src/linux/

Now we can call make.

 make -C src/ clean
 make[1]: Entering directory `/opt/r1000_v1.05/src'
 rm -f *.o *.ko *~ core* .dep* .*.d .*.cmd *.mod.c *.a *.s .*.flags
 make[1]: Leaving directory `/opt/r1000_v1.05/src'
 make -C src/ modules
 make[1]: Entering directory `/opt/r1000_v1.05/src'
 make -C /lib/modules/2.6.5-7.244-default/build SUBDIRS=/opt/r1000_v1.05/src modules
 make[2]: Entering directory `/usr/src/linux-2.6.5-7.244-obj/i386/default'
 make -C ../../../linux-2.6.5-7.244 O=../linux-2.6.5-7.244-obj/i386/default modules
 CC [M]  /opt/r1000_v1.05/src/r1000_n.o
 CC [M]  /opt/r1000_v1.05/src/r1000_ioctl.o
 LD [M]  /opt/r1000_v1.05/src/r1000.o
 Building modules, stage 2.
 MODPOST
 CC      /opt/r1000_v1.05/src/r1000.mod.o
 LD [M]  /opt/r1000_v1.05/src/r1000.ko
 make[2]: Leaving directory `/usr/src/linux-2.6.5-7.244-obj/i386/default'
 make[1]: Leaving directory `/opt/r1000_v1.05/src'
 make -C src/ install
 make[1]: Entering directory `/opt/r1000_v1.05/src'
 install -m 644 -c r1000.ko /lib/modules/2.6.5-7.244-default/kernel/drivers/net/
 make[1]: Leaving directory `/opt/r1000_v1.05/src'


And after some seconds we can find our needed module in the src directory.

Putting our module into the initrd

This is really simple (really!).

Just follow the Novell documentation right here D.4.2 Adding Files to the Initrd or Root File Systems

Create a work -directory in /opt mkdir /opt/work

Point 7 from Novell Documentation :

"cp /your_path/module.ko work/lib/modules/2.6.5-override-default/initrd"

cp /opt/r1000_v1.04/src/r1000.ko /opt/work/lib/modules/2.6.5-override-default/initrd

Following the steps you can finish creating your new initrd.

For testing purposes you can try this initrd on your PXE-server.

Reading the Novell documentation you think you're done - WRONG!

Telling the kernel how to handle the new device(s)

There are 2 IMPORTANT steps between:

Since the SLES kernel is not very new, the kernel doesn't know newer devices. You have to teach him how to handle new devices.

By creating the new initrd I also put the program lspci into it.

The kernel did not load the module, because it's too new. You can take a look on the devices attached on the pci bus.


 00:00.0 0600: 8086:2770 (rev 02)
 00:01.0 0604: 8086:2771 (rev 02)
 00:1b.0 0403: 8086:27d8 (rev 01)
 00:1c.0 0604: 8086:27d0 (rev 01)
 00:1c.3 0604: 8086:27d6 (rev 01)
 00:1d.0 0c03: 8086:27c8 (rev 01)
 00:1d.1 0c03: 8086:27c9 (rev 01)
 00:1d.2 0c03: 8086:27ca (rev 01)
 00:1d.3 0c03: 8086:27cb (rev 01)
 00:1d.7 0c03: 8086:27cc (rev 01)
 00:1e.0 0604: 8086:244e (rev e1)
 00:1f.0 0601: 8086:27b8 (rev 01)
 00:1f.1 0101: 8086:27df (rev 01)
 00:1f.2 0101: 8086:27c0 (rev 01)
 00:1f.3 0c05: 8086:27da (rev 01)
 02:00.0 0200: 10ec:8168 (rev 01)
 04:00.0 0300: 1002:5b60
 04:00.1 0380: 1002:5b70


You can see a lot of numbers 8086? Ah, Intel chips! I downloaded the NIC-Driver RTL8168 from REALTEK. Is there a number like 8168? Yes!

Take a look!

02:00.0 0200: 10ec:8168 (rev 01)


Does 10ec mean REALTEK?? Yes it's REALTEK! You can take a look to the PCIDATABASE.


Where is the glue that puts the driver-module to the device?

Mount your initrd again as described in the Novell documentation.

In the directory lib/modules/2.6.5-7.244-default you find the file modules.pcimap.

Searching for the REALTEKs vendor-string 10ec you can find an entry that looks nice:

r8169                0x000010ec 0x00008169 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0

This means: load the r8169 driver module for the REALTEK (0x000010ec) with device code 8169

We want the kernel to load our newly compiled module r1000. We know its REALTEK and the code was **8168**.

So we put an additional line to this file.

r1000 0x000010ec 0x00008168 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0


Further we know this is a Network device.

This we have to teach the kernel too.

In the modules directory of the initrd we have to adapt the file module.config.

There you find the in the section **[network]** following entry:

r8169,RealTek RTL8169 Gigabit Ethernet

Just add the following line below:

r1000,RealTek RTL8111B Gigabit PCI-Express


Now you can unmount and gzip the improved initrd. Copy this one to your /boot directory on the PXE-Server.

Now we are ready to take off!


Give me the new initrd!

Here you will find my INITRD and the matching LINUX kernel. This stuff works only for the new ZENworks 7.0.1 kernel

Dos not work now, but later

initrd for attensic lan

UPDATE

I have an modified kernel with the ATTANSIC LAN pci-x NIC running!

Drop me a line if you want it!


Good luck!

ralph.gottschalkson [ät] rathaus.potsdam.de


Additional Sources used for this article:

Novell ZenWorks 7 dokumentation

RealTeK Drivers download page

German Novell Documentation

PCI-Database

SLES-9 Download

Recommended update for mkinitrd

SLES Kernel Sources for 2.6.5-7.244

Fixing the trouble with r1000 Module