grub-devel
[Top][All Lists]
Advanced

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

[Patch] Enable libzfs detection on Linux


From: Zachary Bedell
Subject: [Patch] Enable libzfs detection on Linux
Date: Tue, 9 Aug 2011 13:48:32 -0400

Attached is a patch which allows Grub to detect and use libzfs on Linux as 
provided by the ZfsOnLinux project.  

Most of this work was originally done by Darik Horn (dajhorn on GitHub) against 
the Grub 1.99 releases as patched by Ubuntu.  I've forward ported the patches 
to trunk and separated some of the Ubuntu-specific stuff.  These apply against 
trunk independent of the other ZFS work I've been doing.

Changes include:

configure.ac:  
 * Add check for libspl to bring in Solaris Porting Library for Linux support.
 * Include reference to Linux ZFS's config header to get necessary defines for 
other ZFS headers on Linux.
 * Add checks for libavl, libefi, libunicode, libzpool -- Linux decomposes 
these libraries which are lumped into libzfs on other platforms.

getroot.c:
 * Add ref to mnttab.h from libspl to allow getextmntent to work on Linux.
 * Change the order of the grub_find_root_device_from_mountinfo vs 
find_root_device_from_libzfs calls so that libzfs runs first, falling down to 
mountinfo if zfs isn't detected.
 * Scan /proc/mounts and /etc/mtab in addition to /etc/mnttab to discover 
mounted filesystems in grub_find_zpool_from_dir.

grub.d/10_linux.in:
 * Detect ZFS root and include reference to zfsinfo.mod if needed.
 * Detect the bootfs dataset from the zpool attribute.
 * Adjust kernel parameters to omit root= and replace with boot=zfs and 
reference to the detected bootfs if available.
 * If bootfs isn't available from the pool, delegates to detection (hopefully) 
present in the initrd.


These patches have been in use by a number of folks using ZfsOnLinux for some 
time, and they've been robust on those systems.  I've tried to ensure the 
changes won't impact non-Linux platforms, though I'm not sure I trust my 
knowledge of autoconf enough to be positive there are no side effects.

The attached patch is intended for trunk, but I also have a version rolled for 
the 1.99 branch if that would be useful.

Best regards,
Zac Bedell

Attachment: grub-zfs-linux.patch
Description: Binary data


reply via email to

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