Browse Source

add option --ignore-kernel-modules

Instead of adding modprobe and rmmod, create symlinks to /bin/true to
don't produce unnecessary errors.  Anyway it's a workaround for
following desired behaviour: modprobe tries to insert module only if
it's not built into kernel
master
Amadeusz Żołnowski 15 years ago committed by Harald Hoyer
parent
commit
0ca3a5ee84
  1. 10
      dracut
  2. 4
      dracut.8
  3. 11
      modules.d/99base/install

10
dracut

@ -46,6 +46,10 @@ Creates initial ramdisk images for preloading modules
firmwares, separated by : firmwares, separated by :
--kernel-only Only install kernel drivers and firmware files --kernel-only Only install kernel drivers and firmware files
--no-kernel Do not install kernel drivers and firmware files --no-kernel Do not install kernel drivers and firmware files
--ignore-kernel-modules
Don't try to load modules. It automatically implies
'--no-kernel'. It's assumed that everything needed
is built into kernel.
--strip Strip binaries in the initramfs --strip Strip binaries in the initramfs
--nostrip Do not strip binaries in the initramfs (default) --nostrip Do not strip binaries in the initramfs (default)
--mdadmconf Include local /etc/mdadm.conf --mdadmconf Include local /etc/mdadm.conf
@ -86,6 +90,10 @@ while (($# > 0)); do
--fwdir) fw_dir_l="$2"; shift;; --fwdir) fw_dir_l="$2"; shift;;
--kernel-only) kernel_only="yes"; no_kernel="no";; --kernel-only) kernel_only="yes"; no_kernel="no";;
--no-kernel) kernel_only="no"; no_kernel="yes";; --no-kernel) kernel_only="no"; no_kernel="yes";;
--ignore-kernel-modules) kernel_only="no"; no_kernel="yes"
ignore_kmodules="yes"
omit_dracutmodules_l+=\ kernel-modules
;;
--strip) do_strip_l="yes";; --strip) do_strip_l="yes";;
--nostrip) do_strip_l="no";; --nostrip) do_strip_l="no";;
--mdadmconf) mdadmconf_l="yes";; --mdadmconf) mdadmconf_l="yes";;
@ -228,7 +236,7 @@ chmod 755 "$initdir"


export initdir hookdirs dracutbasedir dracutmodules drivers \ export initdir hookdirs dracutbasedir dracutmodules drivers \
fw_dir drivers_dir debug beverbose no_kernel kernel_only \ fw_dir drivers_dir debug beverbose no_kernel kernel_only \
add_drivers mdadmconf lvmconf filesystems add_drivers mdadmconf lvmconf filesystems ignore_kmodules


if [[ $kernel_only != yes ]]; then if [[ $kernel_only != yes ]]; then
# Create some directory structure first # Create some directory structure first

4
dracut.8

@ -52,6 +52,10 @@ only install kernel drivers and firmware files
.BR \-\-no-kernel .BR \-\-no-kernel
do not install kernel drivers and firmware files do not install kernel drivers and firmware files
.TP .TP
.BR \-\-ignore-kernel-modules
don't try to load modules; it automatically implies \fB--no-kernel\fR; it's
assumed that everything needed is built into kernel
.TP
.BR \-\-mdadmconf .BR \-\-mdadmconf
include local /etc/mdadm.conf include local /etc/mdadm.conf
.TP .TP

11
modules.d/99base/install

@ -1,6 +1,13 @@
#!/bin/bash #!/bin/bash
dracut_install mount mknod mkdir modprobe pidof sleep chroot \ dracut_install mount mknod mkdir pidof sleep chroot sed ls flock cp mv dmesg \
sed ls flock cp mv dmesg rm ln rmmod mkfifo less rm ln mkfifo less
if [[ ${ignore_kmodules} = yes ]]; then
inst /bin/true
ln -s /bin/true "${initdir}"/sbin/modprobe
ln -s /bin/true "${initdir}"/sbin/rmmod
else
dracut_install modprobe rmmod
fi
if [ ! -e "${initdir}/bin/sh" ]; then if [ ! -e "${initdir}/bin/sh" ]; then
dracut_install bash dracut_install bash
(ln -s bash "${initdir}/bin/sh" || :) (ln -s bash "${initdir}/bin/sh" || :)

Loading…
Cancel
Save