--- mkinitrd.orig 2009-03-29 00:03:20 +0600 +++ mkinitrd_last 2009-03-29 00:03:20 +0600 @@ -182,6 +182,12 @@ loopFile= uname_r=`uname -r` +# LVM constants +HAVE_LVM= +LVM_MODNAME="dm-mod" +LVM=/sbin/lvm.static +[ -x "$LVM" ] || LVM= + ParseKernelVersion() { KERNEL_MAJOR="${KERNEL%%.*}" @@ -953,6 +959,13 @@ sed -e 's/^raid\([0-9]*\)$/\1/' } +FindLVMModules() +{ + if [ -n "$HAVE_LVM" ]; then + FindModule $LVM_MODNAME + fi +} + FindRaidModules() { [ -z "$noraid" ] || return @@ -1085,6 +1098,22 @@ done } +ConfigInitramfsForLVM() +{ +# this is creating of script for init of LVM + cat >>"$MNTDIR"/scripts/local-top <<'EOF' +# Preparing LVM -*- shell-script -*- + +log_begin_msg "Starting up LVM" + +vgscan +vgchange -ay + +log_end_msg +EOF + +} + ConfigInitramfsForRaid() { # /scripts/local-top runs before swsusp resume - start RAID in @@ -1181,6 +1210,17 @@ Cp -aL "$f" "$MNTDIR"/etc/udev/rules.d/ done fi + + if [ -n "$HAVE_LVM" ]; then + if [ -z $LVM ]; then + Fatal "Couldn't find executable lvm.static " + fi + Cp -aL "$LVM" "$MNTDIR"/sbin/ + cd "$MNTDIR"/sbin/ + Ln -s lvm.static vgscan + Ln -s lvm.static vgchange + ConfigInitramfsForLVM + fi if [ -n "$HAVE_RAID" ]; then ConfigInitramfsForRaid @@ -1322,6 +1362,7 @@ --with MODULES load MODULES after all found automatically. --extra MODULES add MODULES to be loaded only if needed. --with-raid enable software RAID (md) support. +--with-lvm enable LVM support. --omit-scsi-modules do not load any SCSI modules. --omit-ide-modules do not load any IDE modules. --omit-raid-modules do not load any raid modules. @@ -1344,7 +1385,7 @@ [ -n "$1" ] && Exit "$1" || Exit } -TEMP=`getopt -n "$PROG" -o a:fhvd -l help,version,verbose,debug,force,ifneeded,omit-scsi-modules,omit-ide-modules,omit-raid-modules,with-raid,pause,image-version,nocompress,nobootsplash,strict,fstab:,before:,preload:,with:,after:,extra:,type:,add: -- "$@"` || Usage 1 +TEMP=`getopt -n "$PROG" -o a:fhvd -l help,version,verbose,debug,force,ifneeded,omit-scsi-modules,omit-ide-modules,omit-raid-modules,with-raid,with-lvm,pause,image-version,nocompress,nobootsplash,strict,fstab:,before:,preload:,with:,after:,extra:,type:,add: -- "$@"` || Usage 1 eval set -- "$TEMP" img_vers= @@ -1417,6 +1458,10 @@ HAVE_RAID=1 shift ;; + --with-lvm) + HAVE_LVM=1 + shift + ;; --pause) pause=1 shift @@ -1531,6 +1576,8 @@ FindRaidModules +FindLVMModules + FindRootModules FindLoopModules