* util/grub.d/10_linux.in: Add ZFS-related arguments.

* util/grub.d/20_linux_xen.in: Likewise.

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
This commit is contained in:
Richard Laager 2012-02-27 19:07:09 +01:00 committed by Vladimir 'phcoder' Serbinenko
parent 897b741978
commit 817e6abcd0
3 changed files with 35 additions and 15 deletions

View file

@ -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> 2012-02-27 Richard Laager <rlaager@wiktel.com>
* util/getroot.c (find_root_devices_from_poolname): Handle vdevs * util/getroot.c (find_root_devices_from_poolname): Handle vdevs

View file

@ -51,13 +51,20 @@ else
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
fi fi
if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then GRUBFS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`"
rootsubvol="`make_system_path_relative_to_its_root /`"
rootsubvol="${rootsubvol#/}" case x"$GRUBFS" in
if [ "x${rootsubvol}" != x ]; then xbtrfs)
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}" rootsubvol="`make_system_path_relative_to_its_root /`"
fi rootsubvol="${rootsubvol#/}"
fi 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 () linux_entry ()
{ {
@ -184,7 +191,7 @@ while [ "x$list" != "x" ] ; do
if test -n "${initrd}" ; then if test -n "${initrd}" ; then
gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2 gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2
elif test -z "${initramfs}" ; then 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. # no initrd or builtin initramfs, it can't work here.
linux_root_device_thisversion=${GRUB_DEVICE} linux_root_device_thisversion=${GRUB_DEVICE}
fi fi

View file

@ -59,13 +59,20 @@ if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}" ]; then
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}" GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}"
fi fi
if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then GRUBFS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`"
rootsubvol="`make_system_path_relative_to_its_root /`"
rootsubvol="${rootsubvol#/}" case x"$GRUBFS" in
if [ "x${rootsubvol}" != x ]; then xbtrfs)
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}" rootsubvol="`make_system_path_relative_to_its_root /`"
fi rootsubvol="${rootsubvol#/}"
fi 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 () linux_entry ()
{ {