Linux – What does mkinitrd change when it adds kernel modules to the initrd

initrdkernel-moduleslinux

When creating an initrd using mkinitrd (CentOS 5.5), the kernel modules it adds to the initrd get modified in the process. For example, the initrd's /lib/sata_via.ko is not binary identical to /lib/modules/2.6.18-194.32.1.el5/kernel/drivers/ata/sata_via.ko.

I am just curious as to what happens when mkinitrd includes a kernel module – does it link in dependencies, or what is it that makes the module change?

Best Answer

You have a /lib/sata_vio.ko in your initrd? Is (or was) one of your file systems (e.g. / = "root") on a SATA drive that would need that driver? Does an entry for it appear in /etc/modules or /etc/mkinitrd/modules?

On my Ubuntu system, the module is in the same location inside the initrd image, e.g. <extracted initrd>/lib/modules/<uname -r>/drivers/ata/sata_vio.ko.

What does file say? What does strings | grep '\<ver' say? Maybe it's from a different driver or a different kernel version?

Obviously you could use ls -l or du to get an idea if /lib/sata_vio.ko is larger, and run nm -D against both files to see if there is any difference in symbols (e.g. using diff).

The whole process should be documented in man mkinitrd, in particular, it should say what scripts your system runs, perhaps something in /usr/share/initrd-tools/scripts or /etc/mkinitrd/scripts?

Related Question