Browse Source

dracut.sh, dracut-functions.sh: add dracut_kernel_post()

dracut_kernel_post() does lazy kernel module dependency installation,
depmod and cleans up temporary files
master
Harald Hoyer 12 years ago
parent
commit
70c6b773ca
  1. 23
      dracut-functions.sh
  2. 13
      dracut.sh
  3. 8
      test/TEST-30-ISCSI/hosts

23
dracut-functions.sh

@ -22,6 +22,7 @@ @@ -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() { @@ -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() { @@ -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 () (

13
dracut.sh

@ -720,8 +720,6 @@ if [[ $kernel_only != yes ]]; then @@ -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 ***" @@ -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 @@ -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

8
test/TEST-30-ISCSI/hosts

@ -0,0 +1,8 @@ @@ -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
Loading…
Cancel
Save