From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqA4B-0000f7-8R for guix-patches@gnu.org; Sun, 25 Feb 2018 23:07:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqA46-0001as-Um for guix-patches@gnu.org; Sun, 25 Feb 2018 23:07:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:53043) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqA46-0001ak-R2 for guix-patches@gnu.org; Sun, 25 Feb 2018 23:07:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eqA46-0004gj-KW for guix-patches@gnu.org; Sun, 25 Feb 2018 23:07:02 -0500 Subject: [bug#30604] [PATCH v3 2/6] gnu: Add kmod-minimal-static. Resent-Message-ID: From: Danny Milosavljevic Date: Mon, 26 Feb 2018 05:06:05 +0100 Message-Id: <20180226040609.3066-3-dannym@scratchpost.org> In-Reply-To: <20180226040609.3066-1-dannym@scratchpost.org> References: <20180226035025.1698-1-dannym@scratchpost.org> <20180226040609.3066-1-dannym@scratchpost.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 30604@debbugs.gnu.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; +