build-system/linux-module: Support module source versioning.

* guix/build-system/linux-module.scm (make-linux-module-builder)
[native-inputs]: Add linux.
[arguments]<#:phases>[install]: Install "System.map" and "Module.symvers".
* guix/build/linux-module-build-system.scm (configure): Delete procedure.
(%standard-phases): Delete "configure" phase.
This commit is contained in:
Danny Milosavljevic 2019-04-11 23:49:43 +02:00
parent b2521eed91
commit 88e13c2587
No known key found for this signature in database
GPG Key ID: E71A35542C30BAA5
2 changed files with 11 additions and 6 deletions

View File

@ -63,6 +63,9 @@
(package (package
(inherit linux) (inherit linux)
(name (string-append (package-name linux) "-module-builder")) (name (string-append (package-name linux) "-module-builder"))
(native-inputs
`(("linux" ,linux)
,@(package-native-inputs linux)))
(arguments (arguments
(substitute-keyword-arguments (package-arguments linux) (substitute-keyword-arguments (package-arguments linux)
((#:phases phases) ((#:phases phases)
@ -72,11 +75,17 @@
(invoke "make" "modules_prepare"))) (invoke "make" "modules_prepare")))
(delete 'strip) ; faster. (delete 'strip) ; faster.
(replace 'install (replace 'install
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
(out-lib-build (string-append out "/lib/modules/build"))) (out-lib-build (string-append out "/lib/modules/build")))
; TODO: Only preserve the minimum, i.e. [Kbuild], Kconfig, scripts, include, ".config". ; TODO: Only preserve the minimum, i.e. [Kbuild], Kconfig, scripts, include, ".config".
(copy-recursively "." out-lib-build) (copy-recursively "." out-lib-build)
(let* ((linux (assoc-ref inputs "linux")))
(install-file (string-append linux "/System.map")
out-lib-build)
(let ((source (string-append linux "/Module.symvers")))
(if (file-exists? source)
(install-file source out-lib-build))))
#t))))))))) #t)))))))))
(define* (lower name (define* (lower name

View File

@ -32,10 +32,6 @@
;; ;;
;; Code: ;; Code:
;; TODO: It might make sense to provide "Module.symvers" in the future.
(define* (configure #:key inputs #:allow-other-keys)
#t)
(define* (build #:key inputs make-flags #:allow-other-keys) (define* (build #:key inputs make-flags #:allow-other-keys)
(apply invoke "make" "-C" (apply invoke "make" "-C"
(string-append (assoc-ref inputs "linux-module-builder") (string-append (assoc-ref inputs "linux-module-builder")
@ -64,7 +60,7 @@
(define %standard-phases (define %standard-phases
(modify-phases gnu:%standard-phases (modify-phases gnu:%standard-phases
(replace 'configure configure) (delete 'configure)
(replace 'build build) (replace 'build build)
(replace 'install install))) (replace 'install install)))