unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: 30604@debbugs.gnu.org
Subject: [bug#30604] [PATCH v4 2/7] gnu: Add kmod-minimal-static.
Date: Tue, 27 Feb 2018 12:26:14 +0100	[thread overview]
Message-ID: <20180227112619.5071-3-dannym@scratchpost.org> (raw)
In-Reply-To: <20180227112619.5071-1-dannym@scratchpost.org>

* gnu/packages/linux.scm (kmod-minimal/static): New variable.
* gnu/packages/patches/kmod-13-module-directory.patch: New file.
* gnu/local.mk: Add it.
---
 gnu/local.mk                                       |  1 +
 gnu/packages/linux.scm                             | 44 ++++++++++++++++++++++
 .../patches/kmod-13-module-directory.patch         | 33 ++++++++++++++++
 3 files changed, 78 insertions(+)
 create mode 100644 gnu/packages/patches/kmod-13-module-directory.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 21195f8c1..b1e3c878d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -795,6 +795,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/kiki-makefile.patch			\
   %D%/packages/patches/kiki-missing-includes.patch		\
   %D%/packages/patches/kiki-portability-64bit.patch		\
+  %D%/packages/patches/kmod-13-module-directory.patch		\
   %D%/packages/patches/kmod-module-directory.patch		\
   %D%/packages/patches/kobodeluxe-paths.patch			\
   %D%/packages/patches/kobodeluxe-enemies-pipe-decl.patch	\
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 1f8bf3050..b2e47f79a 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -1994,6 +1994,50 @@ from the module-init-tools project.")
                      #t))
                  %standard-phases)))))
 
