aboutsummaryrefslogtreecommitdiff
path: root/gnu/build/activation.scm
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2022-12-15 16:28:14 +0100
committerMarius Bakke <marius@gnu.org>2022-12-17 17:08:50 +0100
commit4d94cdf69889043dd8d9b1305f5f3946ec0f8ff6 (patch)
treec6b4b9653a0344ffffb41d09e90ac88c1af865dd /gnu/build/activation.scm
parent88908c6edce845b8737a18dda415f162d699384a (diff)
downloadguix-4d94cdf69889043dd8d9b1305f5f3946ec0f8ff6.tar
guix-4d94cdf69889043dd8d9b1305f5f3946ec0f8ff6.tar.gz
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.
Diffstat (limited to 'gnu/build/activation.scm')
-rw-r--r--gnu/build/activation.scm11
1 files changed, 8 insertions, 3 deletions
diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm
index 10c9045740..eea2233563 100644
--- a/gnu/build/activation.scm
+++ b/gnu/build/activation.scm
@@ -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.