Adding a driver to kickstart AND driverdisk

The previous post explained that I was able to add the Realtek driver to the PXE boot Kickstart environment. However the driver would not be available or activated on the new machine for some reason. My guess is that I needed to add the driver not just to the Kickstart environment but also as a driver in the driverdisk. If you don't have a driverdisk.img available already, it is easy to make one. Here I will only work on an existing driverdisk.img so some steps may seem incomplete if you're starting from scratch.

I loosely followed Ruiz's instructions again on how to mount driverdisk.img and modify the modules.cgz file and stuff. Take a look again if you need to, there's a link to the article from my previous post.

So I got the driverdisk.img I needed to modify and mounted it as a loop device:

[root@netboot-system-og driverdisk-tmp]# ls -la
total 20516
drwxr-xr-x 2 root root     4096 Jun  4 02:25 .
drwxrwxrwt 7 root root     4096 Jun  4 02:25 ..
-rw-r--r-- 1 root root 20971520 May 21  2008 driverdisk.img
[root@netboot-system-og driverdisk-tmp]# mkdir /mnt/driverdiskmount
[root@netboot-system-og driverdisk-tmp]# mount -o loop driverdisk.img !$
mount -o loop driverdisk.img /mnt/driverdiskmount
[root@netboot-system-og driverdisk-tmp]# ls /mnt/driverdiskmount/
lost+found  modinfo  modules.alias  modules.cgz  modules.dep  modules.pcimap  pci.ids  pcitable  rhdd

The file I need to work with mostly is modules.cgz so I have to do some magic commands to be able to modify that file.

[root@netboot-system-og driverdisk-tmp]# ls -la
total 20836
drwxr-xr-x 2 root root     4096 Jun  4 03:06 .
drwxrwxrwt 7 root root     4096 Jun  4 02:25 ..
-rw-r--r-- 1 root root 20971520 May 21  2008 driverdisk.img
-rw-r--r-- 1 root root   322323 Jun  4 03:06 modules.cgz
[root@netboot-system-og driverdisk-tmp]# mkdir work
[root@netboot-system-og driverdisk-tmp]# 
[root@netboot-system-og driverdisk-tmp]# gunzip < modules.cgz | (cd ./work && cpio -idv)
2.6.9-42.EL
2.6.9-42.EL/i586
2.6.9-42.EL/i586/3w-9xxx.ko
2.6.9-42.EL/i686
2.6.9-42.EL/i686/3w-9xxx.ko
2.6.9-42.EL/i686/r8169.ko
2.6.9-42.ELsmp
2.6.9-42.ELsmp/i686
2.6.9-42.ELsmp/i686/3w-9xxx.ko
2.6.9-42.ELsmp/i686/r8169.ko
1557 blocks
[root@netboot-system-og driverdisk-tmp]# ls -la
total 20840
drwxr-xr-x 3 root root     4096 Jun  4 03:06 .
drwxrwxrwt 7 root root     4096 Jun  4 02:25 ..
-rw-r--r-- 1 root root 20971520 May 21  2008 driverdisk.img
-rw-r--r-- 1 root root   322323 Jun  4 03:06 modules.cgz
drwxr-xr-x 4 root root     4096 Jun  4 03:07 work

I now need to insert the new drivers into the structure. The tree command helps me visualize the structure easier than ls...

[root@netboot-system-og driverdisk-tmp]# scp oscarg@10.10.3.204:~/realtek.8168.zip ./
Password:
realtek.8168.zip                                                                                100%   48KB  48.4KB/s   00:00    
[root@netboot-system-og driverdisk-tmp]# 
[root@netboot-system-og driverdisk-tmp]# 
[root@netboot-system-og driverdisk-tmp]# ls -la
total 20896
drwxr-xr-x 3 root root     4096 Jun  4 03:09 .
drwxrwxrwt 7 root root     4096 Jun  4 02:25 ..
-rw-r--r-- 1 root root 20971520 May 21  2008 driverdisk.img
-rw-r--r-- 1 root root   322323 Jun  4 03:06 modules.cgz
-rw-r--r-- 1 root root    49528 Jun  4 03:09 realtek.8168.zip
drwxr-xr-x 4 root root     4096 Jun  4 03:07 work
[root@netboot-system-og driverdisk-tmp]# unzip realtek.8168.zip 
Archive:  realtek.8168.zip
  inflating: r8168.ko.2.6.9-42.EL    
  inflating: r8168.ko.2.6.9-42.ELsmp  
