12 May 2017

You may need to update drivers for UCS if it doesn’t install or recognize different components. To make this fit with our existing automated installation we need to update the initrd.img that is included in the isolinux directory.

Get your dependencies:

yum -y install xz

Now modify the initrd

mkdir -p /install/stage/centos7.3/exploded
cp <centos7.3root>/isolinux/initrd.img /install/stage/centos7.3/
cd /install/stage/centos7.3/exploded
xz -dc < ../initrd.img | cpio --quiet -i --make-directories

You’ll now have a file system that we need to inject.

Get the New Drivers Into your initrd.img

Figure out where the RPM will install the drivers:

rpm -ql -p kmod-megaraid*

Then install the drivers:

rpm -ivh kmod-megaraid_sas-07.701.16.00_el7.3-1.x86_64.rpm --nodeps

Copy these ko files into the right directory. In this case we have

cd /lib/modules/3.10.0-514.el7.x86_64/extra/megaraid_sas

Overwrite the old one:

mv megaraid_sas.ko /install/stage/centos7.3/exploded/lib/modules/3.10.0-514.el7.x86_64/kernel/drivers/scsi/megaraid/

Pack the old image back up

cd /lib/stage
find . 2>/dev/null | cpio --quiet -c -o | xz -9 --format=lzma >../new_initrd.img

Note: This command takes longer than you probably would like.

You now have a new initrd.img that you can put into your isolinux tree for installations.


  • Need to update squashfs?
yum -y install squashfs-tools

find the LiveOS directory in the isolinux directory.

cd LiveOS
unsquashfs squashfs.img
cd squashfs-root/LiveOS/
mkdir mnt
mount -t ext4 rootfs.img mnt
cp /lib/modules/3.10.0-514.el7.x86_64/extra/megaraid_sas/megaraid_sas.ko extra/megaraid_sas/

Let’s see the pre/post scripts:

rpm -q --scripts kmod-megaraid_sas

We get the output:

if [ -e "/boot/System.map-3.10.0-514.el7.x86_64" ]; then
    /usr/sbin/depmod -aeF "/boot/System.map-3.10.0-514.el7.x86_64" "3.10.0-514.el7.x86_64" > /dev/null || :

modules=( $(find /lib/modules/3.10.0-514.el7.x86_64/extra/megaraid_sas | grep '\.ko$') )
if [ -x "/sbin/weak-modules" ]; then
    printf '%s\n' "${modules[@]}"     | /sbin/weak-modules --add-modules