From: Danny Milosavljevic <dannym@scratchpost.org>
To: 35110@debbugs.gnu.org
Subject: [bug#35110] [PATCH 1/3] gnu: Add make-linux-module.
Date: Tue, 2 Apr 2019 21:28:53 +0200 [thread overview]
Message-ID: <20190402192855.5314-1-dannym@scratchpost.org> (raw)
In-Reply-To: <20190402192729.5262-1-dannym@scratchpost.org>
* gnu/packages/linux.scm (make-linux-module): New procedure.
---
gnu/packages/linux.scm | 66 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 9e4261eb02..55a314258f 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -415,6 +415,72 @@ for ARCH and optionally VARIANT, or #f if there is no such configuration."
It has been modified to remove all non-free binary blobs.")
(license license:gpl2)))
+;; FIXME: Remove CONFIG_MODULE_SRCVERSION_ALL=y from our configs.
+(define (make-linux-module linux module)
+ "Given a LINUX package and a MODULE package, build MODULE using LINUX."
+ (let ((linux-source
+ (package
+ (inherit linux)
+ (name "linux-source")
+ (arguments
+ (substitute-keyword-arguments (package-arguments linux)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (replace 'build
+ (lambda _
+ (invoke "make" "modules_prepare")))
+ (delete 'strip) ; faster.
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (out-lib-build (string-append out "/lib/modules/build")))
+ ; TODO: Only preserve the minimum, i.e. [Kbuild], Kconfig, scripts, include, ".config".
+ (copy-recursively "." out-lib-build)
+ #t))))))))))
+ (package
+ (inherit module)
+ (name (string-append (package-name module) "-" (package-name linux)))
+ (native-inputs
+ `(("linux-source" ,linux-source)
+ ("kmod" ,kmod)
+ ;("elfutils" ,elfutils) ; Needed to enable CONFIG_STACK_VALIDATION
+ ("gcc" ,gcc-7)
+ ,@(package-native-inputs module)))
+ (arguments
+ (substitute-keyword-arguments
+ (default-keyword-arguments (package-arguments module)
+ `(#:phases #f
+ #:make-flags '()))
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (replace 'build
+ (lambda* (#:key inputs make-flags #:allow-other-keys)
+ (apply invoke "make" "-C"
+ (string-append (assoc-ref inputs "linux-source")
+ "/lib/modules/build")
+ (string-append "M=" (getcwd))
+ make-flags)))
+ ;; This block was copied from make-linux-libre--only took the
+ ;; "modules_install" part.
+ (replace 'install
+ (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (moddir (string-append out "/lib/modules"))
+ (kmod (assoc-ref (or native-inputs inputs) "kmod")))
+ ;; Install kernel modules
+ (mkdir-p moddir)
+ (invoke "make"
+ "-C"
+ (string-append (assoc-ref inputs "linux-source")
+ "/lib/modules/build")
+ (string-append "M=" (getcwd))
+ (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")))))))))))
+
(define %linux-libre-version "5.0.5")
(define %linux-libre-hash "1yivxqprxfzhzid4qv9hpnb5i38kijrj2g2pyzz7niliya1c58li")
next prev parent reply other threads:[~2019-04-02 19:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-02 19:27 [bug#35110] [PATCH 0/3] Add support for loadable modules Danny Milosavljevic
2019-04-02 19:28 ` Danny Milosavljevic [this message]
2019-04-02 19:28 ` [bug#35110] [PATCH 2/3] gnu: Add vhba-module-linux-libre Danny Milosavljevic
2019-04-02 21:51 ` Pierre Neidhardt
2019-04-02 22:36 ` Danny Milosavljevic
2019-04-03 6:48 ` Pierre Neidhardt
2019-04-02 19:28 ` [bug#35110] [PATCH 3/3] gnu: linux-libre: Disable module versioning Danny Milosavljevic
2019-04-03 20:16 ` [bug#35110] [PATCH 1/3] gnu: Add make-linux-module Ludovic Courtès
2019-04-03 20:48 ` Danny Milosavljevic
2019-04-04 7:48 ` Ludovic Courtès
2019-04-05 11:05 ` [bug#35110] [PATCH v2 0/2] Add support for loadable modules Danny Milosavljevic
2019-04-05 11:05 ` [bug#35110] [PATCH v2 1/2] Add (guix build-system linux-module) Danny Milosavljevic
2019-04-11 10:50 ` Ludovic Courtès
2019-04-11 15:53 ` bug#35110: " Danny Milosavljevic
2019-04-05 11:05 ` [bug#35110] [PATCH v2 2/2] gnu: Add vhba-module Danny Milosavljevic
2019-04-11 10:51 ` 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=20190402192855.5314-1-dannym@scratchpost.org \
--to=dannym@scratchpost.org \
--cc=35110@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).