grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Remaining ZFS Changes for 2.00 (Was: Re: Freeze on 27 February)


From: Richard Laager
Subject: Remaining ZFS Changes for 2.00 (Was: Re: Freeze on 27 February)
Date: Thu, 08 Mar 2012 16:51:50 -0600

I've rebased my patch sets against BZR revision 4144 and tested. Aside
from the device scanning code (which you wanted me to implement
differently) and the Ubuntu-specific recordfail patch, the following two
changes are all that's left:

---------------------------------------------------------------------

IMHO, the following change should be committed before the next release.
The code currently in BZR does not actually set the RPOOL variable.

Also, I don't think we should be adding rpool= or bootfs= to the Linux
command-line. I had those in my patch set for compatibility with the
existing initramfs on my system. I wasn't intending to propose those for
upstream inclusion. If GRUB 2.00 is released with them, then initrds
might start using them, which would mean GRUB would have to support them
for a long time.

The same applies to boot=zfs. The initrd code should be updated to parse
the root=ZFS=rpool/bootfs syntax. Or, if the distro wants/needs
something else, they can patch GRUB and/or have the admin set the
appropriate flags in GRUB_CMDLINE_LINUX in /etc/default/grub.

Supporting just the root=ZFS=rpool/bootfs syntax in an initrd is not
difficult. On Ubuntu, it's a two-line patch to initramfs-tools (to
eliminate the need for boot=zfs) and a ~10 line patch to zfs-initramfs
(to support root=ZFS=rpool/bootfs). (The patches are
backwards-compatible.) Considering other implementations... The systemd
ZFS code is already using the root=ZFS=rpool/bootfs syntax, so it
shouldn't require any changes. Gentoo is using something very similar, I
believe, so the changes there should be minimal.

Index: grub/util/grub.d/10_linux.in
===================================================================
--- grub.orig/util/grub.d/10_linux.in   2012-03-08 14:06:00.641410243 -0600
+++ grub/util/grub.d/10_linux.in        2012-03-08 15:30:53.557993000 -0600
@@ -61,9 +61,9 @@ case x"$GRUBFS" in
            GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} 
${GRUB_CMDLINE_LINUX}"
        fi;;
     xzfs)
+       rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 
2>/dev/null || true`
        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}";;
+       LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs}"
 esac
 
 title_correction_code=


---------------------------------------------------------------------


I believe the following change is still needed to support pool names
with spaces. That said, maybe we shouldn't care about pool names with
spaces. If a pool name has spaces, then we need some way to escape it
when building the linux_entry command line. Then the initrd needs to
unescape it. That seems like a lot of hassle for a configuration that's
likely to be extremely uncommon even if GRUB does support it.

Index: grub/util/getroot.c
===================================================================
--- grub.orig/util/getroot.c    2012-02-03 05:21:06.838056692 -0600
+++ grub/util/getroot.c 2012-02-03 05:22:36.227364000 -0600
@@ -285,8 +285,7 @@
              st++;
            break;
          case 1:
-           if (!strcmp (name, poolname))
-             st++;
+           st++;
            break;
          case 2:
            if (strcmp (name, "mirror") && !sscanf (name, "mirror-%u", &dummy)

-- 
Richard

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]