summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2017-12-26 16:53:01 +0100
committerChristian Poessinger <christian@poessinger.com>2017-12-26 16:53:01 +0100
commit9499b3e5f88ce72054046ac8a6c0da305f1b5fa4 (patch)
tree6f562d9096367e1110a421257a70e93f19971664 /scripts
parent7ddab704b12dc447a2d8e2acb9178a0d90f63b78 (diff)
downloadvyatta-cfg-system-9499b3e5f88ce72054046ac8a6c0da305f1b5fa4.tar.gz
vyatta-cfg-system-9499b3e5f88ce72054046ac8a6c0da305f1b5fa4.zip
T488: GRUB can't boot from software RAID
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta-grub-setup37
1 files changed, 21 insertions, 16 deletions
diff --git a/scripts/vyatta-grub-setup b/scripts/vyatta-grub-setup
index cf30cbb3..d263eff3 100755
--- a/scripts/vyatta-grub-setup
+++ b/scripts/vyatta-grub-setup
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Module: grup-setup
-#
+#
# **** License ****
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@@ -15,11 +15,11 @@
# This code was originally developed by Vyatta, Inc.
# Portions created by Vyatta are Copyright (C) 2006, 2007 Vyatta, Inc.
# All Rights Reserved.
-#
+#
# Author: Robert Bays
# Date: 2006
# Description:
-#
+#
# **** End License ****
#
# Vyatta grub customization setup script.
@@ -55,7 +55,7 @@ ROOT_PARTITION="$1"
GRUB_OPTIONS="$2"
ROOTFSDIR="$3"
-[ "$ROOT_PARTITION" ] || exit 1
+[ "$ROOT_PARTITION" ] || exit 1
# Grub options
if [ "$GRUB_OPTIONS" ]
@@ -114,7 +114,7 @@ if eval "$UNION"; then
2> /dev/null | grep -v xen \
| awk -F/ '{ print $6 }' | sed 's/vmlinuz//g' \
| sort -r)
-else
+else
# Read UUID off of filesystem and use it to tell GRUB where to mount drive
# This allows device to move around and grub will still find it
uuid=$(dumpe2fs -h /dev/${ROOT_PARTITION} 2>/dev/null | awk '/^Filesystem UUID/ {print $3}')
@@ -133,7 +133,7 @@ if [ -n "$xen_kernel_version" ] || [ -n "$union_xen_kernel_version" ]; then
default_console=0
fi
-# Check for diagnostic partition residing in first partition of drive
+# Check for diagnostic partition residing in first partition of drive
# holding the root partition.
diag_drive_number=""
@@ -175,10 +175,15 @@ fi
echo "terminal_output --append serial"
if [ ${ROOT_PARTITION:0:2} = "md" ]; then
+ uuid_root_disk=`/sbin/tune2fs -l /dev/${root_disk}1 | grep UUID | awk '{print $3}'`
+ uuid_root_md=`/sbin/tune2fs -l /dev/md${ROOT_PARTITION#md} | grep UUID | awk '{print $3}'`
echo ""
- echo -e "insmod mdraid09"
+ echo -e "insmod part_msdos"
+ echo -e "insmod diskfilter"
+ echo -e "insmod ext2"
echo -e "insmod mdraid1x"
- echo -e "set root=(md/${ROOT_PARTITION#md})"
+ echo -e "set root='mduuid/${uuid_root_disk}'"
+ echo -e "search --no-floppy --fs-uuid --set=root ${uuid_root_md}"
fi
# create xen kernels if they exist
@@ -226,7 +231,7 @@ fi
echo -e "\tlinux /boot/$livedir/vmlinuz $GRUB_OPTIONS $usb_console"
echo -e "\tinitrd /boot/$livedir/initrd.img"
echo -e "}"
-
+
elif [ -n "$union_kernel_versions" ]; then
for kversion in $union_kernel_versions; do
echo
@@ -254,8 +259,8 @@ fi
echo -e "\tlinux /boot/vmlinuz $GRUB_OPTIONS $VGA_LOGO $vty_console"
echo -e "\tinitrd /boot/initrd.img"
echo -e "}"
-
- # Set the second system boot option.
+
+ # Set the second system boot option.
# Make the serial port be the default console in this one.
echo
echo -e "menuentry \"VyOS $version (Serial console)\" {"
@@ -288,19 +293,19 @@ fi
fi
fi
- # Set options for root password reset. Offer
+ # Set options for root password reset. Offer
# options for both serial and KVM console.
reset_boot_path=/boot
if eval "$UNION"; then
reset_boot_path=/boot/$livedir
fi
-
+
echo
echo -e "menuentry \"Lost password change $version (KVM console)\" {"
echo -e "\tlinux $reset_boot_path/vmlinuz $GRUB_OPTIONS $NOSELINUX $vty_console init=$pass_reset"
echo -e "\tinitrd $reset_boot_path/initrd.img"
echo -e "}"
-
+
echo
echo -e "menuentry \"Lost password change $version (Serial console)\" {"
echo -e "\tlinux $reset_boot_path/vmlinuz $GRUB_OPTIONS $NOSELINUX $serial_console init=$pass_reset"
@@ -314,12 +319,12 @@ fi
echo -e "}"
if [ -n "$diag_drive_number" ]; then
- echo
+ echo
echo -e "menuentry \"Diagnostics\" {"
echo -e "\tchainloader (hd$diag_drive_number,1)+1"
echo -e "}"
fi
-
+
) >"$ROOTFSDIR"/boot/grub/grub.cfg