Patched grub for vitio blockdevice
authorArne Fitzenreiter <arne_f@ipfire.org>
Sat, 15 Aug 2009 19:58:25 +0000 (21:58 +0200)
committerArne Fitzenreiter <arne_f@ipfire.org>
Sat, 15 Aug 2009 19:58:25 +0000 (21:58 +0200)
lfs/grub
src/patches/grub-0.97_grub-install_virtio.patch [new file with mode: 0644]

index 979dbe9..ed801f8 100644 (file)
--- a/lfs/grub
+++ b/lfs/grub
@@ -81,6 +81,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/grub-0.93-special-device-names.patch
        cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/grub-0.95-moreraid.patch
        cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/grub-0.94-i2o.patch
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/grub-0.97_grub-install_virtio.patch
 
        cd $(DIR_APP) && perl -pi -e 's,/usr/lib/grub/i386-pc,/usr/share/grub/i386-pc,' docs/grub.texi
        cd $(DIR_APP) && sed -i 's/AM_INIT_AUTOMAKE/&\nAM_PROG_AS/' configure.ac
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..432e0f1
--- /dev/null
@@ -0,0 +1,41 @@
+diff -Naur grub-0.97.org/util/grub-install.in grub-0.97/util/grub-install.in
+--- grub-0.97.org/util/grub-install.in 2004-07-24 20:57:31.000000000 +0200
++++ grub-0.97/util/grub-install.in     2009-08-14 20:01:20.000000000 +0200
+@@ -96,12 +96,12 @@
+     # Break the device name into the disk part and the partition part.
+     case "$host_os" in
+     linux*)
+-      tmp_disk=`echo "$1" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
++      tmp_disk=`echo "$1" | sed -e 's%\([vsh]d[a-z]\)[0-9]*$%\1%' \
+                                 -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \
+                                 -e 's%\(fd[0-9]*\)$%\1%' \
+                                 -e 's%/part[0-9]*$%/disc%' \
+                                 -e 's%\(c[0-7]d[0-9]*\).*$%\1%'`
+-      tmp_part=`echo "$1" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' \
++      tmp_part=`echo "$1" | sed -e 's%.*/[vsh]d[a-z]\([0-9]*\)$%\1%' \
+                                 -e 's%.*d[0-9]*p%%' \
+                                 -e 's%.*/fd[0-9]*$%%' \
+                                 -e 's%.*/floppy/[0-9]*$%%' \
+@@ -333,6 +333,10 @@
+ if test -f "$device_map"; then
+     :
+ else
++
++  tmp_disk=`echo "$1" | grep "/dev/vd"`
++  if test "x$tmp_disk" = x; then
++
+     # Create a safe temporary file.
+     test -n "$mklog" && log_file=`$mklog`
+@@ -345,6 +349,11 @@
+     fi
+     rm -f $log_file
++
++  else
++      echo "Create fake device.map for vitio device $1" 1>&2
++      echo "(hd0)    $1" > $device_map
++  fi
+ fi
+ # Make sure that there is no duplicated entry.