summaryrefslogtreecommitdiff
path: root/gnu/system.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-11-02 23:06:17 +0100
committerLudovic Courtès <ludo@gnu.org>2014-11-02 23:06:17 +0100
commitd460204f2efa8d6f169707d0245dff8735fc0eba (patch)
treeb3452eba4ce518b2492230d567dcfdb8e016af88 /gnu/system.scm
parentac67e205824cec15e24f1f4a6895fd5739afd9f6 (diff)
downloadpatches-d460204f2efa8d6f169707d0245dff8735fc0eba.tar
patches-d460204f2efa8d6f169707d0245dff8735fc0eba.tar.gz
system: Allow Linux-libre to find our 'modprobe' command.
Fixes <http://bugs.gnu.org/18525>. Reported by Mark H Weaver <mhw@netris.org>. * gnu/build/activation.scm (activate-modprobe): New procedure. * gnu/system.scm (modprobe-wrapper): New procedure. (operating-system-activation-script): Use both.
Diffstat (limited to 'gnu/system.scm')
-rw-r--r--gnu/system.scm18
1 files changed, 18 insertions, 0 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index 1d57e8c121..0443e5f756 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -477,6 +477,20 @@ alias ll='ls -l'
#$(user-account-password account)
#$(user-account-system? account)))
+(define (modprobe-wrapper)
+ "Return a wrapper for the 'modprobe' command that knows where modules live.
+
+This wrapper is typically invoked by the Linux kernel ('call_modprobe', in
+kernel/kmod.c), a situation where the 'LINUX_MODULE_DIRECTORY' environment
+variable is not set---hence the need for this wrapper."
+ (let ((modprobe "/run/current-system/profile/bin/modprobe"))
+ (gexp->script "modprobe"
+ #~(begin
+ (setenv "LINUX_MODULE_DIRECTORY"
+ "/run/booted-system/kernel/lib/modules")
+ (apply execl #$modprobe
+ (cons #$modprobe (cdr (command-line))))))))
+
(define (operating-system-activation-script os)
"Return the activation script for OS---i.e., the code that \"activates\" the
stateful part of OS, including user accounts and groups, special directories,
@@ -498,6 +512,7 @@ etc."
(etc (operating-system-etc-directory os))
(modules (imported-modules %modules))
(compiled (compiled-modules %modules))
+ (modprobe (modprobe-wrapper))
(accounts (operating-system-accounts os)))
(define setuid-progs
(operating-system-setuid-programs os))
@@ -540,6 +555,9 @@ etc."
;; Activate setuid programs.
(activate-setuid-programs (list #$@setuid-progs))
+ ;; Tell the kernel to use our 'modprobe' command.
+ (activate-modprobe #$modprobe)
+
;; Run the services' activation snippets.
;; TODO: Use 'load-compiled'.
(for-each primitive-load '#$actions)