]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* util/grub.d/10_linux.in: Add ZFS-related arguments.
authorRichard Laager <rlaager@wiktel.com>
Mon, 27 Feb 2012 18:07:09 +0000 (19:07 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 27 Feb 2012 18:07:09 +0000 (19:07 +0100)
* util/grub.d/20_linux_xen.in: Likewise.

Also-By: Vladimir Serbinenko <phcoder@gmail.com>
ChangeLog
util/grub.d/10_linux.in
util/grub.d/20_linux_xen.in

index 5fa574e2eec92ce062f5e58ea54767997836bdbe..bf2f9318a0b49f3df5f7163a81cdc5b6c881c8eb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-02-27  Richard Laager <rlaager@wiktel.com>
+2012-02-27  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * util/grub.d/10_linux.in: Add ZFS-related arguments.
+       * util/grub.d/20_linux_xen.in: Likewise.
+
 2012-02-27  Richard Laager <rlaager@wiktel.com>
 
        * util/getroot.c (find_root_devices_from_poolname): Handle vdevs
index 729c23c26bbc46136b891ad3e7511cc1c8f1dfac..3791dec9d13526c16971e57f891e7844e538eabe 100644 (file)
@@ -51,13 +51,20 @@ else
   LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
 fi
 
-if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then
-  rootsubvol="`make_system_path_relative_to_its_root /`"
-  rootsubvol="${rootsubvol#/}"
-  if [ "x${rootsubvol}" != x ]; then
-    GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
-  fi
-fi
+GRUBFS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`"
+
+case x"$GRUBFS" in
+    xbtrfs)
+       rootsubvol="`make_system_path_relative_to_its_root /`"
+       rootsubvol="${rootsubvol#/}"
+       if [ "x${rootsubvol}" != x ]; then
+           GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
+       fi;;
+    xzfs)
+       bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
+       LINUX_ROOT_DEVICE="ZFS=${RPOOL}${bootfs}"
+       GRUB_CMDLINE_LINUX="boot=zfs rpool=${RPOOL} bootfs=${RPOOL}${bootfs} ${cmdline} ${GRUB_CMDLINE_LINUX}";;
+esac
 
 linux_entry ()
 {
@@ -184,7 +191,7 @@ while [ "x$list" != "x" ] ; do
   if test -n "${initrd}" ; then
     gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2
   elif test -z "${initramfs}" ; then
-    # "UUID=" magic is parsed by initrd or initramfs.  Since there's
+    # "UUID=" and "ZFS=" magic is parsed by initrd or initramfs.  Since there's
     # no initrd or builtin initramfs, it can't work here.
     linux_root_device_thisversion=${GRUB_DEVICE}
   fi
index e2cd247dd68b57a0c746c50569434df98e83f7b5..09ba2f0f1524be5140c8a5c80fc518b0b023d7a2 100644 (file)
@@ -59,13 +59,20 @@ if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}" ]; then
   GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}"
 fi
 
-if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then
-  rootsubvol="`make_system_path_relative_to_its_root /`"
-  rootsubvol="${rootsubvol#/}"
-  if [ "x${rootsubvol}" != x ]; then
-    GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
-  fi
-fi
+GRUBFS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`"
+
+case x"$GRUBFS" in
+    xbtrfs)
+       rootsubvol="`make_system_path_relative_to_its_root /`"
+       rootsubvol="${rootsubvol#/}"
+       if [ "x${rootsubvol}" != x ]; then
+           GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
+       fi;;
+    xzfs)
+       bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
+       LINUX_ROOT_DEVICE="ZFS=${RPOOL}${bootfs}"
+       GRUB_CMDLINE_LINUX="boot=zfs rpool=${RPOOL} bootfs=${RPOOL}${bootfs} ${cmdline} ${GRUB_CMDLINE_LINUX}";;
+esac
 
 linux_entry ()
 {