Fix grub installation on virtio hdd.
authorArne Fitzenreiter <arne_f@ipfire.org>
Thu, 24 Jun 2010 07:48:53 +0000 (09:48 +0200)
committerArne Fitzenreiter <arne_f@ipfire.org>
Thu, 24 Jun 2010 07:48:53 +0000 (09:48 +0200)
lfs/grub
src/patches/grub-0.97_grub-install_virtio.patch [new file with mode: 0644]

index 8b9f0eb..6e5b6bf 100644 (file)
--- a/lfs/grub
+++ b/lfs/grub
@@ -109,6 +109,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/grub-0.97-bz429187-cciss.patch
        cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/grub-0.97-dmraid-recheck-bad.patch
        cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/grub-0.97-mdadm-path.patch
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/grub-0.97_grub-install_virtio.patch
 
        # XXX Does not work anymore
        #cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/grub-0.97_grub-install_virtio.patch
diff --git a/src/patches/grub-0.97_grub-install_virtio.patch b/src/patches/grub-0.97_grub-install_virtio.patch
new file mode 100644 (file)
index 0000000..86afba9
--- /dev/null
@@ -0,0 +1,52 @@
+--- grub-0.97/util/grub-install.in     2010-06-24 08:47:23.000000000 +0200
++++ grub-0.97/util/grub-install.in     2010-06-24 09:20:42.000000000 +0200
+@@ -102,7 +102,7 @@
+     linux*)
+       # formats that need to be handled (disk name -> partition name):
+       # floppies: /dev/fd0
+-      # normal sd/hd devices: /dev/hda -> /dev/hda3
++      # normal sd/hd/vd devices: /dev/hda -> /dev/hda3
+       # md: /dev/md0 -> /dev/md0p0
+       # ide raid devs: /dev/ide/host0/bus0/target0/lun0/disc
+       #             -> /dev/ide/host0/bus0/target0/lun0/part1
+@@ -134,7 +134,7 @@
+       # more? 
+       tmp_disk=`echo "$1" | grep -v '/mapper/control$' |
+               grep -v '/mapper/[[:alnum:]_]\+-[[:digit:]]\+$' | uniq |
+-              sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
++              sed -e 's%\([shv]d[a-z]\)[0-9]*$%\1%' \
+                         -e 's%\(/c[0-9]\+d[0-9]\+\).*$%\1%' \
+                         -e 's%\(fd[0-9]*\)$%\1%' \
+                         -e 's%/part[0-9]*$%/disc%' \
+@@ -142,7 +142,7 @@
+   -e 's%\(/mapper/[[:alnum:]]\+\(_[[:alnum:]]\+\)\+\)\p[[:digit:]]\+$%\1%'`
+       tmp_part=`echo "$1" | grep -v '/mapper/control$' |
+               grep -v '/mapper/[[:alnum:]_]\+-[[:digit:]]\+$' | uniq |
+-              sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' \
++              sed -e 's%.*/[shv]d[a-z]\([0-9]*\)$%\1%' \
+                         -e 's%.*/c[0-9]\+d[0-9]\+p\([[:digit:]]\+\)%\1%' \
+                         -e 's%.*/c[0-9]\+d[0-9]\+$%%' \
+                         -e 's%.*/fd[0-9]\+$%%' \
+@@ -509,6 +509,10 @@
+ if test -f "$device_map"; then
+     :
+ else
++
++  tmp_disk=`echo "$install_device" | grep "/dev/vd"`
++  if test "x$tmp_disk" = x; then
++    
+     # Create a safe temporary file.
+     test -n "$mklog" && log_file=`$mklog`
+@@ -525,6 +529,11 @@
+     fi
+     rm -f $log_file
++
++  else
++    echo "Create fake device.map for virtio device $1" 1>&2
++    echo "(hd0)    $install_device" > $device_map
++  fi
+ fi
+ # Make sure that there is no duplicated entry.