mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 13:28:12 -05:00
activation: Set the firmware search path.
* gnu/build/activation.scm (activate-firmware): New procedure. * gnu/system.scm (<operating-system>)[firmware]: New field. (directory-union): New procedure. (%base-firmware): New variable. (operating-system-activation-script): Use 'directory-union', and call 'activate-firmware'. * doc/guix.texi (operating-system Reference): Document 'firmware'.
This commit is contained in:
parent
1306b0b003
commit
f34c56be3a
3 changed files with 45 additions and 0 deletions
|
@ -3385,6 +3385,13 @@ The system bootloader configuration object. @xref{GRUB Configuration}.
|
||||||
A two-argument monadic procedure that returns an initial RAM disk for
|
A two-argument monadic procedure that returns an initial RAM disk for
|
||||||
the Linux kernel. @xref{Initial RAM Disk}.
|
the Linux kernel. @xref{Initial RAM Disk}.
|
||||||
|
|
||||||
|
@item @code{firmware} (default: @var{%base-firmware})
|
||||||
|
@cindex firmware
|
||||||
|
List of firmware packages loadable by the operating system kernel.
|
||||||
|
|
||||||
|
The default includes firmware needed for Atheros-based WiFi devices
|
||||||
|
(Linux-libre module @code{ath9k}.)
|
||||||
|
|
||||||
@item @code{host-name}
|
@item @code{host-name}
|
||||||
The host name.
|
The host name.
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ (define-module (gnu build activation)
|
||||||
activate-setuid-programs
|
activate-setuid-programs
|
||||||
activate-/bin/sh
|
activate-/bin/sh
|
||||||
activate-modprobe
|
activate-modprobe
|
||||||
|
activate-firmware
|
||||||
activate-current-system))
|
activate-current-system))
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
|
@ -259,6 +260,15 @@ (define (activate-modprobe modprobe)
|
||||||
(lambda (port)
|
(lambda (port)
|
||||||
(display modprobe port))))
|
(display modprobe port))))
|
||||||
|
|
||||||
|
(define (activate-firmware directory)
|
||||||
|
"Tell the kernel to look for device firmware under DIRECTORY. This
|
||||||
|
mechanism bypasses udev: it allows Linux to handle firmware loading directly
|
||||||
|
by itself, without having to resort to a \"user helper\"."
|
||||||
|
(call-with-output-file "/sys/module/firmware_class/parameters/path"
|
||||||
|
(lambda (port)
|
||||||
|
(display directory port))))
|
||||||
|
|
||||||
|
|
||||||
(define %current-system
|
(define %current-system
|
||||||
;; The system that is current (a symlink.) This is not necessarily the same
|
;; The system that is current (a symlink.) This is not necessarily the same
|
||||||
;; as the system we booted (aka. /run/booted-system) because we can re-build
|
;; as the system we booted (aka. /run/booted-system) because we can re-build
|
||||||
|
|
|
@ -39,6 +39,7 @@ (define-module (gnu system)
|
||||||
#:use-module (gnu packages lsof)
|
#:use-module (gnu packages lsof)
|
||||||
#:use-module (gnu packages gawk)
|
#:use-module (gnu packages gawk)
|
||||||
#:use-module (gnu packages compression)
|
#:use-module (gnu packages compression)
|
||||||
|
#:use-module (gnu packages firmware)
|
||||||
#:autoload (gnu packages cryptsetup) (cryptsetup)
|
#:autoload (gnu packages cryptsetup) (cryptsetup)
|
||||||
#:use-module (gnu services)
|
#:use-module (gnu services)
|
||||||
#:use-module (gnu services dmd)
|
#:use-module (gnu services dmd)
|
||||||
|
@ -79,6 +80,7 @@ (define-module (gnu system)
|
||||||
local-host-aliases
|
local-host-aliases
|
||||||
%setuid-programs
|
%setuid-programs
|
||||||
%base-packages
|
%base-packages
|
||||||
|
%base-firmware
|
||||||
|
|
||||||
luks-device-mapping))
|
luks-device-mapping))
|
||||||
|
|
||||||
|
@ -99,6 +101,8 @@ (define-record-type* <operating-system> operating-system
|
||||||
|
|
||||||
(initrd operating-system-initrd ; (list fs) -> M derivation
|
(initrd operating-system-initrd ; (list fs) -> M derivation
|
||||||
(default base-initrd))
|
(default base-initrd))
|
||||||
|
(firmware operating-system-firmware ; list of packages
|
||||||
|
(default %base-firmware))
|
||||||
|
|
||||||
(host-name operating-system-host-name) ; string
|
(host-name operating-system-host-name) ; string
|
||||||
(hosts-file operating-system-hosts-file ; M item | #f
|
(hosts-file operating-system-hosts-file ; M item | #f
|
||||||
|
@ -159,6 +163,20 @@ (define builder
|
||||||
|
|
||||||
(gexp->derivation name builder))
|
(gexp->derivation name builder))
|
||||||
|
|
||||||
|
(define (directory-union name things)
|
||||||
|
"Return a directory that is the union of THINGS."
|
||||||
|
(match things
|
||||||
|
((one)
|
||||||
|
;; Only one thing; return it.
|
||||||
|
(with-monad %store-monad (return one)))
|
||||||
|
(_
|
||||||
|
(gexp->derivation name
|
||||||
|
#~(begin
|
||||||
|
(use-modules (guix build union))
|
||||||
|
(union-build #$output '#$things))
|
||||||
|
#:modules '((guix build union))
|
||||||
|
#:local-build? #t))))
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; Services.
|
;;; Services.
|
||||||
|
@ -298,6 +316,10 @@ (define (operating-system-services os)
|
||||||
;;; /etc.
|
;;; /etc.
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
|
(define %base-firmware
|
||||||
|
;; Firmware usable by default.
|
||||||
|
(list ath9k-htc-firmware))
|
||||||
|
|
||||||
(define %base-packages
|
(define %base-packages
|
||||||
;; Default set of packages globally visible. It should include anything
|
;; Default set of packages globally visible. It should include anything
|
||||||
;; required for basic administrator tasks.
|
;; required for basic administrator tasks.
|
||||||
|
@ -518,6 +540,8 @@ (define (service-activations services)
|
||||||
(modules (imported-modules %modules))
|
(modules (imported-modules %modules))
|
||||||
(compiled (compiled-modules %modules))
|
(compiled (compiled-modules %modules))
|
||||||
(modprobe (modprobe-wrapper))
|
(modprobe (modprobe-wrapper))
|
||||||
|
(firmware (directory-union
|
||||||
|
"firmware" (operating-system-firmware os)))
|
||||||
(accounts (operating-system-accounts os)))
|
(accounts (operating-system-accounts os)))
|
||||||
(define setuid-progs
|
(define setuid-progs
|
||||||
(operating-system-setuid-programs os))
|
(operating-system-setuid-programs os))
|
||||||
|
@ -563,6 +587,10 @@ (define group-specs
|
||||||
;; Tell the kernel to use our 'modprobe' command.
|
;; Tell the kernel to use our 'modprobe' command.
|
||||||
(activate-modprobe #$modprobe)
|
(activate-modprobe #$modprobe)
|
||||||
|
|
||||||
|
;; Tell the kernel where firmware is.
|
||||||
|
(activate-firmware
|
||||||
|
(string-append #$firmware "/lib/firmware"))
|
||||||
|
|
||||||
;; Run the services' activation snippets.
|
;; Run the services' activation snippets.
|
||||||
;; TODO: Use 'load-compiled'.
|
;; TODO: Use 'load-compiled'.
|
||||||
(for-each primitive-load '#$actions)
|
(for-each primitive-load '#$actions)
|
||||||
|
|
Loading…
Reference in a new issue