[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issues and improvement for `kernel-loadable-modules'

From: Brice Waegeneire
Subject: Issues and improvement for `kernel-loadable-modules'
Date: Thu, 26 Mar 2020 14:34:03 +0000
User-agent: Roundcube Webmail/1.3.8

Hello Guix,

Thanks to Danny's work in[0] we have, since a few days, a way for packages
to provide Linux modules in the system profile. I have been waiting for
such a feature since I packaged `ddcci-driver-linux', which was kind of
useless without it. Using the new field `kernel-loadable-modules' I
stumbled upon three issues.

First I was expecting the packages in `kernel-loadable-modules' to use the
`kernel' field as their kernel input or to have a simple procedure to do
so. Otherwise you get a “Specified Linux kernel and Linux kernel modules
are not all of the same version”. It makes it more difficult that it needs
to be to write composable configurations; IOW why would I want to use a
module built with a different kernel that the one I'm specifying in my

Second issue, I can't manage to use an inferior as the kernel input for the
packages in `kernel-loadable-modules'. See the two following

--8<---------------cut here---------------start------------->8---
LANGUAGE=C guix system vm kernel-loadable-modules-barbones.scm
Updating channel 'guix' from Git repository at ''...
           1 (primitive-load "/home/bricewge/.config/guix/current/bi…")
In guix/ui.scm:
  1894:12  0 (run-guix-command _ . _)

guix/ui.scm:1894:12: In procedure run-guix-command:
In procedure %package-native-inputs-real: Wrong type argument: #<inferior-package linux-libre@5.4.27 7f90570fc600>
--8<---------------cut here---------------end--------------->8---

Following is `kernel-loadable-modules-barbones.scm':

--8<---------------cut here---------------start------------->8---
(use-modules (gnu)
             (gnu system)
             (srfi srfi-1)
             (guix inferior)
             (guix utils)
             (guix packages)
             (guix channels))
(use-package-modules linux)

(define channels
  (list (channel
         (name 'guix)
         (url "";)

(define my-linux
  (let ((inferior (inferior-for-channels channels)))
(first (lookup-inferior-packages inferior "linux-libre" "4.4.217"))))

;; ;; NOTE It is already in master
;; (define operating-system-kernel-loadable-modules
;; (@@ (gnu system) operating-system-kernel-loadable-modules))

(define os
    (host-name "komputilo")
    (timezone "Europe/Berlin")
    (locale "en_US.utf8")
    (bootloader (bootloader-configuration
                 (bootloader grub-bootloader)
                 (target "/dev/sdX")))
    (file-systems (cons (file-system
                          (device (file-system-label "my-root"))
                          (mount-point "/")
                          (type "ext4"))

    (kernel-loadable-modules (list ddcci-driver-linux))))

  (inherit os)

  (kernel my-linux)
   (map (lambda (module)
          (package/inherit module
                             (package-arguments module)
;; `(#:linux ,(specification->package "linux@4.4.217")) ; NOTE It should works
                             `(#:linux ,my-linux) ; NOTE That's issue #2
        (operating-system-kernel-loadable-modules os))))
--8<---------------cut here---------------end--------------->8---

And last issue, we are missing a service to load module manually when they
can't be auto-loaded as it's the case with `ddcci`[1]. I have managed to
solve this one by writing my first service `load-kernel-modules-service'.
What can I improve before submitting it as a patch -- except the missing

--8<---------------cut here---------------start------------->8---
(define-record-type* <load-kernel-modules-configuration>
load-kernel-modules-configuration make-load-kernel-modules-configuration
load-kernel-modules-configuration? (modules
load-kernel-modules-configuration-modules ; list of strings (default '())))

(define load-kernel-modules-shepherd-service
    (($ <load-kernel-modules-configuration> modules)
       (documentation "Load kernel modules.")
       (provision '(load-kernel-modules))
       (respawn? #f)
       (one-shot? #t)
        #~(lambda _
            (zero? (system* #$(file-append kmod "/bin/modprobe")

(define load-kernel-modules-service-type
   (name 'load-kernel-modules)
   (description "Load kernel modules.")
     (service-extension shepherd-root-service-type
   (compose concatenate)
   (extend (lambda (config modules)
              (inherit config)
              (modules (append
(load-kernel-modules-configuration-modules config)
   (default-value (load-kernel-modules-configuration))))

(define* (load-kernel-modules-service modules)
  "Return a service that loads kernel MODULES."
  (service load-kernel-modules-service-type
            (modules modules))))
--8<---------------cut here---------------end--------------->8---



reply via email to

[Prev in Thread] Current Thread [Next in Thread]