Subject: Re: [bug#40274] [PATCH v5] gnu: Add kernel-module-loader-service.

From: "pelzflorian (Florian Pelz)" <[email-masked]>
Date: Fri, 3 Apr 2020 14:58:39 +0200

On Fri, Apr 03, 2020 at 12:20:44PM +0200, Danny Milosavljevic wrote:
> On Thu, 02 Apr 2020 17:13:05 +0000 Brice Waegeneire <[email-masked]> wrote:
> > *could* be useful, to some, to pass arguments to modprobe since it is
> > present in its API; 
> Definitely could be useful.  The question is whether the complexity justifies it
> and whether it can be reliable.

I need modprobe arguments in some way via some service to pass to the
uvesafb module to make graphics and kmscon work on machines without
Kernel Mode Setting (see attachment), but the (string-append …) is not
executed as a procedure, it seems.

Apr  3 14:54:45 localhost vmunix: [    9.860831] shepherd[1]: Service user-homes has been started.
Apr  3 14:54:45 localhost vmunix: [    9.880505] shepherd[1]: '/gnu/store/d064bv2b1hrb07j2zj78i608db7qldx9-kmod-26/bin/modprobe -- uvesafb (string-append v86d= /gnu/store/0m780n5q4cr7rqmjn5zzd6adr3042f97-v86d-0.1.10 /sbin/v86d) mode_option=1024x768' exited with status 127; output follows:
Apr  3 14:54:45 localhost vmunix: [    9.881867] shepherd[1]: 
Apr  3 14:54:45 localhost vmunix: [    9.883595] shepherd[1]: Service kernel-module-loader could not be started.

Regards,
Florian
diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index c15c2c7814..7327efe195 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -26,11 +26,13 @@
   #:use-module (gnu bootloader u-boot)
   #:use-module (guix gexp)
   #:use-module (guix store)
+  #:use-module (guix utils)
   #:use-module (guix monads)
   #:use-module ((guix packages) #:select (package-version))
   #:use-module ((guix store) #:select (%store-prefix))
   #:use-module (gnu installer)
   #:use-module (gnu services dbus)
+  #:use-module (gnu services linux)
   #:use-module (gnu services networking)
   #:use-module (gnu services shepherd)
   #:use-module (gnu services ssh)
@@ -50,6 +52,7 @@
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages nvi)
+  #:use-module (gnu packages xorg)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-26)
   #:export (installation-os
@@ -304,7 +307,8 @@ Access documentation at any time by pressing Alt-F2.\x1b[0m
     (define bare-bones-os
       (load "examples/bare-bones.tmpl"))
 
-    (list (service virtual-terminal-service-type)
+    (cons*
+          (service virtual-terminal-service-type)
 
           (service kmscon-service-type
                    (kmscon-configuration
@@ -408,7 +412,14 @@ Access documentation at any time by pressing Alt-F2.\x1b[0m
                    (list bare-bones-os
                          glibc-utf8-locales
                          texinfo
-                         (canonical-package guile-2.2))))))
+                         (canonical-package guile-2.2)))
+          (if (member (%current-system) '("x86_64-linux" "i686-linux"))
+              ;; Load uvesafb to show installer when no KMS is available.
+              `(,(kernel-module-loader-service
+                  (list (list "uvesafb"
+                              #~(string-append "v86d=" #$v86d "/sbin/v86d")
+                              "mode_option=1024x768"))))
+              '()))))
 
 (define %issue
   ;; Greeting.