Fix grub installation on virtio hdd.

This commit is contained in:
Arne Fitzenreiter
2010-06-24 09:48:53 +02:00
parent 66e1ac7b14
commit 47f651f156
2 changed files with 53 additions and 0 deletions

View File

@@ -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

View File

@@ -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.