Updating RedHat/CentOS Kickstart with new drivers

At work, we have a kickstart setup we have been using for a couple years now, with probably 150 servers out in the field based on this install. Our distro of choice is CentOS, a RedHat clone, and we are at version 4.4. This is out of date now, but it still works great for our needs, as security fixes are regularly back-ported. It would also be a major pain to upgrade our existing installations, and/or support multiple OS versions.

On to the issue at hand: we recently received some new server models that we’ll be supporting, both which have hardware not supported in CentOS 4.4. One machine has a RealTek RTL-8110 ethernet chip, and the other as a 3Ware 9650SE Raid controller. As I later discovered, this presented two unique problems with the kickstart - without the proper storage controller driver, one server didn’t find any disk to install on, and without the proper network driver, the other server couldn’t even connect to our kickstart server at all.

So, as you might guess, there are two different solutions here. The more elegant is for the storage controller, we can create a driver disk with the proper drivers, and make it available on the network during the kickstart. The network driver is more difficult - we need to insert it into the initrd image we provide for PXE boot, and then somehow copy it over after installation (this is an updated driver, r8169.ko, that exists in CentOS 4.4 but doesn’t support our newer card).

Adding a RAID/Storage Card Driver to the Kickstart:
For the driver disk, things are especially easy, as 3Ware provides a driver-disk compatible download, although not yet in the correct format to share over the network.

The driver provided by 3ware ( ) includes the following:

-rwxr-xr-x 1 stever stever 66B Oct 10 2007 modinfo*
-rwxr-xr-x 1 stever stever 249B Oct 10 2007 modules.alias*
-rw-r--r-- 1 stever stever 377K Oct 10 2007 modules.cgz
-rwxr-xr-x 1 stever stever 28B Oct 10 2007 modules.dep*
-rwxr-xr-x 1 stever stever 463B Oct 10 2007 modules.pcimap*
-rwxr-xr-x 1 stever stever 192B Oct 10 2007 pci.ids*
-rwxr-xr-x 1 stever stever 339B Oct 10 2007 pcitable*
-rwxr-xr-x 1 stever stever 37B Oct 10 2007 rhdd*

This is all you need on a driver disk, so all you need to do is create a disk image, and copy these files over:

#Create a blank, 20MB image
dd if=/dev/zero of=/root/driverdisk.img bs=1M count=2
#Format the image with ext2
mkfs -t ext2 -q /root/driverdisk.img
#mount it and copy the files over
mount -o loop /root/driverdisk.img /mnt/tmp
cp /root/3ware/* /mnt/tmp/
umount /mnt/tmp

Now, copy the image over to somewhere accesible on kickstart, and update your ks.cfg with the following:
driverdisk --source=nfs:servername:/vol/kickstart/CentOS-4.4-x86/drivers/driverdisk.img

On network kickstart, anaconda should grab the driver, load it, and proceed normally. This should work for any non-network-card driver you need.

Adding a Network Card Driver to the Kickstart:
This is considerably more arduous, but not too difficult with the magic commands. Much of the information here comes from my friend Steve,

There is no nicely package/built driver provided by RealTek, just some source code with instructions for compiling.

I downloaded the driver here:
After untar’ing unzip’ing, I ran make with the default settings, and manually changed the kernel version to build a smp driver as well (assuming you’re building on a single-cpu system):

[root@lb4 ~]# cd r8169-6.006.00/
[root@lb4 ~]# make
[root@lb4 ~]# mv src/r8169.ko r8169.ko.2.6.9-42.EL
[root@lb4 ~]# make clean
(edit src/Makefile, change the line “KVER := $(shell uname -r)” to “KVER := 2.6.9-42.ELsmp”
[root@lb4 ~]# make
[root@lb4 ~]# mv src/r8169.ko r8169.ko.2.6.9-42.ELsmp

Now you should have two .ko module files compatible with the different kernels - we need to get these inserted into the initrd image. An initrd is basically a disk image that holds various drivers and programs needed to pre-boot your system. It is usually a gzipped disk image file, so its nothing too special. Basically, you need to unzip & mount the initrd image, gunzip/cpio the modules.cgz file in the initrd, make the required changes, and package everything back up.

Here’s those steps in gory detail:

mkdir /mnt/tmp
mkdir /mnt/initrd
mkdir /var/tmp/work
mkdir /var/tmp/work/bootnet
mkdir /var/tmp/work/drvnet
gunzip < /root/tftpboot/initrd.img > /var/tmp/work/bootnet/initrd.img.ungzipped
cd /var/tmp/work/bootnet/
mount -o loop initrd.img.ungzipped /mnt/tmp2
cd /mnt/tmp2/modules
gunzip < modules.cgz | (cd /var/tmp/work/bootnet && cpio -idv)
cd /var/tmp/work/bootnet/2.6.9-42.EL/i686
cp /root/r8169-6.006.00/r8169.ko.2.6.9-42.EL r8169.ko
cd /var/tmp/work/bootnet/2.6.9-42.ELsmp/i686
cp /root/r8169-6.006.00/r8169.ko.2.6.9-42.ELsmp r8169.ko
cd /var/tmp/work/bootnet/
find 2.6.9-42.EL | cpio -ov -H crc | gzip > /mnt/tmp2/modules/modules.cgz
#edit /mnt/initrd/modules/pcitable
#add this:
0×10ec 0×8167 “r8169″ “Realtek|RTL-8110 Gigabit Ethernet”
umount /mnt/initrd
gzip < initrd.img.ungzipped > initrd.r8169.img

I had to boot up DSL, run lspci & lspci -n, to get the ID to put in here - third column has 10ec:8167, which is what we need

So now you can replace your initrd.img with the one you just created. The kickstart should work fine now, but upon reboot, the system will not be able to find the right driver. After the kickstart, you need to copy over the .ko files to the appropriate directories - we added a line in our post-install script to do this for us, it simply copies the .ko file to the appropriate directory (/lib/modules/`uname -r`/kernel/drivers/net/)

Hopefully this is useful to someone, I couldn’t find a good, comprehensive guide on how to do this, I had to pull data from a bunch of different sources.

Source :     thx~ : ) steve~

Comment +0