control filesystems included in the generic initramfs

New "filesystems" command line/config file option is added with the ability to
control the list of kernel filesystem modules that are included in the generic
initramfs.

Signed-off-by: Dan Horák <dan@danny.cz>
master
Dan Horák 2009-11-03 11:50:55 +01:00 committed by Harald Hoyer
parent ff777576d8
commit 8fa510d483
4 changed files with 19 additions and 4 deletions

7
dracut
View File

@ -37,6 +37,9 @@ Creates initial ramdisk images for preloading modules
exclusively include in the initramfs. exclusively include in the initramfs.
--add-drivers [LIST] Specify a space-separated list of kernel --add-drivers [LIST] Specify a space-separated list of kernel
modules to add to the initramfs. modules to add to the initramfs.
--filesystems [LIST] Specify a space-separated list of kernel filesystem
modules to exclusively include in the generic
initramfs.
-k, --kmoddir [DIR] Specify the directory, where to look for kernel -k, --kmoddir [DIR] Specify the directory, where to look for kernel
modules modules
--fwdir [DIR] Specify additional directories, where to look for --fwdir [DIR] Specify additional directories, where to look for
@ -76,6 +79,7 @@ while (($# > 0)); do
-a|--add) add_dracutmodules_l="$2"; shift;; -a|--add) add_dracutmodules_l="$2"; shift;;
-d|--drivers) drivers_l="$2"; shift;; -d|--drivers) drivers_l="$2"; shift;;
--add-drivers) add_drivers_l="$2"; shift;; --add-drivers) add_drivers_l="$2"; shift;;
--filesystems) filesystems_l="$2"; shift;;
-k|--kmoddir) drivers_dir_l="$2"; shift;; -k|--kmoddir) drivers_dir_l="$2"; shift;;
--fwdir) fw_dir_l="$2"; shift;; --fwdir) fw_dir_l="$2"; shift;;
--kernel-only) kernel_only="yes"; nokernel="no";; --kernel-only) kernel_only="yes"; nokernel="no";;
@ -127,6 +131,7 @@ fi
[[ $add_dracutmodules_l ]] && add_dracutmodules="$add_dracutmodules $add_dracutmodules_l" [[ $add_dracutmodules_l ]] && add_dracutmodules="$add_dracutmodules $add_dracutmodules_l"
[[ $drivers_l ]] && drivers=$drivers_l [[ $drivers_l ]] && drivers=$drivers_l
[[ $add_drivers_l ]] && add_drivers=$add_drivers_l [[ $add_drivers_l ]] && add_drivers=$add_drivers_l
[[ $filesystems_l ]] && filesystems=$filesystems_l
[[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l [[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
[[ $fw_dir_l ]] && fw_dir=$fw_dir_l [[ $fw_dir_l ]] && fw_dir=$fw_dir_l
[[ $do_strip_l ]] && do_strip=$do_strip_l [[ $do_strip_l ]] && do_strip=$do_strip_l
@ -180,7 +185,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 add_drivers mdadmconf lvmconf filesystems


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

View File

@ -32,6 +32,9 @@ specify a space-separated list of kernel modules to exclusively include in the i
.BR \-\-add-drivers " \fILIST\fR" .BR \-\-add-drivers " \fILIST\fR"
specify a space-separated list of kernel modules to add to the initramfs. specify a space-separated list of kernel modules to add to the initramfs.
.TP .TP
.BR \-\-filesystems " \fILIST\fR"
specify a space-separated list of kernel filesystem modules to exclusively include in the generic initramfs.
.TP
.BR \-k ", " \-\-kmoddir " \fI{DIR}\fR .BR \-k ", " \-\-kmoddir " \fI{DIR}\fR
specify the directory, where to look for kernel modules specify the directory, where to look for kernel modules
.TP .TP

View File

@ -9,6 +9,9 @@
# additional kernel modules to the default # additional kernel modules to the default
#add_drivers="" #add_drivers=""


# list of kernel filesystem modules to be included in the generic initramfs
#filesystems=""

# build initrd only to boot current hardware # build initrd only to boot current hardware
#hostonly="-h" #hostonly="-h"
# #

View File

@ -6,16 +6,20 @@ if [[ -z $drivers ]]; then
nm -uPA "$1" | egrep -q "$blockfuncs" nm -uPA "$1" | egrep -q "$blockfuncs"
} }
instmods pcmcia sd_mod $(filter_kernel_modules block_module_test) "=drivers/pcmcia" =ide "=drivers/usb/storage" instmods pcmcia sd_mod $(filter_kernel_modules block_module_test) "=drivers/pcmcia" =ide "=drivers/usb/storage"
# if not on hostonly mode, install all known filesystems. # if not on hostonly mode, install all known filesystems if the required list is not set via the filesystems variable
if [[ $hostonly = '' ]]; then if [[ $hostonly = '' ]]; then
instmods '=fs' if [[ -z $filesystems ]]; then
instmods '=fs'
else
instmods $filesystems
fi
else else
instmods $(get_fs_type "/dev/block/$(find_root_block_device)") instmods $(get_fs_type "/dev/block/$(find_root_block_device)")
fi fi
# hardcoded list of exceptions # hardcoded list of exceptions
rm -fr ${initdir}/lib/modules/*/kernel/fs/ocfs2 rm -fr ${initdir}/lib/modules/*/kernel/fs/ocfs2
else else
instmods $drivers instmods $drivers $filesystems
fi fi


[[ $add_drivers ]] && instmods $add_drivers [[ $add_drivers ]] && instmods $add_drivers