From d460204f2efa8d6f169707d0245dff8735fc0eba Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 2 Nov 2014 23:06:17 +0100 Subject: system: Allow Linux-libre to find our 'modprobe' command. Fixes . Reported by Mark H Weaver . * gnu/build/activation.scm (activate-modprobe): New procedure. * gnu/system.scm (modprobe-wrapper): New procedure. (operating-system-activation-script): Use both. --- gnu/build/activation.scm | 7 +++++++ gnu/system.scm | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) (limited to 'gnu') diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm index f46ff62d13..142ed8f693 100644 --- a/gnu/build/activation.scm +++ b/gnu/build/activation.scm @@ -27,6 +27,7 @@ (define-module (gnu build activation) activate-etc activate-setuid-programs activate-/bin/sh + activate-modprobe activate-current-system)) ;;; Commentary: @@ -252,6 +253,12 @@ (define (activate-/bin/sh shell) (symlink shell "/bin/sh.new") (rename-file "/bin/sh.new" "/bin/sh")) +(define (activate-modprobe modprobe) + "Tell the kernel to use MODPROBE to load modules." + (call-with-output-file "/proc/sys/kernel/modprobe" + (lambda (port) + (display modprobe port)))) + (define %current-system ;; 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 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 @@ (define (user-account->gexp account) #$(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 @@ (define (service-activations services) (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 @@ (define group-specs ;; 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) -- cgit v1.2.3