diff --git a/ChangeLog b/ChangeLog index 5fa574e2e..bf2f9318a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-02-27 Richard Laager +2012-02-27 Vladimir Serbinenko + + * util/grub.d/10_linux.in: Add ZFS-related arguments. + * util/grub.d/20_linux_xen.in: Likewise. + 2012-02-27 Richard Laager * util/getroot.c (find_root_devices_from_poolname): Handle vdevs diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in index 729c23c26..3791dec9d 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -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 diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in index e2cd247dd..09ba2f0f1 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -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 () {