This is a patch series I have been playing with for awhile.
It cleans up some of the dracut code and adds a PKGBUILD file to make
it easier to use in Arch Linux.
Make sure that we do not accept module name which is substring of
some other module name. This resulted in piix being mistakenly loaded
together with ata_piix. It completely broke DVD access here.
Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
modprobe included in version prior to 3.7 of module-init-tools doesn't
have -d | --dirname option which allows to give a prefix other than
'/' for kernel modules path. Dracut assumes existence of that
option and uses it even with default '/'. The patch passes -d option
only if it's different from default and also checks module-init-tools
version if user changes the prefix by --kmoddir Dracut option.
this makes dracut load kernel module specified in add-drivers even
if building an host-only mkinitrd, it is useful in cases where we
might change some storage drivers and still don't want to build
an enormous initrd (e.g. ahci/ata_piix)
If a module has a hyphen in its name, it will show up as an underscore
in /proc/modules. Because of this, when we're testing /proc/modules,
we have to munge our module filename expression to match.
On amd64 multilib Gentoo, /lib is a symlink to /lib64, and dracut creates
duplicate files in /lib and /lib64 in a resulting cpio image. Other files are
missing in /lib64 but exists in /lib in that image. So /usr/sbin/lvm fails to
run from initrd due to missing libraries. A possible solution is to create in
the initrd the same /lib symlink as in host system, if /lib is a symlink.
http://bugs.gentoo.org/show_bug.cgi?id=278442#c10
This introduces filter_kernel_modules, which should be used to install
all kernel modules that match whatever criteria you want.
If running in --hostonly, filter_kernel_modules will only consider
modules that are loaded in the kernel, otherwise it will consider
all the modules installed on the system for the appropriate kernel.
This drastically reduces initramfs generation time when using --hostonly
by eliminating lots of unneeded filesystem activity.
Instead of grovelling through all the modules available for the
kernel looking for block devices, only look at the modules that are
actually loaded. This speeds things up by a rather large amount
when generating the initramfs with --hostonly.
While we are at it, only load the filesystem module that will actually
be used for the root filesystem when running in --hostonly instead
of all the filesystem modules that happen to be loaded at the time.
Since different distros may or may not use vol_id in udev, and blkid
is generally replacing vol_id, abstract them out into a function which
tries to use vol_id first and blkid second, on the assumption that
blkid can take over for vol_id if vol_id is no longer there.