After I compiled and installed kernel-4.4.1 (from on my CentOS 7, I reboot the machine. But it can’t boot up correctly.

/usr/lib/dracut/skipcpio /boot/initramfs-4.4.1-XXX.img |zcat| cpio -id

to extract the content in initramfs and check them, I found out the ‘mpt2sas’ kernel driver had not been added into initramfs so /boot partition could not be loaded.

Seems this problem is common. Because changing dracut source code or configure file on all servers is not viable, I chose to add command in my kernel rpm spec file:

dracut --add-drivers "raid_class megaraid_sas dm-mod nvme mpt3sas scsi_transport_sas xfs" --kver %{version}-%{release}.%{_target_cpu} --force

This will add drivers to the corresponding initramfs file.

But the kernel could not boot up either. This time, I found that the command line in GRUB2 is like:


Looks we should change it to UUID. Add another command in kernel rpm spec file:

new-kernel-pkg --package %{name} --kernel-args="root=`grep -o -P "(?<=root=)\S+" /proc/cmdline`" --update %{version}-%{release}.%{_target_cpu}

This will get UUID of boot disk from /proc/cmdline and give it to GRUB2 configure file.

Now, the kernel-4.4.1 boot up correctly on CentOS 7.