summaryrefslogtreecommitdiffstats
path: root/patches
diff options
context:
space:
mode:
authorManuel Amador (Rudd-O) <[email protected]>2012-07-23 12:26:17 -0700
committerBrian Behlendorf <[email protected]>2012-07-30 16:17:23 -0700
commit7eebaff409d969394dccb9b12e30aef466cc04b2 (patch)
tree50b660568df64abf889c5c877a9a66131b6d734d /patches
parentc171ea71bbedde9c30c39ce96d555bfd585e49a2 (diff)
Adding grub2 mkconfig support patch
Added simply for convenience until this, or an equivilant, change is merged in the upstream grub2 source. Signed-off-by: Brian Behlendorf <[email protected]> Issue #847
Diffstat (limited to 'patches')
-rw-r--r--patches/grub-mkconfig-zfs-support.diff31
1 files changed, 31 insertions, 0 deletions
diff --git a/patches/grub-mkconfig-zfs-support.diff b/patches/grub-mkconfig-zfs-support.diff
new file mode 100644
index 000000000..ab5362c8f
--- /dev/null
+++ b/patches/grub-mkconfig-zfs-support.diff
@@ -0,0 +1,31 @@
+diff -up ./util/grub-mkconfig.in.original ./util/grub-mkconfig.in
+--- ./util/grub-mkconfig.in.original 2012-03-27 13:03:49.475388000 -0700
++++ ./util/grub-mkconfig.in 2012-03-27 13:06:38.948080000 -0700
+@@ -140,9 +140,24 @@ if test -e ${GRUB_PREFIX}/device.map ; t
+ ${grub_mkdevicemap}
+ 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
++# Attempt to detect if the root file system is in ZFS first
++unset GRUB_DEVICE
++unset GRUB_DEVICE_BOOT
++getzfsgrubdevice() {
++ mount | while read dev dummy mntpnt dummy2 fstype rest ; do
++ if [ -n "$GRUB_DEVICE" ] ; then break ; fi
++ if [ "$fstype" != "zfs" ] ; then continue ; fi
++ if [ "$mntpnt" != "/" ] ; then continue ; fi
++ GRUB_DEVICE=`fstab-decode echo "$dev"`
++ GRUB_DEVICE="ZFS=$GRUB_DEVICE" ; echo "$GRUB_DEVICE" ; break
++ done
++}
++GRUB_DEVICE=`getzfsgrubdevice`
++if [ -z "$GRUB_DEVICE" ] ; then
++ # 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
++fi
+
+ # Device containing our /boot partition. Usually the same as GRUB_DEVICE.
+ GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"