Features Download
From: Zachary Bedell <pendorbound <at> gmail.com>
Subject: getroot for ZFS without libzfs?
Newsgroups: gmane.comp.boot-loaders.grub.devel
Date: Monday 8th August 2011 01:28:30 UTC (over 5 years ago)
Greetings all,

I've been working for the last few weeks with Grub on a Linux system using
ZFS drivers from zfsonlinux.org.  One change required to Grub has been in
adapting the way the the build process detects and links to libzfs for the
code in util/getroot.c.  I'd like to see the changes required included in
Grub of course, but I have some concerns about the licensing issues and
also accessing the private libzfs.

It appears that existing Grub code already links against libzfs for the
benefit of find_root_device_from_libzfs and other functions in getroot.c. 
It also appears that libzfs is not used outside this file.  That linkage
surprises me a bit as I would have expected GPL Grub linked against CDDL
libzfs to create a problem.  Also libzfs is considered a private API and
not intended to be linked against, though admittedly what I propose
(reading on-disk structures directly) is arguably worse than accessing a
private library.

As best I can tell, all of the ZFS-related functionality that getroot.c
requires was included in the GPL release that Sun made in Grub 0.97.  I
think it should be relatively straight forward to modify getroot.c to use
the GPL'd ZFS code to directly access the disk and read the necessary bits
out of ZFS that it needs to configure itself.  Assuming that change is
made, it should be possible to expunge Grub of all references to libzfs and
have its ZFS support operate purely on the GPL'd dump from Sun.

I'd like to dive in and make these changes, but I wanted to solicit
thoughts from other Grub devs before starting.  Am I incorrect in my belief
that linking libzfs is a GPL problem for Grub?  Is the CDDL/GPL problem not
reciprocal and this only a problem for CDDL ZFS using GPL kernel and not
the other way around?

Does anyone see an issue with getroot.c reading the on-disk ZFS structures
directly?  grub-probe already does this in its search for uberblocks and
labels, so I don't think changing getroot.c is making the situation worse.

Any other thoughts would be appreciated.

Best regards,
Zac Bedell
CD: 13ms