[CentOS] Compile driver for new kernel rpm

James Pearson james-p at moving-picture.com
Wed Jun 24 15:30:51 UTC 2009

Chadley Wilson wrote:

> Thanks for the links Filipe, much appreciated.
> to Tim, I had another thread where the scenario is that the centos
> boot disk does not include a  critical ATA driver. We (the company
> where I work) are planning to distribute the discs with the computers
> we sell. So I need the driver included in the disc in the same
> fashion we do with our OEM Windows. The problem is that I can get the
> driver into the initrd.img and you can select it from the list when
> prompted for installation sources / load driver(select or disc). But
> this means we can't run the kickstart files from CD because before
> you can select your CD drivers, you must locate your ks.cfg file or
> cancel kickstart and load the driver. And I am unfortunately not in
> the position to be giving every customer a free flash drive to
> overcome the issue.
> To get back to my main objective,
> I know I am probably asking the question the wrong way here, but if I
> compile my driver, do I have to rebuild the kernel to put it in the
> initrd.img file? Or can I just run mkinitrd?

I frequently rebuild the kernel/installer - mainly to support NICs that 
are newer than the current CentOS release - as we do NFS installs - 
which require a working NIC driver to do the install :-)

Rebuilding a CentOS 5 install image is not hard - it basically involves 
having a copy of the whole distro on disk (with your updated RPMS), 
installing the anaconda-runtime RPM (plus a few other RPMS associated 
RPMS) and running /usr/lib/anaconda-runtime/buildinstall with various 
options to create the installer images.

I've never re-created a set of distro CDs/DVD - but I think that is also 
quite straight forward once you have an updated disto tree.

The difficult part is getting the additional and/or updated/patched 
drivers into the kernel you want to use - but the page at 
<http://wiki.centos.org/HowTos/Custom_Kernel> seems to cover that - but 
you really do need some spec file hacking and SRPM re-building knowledge ...

Feel free to contact me off list if you need further pointers

James Pearson

More information about the CentOS mailing list