--- ./sbin/mkinitrd.orig 2003-09-23 19:51:00.000000000 +0400 +++ ./sbin/mkinitrd 2004-05-15 12:17:06.000000000 +0400 @@ -25,6 +25,9 @@ # $Source: /suse/yast2/cvsroot/mkinitrd/mkinitrd,v $ # $Revision: 1.17 $ +# 2004.03.15 Aleksey Barabanov +# Some fixes for LVM2 and root_dir change + # # Print usage and exit # @@ -672,7 +675,8 @@ echo "Including LVM support" mkdir -p $tmp_mnt/etc/lvmtab.d cp -a $root_dir/dev/lvm $tmp_mnt/dev - cp_bin $root_dir/sbin/{vgscan,vgchange} $tmp_mnt/sbin + cp -a $root_dir/dev/mapper $tmp_mnt/dev + cp_bin $root_dir/sbin/{lvm,vgscan,vgchange} $tmp_mnt/sbin cp_bin $root_dir/bin/cat $tmp_mnt/bin need_mount=1 fi @@ -919,7 +923,7 @@ fi if [ -n "$sysfs_root" ]; then - cat_linuxrc <<-'EOF' + cat_linuxrc <<-EOF |sh_basename () { | local path="$1" IFS="/" | @@ -1135,7 +1139,7 @@ gzip -9 $tmp_initrd_small - if ! cp -f $tmp_initrd_small.gz $initrd_image ; then + if ! cp -f $tmp_initrd_small.gz $root_dir$initrd_image ; then oops 8 "Failed to install initrd" return fi @@ -1215,12 +1219,16 @@ ;; esac +# follow simlink +[ -h $realrootdev ] && realrootdev=`ls -l $realrootdev | awk 'BEGIN{FS="-> "}{print $2}'` + # check if the root device is an lvm device root_lvm= if [ -n "$realrootdev" -a -b "$realrootdev" ] ; then major=$(ls -l "$realrootdev" \ | sed -e "s/.* \\([0-9]\+\\), *[0-9]\+.*/\\1/") [ "$major" -eq 58 ] && root_lvm=1 + [ "$major" -eq 254 ] && root_lvm=1 fi ################################################################### @@ -1354,6 +1362,7 @@ # add modules required by features if [ -n "$root_lvm" ] ; then add_module lvm-mod + add_module dm-mod fi # check if an initrd is needed at all.