GNU bug report logs -
#35110
[PATCH 0/3] Add support for loadable modules.
Previous Next
Full log
Message #8 received at 35110 <at> debbugs.gnu.org (full text, mbox):
* 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")
This bug report was last modified 6 years and 63 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.