unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: raid5atemyhomework via Guix-patches via <guix-patches@gnu.org>
To: "45592@debbugs.gnu.org" <45592@debbugs.gnu.org>
Subject: [bug#45592] [PATCH] gnu, doc: Create and document procedure to compile ZFS for specific kernel.
Date: Fri, 01 Jan 2021 18:28:30 +0000	[thread overview]
Message-ID: <TH45GnK3eU6lNAYIcSSff_lUyHhMSdE99digtDkFmG8Qdbe2O1Wl5y6BdWIWORaLO0pzgi2xK5LjwAnKDT6eGnjyU2oTgBwracuResc20DM=@protonmail.com> (raw)
In-Reply-To: <rP_q9FTeS9oP2-Lwjn6zkwTA2pnugY3OybWeMij4_nFfcKDv1gxQOn-w2vzj3dSmF9CI6eu9plAEdwQXr7Pdk4ZQP4X6mQZ_c6kbgPd7qbY=@protonmail.com>

The previous patch had an incorrect documentation, this patch now has more correct documentation.

I've tried this out in a QEMU image, but haven't tried formatting a ZFS device yet, however this does run `zpool list` and `zfs version` apparently correctly.


From 2e1ee359395d6d6a29f872a5452e750f0b2f8312 Mon Sep 17 00:00:00 2001
From: raid5atemyhomework <raid5atemyhomework@protonmail.com>
Date: Fri, 1 Jan 2021 20:26:42 +0800
Subject: [PATCH] gnu, doc: Create and document procedure to compile ZFS for
 specific kernel.

---
 doc/guix.texi                 | 81 +++++++++++++++++++++++++++++++++++
 gnu/packages/file-systems.scm | 22 +++++++++-
 2 files changed, 102 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 1081ed26a3..aebcf8c6cb 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -13885,6 +13885,87 @@ a file system declaration such as:
 compress-force=zstd,space_cache=v2"))
 @end lisp

+@node ZFS file system
+@subsection ZFS file system
+
+The ZFS on Linux file system cannot legally be downloaded as part of the
+Linux kernel, but you as a user can do anything on hardware you own,
+including download ZFS as source code, compile ZFS as a kernel module,
+and link it into Linux.
+
+As a large and complex kernel module, ZFS has to be compiled for a
+specific version of Linux. Often the latest ZFS package available in Guix
+cannot be compiled with the latest Linux kernel available in Guix, so
+installing the @code{zfs} package in your system configuration file will
+fail.
+
+Instead, you have to check the
+@url{https://github.com/openzfs/zfs/releases,OpenZFS release notes} for
+the specific version of ZFS that Guix has packaged to determine what
+Linux kernels you can use, then check the @code{linux-libre} packages
+that Guix has packaged, and select one you can use on your system.
+
+Then, you have to modify your system configuration file, and create a
+ZFS package that compiles using the specific Linux version you chose.
+Below is a sketch of how you would modify your @code{operating-system}
+declaration in order to set up ZFS:
+
+@lisp
+(use-modules (gnu))
+;; @dots{}
+(use-service-modules
+  ; @dots{}
+  linux)
+(use-package-modules
+  ; @dots{}
+  linux
+  file-systems)
+
+;; @dots{}
+
+;;; (1) Select a specific kernel.
+(define system-kernel linux-libre-5.9)
+;;; (2) Define a ZFS package for your kernel.
+(define system-zfs (make-zfs-package system-kernel))
+
+;; @dots{}
+
+(operating-system
+  ;;; (3) Specify your selected kernel.
+  (kernel system-kernel)
+  ;;; (4) Add the "module" output of the system ZFS package to
+  ;;; the kernel-loadable modules.
+  (kernel-loadable-modules (list (list system-zfs "module")))
+
+  ;; @dots{}
+
+  (packages
+    ;;; (5) Add the system ZFS package to global packages so that
+    ;;; "zfs", "zpool" etc. commands are available.
+    (cons* system-zfs
+           ; @dots{}
+           %base-packages))
+
+  ;; @dots{}
+
+  (services
+    ;;; (6) Add a service that loads ZFS at bootup.
+    (cons* (service kernel-module-loader-service-type
+                    '("zfs"))
+           ; @dots{}
+           %base-services))
+  ;; @dots{}
+  )
+@end lisp
+
+@deffn (Scheme Procedure) make-zfs-package @var{kernel}
+This procedure creates a package which, when included as a package
+in your system, can be loaded as a kernel module for the specified
+@var{kernel}, a Linux kernel package.
+It is intended to create a system-specific ZFS kernel module for
+the Linux kernel you will use in your system.
+@end deffn
+
 @node Mapped Devices
 @section Mapped Devices

diff --git a/gnu/packages/file-systems.scm b/gnu/packages/file-systems.scm
index 895ad069c5..ebc4bc87c1 100644
--- a/gnu/packages/file-systems.scm
+++ b/gnu/packages/file-systems.scm
@@ -951,9 +951,29 @@ APFS.")
     (description
      "ZFS on Linux is an advanced file system and volume manager which was
 originally developed for Solaris and is now maintained by the OpenZFS
-community.")
+community.
+
+DO NOT INSTALL THIS PACKAGE. Instead, refer to the 'ZFS file system' section
+of the Guix info manual for how to install ZFS.")
     (license license:cddl1.0)))

+(define-public (make-zfs-package kernel)
+  (package
+    (inherit zfs)
+    (name (string-append "zfs-for-"
+                         (package-name kernel)
+                         "-"
+                         (package-version kernel)
+                         "-version"))
+    (arguments
+      (cons* #:linux kernel (package-arguments zfs)))
+    (description
+     "ZFS on Linux is an advanced file system and volume manager which was
+originally developed for Solaris and is now maintained by the OpenZFS
+community.
+
+This package has been compiled for a specific Linux kernel.")))
+
 (define-public mergerfs
   (package
     (name "mergerfs")
--
2.29.2





  reply	other threads:[~2021-01-01 18:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-01 12:34 [bug#45592] [PATCH] gnu, doc: Create and document procedure to compile ZFS for specific kernel raid5atemyhomework via Guix-patches via
2021-01-01 18:28 ` raid5atemyhomework via Guix-patches via [this message]
2021-01-02 10:22   ` raid5atemyhomework via Guix-patches via
2021-01-02 18:32     ` raid5atemyhomework via Guix-patches via
2021-01-02 19:08       ` raid5atemyhomework via Guix-patches via
2021-01-08 15:51 ` bug#45592: " raid5atemyhomework via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='TH45GnK3eU6lNAYIcSSff_lUyHhMSdE99digtDkFmG8Qdbe2O1Wl5y6BdWIWORaLO0pzgi2xK5LjwAnKDT6eGnjyU2oTgBwracuResc20DM=@protonmail.com' \
    --to=guix-patches@gnu.org \
    --cc=45592@debbugs.gnu.org \
    --cc=raid5atemyhomework@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).