+(define-public kmod-minimal/static
+  (static-package
+   (package (inherit kmod-minimal)
+    (name "kmod-minimal-static")
+    (version "13")
+    (source (origin
+              (method url-fetch)
+              (uri
+               (string-append "mirror://kernel.org/linux/utils/kernel/kmod/"
+                              "kmod-" version ".tar.xz"))
+              (sha256
+               (base32
+                "0mkrklih0f33c3zc4mkk9qqbzy36r18mj9xffd4wi61gpamx6dkc"))
+              (patches (search-patches "kmod-13-module-directory.patch"))))
+    (arguments
+     (substitute-keyword-arguments
+       (package-arguments (static-package kmod-minimal))
+       ((#:configure-flags flags ''())
+        `(cons* "--disable-manpages" "--disable-static" "--disable-shared" ,flags))
+       ((#:make-flags flags ''())
+        `(cons* "LDFLAGS=-all-static" ,flags))
+       ((#:phases phases '%standard-phases)
+        `(modify-phases ,phases
+          (delete 'install-license-files)
+          (add-after 'unpack 'patch-kmod
+           (lambda _
+             ;; Reduce size by 200 kiB.
+             (substitute* "tools/kmod.c"
+              (("[&]kmod_cmd_compat_lsmod,") "")
+              (("[&]kmod_cmd_compat_rmmod,") "")
+              (("[&]kmod_cmd_compat_insmod,") "")
+              (("[&]kmod_cmd_compat_modinfo,") ""))
+             #t))
+          (replace 'install
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (bin (string-append out "/bin")))
+                (install-file "tools/kmod" bin)
+                (for-each
+                 (lambda (tool)
+                   (symlink "kmod" (string-append bin "/" tool)))
+                 '("modprobe" "depmod"))
+                #t))))))))))
+
 (define-public eudev
   ;; The post-systemd fork, maintained by Gentoo.
   (package
diff --git a/gnu/packages/patches/kmod-13-module-directory.patch b/gnu/packages/patches/kmod-13-module-directory.patch
new file mode 100644
index 000000000..5ff2f8a60
--- /dev/null
+++ b/gnu/packages/patches/kmod-13-module-directory.patch
@@ -0,0 +1,33 @@
+This patch changes libkmod so it honors the 'LINUX_MODULE_DIRECTORY'
+environment variable, rather than looking for modules exclusively in
+/lib/modules.
+
+Patch by Shea Levy and Eelco Dolstra, from Nixpkgs; adjusted to
+use 'LINUX_MODULE_DIRECTORY' rather than 'MODULE_DIR' as the variable
+name.
+
+
+--- kmod-7/libkmod/libkmod.c	2012-03-15 08:19:16.750010226 -0400
++++ kmod-7/libkmod/libkmod.c	2012-04-04 15:21:29.532074313 -0400
+@@ -200,7 +200,7 @@
+ static char *get_kernel_release(const char *dirname)
+ {
+ 	struct utsname u;
+-	char *p;
++	char *p, *dirname_prefix;
+ 
+ 	if (dirname != NULL)
+ 		return path_make_absolute_cwd(dirname);
+@@ -208,7 +208,10 @@
+ 	if (uname(&u) < 0)
+ 		return NULL;
+ 
+-	if (asprintf(&p, "%s/%s", dirname_default_prefix, u.release) < 0)
++	if ((dirname_prefix = getenv("LINUX_MODULE_DIRECTORY")) == NULL)
++		dirname_prefix = dirname_default_prefix;
++
++	if (asprintf(&p, "%s/%s", dirname_prefix, u.release) < 0)
+ 		return NULL;
+ 
+ 	return p;
+

  parent reply	other threads:[~2018-02-27 10:27 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-25 11:45 [bug#30604] [PATCH 0/4] Load Linux module only when supported hardware is present Danny Milosavljevic
2018-02-25 11:48 ` [bug#30604] [PATCH 1/4] gnu: kmod: Split off kmod-minimal Danny Milosavljevic
2018-02-25 11:48   ` [bug#30604] [PATCH 2/4] gnu: Add kmod-minimal-static Danny Milosavljevic
2018-02-25 11:48   ` [bug#30604] [PATCH 3/4] linux-initrd: Add kmod Danny Milosavljevic
2018-02-25 14:05     ` Mathieu Othacehe
2018-02-25 15:07       ` Danny Milosavljevic
2018-02-26 11:51         ` Mathieu Othacehe
2018-02-25 11:48   ` [bug#30604] [PATCH 4/4] linux-boot: Load kernel modules only when the hardware is present Danny Milosavljevic
2018-02-26  1:10   ` [bug#30604] [PATCH 1/4] gnu: kmod: Split off kmod-minimal Marius Bakke
2018-02-26  3:50 ` [bug#30604] [PATCH v2 0/6] Load Linux module only when supported hardware is present Danny Milosavljevic
2018-02-26  3:50   ` [bug#30604] [PATCH v2 1/6] gnu: kmod: Split off kmod-minimal Danny Milosavljevic
2018-02-26  3:50   ` [bug#30604] [PATCH v2 2/6] gnu: Add kmod-minimal-static Danny Milosavljevic
2018-02-26  3:50   ` [bug#30604] [PATCH v2 3/6] linux-initrd: Add kmod Danny Milosavljevic
2018-02-26  3:50   ` [bug#30604] [PATCH v2 4/6] linux-boot: Load kernel modules only when the hardware is present Danny Milosavljevic
2018-02-26  3:50   ` [bug#30604] [PATCH v2 5/6] vm: Allow qemu-image builder to load Linux kernel modules Danny Milosavljevic
2018-02-26  3:50   ` [bug#30604] [PATCH v2 6/6] vm: Make the virtio-blk is uniquely identifyable in /sys Danny Milosavljevic
2018-02-26  4:06   ` [bug#30604] [PATCH v3 0/6] Load Linux module only when supported hardware is present Danny Milosavljevic
2018-02-26  4:06     ` [bug#30604] [PATCH v3 1/6] gnu: kmod: Split off kmod-minimal Danny Milosavljevic
2018-02-26  4:06     ` [bug#30604] [PATCH v3 2/6] gnu: Add kmod-minimal-static Danny Milosavljevic
2018-02-26  4:06     ` [bug#30604] [PATCH v3 3/6] linux-initrd: Add kmod Danny Milosavljevic
2018-02-26  4:06     ` [bug#30604] [PATCH v3 4/6] linux-boot: Load kernel modules only when the hardware is present Danny Milosavljevic
2018-02-27 14:26       ` Ludovic Courtès
2018-02-26  4:06     ` [bug#30604] [PATCH v3 5/6] vm: Allow qemu-image builder to load Linux kernel modules Danny Milosavljevic
2018-02-26  4:06     ` [bug#30604] [PATCH v3 6/6] vm: Make the virtio-blk is uniquely identifyable in /sys Danny Milosavljevic
2018-02-27 11:26     ` [bug#30604] [PATCH v4 0/7] Load Linux module only when supported hardware is present Danny Milosavljevic
2018-02-27 11:26       ` [bug#30604] [PATCH v4 1/7] gnu: kmod: Split off kmod-minimal Danny Milosavljevic
2018-02-27 11:26       ` Danny Milosavljevic [this message]
2018-02-27 11:26       ` [bug#30604] [PATCH v4 3/7] linux-initrd: Add kmod Danny Milosavljevic
2018-02-27 11:26       ` [bug#30604] [PATCH v4 4/7] linux-boot: Load kernel modules only when the hardware is present Danny Milosavljevic
2018-02-27 11:26       ` [bug#30604] [PATCH v4 5/7] vm: Allow qemu-image builder to load Linux kernel modules Danny Milosavljevic
2018-02-27 11:26       ` [bug#30604] [PATCH v4 6/7] vm: Make the virtio-blk uniquely identifyable in /sys Danny Milosavljevic
2018-02-27 11:26       ` [bug#30604] [PATCH v4 7/7] linux-boot: Call make-static-device-nodes much earlier Danny Milosavljevic
2018-02-27 15:50       ` [bug#30604] [PATCH v5 0/7] Load Linux module only when supported hardware is present Danny Milosavljevic
2018-02-27 15:50         ` [bug#30604] [PATCH v5 1/7] gnu: kmod: Split off kmod-minimal Danny Milosavljevic
2018-02-27 15:50         ` [bug#30604] [PATCH v5 2/7] gnu: Add kmod-minimal-static Danny Milosavljevic
2018-02-27 15:50         ` [bug#30604] [PATCH v5 3/7] linux-initrd: Add kmod Danny Milosavljevic
2018-02-27 15:50         ` [bug#30604] [PATCH v5 4/7] linux-boot: Load kernel modules only when the hardware is present Danny Milosavljevic
2018-02-27 15:50         ` [bug#30604] [PATCH v5 5/7] vm: Allow qemu-image builder to load Linux kernel modules Danny Milosavljevic
2018-02-27 15:50         ` [bug#30604] [PATCH v5 6/7] vm: Make the virtio-blk is uniquely identifyable in /sys Danny Milosavljevic
2018-02-27 15:50         ` [bug#30604] [PATCH v5 7/7] linux-boot: Call make-static-device-nodes much earlier Danny Milosavljevic
2018-03-02 14:16         ` [bug#30604] [PATCH v6 0/6] Load Linux module only when supported hardware is present Danny Milosavljevic
2018-03-02 14:17           ` [bug#30604] [PATCH v6 1/6] linux-modules: Add module-aliases Danny Milosavljevic
2018-03-02 14:17             ` [bug#30604] [PATCH v6 2/6] linux-modules: Add install-modules Danny Milosavljevic
2018-03-02 14:17             ` [bug#30604] [PATCH v6 3/6] linux-boot: Load kernel modules only when the hardware is present Danny Milosavljevic
2018-03-02 14:17             ` [bug#30604] [PATCH v6 4/6] vm: Allow qemu-image builder to load Linux kernel modules Danny Milosavljevic
2018-03-02 14:17             ` [bug#30604] [PATCH v6 5/6] vm: Make the virtio-blk uniquely identifiable in /sys Danny Milosavljevic
2018-03-02 14:17             ` [bug#30604] [PATCH v6 6/6] linux-initrd: Provide modprobe to the initrd Danny Milosavljevic
2018-03-02 15:34           ` [bug#30604] [PATCH v7 0/6] Load Linux module only when supported hardware is present Danny Milosavljevic
2018-03-02 15:34             ` [bug#30604] [PATCH v7 1/6] linux-modules: Add module-aliases Danny Milosavljevic
2018-03-02 16:47               ` Danny Milosavljevic
2018-03-02 15:34             ` [bug#30604] [PATCH v7 2/6] linux-modules: Add install-modules Danny Milosavljevic
2018-03-02 15:34             ` [bug#30604] [PATCH v7 3/6] linux-boot: Load kernel modules only when the hardware is present Danny Milosavljevic
2018-03-02 16:47               ` Danny Milosavljevic
2018-03-02 15:34             ` [bug#30604] [PATCH v7 4/6] vm: Allow qemu-image builder to load Linux kernel modules Danny Milosavljevic
2018-03-02 15:34             ` [bug#30604] [PATCH v7 5/6] vm: Make the virtio-blk uniquely identifiable in /sys Danny Milosavljevic
2018-03-02 15:34             ` [bug#30604] [PATCH v7 6/6] linux-initrd: Provide modprobe to the initrd Danny Milosavljevic
2018-03-03 13:55             ` [bug#30604] [PATCH v8 0/7] Load Linux module only when supported hardware is present Danny Milosavljevic
2018-03-03 13:55               ` [bug#30604] [PATCH v8 1/7] linux-modules: Add module-aliases Danny Milosavljevic
2018-03-03 21:58                 ` Ludovic Courtès
2018-03-03 13:55               ` [bug#30604] [PATCH v8 2/7] linux-modules: Add install-modules Danny Milosavljevic
2018-03-03 15:32                 ` Danny Milosavljevic
2018-03-03 22:07                 ` Ludovic Courtès
2018-03-04 12:45                   ` Danny Milosavljevic
2018-03-04 12:53                   ` Danny Milosavljevic
2018-03-03 13:55               ` [bug#30604] [PATCH v8 3/7] linux-boot: Load kernel modules only when the hardware is present Danny Milosavljevic
2018-03-03 22:48                 ` Ludovic Courtès
2018-03-04  1:06                   ` Danny Milosavljevic
2018-03-04  1:54                   ` Danny Milosavljevic
2018-03-04 12:34                   ` Danny Milosavljevic
2018-03-09 22:06                     ` Ludovic Courtès
2018-03-09 22:13                       ` Danny Milosavljevic
2018-03-09 22:19                         ` Danny Milosavljevic
2018-03-09 22:44                         ` Danny Milosavljevic
2018-03-12 12:38                         ` Ludovic Courtès
2018-03-12 12:39                           ` [bug#30604] [PATCH v10 1/6] linux-modules: Add "modules.alias" writer Ludovic Courtès
2018-03-12 12:39                             ` [bug#30604] [PATCH v10 2/6] linux-modules: Add 'load-linux-modules-from-directory' Ludovic Courtès
2018-03-12 19:26                               ` Danny Milosavljevic
2018-03-12 12:39                             ` [bug#30604] [PATCH v10 3/6] linux-modules: Add 'load-needed-linux-modules' Ludovic Courtès
2018-03-12 19:40                               ` Danny Milosavljevic
2018-03-12 21:10                                 ` Ludovic Courtès
2018-03-12 12:39                             ` [bug#30604] [PATCH v10 4/6] vm: Make the virtio-blk uniquely identifiable in /sys Ludovic Courtès
2018-03-12 12:39                             ` [bug#30604] [PATCH v10 5/6] linux-initrd: Provide our own 'modprobe' program Ludovic Courtès
2018-03-12 20:09                               ` Danny Milosavljevic
2018-03-12 21:12                                 ` Danny Milosavljevic
2018-03-13  8:54                                   ` Ludovic Courtès
2018-03-12 22:14                                 ` Ludovic Courtès
2018-03-12 22:15                                   ` [bug#30604] [PATCH v11 1/6] linux-modules: Add "modules.alias" writer Ludovic Courtès
2018-03-12 22:15                                     ` [bug#30604] [PATCH v11 2/6] linux-modules: Add 'load-linux-modules-from-directory' Ludovic Courtès
2018-03-12 22:48                                       ` Danny Milosavljevic
2018-03-12 22:15                                     ` [bug#30604] [PATCH v11 3/6] linux-modules: Add 'load-needed-linux-modules' Ludovic Courtès
2018-03-12 23:00                                       ` Danny Milosavljevic
2018-03-13  8:55                                         ` Ludovic Courtès
2018-03-12 22:15                                     ` [bug#30604] [PATCH v11 4/6] vm: Make the virtio-blk uniquely identifiable in /sys Ludovic Courtès
2018-03-12 22:49                                       ` Danny Milosavljevic
2018-03-12 22:15                                     ` [bug#30604] [PATCH v11 5/6] linux-initrd: Provide our own 'modprobe' program Ludovic Courtès
2018-03-13  8:50                                       ` Ludovic Courtès
2018-03-13  9:28                                         ` Ludovic Courtès
2018-03-13 12:28                                         ` Danny Milosavljevic
2018-03-12 22:15                                     ` [bug#30604] [PATCH v11 6/6] linux-modules: Add "modules.devname" writer Ludovic Courtès
2018-03-12 22:55                                       ` Danny Milosavljevic
2018-03-13  8:56                                         ` Ludovic Courtès
2018-03-12 22:48                                     ` [bug#30604] [PATCH v11 1/6] linux-modules: Add "modules.alias" writer Danny Milosavljevic
2018-03-13  9:27                                   ` [bug#30604] [PATCH v10 5/6] linux-initrd: Provide our own 'modprobe' program Danny Milosavljevic
2018-03-13 10:51                                     ` Ludovic Courtès
2018-03-13 12:05                                       ` Danny Milosavljevic
2018-03-13 19:17                                       ` Danny Milosavljevic
2018-03-12 12:39                             ` [bug#30604] [PATCH v10 6/6] linux-modules: Add "modules.devname" writer Ludovic Courtès
2018-03-12 19:54                             ` [bug#30604] [PATCH v10 1/6] linux-modules: Add "modules.alias" writer Danny Milosavljevic
2018-03-12 21:13                               ` Ludovic Courtès
2018-03-09 22:36                       ` [bug#30604] [PATCH v8 3/7] linux-boot: Load kernel modules only when the hardware is present Danny Milosavljevic
2018-03-03 13:55               ` [bug#30604] [PATCH v8 4/7] vm: Allow qemu-image builder to load Linux kernel modules Danny Milosavljevic
2018-03-03 13:55               ` [bug#30604] [PATCH v8 5/7] vm: Make the virtio-blk uniquely identifiable in /sys Danny Milosavljevic
2018-03-03 13:55               ` [bug#30604] [PATCH v8 6/7] linux-initrd: Provide modprobe to the initrd Danny Milosavljevic
2018-03-03 13:55               ` [bug#30604] [PATCH v8 7/7] linux-initrd: Factorize %modprobe and flat-linux-module-directory Danny Milosavljevic
2018-03-03 18:01                 ` Danny Milosavljevic
2018-03-04  1:09               ` [bug#30604] [PATCH v9 0/7] Load Linux module only when supported hardware is present Danny Milosavljevic
2018-03-04  1:09                 ` [bug#30604] [PATCH v9 1/7] linux-modules: Add "modules.devname" and "modules.alias" writer Danny Milosavljevic
2018-03-04  1:09                 ` [bug#30604] [PATCH v9 2/7] linux-modules: Add module-aliases->module-file-names Danny Milosavljevic
2018-03-04  1:09                 ` [bug#30604] [PATCH v9 3/7] linux-initrd: Provide pure-Guile modprobe Danny Milosavljevic
2018-03-11 20:24                   ` Danny Milosavljevic
2018-03-12 14:45                     ` Ludovic Courtès
2018-03-12 17:51                       ` Danny Milosavljevic
2018-03-04  1:09                 ` [bug#30604] [PATCH v9 4/7] linux-boot: Load kernel modules only when the hardware is present Danny Milosavljevic
2018-03-04  1:09                 ` [bug#30604] [PATCH v9 5/7] vm: Allow qemu-image builder to load Linux kernel modules Danny Milosavljevic
2018-03-04  1:09                 ` [bug#30604] [PATCH v9 6/7] vm: Make the virtio-blk uniquely identifiable in /sys Danny Milosavljevic
2018-03-04  1:09                 ` [bug#30604] [PATCH v9 7/7] linux-initrd: Use module-aliases->module-file-names, too Danny Milosavljevic
2018-03-09 22:26                   ` Danny Milosavljevic
2018-03-18 15:03 ` [bug#30604] Keyboard detection before ‘cryptsetup’ runs Ludovic Courtès
2018-03-23 13:02   ` Danny Milosavljevic
2018-03-23 15:07     ` Danny Milosavljevic
2018-03-24 17:07       ` Ludovic Courtès
2018-03-24 17:12     ` Ludovic Courtès

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=20180227112619.5071-3-dannym@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=30604@debbugs.gnu.org \
    /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).