Adding a new PCI-X NIC kernel module

From MicroFocusInternationalWiki
Revision as of 23:29, 7 November 2006 by Ssalgy (Talk | contribs) (spelling edit)

Jump to: navigation, search

How to make the new PCI-X Realtek 8169B on the ASUS P5PL2 work

This describes how you can patch your Zenworks Linux Kernel (Novell call it imaging OS) for use with newer PCI and PCI-X 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 ZenKernel 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.)

Obtaining the matching Kernel-Sources for 2.6.5-7.244

This was hard. You can't find a link on the 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.

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 here.] The brand new Linux driver for kernel 2.4.x and 2.6.x is r1000_v1.04.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.04. 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.04
cp -r src/ /usr/src/linux/

Now we can call make.

 make -C src/ clean
 make[1]: Entering directory `/opt/r1000_v1.04/src'
 rm -f *.o *.ko *~ core* .dep* .*.d .*.cmd *.mod.c *.a *.s .*.flags
 make[1]: Leaving directory `/opt/r1000_v1.04/src'
 make -C src/ modules
 make[1]: Entering directory `/opt/r1000_v1.04/src'
 make -C /lib/modules/2.6.5-7.244-default/build SUBDIRS=/opt/r1000_v1.04/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.04/src/r1000_n.o
 CC [M]  /opt/r1000_v1.04/src/r1000_ioctl.o
 LD [M]  /opt/r1000_v1.04/src/r1000.o
 Building modules, stage 2.
 CC      /opt/r1000_v1.04/src/r1000.mod.o
 LD [M]  /opt/r1000_v1.04/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.04/src'
 make -C src/ install
 make[1]: Entering directory `/opt/r1000_v1.04/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.04/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

You must rename it to initrd! This initrd works only for the new ZENworks 7.0.1 kernel


Good luck!

ralph.gottschalkson [ät]

Additional Sources used for this article:

Novell ZenWorks 7 dokumentation

RealTeK Drivers download page

German Novell Documentation


SLES-9 Download

Recommended update for mkinitrd

SLES Kernel Sources for 2.6.5-7.244

Fixing the trouble with r1000 Module