Description of Problem: 'mkinitrd' is broken in such sense that it is unable to reasonably handle even simple /etc/modules.conf conditional constructs like these: if -f /lib/modules/`uname -r`/kernel/drivers/scsi/sym53c8xx_2/sym53c8xx_2.o alias scsi_hostadapter sym53c8xx_2 else alias scsi_hostadapter sym53c8xx endif which is both legal and very reasonable in handling multiple kernels with possibly different module lists. This is a very simple example and quite a bit more complicated are possible. Instead of feeble attempts of parsing /etc/modules.conf in 'mkinitrd' this script should rely on an output of 'modprobe -c' which _has_ to do that properly, and normalizes its output, or it is broken. Attached simple patch is for version 3.3.10 but some variations of it will apply all over.
Created attachment 76345 [details] Simple patch to handle all legal /etc/modules.conf files in mkinitrd
Oops! A space is missing. The patch should read options=$( /sbin/modprobe -c | grep "^options $module " | \ instead of options=$( /sbin/modprobe -c | grep "^options $module" | \ or, alternatively, "$module" can be tested in a subseqent while-loop.
Sigh! This still will not work in general without adding to modprobe an option to request a configuration for a specified kernel instead of the current one. This is not likely be very difficult and/or invasive. Trying to reparse modules.conf correctly in a shell script likely will be always a very dicey proposition.
as you've noted, this is not going to be straightforward to fix. if the upstream modutils folks decide to help out I'll add the support to mkinitrd