grub2/grub2-pass-corret-root-for-nfsroot.patch
Michael Chang 2764c99fe0 Accepting request 212604 from home:arvidjaar:grub2-next
I think it is good time to update to 2.02 so it can get more testing.
Although internal changes are pretty extensive, externally it should be
pretty much the same. The main user visible changes are

 - autogen is not used anymore, so we can finally simplify patches
   and recreate files during RPM build. So generated files need not be
   patched and shipped any more.

 - GRUB_HIDDEN_TIMEOUT is deprecated, we should use GRUB_TIMEOUT_STYLE
   instead. This will need perl-Bootloader and YaST changes. Old config
   is still accpepted so nothing should be broken.

 - native pvgrub2 support for Xen PV guests.

 - ARM support (32 and 64 bit), although it has rough edges.

OBS-URL: https://build.opensuse.org/request/show/212604
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=62
2014-01-06 03:50:43 +00:00

76 lines
2.8 KiB
Diff

From 340fd0c8717c2bf33163a18bfec72243b0e51862 Mon Sep 17 00:00:00 2001
From: Michael Chang <mchang@suse.com>
Date: Thu, 30 Aug 2012 15:43:17 +0800
Subject: [PATCH] Pass corret root= for nfsroot
References: bnc#774548
Patch-Mainline: no
Fix / is mounted on nfs. The fix is to pass kernel parameters
with correct root= for nfs. However since grub2 doesn't support
nfs file system module, the /boot on nfs is not possible and
grub2-probe not work in probing nfs mounted path. The fix is merely
on the script level and not use grub2-probe for above reasons.
---
util/grub-mkconfig.in | 37 ++++++++++++++++++++++++++++++-------
1 files changed, 30 insertions(+), 7 deletions(-)
Index: grub-2.02~beta2/util/grub-mkconfig.in
===================================================================
--- grub-2.02~beta2.orig/util/grub-mkconfig.in
+++ grub-2.02~beta2/util/grub-mkconfig.in
@@ -128,22 +128,42 @@ else
exit 1
fi
-# Device containing our userland. Typically used for root= parameter.
-GRUB_DEVICE="`${grub_probe} --target=device /`"
-GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
+probe_nfsroot_device () {
+ while read line ; do
+ set -- $line
+ path=$5
+ fstype=$8
+ device=$9
-# Device containing our /boot partition. Usually the same as GRUB_DEVICE.
-GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"
-GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true
+ if [ "x${path}" = "x/" ] &&
+ [ "x${fstype}" = "xnfs" -o "x${fstype}" = "xnfs4" ] ; then
+ echo "$device"
+ return
+ fi
+ done
+} </proc/self/mountinfo
+
+NFSROOT_DEVICE="`probe_nfsroot_device`"
+
+if [ "x${NFSROOT_DEVICE}" != "x" ]; then
+ GRUB_DEVICE="$NFSROOT_DEVICE"
+ GRUB_DEVICE_UUID=""
+ GRUB_FS="unknown"
+else
+ # Device containing our userland. Typically used for root= parameter.
+ GRUB_DEVICE="`${grub_probe} --target=device /`"
+ GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
-# Filesystem for the device containing our userland. Used for stuff like
-# choosing Hurd filesystem module.
-GRUB_FS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2> /dev/null || echo unknown`"
-if [ x"$GRUB_FS" = xunknown ]; then
- GRUB_FS="$(stat -f --printf=%T / || echo unknown)"
+ if [ x"$GRUB_FS" = x ] || [ x"$GRUB_FS" = xunknown ]; then
+ GRUB_FS="$(stat -f --printf=%T / || echo unknown)"
+ fi
fi
+# Device containing our /boot partition. Usually the same as GRUB_DEVICE.
+GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"
+GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true
+
if test -f ${sysconfdir}/default/grub ; then
. ${sysconfdir}/default/grub
fi