[root@netboot-system-og driverdisk-tmp]# ls -la work/
total 16
drwxr-xr-x 4 root root 4096 Jun  4 03:07 .
drwxr-xr-x 3 root root 4096 Jun  4 03:09 ..
drwx------ 4 root root 4096 Jun  4 03:07 2.6.9-42.EL
drwx------ 3 root root 4096 Jun  4 03:07 2.6.9-42.ELsmp
[root@netboot-system-og driverdisk-tmp]# cd !$
cd work/
[root@netboot-system-og work]# tree -L 3
.
|-- 2.6.9-42.EL
|   |-- i586
|   |   `-- 3w-9xxx.ko
|   `-- i686
|       |-- 3w-9xxx.ko
|       `-- r8169.ko
`-- 2.6.9-42.ELsmp
    `-- i686
        |-- 3w-9xxx.ko
        `-- r8169.ko

5 directories, 5 files
[root@netboot-system-og work]# cp ../r
r8168.ko.2.6.9-42.EL     r8168.ko.2.6.9-42.ELsmp  realtek.8168.zip         
[root@netboot-system-og work]# cp ../r8168.ko.2.6.9-42.EL 2.6.9-42.EL/i686/r8168.ko
[root@netboot-system-og work]# cp ../r8168.ko.2.6.9-42.ELsmp 2.6.9-42.ELsmp/i686/r8168.ko
[root@netboot-system-og work]# tree -L 3
.
|-- 2.6.9-42.EL
|   |-- i586
|   |   `-- 3w-9xxx.ko
|   `-- i686
|       |-- 3w-9xxx.ko
|       |-- r8168.ko
|       `-- r8169.ko
`-- 2.6.9-42.ELsmp
    `-- i686
        |-- 3w-9xxx.ko
        |-- r8168.ko
        `-- r8169.ko

5 directories, 7 files

Then repackage modules.cgz and hold on to it for a minute, we still have to edit 2 more files in the driverdisk that is mounted. We need to edit pcitable and modinfo; pcitable should get the same extra line that I added in the previous post to the pcitable file in the initrd image we modified for the kickstart.

[root@netboot-system-og driverdisk-tmp]# grep 8168 ~/pcitable.frominitrd 
0x10ec  0x8168  "r8168" "Realtek|RTL8111/8168B PCI Express Gigabit Ethernet controller"
[root@netboot-system-og driverdisk-tmp]# ls
driverdisk.img  md5sum.modules.cgz  modules.cgz  modules.cgz.orig  r8168.ko.2.6.9-42.EL  r8168.ko.2.6.9-42.ELsmp  realtek.8168.zip  work
[root@netboot-system-og driverdisk-tmp]# ls -la
total 21404
drwxr-xr-x 3 root root     4096 Jun  4 03:16 .
drwxrwxrwt 8 root root     4096 Jun  4 03:32 ..
-rw-r--r-- 1 root root 20971520 May 21  2008 driverdisk.img
-rw-r--r-- 1 root root       46 Jun  4 03:16 md5sum.modules.cgz
-rw-r--r-- 1 root root   371698 Jun  4 03:19 modules.cgz
-rw-r--r-- 1 root root   322323 Jun  4 03:15 modules.cgz.orig
-rw-r--r-- 1 root root    65068 Jun  2 13:13 r8168.ko.2.6.9-42.EL
-rw-r--r-- 1 root root    64168 Jun  2 13:13 r8168.ko.2.6.9-42.ELsmp
-rw-r--r-- 1 root root    49528 Jun  4 03:09 realtek.8168.zip
drwxr-xr-x 4 root root     4096 Jun  4 03:07 work
[root@netboot-system-og driverdisk-tmp]# cd /mnt/
cdrom/           centos52-x86-64/ clonezilla-live/ driverdiskmount/ initrdtmp/       oracle/          tmp/             
[root@netboot-system-og driverdisk-tmp]# cd /mnt/driverdiskmount/
[root@netboot-system-og driverdiskmount]# ls
lost+found  modinfo  modules.alias  modules.cgz  modules.dep  modules.pcimap  pci.ids  pcitable  rhdd
[root@netboot-system-og driverdiskmount]# cd -
/tmp/driverdisk-tmp
[root@netboot-system-og driverdisk-tmp]# cd work/
[root@netboot-system-og work]# ls -la
total 16
drwxr-xr-x 4 root root 4096 Jun  4 03:07 .
drwxr-xr-x 3 root root 4096 Jun  4 03:16 ..
drwx------ 4 root root 4096 Jun  4 03:07 2.6.9-42.EL
drwx------ 3 root root 4096 Jun  4 03:07 2.6.9-42.ELsmp
[root@netboot-system-og work]# cd -
/tmp/driverdisk-tmp
[root@netboot-system-og driverdisk-tmp]# ls
driverdisk.img  md5sum.modules.cgz  modules.cgz  modules.cgz.orig  r8168.ko.2.6.9-42.EL  r8168.ko.2.6.9-42.ELsmp  realtek.8168.zip  work
[root@netboot-system-og driverdisk-tmp]# cd /mnt/driverdiskmount/
[root@netboot-system-og driverdiskmount]# cp pcitable ~/pcitable.original.driverdisk
[root@netboot-system-og driverdiskmount]# vi pcitable 
[root@netboot-system-og driverdiskmount]# cp modinfo ~/modinfo.original.driverdisk
[root@netboot-system-og driverdiskmount]# vi modinfo
[root@netboot-system-og driverdiskmount]# cat pcitable && cat modinfo 
0x13c1  0x1000  "3w-xxxx"       "3ware Storage Controller"
0x13c1  0x1001  "3w-xxxx"       "3ware Storage Controller"
0x13c1  0x1002  "3w-9xxx"       "3ware 9xxx Storage Controller"
0x13c1  0x1003  "3w-9xxx"       "3ware 9550SX/9590SE Storage Controller"
0x13c1  0x1004  "3w-9xxx"       "3ware 9650SE Storage Controller"
0x13c1  0x1005  "3w-9xxx"       "3ware 9690SA Storage Controller"
0x10ec  0x8168  "r8168" "Realtek|RTL8111/8168B PCI Express Gigabit Ethernet controller"
0x10ec  0x8167  "r8169" "Realtek|RTL-8169 Gigabit Ethernet"
0x10ec  0x8169  "r8169" "Realtek|RTL-8169 Gigabit Ethernet"
Version 0
3w-9xxx
        scsi
        "3ware Storage Controller"
