[WIP 0/6] Add kernel-module-configuration service

OpenSubmitted by Brice Waegeneire.
Details
4 participants
  • Brice Waegeneire
  • Danny Milosavljevic
  • pelzflorian (Florian Pelz)
  • raid5atemyhomework
Owner
unassigned
Severity
normal
B
B
Brice Waegeneire wrote on 4 Jul 2020 20:52
(address . guix-patches@gnu.org)(address . guix-devel@gnu.org)
20200704185234.12571-1-brice@waegenei.re
Hello Guix,
Here is a work-in-progress to create a service centralizing the configurationfor built-in and loadable kernel modules. The kernel module configurationservice has been implemented by making some fields from 'operating-system'custom from the 'services' field.
Here are are some example of how to use it.
Toggle snippet (18 lines);; Loadable kernel module(simple-service 'ddcci-module kernel-module-configuration-service-type (list (kernel-module (name "ddcci") (package ddcci-driver-linux) (load? #t) (options '("dyndbg" "delay=600"))) (kernel-module (name "ddcci-backlight") (blacklist? #t))));; Built-in kernel module(simple-service 'intel-module kernel-module-configuration-service-type (list (kernel-module (name "i915") (options '("fastboot=1")))))
This WIP version is mainly missing the ability to configure built-in modulestrough the kernel arguments. It's the continuation of the work onkernel-module-loader-service[1] and is needed to help fixing #41082[2].
I will try to go back to it after the GSOC network boot project.
[1]: https://issues.guix.info/40274[2]: https://issues.guix.info/41082
- Brice
Brice Waegeneire (6): services: simulated-wifi: Use 'kernel-module-loader'. services: Add 'kernel-profile-service-type'. services: Add 'modprobe-service-type'. services: kernel-module-loader: Return a single 'shepherd-service'. WIP services: Add kernel-arguments-service-type. WIP services: Add kernel-module-configuration service.
gnu/services.scm | 102 +++++++++--- gnu/services/linux.scm | 276 +++++++++++++++++++++++++++++---- gnu/services/networking.scm | 25 +-- gnu/system.scm | 55 +++++-- gnu/system/linux-container.scm | 2 + gnu/tests/linux-modules.scm | 65 +++++--- 6 files changed, 420 insertions(+), 105 deletions(-)
-- 2.26.2
B
B
Brice Waegeneire wrote on 4 Jul 2020 20:54
[WIP 1/6] services: simulated-wifi: Use 'kernel-module-loader'.
(address . guix-patches@gnu.org)
20200704185431.13739-1-brice@waegenei.re
* gnu/services/networking.scm (simulated-wifi-shepherd-services):Change 'mac-simulation-module' service to use 'kernel-module-loader'.--- gnu/services/networking.scm | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-)
Toggle diff (68 lines)diff --git a/gnu/services/networking.scm b/gnu/services/networking.scmindex 348dc369d8..353fdce2bb 100644--- a/gnu/services/networking.scm+++ b/gnu/services/networking.scm@@ -13,6 +13,7 @@ ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; Copyright © 2019 Sou Bunnbu <iyzsong@member.fsf.org> ;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>+;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re> ;;; ;;; This file is part of GNU Guix. ;;;@@ -33,6 +34,7 @@ #:use-module (gnu services) #:use-module (gnu services base) #:use-module (gnu services configuration)+ #:use-module (gnu services linux) #:use-module (gnu services shepherd) #:use-module (gnu services dbus) #:use-module (gnu system shadow)@@ -1442,10 +1444,10 @@ simulation." (append (hostapd-shepherd-services config #:requirement '(unblocked-wifi- mac-simulation-module))+ kernel-module-loader)) (list (shepherd-service (provision '(unblocked-wifi))- (requirement '(file-systems mac-simulation-module))+ (requirement '(file-systems kernel-module-loader)) (documentation "Unblock WiFi devices for use by mac80211_hwsim.") (start #~(lambda _@@ -1453,21 +1455,6 @@ simulation." "unblock" "0") (invoke #$(file-append util-linux "/sbin/rfkill") "unblock" "1")))- (one-shot? #t))- (shepherd-service- (provision '(mac-simulation-module))- (requirement '(file-systems))- (modules '((guix build utils)))- (documentation- "Load the mac80211_hwsim Linux kernel module.")- (start (with-imported-modules '((guix build utils))- #~(lambda _- ;; XXX: We can't use 'load-linux-module*' here because it- ;; expects a flat module directory.- (setenv "LINUX_MODULE_DIRECTORY"- "/run/booted-system/kernel/lib/modules")- (invoke #$(file-append kmod "/bin/modprobe")- "mac80211_hwsim")))) (one-shot? #t))))) (define simulated-wifi-service-type@@ -1475,7 +1462,9 @@ simulation." (name 'simulated-wifi) (extensions (list (service-extension shepherd-root-service-type- simulated-wifi-shepherd-services)))+ simulated-wifi-shepherd-services)+ (service-extension kernel-module-loader-service-type+ (const '("mac80211_hwsim"))))) (default-value (hostapd-configuration (interface "wlan1") (ssid "Test Network")))-- 2.26.2
B
B
Brice Waegeneire wrote on 4 Jul 2020 20:54
[WIP 3/6] services: Add 'modprobe-service-type'.
(address . guix-patches@gnu.org)
20200704185431.13739-4-brice@waegenei.re
* gnu/services.scm (%linux-kernel-activation): Remove'activate-modprobe' from it.(%modprobe-wrapper): Move it…* gnu/services/linux.scm (%modprobe-wrapper): …here and make it aprocedure taking one argument specifying the configuration directory.(modprobe-service-type, modprobe-environment,modprobe->activation-gexp): New variables.* gnu/system.scm (operating-system-default-essential-services): Add'modprobe-service-type'.* gnu/system/linux-container.scm (container-essential-services): Add'modprobe-service-type' to the list of services to be removed.--- gnu/services.scm | 22 +------------- gnu/services/linux.scm | 53 +++++++++++++++++++++++++++++++++- gnu/system.scm | 2 ++ gnu/system/linux-container.scm | 2 ++ 4 files changed, 57 insertions(+), 22 deletions(-)
Toggle diff (154 lines)diff --git a/gnu/services.scm b/gnu/services.scmindex b5ec222207..7df9bf9d46 100644--- a/gnu/services.scm+++ b/gnu/services.scm@@ -654,31 +654,11 @@ ACTIVATION-SCRIPT-TYPE." ;; receives. (service activation-service-type #t)) -(define %modprobe-wrapper- ;; 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"))- (program-file "modprobe"- #~(begin- (setenv "LINUX_MODULE_DIRECTORY"- "/run/booted-system/kernel/lib/modules")- ;; FIXME: Remove this crutch when the patch #40422,- ;; updating to kmod 27 is merged.- (setenv "MODPROBE_OPTIONS"- "-C /etc/modprobe.d")- (apply execl #$modprobe- (cons #$modprobe (cdr (command-line))))))))-+;; TODO Maybe rename it (define %linux-kernel-activation ;; Activation of the Linux kernel running on the bare metal (as opposed to ;; running in a container.) #~(begin- ;; Tell the kernel to use our 'modprobe' command.- (activate-modprobe #$%modprobe-wrapper)- ;; Let users debug their own processes! (activate-ptrace-attach))) diff --git a/gnu/services/linux.scm b/gnu/services/linux.scmindex 12934c2084..c608cc4d8d 100644--- a/gnu/services/linux.scm+++ b/gnu/services/linux.scm@@ -23,6 +23,7 @@ #:use-module (guix modules) #:use-module (gnu services) #:use-module (gnu services shepherd)+ #:use-module (gnu system pam) #:use-module (gnu packages linux) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26)@@ -42,7 +43,9 @@ earlyoom-configuration-send-notification-command earlyoom-service-type - kernel-module-loader-service-type))+ kernel-module-loader-service-type++ modprobe-service-type)) ;;;@@ -177,3 +180,51 @@ representation." (compose concatenate) (extend append) (default-value '())))++ +;;;+;;; Modprobe service.+;;;++(define (%modprobe-wrapper directory)+ "Return a wrapper for modprobe loading configuration files from CONFIG."+ ;; 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"))+ (program-file "modprobe"+ #~(begin+ (setenv "LINUX_MODULE_DIRECTORY"+ "/run/booted-system/kernel/lib/modules")+ (setenv "MODPROBE_OPTIONS"+ (string-append "--config=" #$directory))+ (apply execl #$modprobe+ (cons #$modprobe (cdr (command-line))))))))++(define (modprobe->activation-gexp configs)+ "Return a gexp to tell the kernel to use modprobe configured with CONFIGS+files."+ (let ((directory (file-union "modprobe.d" configs)))+ #~(activate-modprobe #$(%modprobe-wrapper directory))))++(define (modprobe-environment configs)+ (let ((options #~(string-append+ "--config="+ #$(file-union "modprobe.d"+ configs))))+ `(("MODPROBE_OPTIONS" . ,options))))++(define modprobe-service-type+ (service-type+ (name 'modropbe)+ (description "Tell the kernel to use Guix's 'modprobe'.")+ (default-value '()) ; list of <file-like>+ (extensions+ (list (service-extension activation-service-type+ modprobe->activation-gexp)+ (service-extension session-environment-service-type+ modprobe-environment)))+ (compose concatenate)+ (extend append)))diff --git a/gnu/system.scm b/gnu/system.scmindex ff374dddda..ba9eeb66b8 100644--- a/gnu/system.scm+++ b/gnu/system.scm@@ -58,6 +58,7 @@ #:use-module (gnu services) #:use-module (gnu services shepherd) #:use-module (gnu services base)+ #:use-module (gnu services linux) #:use-module (gnu bootloader) #:use-module (gnu system shadow) #:use-module (gnu system nss)@@ -594,6 +595,7 @@ bookkeeping." (service profile-service-type (operating-system-packages os)) other-fs+ (service modprobe-service-type) (append mappings swaps ;; Add the firmware service.diff --git a/gnu/system/linux-container.scm b/gnu/system/linux-container.scmindex c5e2e4bf9c..b8bf88e495 100644--- a/gnu/system/linux-container.scm+++ b/gnu/system/linux-container.scm@@ -31,6 +31,7 @@ #:use-module (gnu build linux-container) #:use-module (gnu services) #:use-module (gnu services base)+ #:use-module (gnu services linux) #:use-module (gnu services networking) #:use-module (gnu services shepherd) #:use-module (gnu system)@@ -48,6 +49,7 @@ from OS that are needed on the bare metal and not in a container." (remove (lambda (service) (memq (service-kind service) (list (service-kind %linux-bare-metal-service)+ modprobe-service-type firmware-service-type system-service-type))) (operating-system-default-essential-services os)))-- 2.26.2
B
B
Brice Waegeneire wrote on 4 Jul 2020 20:54
[WIP 5/6] WIP services: Add kernel-arguments-service-type.
(address . guix-patches@gnu.org)
20200704185431.13739-6-brice@waegenei.re
--- gnu/services.scm | 14 ++++++++++++++ gnu/system.scm | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 51 insertions(+), 2 deletions(-)
Toggle diff (109 lines)diff --git a/gnu/services.scm b/gnu/services.scmindex 7df9bf9d46..7cf71ae97a 100644--- a/gnu/services.scm+++ b/gnu/services.scm@@ -538,6 +538,20 @@ possible (that is if there's a LINUX keyword argument in the build system)." (kernel kernel) ;the kernel package to use (packages (append packages additional-packages)))))))) + +;;;+;;; Kernel arguments.+;;;++;; (define kernel-arguments-service-type+;; (service-type (name 'kernel-arguments)+;; (description "Set the kernel arguments.")+;; (extensions+;; (list (service-extension system-service-type+;; kernel-arguments->profile-entry)))+;; (compose concatenate)+;; (extend append)))+ ;;; ;;; Cleanup.diff --git a/gnu/system.scm b/gnu/system.scmindex ba9eeb66b8..805aa2ab01 100644--- a/gnu/system.scm+++ b/gnu/system.scm@@ -56,6 +56,7 @@ #:use-module (gnu packages compression) #:use-module (gnu packages firmware) #:use-module (gnu services)+ #:use-module (gnu services linux) #:use-module (gnu services shepherd) #:use-module (gnu services base) #:use-module (gnu services linux)@@ -258,11 +259,37 @@ (sudoers-file operating-system-sudoers-file ; file-like (default %sudoers-specification))) +(define (operating-system-modules-kernel-arguments os)+ "Return the kernel arguments for builtin modules specified in+<kernel-module-configuration-service-type> from OS."+ (let* ((kernel-module-configuration-service+ (find (lambda (service)+ (eq? (service-kind service)+ kernel-module-configuration-service-type))+ (operating-system-user-services os)))+ (modules (if kernel-module-configuration-service+ (service-value kernel-module-configuration-service)+ '())))+ (display kernel-module-configuration-service)+ (display (concatenate+ (filter-map (lambda (module)+ (if (kernel-module-is-builtin? module)+ (kernel-module->kernel-arguments module)+ #f))+ modules)))+ (concatenate+ (filter-map (lambda (module)+ (if (kernel-module-is-builtin? module)+ (kernel-module->kernel-arguments module)+ #f))+ modules))))+ (define (operating-system-kernel-arguments os root-device) "Return all the kernel arguments, including the ones not specified directly by the user." (append (bootable-kernel-arguments os root-device)- (operating-system-user-kernel-arguments os)))+ (operating-system-user-kernel-arguments os)+ (operating-system-modules-kernel-arguments os))) ;;;@@ -512,6 +539,7 @@ OS." (file-append (operating-system-kernel os) "/" (system-linux-image-file-name)))) +;; TODO Migrate to KMCS (define %default-modprobe-blacklist ;; List of kernel modules to blacklist by default. '("usbmouse" ;races with bcm5974, see <https://bugs.gnu.org/35574>@@ -569,6 +597,11 @@ bookkeeping." (kernel-profile-configuration (kernel (operating-system-kernel os)) (packages (operating-system-kernel-loadable-modules os))))+ ;; (service kernel-arguments-service-type+ ;; (kernel-arguments-configuration+ ;; (root (operating-system-root-file-system os))+ ;; (bootloader (operating-system-bootloader os))+ ;; (parameters "TODO"))) %boot-service ;; %SHEPHERD-ROOT-SERVICE must come last so that the gexp that@@ -1232,7 +1265,9 @@ such as '--root' and '--load' to <boot-parameters>." (kernel-arguments (if system-kernel-arguments? (operating-system-kernel-arguments os root-device)- (operating-system-user-kernel-arguments os)))+ (append+ (operating-system-user-kernel-arguments os)+ (operating-system-modules-kernel-arguments os)))) (initrd initrd) (multiboot-modules multiboot-modules) (bootloader-name bootloader-name)-- 2.26.2
B
B
Brice Waegeneire wrote on 4 Jul 2020 20:54
[WIP 2/6] services: Add 'kernel-profile-service-type'.
(address . guix-patches@gnu.org)
20200704185431.13739-3-brice@waegenei.re
* gnu/system.scm (operating-system-default-essential-services): Use'kernel-profile-service-type'.(operating-system-default-essential-services): Remove kernel profile.(package-for-kernel): Move it to …* gnu/services.scm (package-for-kernel): … here.(kernel-profile-configuration,kernel-profile-configuration->profile-entry,kernel-profile-service-type): New variables.* gnu/tests/linux-modules.scm (run-loadable-kernel-modules-test): Test'kernel-profile-service-type'.--- gnu/services.scm | 66 ++++++++++++++++++++++++++++++++++++- gnu/system.scm | 14 +++----- gnu/tests/linux-modules.scm | 10 +++--- 3 files changed, 75 insertions(+), 15 deletions(-)
Toggle diff (155 lines)diff --git a/gnu/services.scm b/gnu/services.scmindex f6dc56d940..b5ec222207 100644--- a/gnu/services.scm+++ b/gnu/services.scm@@ -2,6 +2,7 @@ ;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com> ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>+;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re> ;;; ;;; This file is part of GNU Guix. ;;;@@ -30,9 +31,11 @@ #:use-module (guix describe) #:use-module (guix sets) #:use-module (guix ui)- #:use-module ((guix utils) #:select (source-properties->location))+ #:use-module ((guix utils) #:select (source-properties->location+ substitute-keyword-arguments)) #:autoload (guix openpgp) (openpgp-format-fingerprint) #:use-module (guix modules)+ #:use-module (guix packages) #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages hurd)@@ -105,6 +108,12 @@ firmware-service-type gc-root-service-type + kernel-profile-configuration+ kernel-profile-configuration?+ kernel-profile-configuration-kernel+ kernel-profile-configuration-packages+ kernel-profile-service-type+ %boot-service %activation-service etc-service))@@ -474,6 +483,61 @@ channels in use and CONFIG-FILE, if it is true." itself: the channels used when building the system, and its configuration file, when available."))) + +;;;+;;; Kernel profile.+;;;++(define-record-type* <kernel-profile-configuration>+ kernel-profile-configuration make-kernel-profile-configuration+ kernel-profile-configuration?+ (kernel kernel-profile-configuration-kernel) ; <package>+ (packages kernel-profile-configuration-packages ; list of <package>+ (default '())))++(define (package-for-kernel target-kernel module-package)+ "Return a package like MODULE-PACKAGE, adapted for TARGET-KERNEL, if+possible (that is if there's a LINUX keyword argument in the build system)."+ (package+ (inherit module-package)+ (arguments+ (substitute-keyword-arguments (package-arguments module-package)+ ((#:linux kernel #f)+ target-kernel)))))++(define (kernel-profile-configuration->profile-entry config)+ "Return a system entry for the kernel profile CONFIG."+ (let* ((kernel (kernel-profile-configuration-kernel config))+ (packages (map (lambda (package)+ (if (package? package)+ (package-for-kernel kernel+ package)+ package))+ (kernel-profile-configuration-packages config))))+ (with-monad %store-monad+ (return `(("kernel"+ ,(profile+ (content (packages->manifest+ (cons kernel+ (delete-duplicates packages eq?))))+ (hooks (list linux-module-database)))))))))++(define kernel-profile-service-type+ (service-type (name 'kernel-profile)+ (description "This is the @dfn{kernel profile}, available as+@file{/run/current-system/kernel}.")+ (extensions+ (list (service-extension+ system-service-type+ kernel-profile-configuration->profile-entry)))+ (compose concatenate)+ (extend (lambda (config additional-packages)+ (match-record config <kernel-profile-configuration>+ (kernel packages)+ (kernel-profile-configuration+ (kernel kernel) ;the kernel package to use+ (packages (append packages additional-packages))))))))+ ;;; ;;; Cleanup.diff --git a/gnu/system.scm b/gnu/system.scmindex bfbcb6fbdd..ff374dddda 100644--- a/gnu/system.scm+++ b/gnu/system.scm@@ -511,16 +511,6 @@ OS." (file-append (operating-system-kernel os) "/" (system-linux-image-file-name)))) -(define (package-for-kernel target-kernel module-package)- "Return a package like MODULE-PACKAGE, adapted for TARGET-KERNEL, if-possible (that is if there's a LINUX keyword argument in the build system)."- (package- (inherit module-package)- (arguments- (substitute-keyword-arguments (package-arguments module-package)- ((#:linux kernel #f)- target-kernel)))))- (define %default-modprobe-blacklist ;; List of kernel modules to blacklist by default. '("usbmouse" ;races with bcm5974, see <https://bugs.gnu.org/35574>@@ -574,6 +564,10 @@ bookkeeping." (host-name (host-name-service (operating-system-host-name os))) (entries (operating-system-directory-base-entries os))) (cons* (service system-service-type entries)+ (service kernel-profile-service-type+ (kernel-profile-configuration+ (kernel (operating-system-kernel os))+ (packages (operating-system-kernel-loadable-modules os)))) %boot-service ;; %SHEPHERD-ROOT-SERVICE must come last so that the gexp thatdiff --git a/gnu/tests/linux-modules.scm b/gnu/tests/linux-modules.scmindex 953b132ef7..22e9a0c65c 100644--- a/gnu/tests/linux-modules.scm+++ b/gnu/tests/linux-modules.scm@@ -73,10 +73,12 @@ are loaded in memory." (marionette-operating-system (operating-system (inherit (simple-operating-system))- (services (cons (service kernel-module-loader-service-type module-names)- (operating-system-user-services- (simple-operating-system))))- (kernel-loadable-modules module-packages))+ (services (cons* (service kernel-module-loader-service-type module-names)+ (simple-service 'kernel-module-packages+ kernel-profile-service-type+ module-packages)+ (operating-system-user-services+ (simple-operating-system))))) #:imported-modules '((guix combinators)))) (define vm (virtual-machine os)) (define (test script)-- 2.26.2
B
B
Brice Waegeneire wrote on 4 Jul 2020 20:54
[WIP 1/6] services: simulated-wifi: Use 'kernel-module-loader'.
(address . guix-patches@gnu.org)
20200704185431.13739-2-brice@waegenei.re
* gnu/services/networking.scm (simulated-wifi-shepherd-services):Change 'mac-simulation-module' service to use 'kernel-module-loader'.--- gnu/services/networking.scm | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-)
Toggle diff (68 lines)diff --git a/gnu/services/networking.scm b/gnu/services/networking.scmindex 348dc369d8..353fdce2bb 100644--- a/gnu/services/networking.scm+++ b/gnu/services/networking.scm@@ -13,6 +13,7 @@ ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; Copyright © 2019 Sou Bunnbu <iyzsong@member.fsf.org> ;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>+;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re> ;;; ;;; This file is part of GNU Guix. ;;;@@ -33,6 +34,7 @@ #:use-module (gnu services) #:use-module (gnu services base) #:use-module (gnu services configuration)+ #:use-module (gnu services linux) #:use-module (gnu services shepherd) #:use-module (gnu services dbus) #:use-module (gnu system shadow)@@ -1442,10 +1444,10 @@ simulation." (append (hostapd-shepherd-services config #:requirement '(unblocked-wifi- mac-simulation-module))+ kernel-module-loader)) (list (shepherd-service (provision '(unblocked-wifi))- (requirement '(file-systems mac-simulation-module))+ (requirement '(file-systems kernel-module-loader)) (documentation "Unblock WiFi devices for use by mac80211_hwsim.") (start #~(lambda _@@ -1453,21 +1455,6 @@ simulation." "unblock" "0") (invoke #$(file-append util-linux "/sbin/rfkill") "unblock" "1")))- (one-shot? #t))- (shepherd-service- (provision '(mac-simulation-module))- (requirement '(file-systems))- (modules '((guix build utils)))- (documentation- "Load the mac80211_hwsim Linux kernel module.")- (start (with-imported-modules '((guix build utils))- #~(lambda _- ;; XXX: We can't use 'load-linux-module*' here because it- ;; expects a flat module directory.- (setenv "LINUX_MODULE_DIRECTORY"- "/run/booted-system/kernel/lib/modules")- (invoke #$(file-append kmod "/bin/modprobe")- "mac80211_hwsim")))) (one-shot? #t))))) (define simulated-wifi-service-type@@ -1475,7 +1462,9 @@ simulation." (name 'simulated-wifi) (extensions (list (service-extension shepherd-root-service-type- simulated-wifi-shepherd-services)))+ simulated-wifi-shepherd-services)+ (service-extension kernel-module-loader-service-type+ (const '("mac80211_hwsim"))))) (default-value (hostapd-configuration (interface "wlan1") (ssid "Test Network")))-- 2.26.2
B
B
Brice Waegeneire wrote on 4 Jul 2020 20:54
[WIP 4/6] services: kernel-module-loader: Return a single 'shepherd-service'.
(address . guix-patches@gnu.org)
20200704185431.13739-5-brice@waegenei.re
* gnu/services/linux.scm (kernel-module-loader-shepherd-service): Returna 'shepherd-service' instead of a list of it.(kernel-module-loader-service-type): Adjust it.--- gnu/services/linux.scm | 59 +++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 30 deletions(-)
Toggle diff (79 lines)diff --git a/gnu/services/linux.scm b/gnu/services/linux.scmindex c608cc4d8d..7ea30a1270 100644--- a/gnu/services/linux.scm+++ b/gnu/services/linux.scm@@ -140,35 +140,34 @@ representation." (define kernel-module-loader-shepherd-service (match-lambda ((and (? list? kernel-modules) ((? string?) ...))- (list- (shepherd-service- (documentation "Load kernel modules.")- (provision '(kernel-module-loader))- (requirement '(file-systems))- (one-shot? #t)- (modules `((srfi srfi-1)- (srfi srfi-34)- (srfi srfi-35)- (rnrs io ports)- ,@%default-modules))- (start- #~(lambda _- (cond- ((null? '#$kernel-modules) #t)- ((file-exists? "/proc/sys/kernel/modprobe")- (let ((modprobe (call-with-input-file- "/proc/sys/kernel/modprobe" get-line)))- (guard (c ((message-condition? c)- (format (current-error-port) "~a~%"- (condition-message c))- #f))- (every (lambda (module)- (invoke/quiet modprobe "--" module))- '#$kernel-modules))))- (else- (format (current-error-port) "error: ~a~%"- "Kernel is missing loadable module support.")- #f)))))))))+ (shepherd-service+ (documentation "Load kernel modules.")+ (provision '(kernel-module-loader))+ (requirement '(file-systems))+ (one-shot? #t)+ (modules `((srfi srfi-1)+ (srfi srfi-34)+ (srfi srfi-35)+ (rnrs io ports)+ ,@%default-modules))+ (start+ #~(lambda _+ (cond+ ((null? '#$kernel-modules) #t)+ ((file-exists? "/proc/sys/kernel/modprobe")+ (let ((modprobe (call-with-input-file+ "/proc/sys/kernel/modprobe" get-line)))+ (guard (c ((message-condition? c)+ (format (current-error-port) "~a~%"+ (condition-message c))+ #f))+ (every (lambda (module)+ (invoke/quiet modprobe "--" module))+ '#$kernel-modules))))+ (else+ (format (current-error-port) "error: ~a~%"+ "Kernel is missing loadable module support.")+ #f)))))))) (define kernel-module-loader-service-type (service-type@@ -176,7 +175,7 @@ representation." (description "Load kernel modules.") (extensions (list (service-extension shepherd-root-service-type- kernel-module-loader-shepherd-service)))+ (compose list kernel-module-loader-shepherd-service)))) (compose concatenate) (extend append) (default-value '())))-- 2.26.2
B
B
Brice Waegeneire wrote on 4 Jul 2020 20:54
[WIP 6/6] WIP services: Add kernel-module-configuration service.
(address . guix-patches@gnu.org)
20200704185431.13739-7-brice@waegenei.re
--- gnu/services/linux.scm | 166 +++++++++++++++++++++++++++++++++++- gnu/tests/linux-modules.scm | 67 +++++++++------ 2 files changed, 208 insertions(+), 25 deletions(-)
Toggle diff (302 lines)diff --git a/gnu/services/linux.scm b/gnu/services/linux.scmindex 7ea30a1270..9773dd5072 100644--- a/gnu/services/linux.scm+++ b/gnu/services/linux.scm@@ -45,7 +45,22 @@ kernel-module-loader-service-type - modprobe-service-type))+ modprobe-service-type++ kernel-module+ kernel-module?+ kernel-module-name+ kernel-module-package+ kernel-module-aliases+ kernel-module-install+ kernel-module-remove+ kernel-module-pre-dependencies+ kernel-module-post-dependencies+ kernel-module-blacklist?+ kernel-module-load?+ kernel-module-is-builtin?+ kernel-module->kernel-arguments+ kernel-module-configuration-service-type)) ;;;@@ -151,6 +166,9 @@ representation." (rnrs io ports) ,@%default-modules)) (start+ ;; TODO Verify that we are loading a loadable kernel and not a builtin+ ;; one looking in+ ;; /run/booted-system/kernel/lib/modules/5.4.39/modules.builtin #~(lambda _ (cond ((null? '#$kernel-modules) #t)@@ -227,3 +245,149 @@ files." modprobe-environment))) (compose concatenate) (extend append)))++ +;;;+;;; Kernel module configuration.+;;;++;; NOTE Maybe have sperate records betwwen <kernel-builtin-module> and+;; <kernel-lodable-module>+(define-record-type* <kernel-module>+ kernel-module make-kernel-module+ kernel-module?+ (name kernel-module-name) ; string+ ;; For out-of-tree modules+ (package kernel-module-package+ (default #f)) ; #f | <package>+ ;; NOTE Maybe use an alist instead+ (options kernel-module-options+ (default '())) ; list of strings+ (aliases kernel-module-aliases+ (default '())) ; list of strings+ (install kernel-module-install+ (default #f)) ; #f | string+ (remove kernel-module-remove+ (default #f)) ; #f | string+ (pre-dependencies kernel-module-pre-dependencies+ (default '())) ; list of strings+ (post-dependencies kernel-module-post-dependencies+ (default '())) ; list of strings+ (blacklist? kernel-module-blacklist?+ (default #f)) ; boolean+ ;; NOTE Only possible if it's not built-in+ ;; TODO maybe trow an error when it's set to true on a built-in module+ (load? kernel-module-load?+ (default #f))) ; boolean++;; FIXME use 'modules.builtin' instead+(define (kernel-module-is-builtin? module)+ (if (kernel-module-package module) #f+ #t))++(define (kernel-module->kernel-arguments module)+ "Return a list of kernel arguments for MODULE."+ (match-record module <kernel-module>+ (name options blacklist?)+ (filter (lambda (s) (not (string-null? s)))+ (list (if blacklist? (string-append name ".blacklist=yes") "")+ (if (null? options) ""+ (map (lambda (option)+ (string-append name "." option))+ options))))))++(define (kernel-module->config module)+ "Return a config string for MODULE."+ (match-record module <kernel-module>+ (name options aliases install remove pre-dependencies+ post-dependencies blacklist?)+ (string-concatenate+ (list (if (null? options) ""+ (format #f "options ~a~{ ~a~}\n" name options))+ (if blacklist? (format #f "blacklist ~a\n" name)+ "")+ (if (null? aliases) ""+ (map (lambda (alias)+ (format #f "alias ~a ~a\n" alias name))+ aliases))+ (if install (format #f "install ~a ~a\n" name install)+ "")+ (if remove (format #f "remove ~a ~a\n" name remove)+ "")+ (if (null? pre-dependencies) ""+ (map (lambda (dependency)+ (format #f "softdep ~a :pre ~a\n"+ name dependency))+ pre-dependencies))+ (if (null? post-dependencies) ""+ (map (lambda (dependency)+ (format #f "softdep ~a :post ~a\n"+ name dependency))+ post-dependencies))))))++(define (string-underscorize s)+ "Replace '-' characters by '_' in string S."+ (string-map (lambda (c) (if (char=? c #\-) #\_ c)) s))++(define (kernel-modules->config-files modules)+ "Return a list of pairs of file name and gexp, to be used by 'file-union',+from MODULES."+ (define (kernel-module->filename-gexp module)+ (let ((config (kernel-module->config module))+ (name (kernel-module-name module)))+ (if (string-null? config) #f+ (list (string-append name ".conf")+ (plain-file (string-append name ".conf") config)))))+ (filter-map+ (lambda (module)+ (let ((module (kernel-module+ (inherit module)+ ;; XXX The kernel replace '-' by '_' in module name, we do+ ;; the same to make name collision visible, that would+ ;; otherwise be hidden.+ (name (string-underscorize (kernel-module-name module))))))+ (if (kernel-module-is-builtin? module) #f+ (kernel-module->filename-gexp module))))+ modules))++(define (kernel-modules->packages modules)+ "Return a list of packages from MODULES."+ (filter-map (lambda (module)+ (kernel-module-package module))+ modules))++(define (kernel-modules-to-load modules)+ "Return a list of loadable module names, from MODULES, to be loaded."+ (filter-map (lambda (module)+ (if (and (not (kernel-module-is-builtin? module))+ (kernel-module-load? module))+ (kernel-module-name module)+ #f))+ modules))++(define kernel-module-configuration-service-type+ (service-type+ (name 'kernel-module-configuration)+ (description+ "Configure kernel modules, in similar manner as @file{modprobe.d}.")+ (default-value '())+ (extensions+ (list (service-extension modprobe-service-type+ kernel-modules->config-files)+ (service-extension kernel-profile-service-type+ kernel-modules->packages)+ (service-extension kernel-module-loader-service-type+ kernel-modules-to-load)))+ (compose concatenate)+ (extend append)))++;; TODO Make a naked modprobe call use MODPROBE_OPTIONS environment or+;; /proc/sys/kernel/modprobe++;; TODO write a helper to load a module from guile using modprobe command from+;; '/proc/sys/kernel/modprobe' or %modprobe-wrapper. See linux-module-builder+;; maybe.++;; NOTE Throw an error when kernel-module-name isn't unique? It may already+;; do it by itself already because 2 loadable module will try to create+;; separeta config file with the same name.diff --git a/gnu/tests/linux-modules.scm b/gnu/tests/linux-modules.scmindex 22e9a0c65c..296066e68f 100644--- a/gnu/tests/linux-modules.scm+++ b/gnu/tests/linux-modules.scm@@ -32,6 +32,7 @@ #:use-module (guix monads) #:use-module (guix store) #:use-module (guix utils)+ #:use-module (srfi srfi-1) #:export (%test-loadable-kernel-modules-0 %test-loadable-kernel-modules-1 %test-loadable-kernel-modules-2))@@ -66,19 +67,18 @@ that MODULES are actually loaded." (member module modules string=?)) '#$modules)))))) -(define* (run-loadable-kernel-modules-test module-packages module-names)- "Run a test of an OS having MODULE-PACKAGES, and verify that MODULE-NAMES-are loaded in memory."+(define* (run-loadable-kernel-modules-test modules)+ "Run a test of an OS having MODULES and verify that they are loaded in+memory." (define os (marionette-operating-system (operating-system- (inherit (simple-operating-system))- (services (cons* (service kernel-module-loader-service-type module-names)- (simple-service 'kernel-module-packages- kernel-profile-service-type- module-packages)- (operating-system-user-services- (simple-operating-system)))))+ (inherit (simple-operating-system))+ (services (cons* (service kernel-module-loader-service-type)+ (service kernel-module-configuration-service-type+ modules)+ (operating-system-user-services+ (simple-operating-system))))) #:imported-modules '((guix combinators)))) (define vm (virtual-machine os)) (define (test script)@@ -97,15 +97,20 @@ are loaded in memory." marionette)) (test-end) (exit (= (test-runner-fail-count (test-runner-current)) 0)))))- (gexp->derivation "loadable-kernel-modules"- (test (modules-loaded?-program os module-names))))+ (let ((modules (filter-map (lambda (module)+ (if (kernel-module-load? module)+ (kernel-module-name module)+ #f))+ modules)))+ (gexp->derivation "loadable-kernel-modules"+ (test (modules-loaded?-program os modules))))) (define %test-loadable-kernel-modules-0 (system-test (name "loadable-kernel-modules-0") (description "Tests loadable kernel modules facility of <operating-system> with no extra modules.")- (value (run-loadable-kernel-modules-test '() '()))))+ (value (run-loadable-kernel-modules-test '())))) (define %test-loadable-kernel-modules-1 (system-test@@ -113,8 +118,11 @@ with no extra modules.") (description "Tests loadable kernel modules facility of <operating-system> with one extra module.") (value (run-loadable-kernel-modules-test- (list ddcci-driver-linux)- '("ddcci")))))+ (list (kernel-module+ (name "ddcci")+ (package ddcci-driver-linux)+ (options '("delay=606"))+ (load? #t))))))) (define %test-loadable-kernel-modules-2 (system-test@@ -122,12 +130,23 @@ with one extra module.") (description "Tests loadable kernel modules facility of <operating-system> with two extra modules.") (value (run-loadable-kernel-modules-test- (list acpi-call-linux-module- (package- (inherit ddcci-driver-linux)- (arguments- `(#:linux #f- ,@(strip-keyword-arguments '(#:linux)- (package-arguments- ddcci-driver-linux))))))- '("acpi_call" "ddcci")))))+ (list (kernel-module+ (name "ddcci")+ ;; XXX Verify that kernel modules are built with the correct+ ;; kernel+ (package (package+ (inherit ddcci-driver-linux)+ (arguments+ `(#:linux #f+ ,@(strip-keyword-arguments '(#:linux)+ (package-arguments+ ddcci-driver-linux))))))+ (load? #t))+ (kernel-module+ (name "acpi_call")+ (package acpi-call-linux-module)+ (load? #t))+ ;; TODO Test that a module isn't loaded+ (kernel-module+ (name "radeon")+ (blacklist? #t)))))))-- 2.26.2
D
D
Danny Milosavljevic wrote on 6 Jul 2020 02:03
Re: [bug#42193] [WIP 4/6] services: kernel-module-loader: Return a single 'shepherd-service'.
(name . Brice Waegeneire)(address . brice@waegenei.re)(address . 42193@debbugs.gnu.org)
20200706020322.3577052e@scratchpost.org
I mean technically we could do that, but almost none of the other"-shepherd-service"s we have avoid returning a list. Why single this one out?
Could we change all of them to not return a list?
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl8CakoACgkQ5xo1VCwwuqW+jwgAl9Ixjug+FpXcSp3poPCwoN+i82RM/twCpXmuqPLyvfe+sfJ61DJQg5nl4gIFL5j2j17ZnTw/d1CGtwjEH9wXohgO1oOtJafD/0rSLUzXKNiOCRQz5bC5kfZUZe069EbPUNUA1P7DkPeOW3s6AQLspHP020ap1uR3krmDlHvLf8VrcbakTSfnefP0xkUAXWFCwWSLZZXEHhoMtBJhJcaSRrU/77m3lA7VzzYk6KkeeVr3QinJLNaN1PW0oLz/+jUyfgI36iQnXzs3tOB6blIQQXn9zE8wcE96y3DLFi1DGdejYpsKqFmSrXRZhTpfJLGFJrvR3YLNC0jH5iwTM+k6SA===Zltz-----END PGP SIGNATURE-----

B
B
Brice Waegeneire wrote on 6 Jul 2020 12:01
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 42193@debbugs.gnu.org)
fde539b184f76c2a8086f38fb77acb75@waegenei.re
Hello Danny,
On 2020-07-06 00:03, Danny Milosavljevic wrote:
Toggle quote (4 lines)> I mean technically we could do that, but almost none of the other> "-shepherd-service"s we have avoid returning a list. Why single this > one out?
Because I wrote that module, forgetting to add a plural to'kernel-module-loader-shepherd-service' and when reading the dnsmasq service codeI was made aware of it. It's either that patch or a stupid typo one to go from'kernel-module-loader-shepherd-service' to 'kernel-module-loader-shepherd-serviceS'.
There are currently 14 other services that are using that pattern.
Toggle quote (2 lines)> Could we change all of them to not return a list?
Maybe, but I don't see the point of doing so as I expect that if the procedure'sname is plural and return a list there is no need to change it.
- Brice
D
D
Danny Milosavljevic wrote on 6 Jul 2020 13:08
Re: [bug#42193] [WIP 1/6] services: simulated-wifi: Use 'kernel-module-loader'.
(name . Brice Waegeneire)(address . brice@waegenei.re)(address . 42193@debbugs.gnu.org)
20200706130835.1a69abf8@scratchpost.org
Hi Brice,
this one LGTM and can go to master right away.
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl8DBjQACgkQ5xo1VCwwuqXVpAf+K6waXxErEQ0Vss3IyrBFGIIZrmJJqBd0bDuAHq4V3wCoMp78WhmL1ACKtyUT8rdfGWvsSe8iLvUyiN9GGRPAJeBNRGx96ab5difuYc/Xr3v4PWgAhDTIAssVQyezXzQ7S0fGscKSJoDvVd9umaJRMP5aSqDwj6XEq7SgID4rqk4NbEsbJPrg4GltYO/cTK/2CIa/FvT+0136Lpk7spHQIvnYrAFgYQ8NAf4pzNytvsPd3fZu8UNdj4tivPUVwqMB8uee9piGeAeE7+XAfr5F6y+jzuZV168UTuGYf4V+LlyXYOQ0ihJMkYBIuRnL0+Uk8RkIVclCiVKvW7hBePuE3A===+O9/-----END PGP SIGNATURE-----

B
B
Brice Waegeneire wrote on 6 Jul 2020 14:31
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 42193@debbugs.gnu.org)
7b30af0c8e267a9c76fc7cbaf163836c@waegenei.re
On 2020-07-06 11:08, Danny Milosavljevic wrote:
Toggle quote (4 lines)> Hi Brice,> > this one LGTM and can go to master right away.
Pushed that commit as ef20acae83af8189df3225bdf59c5a0c1ae7da45 to master.
P
P
pelzflorian (Florian Pelz) wrote on 8 Jul 2020 13:29
Re: [bug#42193] [WIP 2/6] services: Add 'kernel-profile-service-type'.
(name . Brice Waegeneire)(address . brice@waegenei.re)(address . 42193@debbugs.gnu.org)
20200708112947.i4iaayf45y5jxoti@pelzflorian.localdomain
Thank you for your work!
After I apply this kernel profile patch, I get an error:
florian@florianmacbook ~/git/guix [env]$ ./pre-inst-env guix system disk-image --file-system-type=iso9660 gnu/system/install.scmsubstitute: Liste der Substitute von „https://ci.guix.gnu.org“ wird aktualisiert … 100.0%The following derivations will be built: /gnu/store/l51h17zylvjmapvcpdmmqmvrylv8b2cb-iso9660-image.drv /gnu/store/mhdkqnh4iri5rk1ayqd3xlw04q86zj29-grub.cfg.drv /gnu/store/xvgn60irpzzdwvk30lqpsj2hh81h8jyh-system.drv /gnu/store/6y2r0ab5jcflbajd6843v9g1j0v9xrzj-gc-roots.drv /gnu/store/156m13243bcn2429swq8brp2qmfifi3b-system.drvbuilding /gnu/store/156m13243bcn2429swq8brp2qmfifi3b-system.drv...|builder for `/gnu/store/156m13243bcn2429swq8brp2qmfifi3b-system.drv' failed with exit code 1build of /gnu/store/156m13243bcn2429swq8brp2qmfifi3b-system.drv failedView build log at '/var/log/guix/drvs/15/6m13243bcn2429swq8brp2qmfifi3b-system.drv.bz2'.cannot build derivation `/gnu/store/6y2r0ab5jcflbajd6843v9g1j0v9xrzj-gc-roots.drv': 1 dependencies couldn't be builtcannot build derivation `/gnu/store/xvgn60irpzzdwvk30lqpsj2hh81h8jyh-system.drv': 1 dependencies couldn't be builtcannot build derivation `/gnu/store/l51h17zylvjmapvcpdmmqmvrylv8b2cb-iso9660-image.drv': 1 dependencies couldn't be builtguix system: error: build of `/gnu/store/l51h17zylvjmapvcpdmmqmvrylv8b2cb-iso9660-image.drv' failedflorian@florianmacbook ~/git/guix [env]$ bzcat /var/log/guix/drvs/15/6m13243bcn2429swq8brp2qmfifi3b-system.drv.bz2Backtrace: 1 (primitive-load "/gnu/store/59nx7bbflcqzavwsjj3wkq3lwfb?") 0 (symlink "/gnu/store/86xgvarqwir47c16x6crx0jra5dgzr62-?" ?)
ERROR: In procedure symlink:In procedure symlink: File exists

I have no idea where this comes from but I hope you can reproduce the error.
In general, I would be happy to use the kernel module configurationservice for replacing the uvesafb-service-type by something like
(simple-service 'uvesafb-module kernel-module-configuration-service-type (list (kernel-module (name "uvesafb") (options (list #~(string-append "v86d=" #$v86d "/sbin/v86d") "mode_option=1024x768\n"))))))))
Even better would be if it were possible to detect the resolution touse for uvesafb at runtime before the module is loaded. Is itpossible to execute as root at runtime before modprobe a script liketestvbe.scm attached to the first message fromhttps://issues.guix.gnu.org/40538#0 to compute the mode_option touse?
Regards,Florian
B
B
Brice Waegeneire wrote on 8 Jul 2020 18:22
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)(address . 42193@debbugs.gnu.org)
934d7c4429a5e64e12af5928ddf10b0d@waegenei.re
On 2020-07-08 11:29, pelzflorian (Florian Pelz) wrote:
Toggle quote (2 lines)> Thank you for your work!
Note that it's not finished yet.
Toggle quote (43 lines)> After I apply this kernel profile patch, I get an error:> > florian@florianmacbook ~/git/guix [env]$ ./pre-inst-env guix system> disk-image --file-system-type=iso9660 gnu/system/install.scm> substitute: Liste der Substitute von „https://ci.guix.gnu.org“ wird> aktualisiert … 100.0%> The following derivations will be built:> /gnu/store/l51h17zylvjmapvcpdmmqmvrylv8b2cb-iso9660-image.drv> /gnu/store/mhdkqnh4iri5rk1ayqd3xlw04q86zj29-grub.cfg.drv> /gnu/store/xvgn60irpzzdwvk30lqpsj2hh81h8jyh-system.drv> /gnu/store/6y2r0ab5jcflbajd6843v9g1j0v9xrzj-gc-roots.drv> /gnu/store/156m13243bcn2429swq8brp2qmfifi3b-system.drv> building /gnu/store/156m13243bcn2429swq8brp2qmfifi3b-system.drv...> |builder for `/gnu/store/156m13243bcn2429swq8brp2qmfifi3b-system.drv'> failed with exit code 1> build of /gnu/store/156m13243bcn2429swq8brp2qmfifi3b-system.drv failed> View build log at> '/var/log/guix/drvs/15/6m13243bcn2429swq8brp2qmfifi3b-system.drv.bz2'.> cannot build derivation> `/gnu/store/6y2r0ab5jcflbajd6843v9g1j0v9xrzj-gc-roots.drv': 1> dependencies couldn't be built> cannot build derivation> `/gnu/store/xvgn60irpzzdwvk30lqpsj2hh81h8jyh-system.drv': 1> dependencies couldn't be built> cannot build derivation> `/gnu/store/l51h17zylvjmapvcpdmmqmvrylv8b2cb-iso9660-image.drv': 1> dependencies couldn't be built> guix system: error: build of> `/gnu/store/l51h17zylvjmapvcpdmmqmvrylv8b2cb-iso9660-image.drv' failed> florian@florianmacbook ~/git/guix [env]$ bzcat> /var/log/guix/drvs/15/6m13243bcn2429swq8brp2qmfifi3b-system.drv.bz2> Backtrace:> 1 (primitive-load "/gnu/store/59nx7bbflcqzavwsjj3wkq3lwfb?")> 0 (symlink "/gnu/store/86xgvarqwir47c16x6crx0jra5dgzr62-?" > ?)> > ERROR: In procedure symlink:> In procedure symlink: File exists> > > I have no idea where this comes from but I hope you can reproduce the > error.
Unfortunately I can't, it build successfully for me when applied on top of6f3ede9ae2b2268181ebc0ca3764d865bd06bd63. You probably just need to cleanyour Guix repository and rebuild it from scratch
Toggle quote (12 lines)> In general, I would be happy to use the kernel module configuration> service for replacing the uvesafb-service-type by something like> > (simple-service 'uvesafb-module> kernel-module-configuration-service-type> (list (kernel-module> (name "uvesafb")> (options> (list #~(string-append "v86d=" #$v86d > "/sbin/v86d")> "mode_option=1024x768\n"))))))))
I think it should work without gexp/ungexp and the "\n".
Toggle quote (7 lines)> Even better would be if it were possible to detect the resolution to> use for uvesafb at runtime before the module is loaded. Is it> possible to execute as root at runtime before modprobe a script like> testvbe.scm attached to the first message from> <https://issues.guix.gnu.org/40538#0> to compute the mode_option to> use?
AFAIU it's not possible because service extensions are generated at build time,not run time so you can't extend KMCS with a value generated when your serviceis executed. It is a limitation of the service extension paradigm.
A kind of dirty way to achieve what you want would be for KMCS' options fieldto accept an arbitrary configuration path that will be symlinked to, like“(options "/var/run/uvesafb/uvesafb.conf")”. That way from uvesafb serviceyou generate that modprobe configuration file at run time (before KMCS) andso when KMCS run modprobe it's direcotry configuration contains a symlinknamed "uvesafb.conf" which point to "/var/run/uvesafb/uvesafb.conf". Butit doesn't seems Guixy to me.
- Brice
P
P
pelzflorian (Florian Pelz) wrote on 11 Jul 2020 19:30
(name . Brice Waegeneire)(address . brice@waegenei.re)(address . 42193@debbugs.gnu.org)
20200711173008.3zgtlagkypbc4bw6@pelzflorian.localdomain
On Wed, Jul 08, 2020 at 04:22:06PM +0000, Brice Waegeneire wrote:
Toggle quote (17 lines)> > After I apply this kernel profile patch, I get an error:> > > > florian@florianmacbook ~/git/guix [env]$ ./pre-inst-env guix system> > disk-image --file-system-type=iso9660 gnu/system/install.scm> > […]> > failed with exit code 1> > […]> > In procedure symlink: File exists> > > > > > I have no idea where this comes from but I hope you can reproduce the> > error.> > Unfortunately I can't, it build successfully for me when applied on top of> 6f3ede9ae2b2268181ebc0ca3764d865bd06bd63. You probably just need to clean> your Guix repository and rebuild it from scratch
I still have the error after pulling current guix (commit f2dce740b2)and applying your patch.
florian@florianmacbook ~/.config/guix/current/share/guile/site/3.0$ guix system disk-image --file-system-type=iso9660 gnu/system/install.scm[…]build of /gnu/store/v9jzdiykyz1rdb1an7jpsfhnnkvx21mq-system.drv failedView build log at '/var/log/guix/drvs/v9/jzdiykyz1rdb1an7jpsfhnnkvx21mq-system.drv.bz2'.
Indeed /gnu/store/v9jzdiykyz1rdb1an7jpsfhnnkvx21mq-system.drv contains
Derive([("out","/gnu/store/xzavg5awkmbcx556f3a0h329w5ninhyk-system","","")],[("/gnu/store/28zlas3x4ry6q88fgq625ixh40igjws5-guile-3.0.2.drv",["out"]),("/gnu/store/32yj3cnz8rjipd6lw27d08rb272rcmbp-boot.drv",["out"]),("/gnu/store/6iwq8qmqpf9sy84jvbbsd6lwwb05rvlf-etc.drv",["out"]),("/gnu/store/8rfp2v0vz8w72621qsr0mr21zgr5f062-profile.drv",["out"]),("/gnu/store/92sqsa639hl3ixy6ryys38xha7mgkyb0-profile.drv",["out"]),("/gnu/store/ca0g4jfdqx4fhsp67jr2ra17sdwajczc-parameters.drv",["out"]),("/gnu/store/fi6hy331yp7pn03zhlxavdd4d9kv6l6i-raw-initrd.drv",["out"]),("/gnu/store/i3fx8c0k6yna92cf9h7r57amdjzii7l3-locale-multiple-versions.drv",["out"]),("/gnu/store/zcz3jhx84q3zmz37wddwlfk2w3rnn5fc-module-import-compiled.drv",["out"])],["/gnu/store/ah60schb9jlzx12jzi6v872q3j099afi-system-builder","/gnu/store/xv5ylv9hxvs1wraw375b5g9jwy57vs8p-module-import"],"x86_64-linux","/gnu/store/0m0vd873jp61lcm4xa3ljdgx381qa782-guile-3.0.2/bin/guile",["--no-auto-compile","-L","/gnu/store/xv5ylv9hxvs1wraw375b5g9jwy57vs8p-module-import","-C","/gnu/store/08da6i38fzn9g36gyq443k03f84nk8rk-module-import-compiled","/gnu/store/ah60schb9jlzx12jzi6v872q3j099afi-system-builder"],[("out","/gnu/store/xzavg5awkmbcx556f3a0h329w5ninhyk-system"),("preferLocalBuild","1")])
and /gnu/store/ah60schb9jlzx12jzi6v872q3j099afi-system-buildercontains (with indentation added by me):
(begin (use-modules (guix build utils)) (mkdir ((@ (guile) getenv) "out")) (chdir ((@ (guile) getenv) "out")) (begin (stat "/gnu/store/x22lj7pv64cg58dlwsg1q1srqawjbahi-profile") (mkdir-p (dirname "kernel")) (symlink "/gnu/store/x22lj7pv64cg58dlwsg1q1srqawjbahi-profile" "kernel")) (begin (stat "/gnu/store/7wjapypmzz4n93rwrnrrqwalwg8hhh3h-parameters") (mkdir-p (dirname "parameters")) (symlink "/gnu/store/7wjapypmzz4n93rwrnrrqwalwg8hhh3h-parameters" "parameters")) (begin (stat "/gnu/store/j27l3k8zjg9gn9j04y90gsjrqsryjapw-raw-initrd/initrd.cpio.gz") (mkdir-p (dirname "initrd")) (symlink "/gnu/store/j27l3k8zjg9gn9j04y90gsjrqsryjapw-raw-initrd/initrd.cpio.gz" "initrd")) (begin (stat "/gnu/store/bhnyk7bpzlzna28njkx21dd3940m1m4a-locale-multiple-versions") (mkdir-p (dirname "locale")) (symlink "/gnu/store/bhnyk7bpzlzna28njkx21dd3940m1m4a-locale-multiple-versions" "locale")) (begin (stat "/gnu/store/24irabcnv3pn2mpx4cjrggmlvn30k053-profile") (mkdir-p (dirname "profile")) (symlink "/gnu/store/24irabcnv3pn2mpx4cjrggmlvn30k053-profile" "profile")) (begin (stat "/gnu/store/z9jm8d8rrrpq19y1pmahpp73ja5ydw6h-etc") (mkdir-p (dirname "etc")) (symlink "/gnu/store/z9jm8d8rrrpq19y1pmahpp73ja5ydw6h-etc" "etc")) (begin (stat "/gnu/store/w90vvv7mx8g17i6frd34yvmbfi0nhnl1-boot") (mkdir-p (dirname "boot")) (symlink "/gnu/store/w90vvv7mx8g17i6frd34yvmbfi0nhnl1-boot" "boot")) (begin (stat "/gnu/store/x22lj7pv64cg58dlwsg1q1srqawjbahi-profile") (mkdir-p (dirname "kernel")) (symlink "/gnu/store/x22lj7pv64cg58dlwsg1q1srqawjbahi-profile" "kernel")))

Without your patch I get a/gnu/store/c74g6pazpx9z5c1jkfi4rn8h42lf36dy-system-builder with onlyone "kernel":
(begin (use-modules (guix build utils)) (mkdir ((@ (guile) getenv) "out")) (chdir ((@ (guile) getenv) "out")) (begin (stat "/gnu/store/x22lj7pv64cg58dlwsg1q1srqawjbahi-profile") (mkdir-p (dirname "kernel")) (symlink "/gnu/store/x22lj7pv64cg58dlwsg1q1srqawjbahi-profile" "kernel")) (begin (stat "/gnu/store/7wjapypmzz4n93rwrnrrqwalwg8hhh3h-parameters") (mkdir-p (dirname "parameters")) (symlink "/gnu/store/7wjapypmzz4n93rwrnrrqwalwg8hhh3h-parameters" "parameters")) (begin (stat "/gnu/store/j27l3k8zjg9gn9j04y90gsjrqsryjapw-raw-initrd/initrd.cpio.gz") (mkdir-p (dirname "initrd")) (symlink "/gnu/store/j27l3k8zjg9gn9j04y90gsjrqsryjapw-raw-initrd/initrd.cpio.gz" "initrd")) (begin (stat "/gnu/store/bhnyk7bpzlzna28njkx21dd3940m1m4a-locale-multiple-versions") (mkdir-p (dirname "locale")) (symlink "/gnu/store/bhnyk7bpzlzna28njkx21dd3940m1m4a-locale-multiple-versions" "locale")) (begin (stat "/gnu/store/24irabcnv3pn2mpx4cjrggmlvn30k053-profile") (mkdir-p (dirname "profile")) (symlink "/gnu/store/24irabcnv3pn2mpx4cjrggmlvn30k053-profile" "profile")) (begin (stat "/gnu/store/z9jm8d8rrrpq19y1pmahpp73ja5ydw6h-etc") (mkdir-p (dirname "etc")) (symlink "/gnu/store/z9jm8d8rrrpq19y1pmahpp73ja5ydw6h-etc" "etc")) (begin (stat "/gnu/store/w90vvv7mx8g17i6frd34yvmbfi0nhnl1-boot") (mkdir-p (dirname "boot")) (symlink "/gnu/store/w90vvv7mx8g17i6frd34yvmbfi0nhnl1-boot" "boot")))
The diff is only the three lines at the bottom
(begin (stat "/gnu/store/x22lj7pv64cg58dlwsg1q1srqawjbahi-profile") (mkdir-p (dirname "kernel")) (symlink "/gnu/store/x22lj7pv64cg58dlwsg1q1srqawjbahi-profile" "kernel")))
Regards,Florian
D
D
Danny Milosavljevic wrote on 17 Jul 2020 20:49
Re: [bug#42193] [WIP 4/6] services: kernel-module-loader: Return a single 'shepherd-service'.
(name . Brice Waegeneire)(address . brice@waegenei.re)(address . 42193@debbugs.gnu.org)
20200717204909.7badb026@scratchpost.org
Sure, OK for master.
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl8R8qUACgkQ5xo1VCwwuqUHKQgAlwKJyybcpH/Xt5wbbk+s/eRP91nUg2JlGOX4R68dZwSoGskfkhQQv70bGsXTtjpoprqt/ONxAvAT3kHfrTWExFNnbKRhVwm9ZUVLgXmPGCT2WLdjdYHmiy7olZ2c0jxlbeahyFpl96pD+1lUTaivldQvOefnQyu+SigzRmChxk98xA4fyCUsIXQEGNWBuBrYlcw1ArAAK94au1P9WcTaudPDTkWmXfwBjh7ZeWfPZv6MsN2RGrxNSI653NF49L76YizF2TfNlls4Vav/WiCjiCPg7FNJqU32rSJDKXkrHgjDRKI57DPD50fqZitOlPIVmgu+63Kx6k72qnqbxVTBZw===6Yh/-----END PGP SIGNATURE-----

D
D
Danny Milosavljevic wrote on 6 Jan 19:20 +0100
(name . Brice Waegeneire)(address . brice@waegenei.re)(address . 42193@debbugs.gnu.org)
20210106192001.59cb728f@scratchpost.org
Hi Brice,
pushed this patch to guix master ascommit 3d3185b54448cb44fffc1badc8c1cf51bb76585d.
Thanks!
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl/1/1EACgkQ5xo1VCwwuqVIoggAk30As2MRORPMIme7xSN0cCXZjx2CjIOaw3XzSxaQ+/hUJCA07UEv7U+E4G/gMN39171WVJJXgy/RnS6G2h4o5XgiZzWT+H3EGE/j3dVKbs0e0w/j14xaLkvEBHGjy4fO9okmuTjUSbecRwP8tLPXxRZNamty0NKbCOZIA6kyuh2snQMatLkxNcShVSA/saB3JfMH6h5KCWFsyy7yb5P1OhTF6pmN/GjCRtEFzJj37PO9hdjTmk3s1dCLsqficg5hA24jfzkvdvqjZNu6nHH5a8UV1adzxZrdQFWe1a6SAj1SkVC4wY6AxyIzxCcYcDVNqEOXo+5j7W1zGE2sZXHrng===aLPU-----END PGP SIGNATURE-----

R
R
raid5atemyhomework wrote on 7 Jan 10:16 +0100
Re: kernel-module-configuration-service for configuring kernel parameters
5bC3wYco2_hQFFuoBgIXEzu8nw1EJSACCaM1vnewD14AEQqQ-y32uoIWX1a5rJJxVvsSmWxI05fY0IKIjem5TyznqxZahm8v1F_fkEF7AeE=@protonmail.com
Hi Danny and Brice,
Cross-posting to 42193 as well.
Toggle quote (3 lines)> > > See also https://issues.guix.info/issue/42193for an earlier attempt (which> > > is already very far--but it has a bug somewhere).
I think what 42193 WIP 2/6 is missing is this hunk from my own 45592 PATCH 1/4:
```diff
Toggle diff (38 lines)diff --git a/gnu/system.scm b/gnu/system.scmindex c284a18379..5c530f176e 100644--- a/gnu/system.scm+++ b/gnu/system.scm@@ -625,26 +616,10 @@ possible (that is if there's a LINUX keyword argument in the build system)." "Return the basic entries of the 'system' directory of OS for use as the value of the SYSTEM-SERVICE-TYPE service." (let* ((locale (operating-system-locale-directory os))- (kernel (operating-system-kernel os)) (hurd (operating-system-hurd os))- (modules (operating-system-kernel-loadable-modules os))- (kernel (if hurd- kernel- (profile- (content (packages->manifest- (cons kernel- (map (lambda (module)- (if (package? module)- (package-for-kernel kernel- module)- module))- modules))))- (hooks (list linux-module-database))))) (initrd (and (not hurd) (operating-system-initrd-file os))) (params (operating-system-boot-parameters-file os)))- `(("kernel" ,kernel)- ,@(if hurd `(("hurd" ,hurd)) '())- ("parameters" ,params)+ `(("parameters" ,params) ,@(if initrd `(("initrd" ,initrd)) '()) ("locale" ,locale)))) ;used by libc```


I hope we can progress this towards a workable ZFS-on-Guix.
Thanksraid5atemyhomework
?