activation: Firmware activation handles missing support in kernel.

* gnu/build/activation.scm (activate-firmware): Check if firmware loading is
enabled before attempting to use it.
This commit is contained in:
Marius Bakke 2022-12-15 16:28:14 +01:00
parent 88908c6edc
commit 4d94cdf698
No known key found for this signature in database
GPG Key ID: A2A06DF2A33A54FA

View File

@ -363,9 +363,14 @@ second element is the name it should appear at, such as:
"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))))
;; If the kernel was built without firmware loading support, this file
;; does not exist. Do nothing in that case.
(let ((firmware-path "/sys/module/firmware_class/parameters/path"))
(when (file-exists? firmware-path)
(call-with-output-file firmware-path
(lambda (port)
(display directory port))))))
(define (activate-ptrace-attach)
"Allow users to PTRACE_ATTACH their own processes.