Thursday, April 12, 2012

How to add kernel module to RHEL/Centos to fix unsupport driver

When you setup RHEL/Centos on Server, may be some driver is missing or not support.
One easy solution is rebuild ISO to add new module. This article may help you.
- Prerequires:
+ RHEL/Centos DVD (or ISO).
+ Kernel module.
- First: Build kernel module.
- Second: Mount DVD to disk and copy entire disk to new location.
mkdir ~/rebuild/ISO
mount /dev/cdrom ~/rebuild/ISO
rsync -a ~/rebuild/ISO ~/rebuild/BUILD
- Third: add module to initrd.img
Copy initrd.img to /tmp and move to this directory, then:
gzip -dc initrd.img > initrd.unc.img
cpio -id < initrd.unc.img
cd modules
zcat modules.cgz | cpio -idvm
Copy module to modules/2.6.18-128.el5/x86_64 ( in case i use 64bit) then repacked:
find 2.6.18-128.el5 | cpio -H newc -ov | gzip -9 -c - > modules.cgz
sync
Edit pci.ids, module-info and modules.dep (if necessary). Then create initrd.img:
cd ..
find . | cpio -H newc -ov | gzip -9 -c - > initrd.img
- Final: replace with your new initrd.img, and move to ~/build/BUILD to rebuild ISO
mkisofs -o ../custom.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul- boot -boot- load-size 4 -boot-info-table -v -r -l -L -T -J -V "CUSTOM.X.X" .

1 comment:

jjinno said...

What about something like a RAID driver? What you have described will put the driver into the installer, allowing the installer to complete...

However, once complete (aka: when we reboot into the disk-fs instead of booting to the DVD ramfs) the system would be dead in the water, no?

Also, as far as I have been able to identify, the solution is more complex than simply installing the driver (RPM) as part of the install. The problem herein exists in the generation of the initrd file used at boot. It is possible to install the RPM kernel module but fail to include that within the initrd, resulting in a non-bootable system.

Have you run into this? And/or got past this?