mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-11 21:59:08 -05:00
system: Automatically adjust linux-module packages to use the
operating-system's kernel. * gnu/system.scm (package-for-kernel): New procedure. (operating-system-directory-base-entries): Use it. * gnu/tests/linux-module.scm: Test it.
This commit is contained in:
parent
2213d00fac
commit
f91ad0b13d
2 changed files with 27 additions and 2 deletions
|
@ -33,6 +33,7 @@ (define-module (gnu system)
|
|||
#:use-module (guix derivations)
|
||||
#:use-module (guix profiles)
|
||||
#:use-module (guix ui)
|
||||
#:use-module (guix utils)
|
||||
#:use-module (gnu packages base)
|
||||
#:use-module (gnu packages bash)
|
||||
#:use-module (gnu packages guile)
|
||||
|
@ -477,6 +478,16 @@ (define (operating-system-kernel-file os)
|
|||
(file-append (operating-system-kernel os)
|
||||
"/" (system-linux-image-file-name)))
|
||||
|
||||
(define (package-for-kernel target-kernel module-package)
|
||||
"Return a package like MODULE-PACKAGE, adapted for TARGET-KERNEL, if
|
||||
possible (that is if there's a LINUX keyword argument in the build system)."
|
||||
(package
|
||||
(inherit module-package)
|
||||
(arguments
|
||||
(substitute-keyword-arguments (package-arguments module-package)
|
||||
((#:linux kernel #f)
|
||||
target-kernel)))))
|
||||
|
||||
(define* (operating-system-directory-base-entries os)
|
||||
"Return the basic entries of the 'system' directory of OS for use as the
|
||||
value of the SYSTEM-SERVICE-TYPE service."
|
||||
|
@ -487,7 +498,12 @@ (define* (operating-system-directory-base-entries os)
|
|||
(kernel
|
||||
(profile-derivation
|
||||
(packages->manifest
|
||||
(cons kernel modules))
|
||||
(cons kernel
|
||||
(map (lambda (module)
|
||||
(if (package? module)
|
||||
(package-for-kernel kernel module)
|
||||
module))
|
||||
modules)))
|
||||
#:hooks (list linux-module-database)))
|
||||
(initrd -> (operating-system-initrd-file os))
|
||||
(params -> (operating-system-boot-parameters-file os)))
|
||||
|
|
|
@ -28,8 +28,10 @@ (define-module (gnu tests linux-modules)
|
|||
#:use-module (guix derivations)
|
||||
#:use-module (guix gexp)
|
||||
#:use-module (guix modules)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix monads)
|
||||
#:use-module (guix store)
|
||||
#:use-module (guix utils)
|
||||
#:export (%test-loadable-kernel-modules-0
|
||||
%test-loadable-kernel-modules-1
|
||||
%test-loadable-kernel-modules-2))
|
||||
|
@ -118,5 +120,12 @@ (define %test-loadable-kernel-modules-2
|
|||
(description "Tests loadable kernel modules facility of <operating-system>
|
||||
with two extra modules.")
|
||||
(value (run-loadable-kernel-modules-test
|
||||
(list acpi-call-linux-module ddcci-driver-linux)
|
||||
(list acpi-call-linux-module
|
||||
(package
|
||||
(inherit ddcci-driver-linux)
|
||||
(arguments
|
||||
`(#:linux #f
|
||||
,@(strip-keyword-arguments '(#:linux)
|
||||
(package-arguments
|
||||
ddcci-driver-linux))))))
|
||||
'("acpi_call" "ddcci")))))
|
||||
|
|
Loading…
Reference in a new issue