From: Harald Hoyer Date: Wed, 27 Jun 2012 15:02:49 +0000 (+0200) Subject: dracut.sh, dracut-functions.sh: add dracut_kernel_post() X-Git-Tag: 020~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70c6b773ca92f3b943b019326d2d70d9f0bc513e;p=thirdparty%2Fdracut.git dracut.sh, dracut-functions.sh: add dracut_kernel_post() dracut_kernel_post() does lazy kernel module dependency installation, depmod and cleans up temporary files --- diff --git a/dracut-functions.sh b/dracut-functions.sh index 7ec20cb33..696f64715 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -22,6 +22,7 @@ [[ $initdir ]] || { echo "ERROR: initdir $initdir not set" 2>&1; exit 10; } [[ -d $initdir ]] || mkdir -p $initdir +[[ -d "$initdir/.kernelmodseen" ]] || mkdir -p "$initdir/.kernelmodseen" export initdir # Generic substring function. If $2 is in $1, return 0. @@ -1122,7 +1123,7 @@ for_each_kmod_dep() { ) } -do_lazy_kmod_dep() { +dracut_kernel_post() { local _moddirname=${srcmods%%/lib/modules/*} [[ -f "$initdir/.kernelmodseen/lazylist" ]] || return 0 @@ -1150,6 +1151,26 @@ do_lazy_kmod_dep() { done done wait + + for _f in modules.builtin.bin modules.builtin; do + [[ $srcmods/$_f ]] && break + done || { + dfatal "No modules.builtin.bin and modules.builtin found!" + return 1 + } + + for _f in modules.builtin.bin modules.builtin modules.order; do + [[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f" + done + + # generate module dependencies for the initrd + if [[ -d $initdir/lib/modules/$kernel ]] && \ + ! depmod -a -b "$initdir" $kernel; then + dfatal "\"depmod -a $kernel\" failed." + exit 1 + fi + + rm -fr "$initdir/.kernelmodseen" } find_kernel_modules_by_path () ( diff --git a/dracut.sh b/dracut.sh index 0f475f5af..1caf351d9 100755 --- a/dracut.sh +++ b/dracut.sh @@ -720,8 +720,6 @@ if [[ $kernel_only != yes ]]; then fi fi -mkdir -p "$initdir/.kernelmodseen" - mods_to_load="" # check all our modules to see if they should be sourced. # This builds a list of modules that we will install next. @@ -774,16 +772,9 @@ dinfo "*** Including modules done ***" ## final stuff that has to happen dinfo "*** Installing kernel module dependencies and firmware ***" -do_lazy_kmod_dep +dracut_kernel_post dinfo "*** Installing kernel module dependencies and firmware done ***" -# generate module dependencies for the initrd -if [[ -d $initdir/lib/modules/$kernel ]] && \ - ! depmod -a -b "$initdir" $kernel; then - dfatal "\"depmod -a $kernel\" failed." - exit 1 -fi - while pop include_src src && pop include_target tgt; do if [[ $src && $tgt ]]; then if [[ -f $src ]]; then @@ -837,8 +828,6 @@ if [[ $kernel_only != yes ]]; then fi fi -rm -fr "$initdir/.kernelmodseen" - if (($maxloglvl >= 5)); then ddebug "Listing sizes of included files:" du -c "$initdir" | sort -n | ddebug diff --git a/test/TEST-30-ISCSI/hosts b/test/TEST-30-ISCSI/hosts new file mode 100644 index 000000000..f8c18b6bb --- /dev/null +++ b/test/TEST-30-ISCSI/hosts @@ -0,0 +1,8 @@ +127.0.0.1 localhost +192.168.50.1 server +192.168.50.2 server-ip +192.168.50.3 server-proto-ip +192.168.50.100 workstation1 +192.168.50.101 workstation2 +192.168.50.102 workstation3 +192.168.50.103 workstation4