r8169
        eth
        "RTL8169 Gigabit Ethernet"
r8168
        eth
        "RTL8111/8168B PCI Express Gigabit Ethernet controller"
[root@netboot-system-og driverdiskmount]#

Now we can copy modules.cgz back into the loop device and unmount it and it should be ready to go. Notice the modified times and size.

[root@netboot-system-og driverdiskmount]# pwd
/mnt/driverdiskmount
[root@netboot-system-og driverdiskmount]# ls -la
total 352
drwxr-xr-x 3 root root   1024 Jun  4 03:36 .
drwxr-xr-x 9 root root   4096 Jun  4 03:31 ..
drwx------ 2 root root  12288 May 21  2008 lost+found
-rwxr-xr-x 1 root root    187 Jun  4 03:36 modinfo
-rwxr-xr-x 1 root root    249 May 21  2008 modules.alias
-rw-r--r-- 1 root root 322323 May 21  2008 modules.cgz
-rwxr-xr-x 1 root root     28 May 21  2008 modules.dep
-rwxr-xr-x 1 root root    463 May 21  2008 modules.pcimap
-rwxr-xr-x 1 root root    192 May 21  2008 pci.ids
-rwxr-xr-x 1 root root    547 Jun  4 03:36 pcitable
-rwxr-xr-x 1 root root     37 May 21  2008 rhdd
[root@netboot-system-og driverdiskmount]# pwd
/mnt/driverdiskmount
[root@netboot-system-og driverdiskmount]# cp /tmp/
crap/           driverdisk-tmp/ .font-unix/     .ICE-unix/      initrd/         tftpboot1/      
[root@netboot-system-og driverdiskmount]# cp /tmp/driverdisk-tmp/
driverdisk.img           modules.cgz              r8168.ko.2.6.9-42.EL     realtek.8168.zip         
md5sum.modules.cgz       modules.cgz.orig         r8168.ko.2.6.9-42.ELsmp  work/                    
[root@netboot-system-og driverdiskmount]# cp /tmp/driverdisk-tmp/modules.cgz ./
cp: overwrite `./modules.cgz'? y
[root@netboot-system-og driverdiskmount]# ls -la
total 400
drwxr-xr-x 3 root root   1024 Jun  4 03:36 .
drwxr-xr-x 9 root root   4096 Jun  4 03:31 ..
drwx------ 2 root root  12288 May 21  2008 lost+found
-rwxr-xr-x 1 root root    187 Jun  4 03:36 modinfo
-rwxr-xr-x 1 root root    249 May 21  2008 modules.alias
-rw-r--r-- 1 root root 371698 Jun  4 03:39 modules.cgz
-rwxr-xr-x 1 root root     28 May 21  2008 modules.dep
-rwxr-xr-x 1 root root    463 May 21  2008 modules.pcimap
-rwxr-xr-x 1 root root    192 May 21  2008 pci.ids
-rwxr-xr-x 1 root root    547 Jun  4 03:36 pcitable
-rwxr-xr-x 1 root root     37 May 21  2008 rhdd
[root@netboot-system-og driverdiskmount]#

Unmount it and it should be ready to use. I noticed that my driverdisk.img file did not change in filesize or its timestamp. I think that the filesize is detrmined by how you initially create the file e.g. using dd and specifying 20mb. And the timestamp thing... thats a mystery to me right now ((If you'd like to explain this to me please leave a comment)) but it should work once you replace the original driverdisk.img file with the one you edited recently.

Similar Posts