From: Brice Waegeneire <brice@waegenei.re>
To: 42193@debbugs.gnu.org
Subject: [bug#42193] [WIP 5/6] WIP services: Add kernel-arguments-service-type.
Date: Sat, 4 Jul 2020 20:54:30 +0200 [thread overview]
Message-ID: <20200704185431.13739-6-brice@waegenei.re> (raw)
In-Reply-To: <20200704185234.12571-1-brice@waegenei.re>
---
gnu/services.scm | 14 ++++++++++++++
gnu/system.scm | 39 +++++++++++++++++++++++++++++++++++++--
2 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/gnu/services.scm b/gnu/services.scm
index 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))))))))
+\f
+;;;
+;;; 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)))
+
\f
;;;
;;; Cleanup.
diff --git a/gnu/system.scm b/gnu/system.scm
index 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)))
\f
;;;
@@ -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
next prev parent reply other threads:[~2020-07-04 18:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200704185234.12571-1-brice@waegenei.re>
2020-07-04 18:54 ` [bug#42193] [WIP 1/6] services: simulated-wifi: Use 'kernel-module-loader' Brice Waegeneire
2020-07-04 18:54 ` Brice Waegeneire
2020-07-06 11:08 ` Danny Milosavljevic
2020-07-06 12:31 ` Brice Waegeneire
2020-07-04 18:54 ` [bug#42193] [WIP 2/6] services: Add 'kernel-profile-service-type' Brice Waegeneire
2020-07-08 11:29 ` pelzflorian (Florian Pelz)
2020-07-08 16:22 ` Brice Waegeneire
2020-07-11 17:30 ` pelzflorian (Florian Pelz)
2020-07-04 18:54 ` [bug#42193] [WIP 3/6] services: Add 'modprobe-service-type' Brice Waegeneire
2020-07-04 18:54 ` [bug#42193] [WIP 4/6] services: kernel-module-loader: Return a single 'shepherd-service' Brice Waegeneire
2020-07-06 0:03 ` Danny Milosavljevic
2020-07-06 10:01 ` Brice Waegeneire
2020-07-17 18:49 ` Danny Milosavljevic
2021-01-06 18:20 ` Danny Milosavljevic
2020-07-04 18:54 ` Brice Waegeneire [this message]
2020-07-04 18:54 ` [bug#42193] [WIP 6/6] WIP services: Add kernel-module-configuration service Brice Waegeneire
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200704185431.13739-6-brice@waegenei.re \
--to=brice@waegenei.re \
--cc=42193@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).