Ok, so I finally got my new Asus Eee Box B202 with Linux preinstalled, however, I didn’t like the distribution that came installed even for a bit, and I had other plans in mind for this machine…
So I wanted to install CentOS on it (my favorite), using PXE of course since I don’t an external CD/DVD drive…
However, during boot up the kernel wouldn’t recognize the 1Gbit Ethernet interface, so it was unable to retrieve the rest of the setup files…
I found that Realtek has put some drivers as source code on thier site, compiling it to the target kernel (2.6.18-53.el5) was not a problem at all…
I wanted to embed this driver into initrd so the setup would recognize and initialize the interface automatically…
Googling around, I couldn’t find much resources or how-tos, the best one was this post…
However, he was talking about CentOS/RHEL 4.x, since CentOS/RHEL things have changed just a bit…
So, here’s what I’ve done to include r8168 driver into the CentOS 5.1 initrd.img …
We start with unpacking initrd.img
cd /tftpboot
mv initrd.img initrd.img.gz
gunzip initrd.img.gz
mkdir initrd
cd initrd && cpio -i –make-directories < ../initrd.img
And then extract the archive the holds the kernel modules
cd modules/
mkdir unpacked
gunzip < modules.cgz | (cd /tftpboot/initrd/modules/unpacked && cpio -idv)
Now, we copy the kernel module into the proper location, and then repack the archive
cp /root/r8168-8.011.00/src/r8168.ko unpacked/2.6.18-53.el5/i686/r8168.ko
cd unpacked
find 2.6.18-53.el5 | cpio -ov -H crc | gzip > /tftpboot/initrd/modules/modules.cgz
cd .. && rm -rf unpacked
Now we need to add the meta data required for loading this module, unlike what has been mentioned the post, CentOS/RHEL 5 have this information now spread in 3 files; pci.ids, modules.alias, module-info
In pci.ids, add these lines:
10ec Realtek Semiconductor Co., Ltd.
8168 RTL8111/8168B Gigabit Ethernet
In modules.alias, add this line:
alias pci:v000010ECd00008168sv*sd*bc*sc*i* r8168
In module-info, add this line:
r8168
eth
"RTL8111/8168B PCI Express Gigabit Ethernet"
Now let’s repack the initrd.img
cd /tftpboot/initrd
(find . | cpio –quiet -c -o) > ../initrd.img
cd .. && rm -rf initrd
gzip initrd.img
mv initrd.img.gz initrd.img
And we’re done
Filed under: Software fun, Work Work Work Tagged: | drivers, initrd, kickstart, linux, pxe
Thanks for the easy step-by-step ..
[...] Adding a new driver to CentOS/RHEL 5.x initrd.img … « Sameh M. Shaker’s Weblog (tags: linux kickstart tips) [...]
Thank you very much! you saved my week -)
Thanks for this.
I could succesfully update the faulty intel e1000e in rhel6 (scientific linux 6) for the network install initrd.img.
The driver came from the elrepo
There is just a difference with redhat6: there is no module.cgz. Each file is gzipped individualy.
Now network install works fine!
Thanks again
[...] http://smshaker.wordpress.com/2009/04/09/adding-network-driver-to-pxe-initrdimg/ [...]
There is something strange with
“–make-directories”
in this line:
“cd initrd && cpio -i –make-directories < ../initrd.img"
I think it should start with two hyphens:
"–make-directories"
actually, it’s two dashes –, it’s the silly blog writer i’m using that converted it to that character …
Thanks for the heads up