On Fri, Apr 10, 2020 at 04:38:37PM +0200, Ludovic Courtès wrote:
> > + (if (member (%current-system) '("x86_64-linux" "i686-linux"))
> > + ;; Load uvesafb to show installer when no KMS is available.
> > + `(,(service kernel-module-loader-service-type '("uvesafb"))
> > + [...]
>
> This is not quite correct because here ‘%current-system’ is evaluated at
> the top level, when (gnu tests install) is loaded. So on my laptop,
> it’s always "x86_64-linux", regardless of any ‘-s’ flags. Also, it
> ignores ‘--target’.
>
> Can we arrange to make it unconditional?
>
> One way to do that (not great), would be to make it an activation
> snippet: since activation snippets are written as monadic code, we can
> reliably check ‘%current-system’ & ‘%current-target-system’ from there.
> (For lack of a solution like <https://issues.guix.gnu.org/issue/29296>.)
Please consider the attached patch. I chose to go without
kernel-module-loader-service (only copying its requirements field)
because I do not know how to conditionally extend or start another
Shepherd service from an activation snippet.
I tested it on QEMU with and without nomodeset. With a previous Guix
System install image, it stayed black when adding a nomodeset kernel
parameter. I will test again on real hardware now, but previous
testing of uvesafb-enabled installer images proved successful unlike
non-uvesafb images.
Feel free to adapt the patch or not include it. Or tell me to change
it if there is time.
Regards,
Florian
>From 85a95ce758384979a0aae3bc9065197c74862b4b Mon Sep 17 00:00:00 2001
From: Florian Pelz <[email protected]>
Date: Sat, 11 Apr 2020 18:56:37 +0200
Subject: [PATCH] installer: Load uvesafb kernel module.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fixes <https://bugs.gnu.org/40538>.
Machines without Kernel Mode Setting (those with many old and current AMD
GPUs, SiS GPUs, …) need uvesafb to show the GUI installer. Some may also need
a kernel parameter like nomodeset or vga=793, but we leave that for the user
to specify in GRUB.
* gnu/system/install.scm (uvesafb-shepherd-service): New procedure.
(uvesafb-service-type): New variable.
(%uvesafb-service): New variable.
(%installation-services): Add it.
---
gnu/system/install.scm | 47 ++++++++++++++++++++++++++++++++++++++++--
1 file changed, 45 insertions(+), 2 deletions(-)
diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index c15c2c7814..73a013bed0 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2016 Andreas Enge <[email protected]>
;;; Copyright © 2017 Marius Bakke <[email protected]>
;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <[email protected]>
+;;; Copyright © 2020 Florian Pelz <[email protected]>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -27,6 +28,7 @@
#:use-module (guix gexp)
#:use-module (guix store)
#:use-module (guix monads)
+ #:use-module (guix modules)
#:use-module ((guix packages) #:select (package-version))
#:use-module ((guix store) #:select (%store-prefix))
#:use-module (gnu installer)
@@ -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
@@ -273,7 +276,6 @@ the user's target storage device rather than on the RAM
disk."
(define %configuration-template-service
(service configuration-template-service-type #t))
-
(define %nscd-minimal-caches
;; Minimal in-memory caching policy for nscd.
(list (nscd-cache (database 'hosts)
@@ -287,6 +289,41 @@ the user's target storage device rather than on the RAM
disk."
(persistent? #f)
(max-database-size (* 5 (expt 2 20)))))) ;5 MiB
+
+;; These define a service to load the uvesafb kernel module with the
+;; appropriate options. The GUI installer needs it when the machine does not
+;; support Kernel Mode Setting. Otherwise kmscon is missing /dev/fb0.
+(define (uvesafb-shepherd-service _)
+ (list (shepherd-service
+ (documentation "Load uvesafb.")
+ (provision '(uvesafb))
+ (requirement '(file-systems))
+ (start (with-imported-modules (source-module-closure '((guix utils)))
+ #~(begin
+ (use-modules (guix utils))
+ (lambda ()
+ ;; uvesafb is only supported on x86 and x86_64.
+ (if (member (%current-system)
+ '("x86_64-linux" "i686-linux"))
+ (invoke #+(file-append kmod "/bin/modprobe")
+ "uvesafb"
+ (string-append "v86d=" #$v86d "/sbin/v86d")
+ "mode_option=1024x768")
+ #t)))))
+ (respawn? #f)
+ (one-shot? #t))))
+
+(define uvesafb-service-type
+ (service-type
+ (name 'uvesafb)
+ (extensions
+ (list (service-extension shepherd-root-service-type
+ uvesafb-shepherd-service)))
+ (default-value #t)))
+
+(define %uvesafb-service
+ (service uvesafb-service-type))
+
(define %installation-services
;; List of services of the installation system.
(let ((motd (plain-file "motd" "
@@ -408,7 +445,13 @@ 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)))
+
+ ;; Machines without Kernel Mode Setting (those with many old and
+ ;; current AMD GPUs, SiS GPUs, ...) need uvesafb to show the GUI
+ ;; installer. Some may also need a kernel parameter like nomodeset
+ ;; or vga=793, but we leave that for the user to specify in GRUB.
+ %uvesafb-service)))
(define %issue
;; Greeting.
--
2.26.0