gnu: miniupnpc: Update to 2.0.
[jackhill/guix/guix.git] / gnu / packages / linux.scm
index 50568d2..e562213 100644 (file)
@@ -15,6 +15,8 @@
 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2016 David Craven <david@craven.ch>
 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
+;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2016 Rene Saavedra <rennes@openmailbox.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -33,6 +35,7 @@
 
 (define-module (gnu packages linux)
   #:use-module (gnu packages)
+  #:use-module (gnu packages acl)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages attr)
@@ -61,6 +64,7 @@
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pciutils)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages popt)
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
   #:use-module (gnu packages readline)
@@ -69,6 +73,8 @@
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages xml)
+  #:use-module (gnu packages xdisorg)
+  #:use-module (gnu packages xorg)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
@@ -84,7 +90,7 @@
 
 (define-public (system->linux-architecture arch)
   "Return the Linux architecture name for ARCH, a Guix system name such as
-\"x86_64-linux\"."
+\"x86_64-linux\" or a target triplet such as \"arm-linux-gnueabihf\"."
   (let ((arch (car (string-split arch #\-))))
     (cond ((string=? arch "i686") "i386")
           ((string-prefix? "mips" arch) "mips")
     (description "Headers of the Linux-Libre kernel.")
     (license license:gpl2)))
 
-(define-public module-init-tools
-  (package
-    (name "module-init-tools")
-    (version "3.16")
-    (source (origin
-             (method url-fetch)
-             (uri (string-append
-                   "mirror://kernel.org/linux/utils/kernel/module-init-tools/module-init-tools-"
-                   version ".tar.bz2"))
-             (sha256
-              (base32
-               "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1"))
-             (patches (search-patches "module-init-tools-moduledir.patch"))))
-    (build-system gnu-build-system)
-    (arguments
-     ;; FIXME: The upstream tarball lacks man pages, and building them would
-     ;; require DocBook & co.  We used to use Gentoo's pre-built man pages,
-     ;; but they vanished.  In the meantime, fake it.
-     '(#:phases (alist-cons-before
-                 'configure 'fake-docbook
-                 (lambda _
-                   (substitute* "Makefile.in"
-                     (("^DOCBOOKTOMAN.*$")
-                      "DOCBOOKTOMAN = true\n")))
-                 %standard-phases)))
-    (home-page "http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/")
-    (synopsis "Tools for loading and managing Linux kernel modules")
-    (description
-     "Tools for loading and managing Linux kernel modules, such as `modprobe',
-`insmod', `lsmod', and more.")
-    (license license:gpl2+)))
-
-(define-public libnfsidmap
-  (package
-    (name "libnfsidmap")
-    (version "0.25")
-    (source (origin
-             (method url-fetch)
-             (uri (string-append
-                   "http://www.citi.umich.edu/projects/nfsv4/linux/"
-                   name "/" name "-" version ".tar.gz"))
-             (sha256
-              (base32
-               "1kzgwxzh83qi97rblcm9qj80cdvnv8kml2plz0q103j0hifj8vb5"))))
-    (build-system gnu-build-system)
-    (home-page
-     "http://www.citi.umich.edu/projects/nfsv4/crossrealm/libnfsidmap_config.html")
-    (synopsis
-     "NFSv4 support library for name/ID mapping")
-    (description "Libnfsidmap is a library holding mulitiple methods of
-mapping names to ids and visa versa, mainly for NFSv4.  It provides an
-extensible array of mapping functions, currently consisting of two choices:
-the default @code{nsswitch} and the experimental @code{umich_ldap}.")
-    (license (license:non-copyleft "file://COPYING"
-                                   "See COPYING in the distribution."))))
-
 (define %boot-logo-patch
   ;; Linux-Libre boot logo featuring Freedo and a gnu.
   (origin
@@ -231,171 +181,179 @@ the default @code{nsswitch} and the experimental @code{umich_ldap}.")
      (base32
       "1hk9swxxc80bmn2zd2qr5ccrjrk28xkypwhl4z0qx4hbivj7qm06"))))
 
-(define* (kernel-config system #:key variant)
+(define* (kernel-config arch #:key variant)
   "Return the absolute file name of the Linux-Libre build configuration file
-for SYSTEM and optionally VARIANT, or #f if there is no such configuration."
-  (and-let* ((arch (match system
-                     ("i686-linux"
-                      "i686")
-                     ("x86_64-linux"
-                      "x86_64")
-                     (_
-                      #f)))
-             (name (string-append "linux-libre-"
-                                  (if variant
-                                      (string-append variant "-")
-                                      "")
-                                  arch
-                                  ".conf"))
-             (file (string-append "gnu/packages/" name)))
+for ARCH and optionally VARIANT, or #f if there is no such configuration."
+  (let* ((name (string-append "linux-libre-"
+                              (if variant (string-append variant "-") "")
+                              (if (string=? "i386" arch) "i686" arch) ".conf"))
+         (file (string-append "gnu/packages/" name)))
     (search-path %load-path file)))
 
-(define-public linux-libre
-  (let* ((version "4.7.2")
-         (build-phase
-          '(lambda* (#:key system inputs #:allow-other-keys #:rest args)
+(define %default-extra-linux-options
+  `(;; https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00039.html
+    ("CONFIG_DEVPTS_MULTIPLE_INSTANCES" . #t)
+    ;; Modules required for initrd:
+    ("CONFIG_NET_9P" . m)
+    ("CONFIG_NET_9P_VIRTIO" . m)
+    ("CONFIG_VIRTIO_BLK" . m)
+    ("CONFIG_VIRTIO_NET" . m)
+    ("CONFIG_VIRTIO_PCI" . m)
+    ("CONFIG_VIRTIO_BALLOON" . m)
+    ("CONFIG_VIRTIO_MMIO" . m)
+    ("CONFIG_FUSE_FS" . m)
+    ("CONFIG_CIFS" . m)
+    ("CONFIG_9P_FS" . m)))
+
+(define (config->string options)
+  (string-join (map (match-lambda
+                      ((option . 'm)
+                       (string-append option "=m"))
+                      ((option . #t)
+                       (string-append option "=y"))
+                      ((option . #f)
+                       (string-append option "=n")))
+                    options)
+               "\n"))
+
+(define* (make-linux-libre version hash supported-systems
+                           #:key
+                           ;; A function that takes an arch and a variant.
+                           ;; See kernel-config for an example.
+                           (extra-version #f)
+                           (configuration-file #f)
+                           (defconfig "defconfig")
+                           (extra-options %default-extra-linux-options)
+                           (patches (list %boot-logo-patch)))
+  (package
+    (name (if extra-version
+              (string-append "linux-libre-" extra-version)
+              "linux-libre"))
+    (version version)
+    (source (origin
+              (method url-fetch)
+              (uri (linux-libre-urls version))
+              (sha256 (base32 hash))
+              (patches patches)))
+    (supported-systems supported-systems)
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("perl" ,perl)
+       ("bc" ,bc)
+       ("openssl" ,openssl)
+       ("kmod" ,kmod)
+       ,@(if configuration-file
+             `(("kconfig" ,(configuration-file
+                            (system->linux-architecture
+                             (or (%current-target-system)
+                                 (%current-system)))
+                            #:variant (version-major+minor version))))
+             '())))
+    (arguments
+     `(#:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (srfi srfi-1)
+                  (ice-9 match))
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key inputs native-inputs target #:allow-other-keys)
              ;; Avoid introducing timestamps
              (setenv "KCONFIG_NOTIMESTAMP" "1")
              (setenv "KBUILD_BUILD_TIMESTAMP" (getenv "SOURCE_DATE_EPOCH"))
 
-             ;; Apply the neat patch.
-             (system* "patch" "-p1" "--force"
-                      "-i" (assoc-ref inputs "patch/freedo+gnu"))
+             ;; Set ARCH and CROSS_COMPILE
+             (let ((arch ,(system->linux-architecture
+                           (or (%current-target-system)
+                               (%current-system)))))
+               (setenv "ARCH" arch)
+               (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
 
-             (let ((arch (car (string-split system #\-))))
-               (setenv "ARCH"
-                       (cond ((string=? arch "i686") "i386")
-                             ((string=? arch "mips64el") "mips")
-                             (else arch)))
-               (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")))
+               (when target
+                 (setenv "CROSS_COMPILE" (string-append target "-"))
+                 (format #t "`CROSS_COMPILE' set to `~a'~%"
+                         (getenv "CROSS_COMPILE"))))
+
+             (setenv "EXTRA_VERSION" ,extra-version)
 
              (let ((build  (assoc-ref %standard-phases 'build))
                    (config (assoc-ref inputs "kconfig")))
 
-               ;; Use the architecture-specific config if available, and
-               ;; 'defconfig' otherwise.
+               ;; Use a custom kernel configuration file or a default
+               ;; configuration file.
                (if config
                    (begin
                      (copy-file config ".config")
                      (chmod ".config" #o666))
-                   (system* "make" "defconfig"))
+                   (system* "make" ,defconfig))
 
                ;; Appending works even when the option wasn't in the
                ;; file.  The last one prevails if duplicated.
-               (let ((port (open-file ".config" "a")))
-                 (display (string-append "CONFIG_NET_9P=m\n"
-                                         "CONFIG_NET_9P_VIRTIO=m\n"
-                                         "CONFIG_VIRTIO_BLK=m\n"
-                                         "CONFIG_VIRTIO_NET=m\n"
-                                         ;; https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00039.html
-                                         "CONFIG_DEVPTS_MULTIPLE_INSTANCES=y\n"
-                                         "CONFIG_VIRTIO_PCI=m\n"
-                                         "CONFIG_VIRTIO_BALLOON=m\n"
-                                         "CONFIG_VIRTIO_MMIO=m\n"
-                                         "CONFIG_FUSE_FS=m\n"
-                                         "CONFIG_CIFS=m\n"
-                                         "CONFIG_9P_FS=m\n")
-                          port)
+               (let ((port (open-file ".config" "a"))
+                     (extra-configuration ,(config->string extra-options)))
+                 (display extra-configuration port)
                  (close-port port))
 
-               (zero? (system* "make" "oldconfig"))
-
-               ;; Call the default `build' phase so `-j' is correctly
-               ;; passed.
-               (apply build #:make-flags "all" args))))
-         (install-phase
-          `(lambda* (#:key inputs outputs #:allow-other-keys)
+               (zero? (system* "make" "oldconfig")))))
+         (replace 'install
+           (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
              (let* ((out    (assoc-ref outputs "out"))
                     (moddir (string-append out "/lib/modules"))
-                    (mit    (assoc-ref inputs "module-init-tools")))
+                    (dtbdir (string-append out "/lib/dtbs"))
+                    (kmod   (assoc-ref (or native-inputs inputs) "kmod")))
+               ;; Install kernel image, kernel configuration and link map.
+               (for-each (lambda (file) (install-file file out))
+                         (find-files "." "^(\\.config|bzImage|zImage|vmlinuz|System\\.map)$"))
+               ;; Install device tree files
+               (for-each (lambda (file) (install-file file dtbdir))
+                         (find-files "." "\\.dtb$"))
+               ;; Install kernel modules
                (mkdir-p moddir)
-               (for-each (lambda (file)
-                           (copy-file file
-                                      (string-append out "/" (basename file))))
-                         (find-files "." "^(bzImage|vmlinuz|System\\.map)$"))
-               (copy-file ".config" (string-append out "/config"))
                (zero? (system* "make"
-                               (string-append "DEPMOD=" mit "/sbin/depmod")
+                               (string-append "DEPMOD=" kmod "/bin/depmod")
                                (string-append "MODULE_DIR=" moddir)
                                (string-append "INSTALL_PATH=" out)
                                (string-append "INSTALL_MOD_PATH=" out)
                                "INSTALL_MOD_STRIP=1"
                                "modules_install"))))))
-   (package
-    (name "linux-libre")
-    (version version)
-    (source (origin
-             (method url-fetch)
-             (uri (linux-libre-urls version))
-             (sha256
-              (base32
-               "1rp09y2hv0hvdybm2n2im9717kzxmklpgzs8k1bmdfzqxyg8cb85"))))
-    (build-system gnu-build-system)
-    (supported-systems '("x86_64-linux" "i686-linux"))
-    (native-inputs `(("perl" ,perl)
-                     ("bc" ,bc)
-                     ("openssl" ,openssl)
-                     ("module-init-tools" ,module-init-tools)
-                     ("patch/freedo+gnu" ,%boot-logo-patch)
-
-                     ,@(let ((conf (kernel-config
-                                    (or (%current-target-system)
-                                        (%current-system))
-                                    #:variant (version-major+minor version))))
-                         (if conf
-                             `(("kconfig" ,conf))
-                             '()))))
-    (arguments
-     `(#:modules ((guix build gnu-build-system)
-                  (guix build utils)
-                  (srfi srfi-1)
-                  (ice-9 match))
-       #:phases (alist-replace
-                 'build ,build-phase
-                 (alist-replace
-                  'install ,install-phase
-                  (alist-delete 'configure %standard-phases)))
        #:tests? #f))
+    (home-page "http://www.gnu.org/software/linux-libre/")
     (synopsis "100% free redistribution of a cleaned Linux kernel")
     (description
      "GNU Linux-Libre is a free (as in freedom) variant of the Linux kernel.
 It has been modified to remove all non-free binary blobs.")
-    (license license:gpl2)
-    (home-page "http://www.gnu.org/software/linux-libre/"))))
+    (license license:gpl2)))
+
+(define %intel-compatible-systems '("x86_64-linux" "i686-linux"))
+
+(define-public linux-libre
+  (make-linux-libre "4.8.10"
+                    "04kwarmpz5adz64wwy0xpwzxsri7jrjkhbmjlwxsac69x9a26bkl"
+                    %intel-compatible-systems
+                    #:configuration-file kernel-config))
 
 (define-public linux-libre-4.4
-  (package
-    (inherit linux-libre)
-    (version "4.4.19")
-    (source (origin
-              (method url-fetch)
-              (uri (linux-libre-urls version))
-              (sha256
-               (base32
-                "0nddjs7prmb0g7g3w2k4qfyq02a9szm5nvsgflxcaarbq1slibb5"))))
-    (native-inputs
-     (let ((conf (kernel-config (or (%current-target-system)
-                                    (%current-system))
-                                #:variant "4.4")))
-       `(,@(alist-delete "kconfig" (package-native-inputs linux-libre))
-         ("kconfig" ,conf))))))
+  (make-linux-libre "4.4.34"
+                    "04ng40l2av34bcfwjs5vliv15f0m8bl0sfw08imspiplxvajd6ca"
+                    %intel-compatible-systems
+                    #:configuration-file kernel-config))
 
 (define-public linux-libre-4.1
-  (package
-    (inherit linux-libre)
-    (version "4.1.31")
-    (source (origin
-              (method url-fetch)
-              (uri (linux-libre-urls version))
-              (sha256
-               (base32
-                "0grffah921k136w1qwcswxv6m810s8q54nr2rk7kyqka3a1b81yw"))))
-    (native-inputs
-     (let ((conf (kernel-config (or (%current-target-system)
-                                    (%current-system))
-                                #:variant "4.1")))
-       `(,@(alist-delete "kconfig" (package-native-inputs linux-libre))
-         ("kconfig" ,conf))))))
+  (make-linux-libre "4.1.35"
+                    "05zvrld1digqwf9kqf5pxx0mxqmwpr5kamhnks6y4yfy7x7jynyk"
+                    %intel-compatible-systems
+                    #:configuration-file kernel-config))
+
+;; Avoid rebuilding kernel variants when there is a minor version bump.
+(define %linux-libre-version "4.8.10")
+(define %linux-libre-hash "04kwarmpz5adz64wwy0xpwzxsri7jrjkhbmjlwxsac69x9a26bkl")
+
+(define-public linux-libre-arm-generic
+  (make-linux-libre %linux-libre-version
+                    %linux-libre-hash
+                    '("armhf-linux")
+                    #:defconfig "multi_v7_defconfig"
+                    #:extra-version "arm-generic"))
 
 \f
 ;;;
@@ -414,7 +372,9 @@ It has been modified to remove all non-free binary blobs.")
             "Linux-PAM-" version ".tar.bz2"))
       (sha256
        (base32
-        "1fyi04d5nsh8ivd0rn2y0z83ylgc0licz7kifbb6xxi2ylgfs6i4"))))
+        "1fyi04d5nsh8ivd0rn2y0z83ylgc0licz7kifbb6xxi2ylgfs6i4"))
+      (patches (search-patches "linux-pam-no-setfsuid.patch"))))
+
     (build-system gnu-build-system)
     (native-inputs
      `(("flex" ,flex)
@@ -445,7 +405,6 @@ at login.  Local and dynamic reconfiguration are its key features.")
 (define-public linux-pam-1.2
   (package
     (inherit linux-pam)
-    (name "linux-pam-1.2")
     (version "1.2.1")
     (source
      (origin
@@ -455,8 +414,8 @@ at login.  Local and dynamic reconfiguration are its key features.")
             "Linux-PAM-" version ".tar.bz2"))
       (sha256
        (base32
-        "1n9lnf9gjs72kbj1g354v1xhi2j27aqaah15vykh7cnkq08i4arl"))))))
-
+        "1n9lnf9gjs72kbj1g354v1xhi2j27aqaah15vykh7cnkq08i4arl"))
+      (patches (search-patches "linux-pam-no-setfsuid.patch"))))))
 
 
 ;;;
@@ -479,10 +438,10 @@ at login.  Local and dynamic reconfiguration are its key features.")
     (inputs `(("ncurses" ,ncurses)))
     (home-page "http://psmisc.sourceforge.net/")
     (synopsis
-     "Small utilities that use the proc filesystem")
+     "Small utilities that use the proc file system")
     (description
      "This PSmisc package is a set of some small useful utilities that
-use the proc filesystem.  We're not about changing the world, but
+use the proc file system.  We're not about changing the world, but
 providing the system administrator with some help in common tasks.")
     (license license:gpl2+)))
 
@@ -560,7 +519,7 @@ providing the system administrator with some help in common tasks.")
     (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
     (synopsis "Collection of utilities for the Linux kernel")
     (description "Util-linux is a diverse collection of Linux kernel
-utilities.  It provides dmesg and includes tools for working with filesystems,
+utilities.  It provides dmesg and includes tools for working with file systems,
 block devices, UUIDs, TTYs, and many other tools.")
 
     ;; Note that util-linux doesn't use the same license for all the
@@ -664,7 +623,11 @@ slabtop, and skill.")
     (native-inputs `(("pkg-config" ,pkg-config)
                      ("texinfo" ,texinfo)))     ;for the libext2fs Info manual
     (arguments
-     '(;; util-linux is the preferred source for some of the libraries and
+     '(;; Parallel building reliably yields a failure like this:
+       ;; "make[2]: *** No rule to make target '../lib/libss.so', needed by
+       ;; 'debugfs'.  Stop."
+       #:parallel-build? #f
+       ;; util-linux is the preferred source for some of the libraries and
        ;; commands, so disable them (see, e.g.,
        ;; <http://git.buildroot.net/buildroot/commit/?id=e1ffc2f791b33633>.)
        #:configure-flags '("--disable-libblkid"
@@ -709,7 +672,7 @@ slabtop, and skill.")
 
        ;; FIXME: Tests work by comparing the stdout/stderr of programs, that
        ;; they fail because we get an extra line that says "Can't check if
-       ;; filesystem is mounted due to missing mtab file".
+       ;; file system is mounted due to missing mtab file".
        #:tests? #f))
     (home-page "http://e2fsprogs.sourceforge.net/")
     (synopsis "Creating and checking ext2/ext3/ext4 file systems")
@@ -961,7 +924,7 @@ packet filter.")
 (define-public iproute
   (package
     (name "iproute2")
-    (version "4.4.0")
+    (version "4.8.0")
     (source (origin
               (method url-fetch)
               (uri (string-append
@@ -969,12 +932,14 @@ packet filter.")
                     version ".tar.xz"))
               (sha256
                (base32
-                "05351m4m0whsivlblvs3m0nz5q9v6r06ik80z27gf6ca51kw74dw"))))
+                "12dk5hn1zlraqk2p0z8dv2xgsz0x9v8l3vcvf51fzj0v8b45j2d3"))))
     (build-system gnu-build-system)
     (arguments
      `(#:tests? #f                                ; no test suite
        #:make-flags (let ((out (assoc-ref %outputs "out")))
                       (list "DESTDIR="
+                            (string-append "BASH_COMPDIR=" out
+                                           "/etc/bash_completion.d")
                             (string-append "LIBDIR=" out "/lib")
                             (string-append "SBINDIR=" out "/sbin")
                             (string-append "CONFDIR=" out "/etc")
@@ -1700,14 +1665,14 @@ time.")
 (define-public lvm2
   (package
     (name "lvm2")
-    (version "2.02.109")
+    (version "2.02.166")
     (source (origin
               (method url-fetch)
               (uri (string-append "ftp://sources.redhat.com/pub/lvm2/releases/LVM2."
                                   version ".tgz"))
               (sha256
                (base32
-                "1rv5ivg0l1w3nwzwdkqixm96h5bzg7ib4rr196ysb2lw42jmpjbv"))
+                "150v0mawd2swdvypcmkjd3h3s4n5i1220h6sxx94a8jvp1kb0871"))
               (modules '((guix build utils)))
               (snippet
                '(begin
@@ -1718,7 +1683,8 @@ time.")
                     (("confdir = .*$")
                      "confdir = @sysconfdir@\n")
                     (("DEFAULT_SYS_DIR = @DEFAULT_SYS_DIR@")
-                     "DEFAULT_SYS_DIR = @sysconfdir@"))))))
+                     "DEFAULT_SYS_DIR = @sysconfdir@"))))
+              (patches (search-patches "lvm2-static-link.patch"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("pkg-config" ,pkg-config)
@@ -1726,16 +1692,27 @@ time.")
     (inputs
      `(("udev" ,eudev)))
     (arguments
-     '(#:phases (alist-cons-after
-                 'configure 'set-makefile-shell
-                 (lambda _
-                   ;; Use 'sh', not 'bash', so that '. lib/utils.sh' works as
-                   ;; expected.
-                   (setenv "SHELL" (which "sh"))
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'configure 'set-makefile-shell
+           (lambda _
+             ;; Use 'sh', not 'bash', so that '. lib/utils.sh' works as
+             ;; expected.
+             (setenv "SHELL" (which "sh"))
 
-                   ;; Replace /bin/sh with the right file name.
-                   (patch-makefile-SHELL "make.tmpl"))
-                 %standard-phases)
+             ;; Replace /bin/sh with the right file name.
+             (patch-makefile-SHELL "make.tmpl")
+             #t))
+         (add-before 'strip 'make-objects-writable
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; Make compiled objects writable so they can be stripped.
+             (let ((out (assoc-ref outputs "out")))
+               (for-each (lambda (file)
+                           (chmod file #o755))
+                         (append
+                           (find-files (string-append out "/lib"))
+                           (find-files (string-append out "/sbin"))))
+               #t))))
 
        #:configure-flags (list (string-append "--sysconfdir="
                                               (assoc-ref %outputs "out")
@@ -1762,6 +1739,22 @@ mapper.  Kernel components are part of Linux-libre.")
     ;; Command-line tools are GPLv2.
     (license (list license:gpl2 license:lgpl2.1))))
 
+(define-public lvm2-static
+  (package
+    (inherit lvm2)
+    (name "lvm2-static")
+
+    ;; Propagate udev because libdevmapper.a depends on libudev.
+    (inputs (alist-delete "udev" (package-inputs lvm2)))
+    (propagated-inputs `(("udev" ,eudev)))
+
+    (arguments
+     (substitute-keyword-arguments (package-arguments lvm2)
+       ((#:configure-flags flags '())
+        ;; LVM2 doesn't use Libtool, hence the custom option.
+        `(cons "--enable-static_link" ,flags))))
+    (synopsis "Logical volume management for Linux (statically linked)")))
+
 (define-public wireless-tools
   (package
     (name "wireless-tools")
@@ -1921,20 +1914,16 @@ country-specific regulations for the wireless spectrum.")
 (define-public lm-sensors
   (package
     (name "lm-sensors")
-    (version "3.3.5")
+    (version "3.4.0")
     (source (origin
               (method url-fetch)
               (uri (list (string-append
-                           "ftp://ftp.netroedge.com/pub/lm-sensors/"
-                           "lm_sensors-" version ".tar.bz2")
-                         (string-append
-                           "http://pkgs.fedoraproject.org/repo/pkgs/"
-                           "lm_sensors/lm_sensors-3.3.5.tar.bz2/"
-                           "da506dedceb41822e64865f6ba34828a/"
-                           "lm_sensors-3.3.5.tar.bz2")))
+                           "https://github.com/groeck/lm-sensors/archive/V"
+                           (string-join (string-split version #\.) "-")
+                           ".tar.gz")))
               (sha256
                (base32
-                "1ksgrynxgrq590nb2fwxrl1gwzisjkqlyg3ljfd1al0ibrk6mbjx"))
+                "0knb09s9lvx0wzfsaizx3xq58q6kllqf7nkbwvir0wkgn31c2d73"))
               (patches (search-patches "lm-sensors-hwmon-attrs.patch"))))
     (build-system gnu-build-system)
     (inputs `(("rrdtool" ,rrdtool)
@@ -2251,7 +2240,7 @@ specified in /etc/acpi/events and execute the rules that match the event.")
     (home-page "http://linux-diag.sourceforge.net/Sysfsutils.html")
     (synopsis "System utilities based on Linux sysfs")
     (description
-     "These are a set of utilities built upon sysfs, a virtual filesystem in
+     "These are a set of utilities built upon sysfs, a virtual file system in
 Linux kernel versions 2.5+ that exposes a system's device tree.  The package
 also contains the libsysfs library.")
     ;; The library is under lgpl2.1+ (all files say "or any later version").
@@ -2430,6 +2419,35 @@ assemble, report on, and monitor arrays.  It can also move spares between raid
 arrays when needed.")
     (license license:gpl2+)))
 
+(define-public mdadm-static
+  (package
+    (inherit mdadm)
+    (name "mdadm-static")
+    (arguments
+     (substitute-keyword-arguments (package-arguments mdadm)
+       ((#:make-flags flags)
+        `(cons "LDFLAGS = -static" ,flags))
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (add-after 'install 'remove-cruft
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out         (assoc-ref outputs "out"))
+                      (precious?   (lambda (file)
+                                     (member file '("." ".." "sbin"))))
+                      (directories (scandir out (negate precious?))))
+                 (with-directory-excursion out
+                   (for-each delete-file-recursively directories)
+                   (remove-store-references "sbin/mdadm")
+                   (delete-file "sbin/mdmon")
+                   #t))))))
+       ((#:modules modules %gnu-build-system-modules)
+        `((ice-9 ftw) ,@modules))
+       ((#:strip-flags _ '())
+        ''("--strip-all"))                        ;strip a few extra KiB
+       ((#:allowed-references _ '("out"))
+        '("out"))))                               ;refer only self
+    (synopsis "Statically-linked 'mdadm' command for use in an initrd")))
+
 (define-public libaio
   (package
     (name "libaio")
@@ -2646,7 +2664,7 @@ and copy/paste text in the console and in xterm.")
 (define-public btrfs-progs
   (package
     (name "btrfs-progs")
-    (version "4.7.1")
+    (version "4.8.3")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://kernel.org/linux/kernel/"
@@ -2654,7 +2672,7 @@ and copy/paste text in the console and in xterm.")
                                   "btrfs-progs-v" version ".tar.xz"))
               (sha256
                (base32
-                "15jsa12ijc6z49v1csc62x9zidrgcf307lwy1rbffdwk3gsrczww"))))
+                "1wlflrygnpndppil9g12pk184f75g9qx1lkr0x1gijigglqhr9n1"))))
     (build-system gnu-build-system)
     (outputs '("out"
                "static"))      ; static versions of binaries in "out" (~16MiB!)
@@ -2689,7 +2707,7 @@ and copy/paste text in the console and in xterm.")
                      ("which" ,which)))
     (home-page "https://btrfs.wiki.kernel.org/")
     (synopsis "Create and manage btrfs copy-on-write file systems")
-    (description "Btrfs is a copy-on-write (CoW) filesystem for Linux aimed at
+    (description "Btrfs is a copy-on-write (CoW) file system for Linux aimed at
 implementing advanced features while focusing on fault tolerance, repair and
 easy administration.")
     ;; GPL2+: crc32.c, radix-tree.c, raid6.c, rbtree.c.
@@ -2944,3 +2962,277 @@ native Linux file system, and has been part of the Linux kernel since version
     ;; The files src/key_mod/ecryptfs_key_mod_{openssl,pkcs11_helper,tspi}.c
     ;; grant additional permission to link with OpenSSL.
     (license license:gpl2+)))
+
+(define-public libnfsidmap
+  (package
+    (name "libnfsidmap")
+    (version "0.25")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append
+                   "http://www.citi.umich.edu/projects/nfsv4/linux/"
+                   name "/" name "-" version ".tar.gz"))
+             (sha256
+              (base32
+               "1kzgwxzh83qi97rblcm9qj80cdvnv8kml2plz0q103j0hifj8vb5"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:configure-flags (list
+                          (string-append "--with-pluginpath="
+                                         (assoc-ref %outputs "out")
+                                         "/lib/libnfsidmap"))))
+    (home-page
+     "http://www.citi.umich.edu/projects/nfsv4/crossrealm/libnfsidmap_config.html")
+    (synopsis
+     "NFSv4 support library for name/ID mapping")
+    (description "Libnfsidmap is a library holding mulitiple methods of
+mapping names to ids and visa versa, mainly for NFSv4.  It provides an
+extensible array of mapping functions, currently consisting of two choices:
+the default @code{nsswitch} and the experimental @code{umich_ldap}.")
+    (license (license:non-copyleft "file://COPYING"
+                                   "See COPYING in the distribution."))))
+
+(define-public module-init-tools
+  (package
+    (name "module-init-tools")
+    (version "3.16")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append
+                   "mirror://kernel.org/linux/utils/kernel/module-init-tools/"
+                   "module-init-tools-" version ".tar.bz2"))
+             (sha256
+              (base32
+               "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1"))
+             (patches (search-patches "module-init-tools-moduledir.patch"))))
+    (build-system gnu-build-system)
+    (arguments
+     ;; FIXME: The upstream tarball lacks man pages, and building them would
+     ;; require DocBook & co.  We used to use Gentoo's pre-built man pages,
+     ;; but they vanished.  In the meantime, fake it.
+     '(#:phases (alist-cons-before
+                 'configure 'fake-docbook
+                 (lambda _
+                   (substitute* "Makefile.in"
+                     (("^DOCBOOKTOMAN.*$")
+                      "DOCBOOKTOMAN = true\n")))
+                 %standard-phases)))
+    (home-page "http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/")
+    (synopsis "Tools for loading and managing Linux kernel modules")
+    (description
+     "Tools for loading and managing Linux kernel modules, such as `modprobe',
+`insmod', `lsmod', and more.")
+    (license license:gpl2+)))
+
+(define-public mcelog
+  (package
+    (name "mcelog")
+    (version "144")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://git.kernel.org/cgit/utils/cpu/mce/"
+                                  "mcelog.git/snapshot/v" version ".tar.gz"))
+              (sha256
+               (base32
+                "03jyhsl0s59sfqykj5p6gkb03k4w1h9ay31yxym1dnzis5sq99pa"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; The snapshots lack a .git directory, breaking ‘git describe’.
+               `(substitute* "Makefile"
+                  (("\"unknown\"") (string-append "\"v" ,version "\""))))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (delete 'configure))  ; no configure script
+       #:make-flags (let ((out (assoc-ref %outputs "out")))
+                      (list "CC=gcc"
+                            (string-append "prefix=" out)
+                            (string-append "DOCDIR=" out "/share/doc/mcelog")
+                            "etcprefix=$(DOCDIR)/examples"))
+       ;; The tests will only run as root on certain supported CPU models.
+       #:tests? #f))
+    (supported-systems (list "i686-linux" "x86_64-linux"))
+    (home-page "http://mcelog.org/")
+    (synopsis "Machine check monitor for x86 Linux systems")
+    (description
+     "The mcelog daemon is required by the Linux kernel to log memory, I/O, CPU,
+and other hardware errors on x86 systems.  It can also perform user-defined
+tasks, such as bringing bad pages off-line, when configurable error thresholds
+are exceeded.")
+    (license license:gpl2)))
+
+(define-public mtd-utils
+  (package
+    (name "mtd-utils")
+    (version "1.5.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "ftp://ftp.infradead.org/pub/mtd-utils/"
+                    "mtd-utils-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "007lhsd8yb34l899r4m37whhzdw815cz4fnjbpnblfha524p7dax"))))
+    (inputs
+     `(("acl" ,acl)
+       ("libuuid" ,util-linux)
+       ("lzo", lzo)
+       ("zlib" ,zlib)))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "tests"
+       #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
+       #:phases (modify-phases %standard-phases
+                  (delete 'configure))))
+    (synopsis "MTD Flash Storage Utilities")
+    (description "This package provides utilities for testing, partitioning, etc
+of flash storage.")
+    (home-page "http://www.linux-mtd.infradead.org/")
+    (license
+      (list license:gpl2 ; Almost everything is gpl2 or gpl2+
+            license:mpl1.1 ; All ftl* files
+            license:expat)))) ; libiniparser
+
+(define-public libseccomp
+  (package
+    (name "libseccomp")
+    (version "2.3.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/seccomp/libseccomp/"
+                                  "releases/download/v" version
+                                  "/libseccomp-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0asnlkzqms520r0dra08dzcz5hh6hs7lkajfw9wij3vrd0hxsnzz"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("which" ,which)))
+    (synopsis "Interface to Linux's seccomp syscall filtering mechanism")
+    (description "The libseccomp library provides an easy to use, platform
+independent, interface to the Linux Kernel's syscall filtering mechanism.  The
+libseccomp API is designed to abstract away the underlying BPF based syscall
+filter language and present a more conventional function-call based filtering
+interface that should be familiar to, and easily adopted by, application
+developers.")
+    (home-page "https://github.com/seccomp/libseccomp")
+    (license license:lgpl2.1)))
+
+(define-public radeontop
+  (package
+    (name "radeontop")
+    (version "0.9")
+    (home-page "https://github.com/clbr/radeontop/")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append home-page "/archive/v" version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "07fnimn6wwablmdjw0av11hk9a6xilbryh09izq4b2ic4b8md2p7"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  ;; getver.sh uses ‘git --describe’, isn't worth an extra git
+                  ;; dependency, and doesn't even work on release(!) tarballs.
+                  (add-after 'unpack 'report-correct-version
+                    (lambda _ (substitute* "getver.sh"
+                                (("ver=unknown")
+                                 (string-append "ver=" ,version)))))
+                  (delete 'configure))  ; no configure script
+       #:make-flags (list "CC=gcc"
+                          (string-append "PREFIX=" %output))
+       #:tests? #f))                    ; no tests
+    (native-inputs
+     `(("gettext" ,gettext-minimal)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("libdrm" ,libdrm)
+       ("libpciaccess" ,libpciaccess)
+       ("ncurses" ,ncurses)))
+    (synopsis "Usage monitor for AMD Radeon graphics")
+    (description "RadeonTop monitors resource consumption on supported AMD
+Radeon Graphics Processing Units (GPUs), either in real time as bar graphs on
+a terminal or saved to a file for further processing.  It measures both the
+activity of the GPU as a whole, which is also accurate during OpenCL
+computations, as well as separate component statistics that are only meaningful
+under OpenGL graphics workloads.")
+    (license license:gpl3)))
+
+(define-public efivar
+  (package
+    (name "efivar")
+    (version "30")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/rhinstaller/" name
+                                  "/releases/download/" version "/" name
+                                  "-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "12qjnm44yi55ffqxjpgrxy82s89yjziy84w2rfjjknsd8flj0mqz"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(;; Tests require a UEFI system and is not detected in the chroot.
+       #:tests? #f
+       #:make-flags (list (string-append "prefix=" %output)
+                          (string-append "libdir=" %output "/lib")
+                          (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("popt" ,popt)))
+    (home-page "https://github.com/rhinstaller/efivar")
+    (synopsis "Tool and library to manipulate EFI variables")
+    (description "This package provides a library and a command line
+interface to the variable facility of UEFI boot firmware.")
+    (license license:lgpl2.1+)))
+
+(define-public efibootmgr
+  (package
+    (name "efibootmgr")
+    (version "14")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/rhinstaller/" name
+                                  "/releases/download/" version "/" name
+                                  "-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "1n3sydvpr6yl040hhf460k7mrxby7laqd9dqs6pq0js1hijc2zip"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ; No tests.
+       #:make-flags (list (string-append "prefix=" %output)
+                          (string-append "libdir=" %output "/lib")
+                          ;; Override CFLAGS to add efivar include directory.
+                          (string-append "CFLAGS=-O2 -g -flto -I"
+                                         (assoc-ref %build-inputs "efivar")
+                                         "/include/efivar"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'branding
+           ;; Replace default loader path with something more familiar.
+           (lambda _
+             (substitute* "src/efibootmgr.c"
+               (("EFI\\\\\\\\redhat") ; Matches 'EFI\\redhat'.
+                "EFI\\\\gnu"))
+             #t))
+         (delete 'configure))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("efivar" ,efivar)
+       ("popt" ,popt)))
+    (home-page "https://github.com/rhinstaller/efibootmgr")
+    (synopsis "Modify the Extensible Firmware Interface (EFI) boot manager")
+    (description
+     "@code{efibootmgr} is a user-space application to modify the Intel
+Extensible Firmware Interface (EFI) Boot Manager.  This application can
+create and destroy boot entries, change the boot order, change the next
+running boot option, and more.")
+    (license license:gpl2+)))