all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mathieu Othacehe <m.othacehe@gmail.com>
To: "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de>,
	"Ludovic Courtès" <ludo@gnu.org>,
	"Pierre Neidhardt" <mail@ambrevar.xyz>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: KMScon vs. AMD Radeon
Date: Mon, 01 Apr 2019 15:58:45 +0200	[thread overview]
Message-ID: <871s2lkesq.fsf@gmail.com> (raw)
In-Reply-To: <20190330152211.2ugzdbvp2hjy3lvl@pelzflorian.localdomain>

[-- Attachment #1: Type: text/plain, Size: 329 bytes --]


Hello,

> On Guix System 0.16 the directory /sys/class/drm contains only
> ttm and version.

Ok, thanks for testing.

Here's a patch that fallback to mingetty if kmscon is not supported. I
don't have a machine with AMD GPU for testing so if Florian or Pierre
could test the patch that would be very helpful :)

Thanks,

Mathieu

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-wip-Fallback-to-mingetty-if-kmscon-is-not-supported.patch --]
[-- Type: text/x-diff, Size: 14598 bytes --]

From f728749dc02f8bb8a1870925547d96d8ce352f55 Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <m.othacehe@gmail.com>
Date: Mon, 1 Apr 2019 15:54:26 +0200
Subject: [PATCH] wip: Fallback to mingetty if kmscon is not supported.

---
 gnu/services/base.scm  |  29 +++--
 gnu/system/install.scm | 240 +++++++++++++++++++++++------------------
 2 files changed, 160 insertions(+), 109 deletions(-)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 04b123b833..fde2cdbcfb 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1105,12 +1105,18 @@ the tty to run, among other things."
   (login-program  mingetty-login-program          ;gexp
                   (default #f))
   (login-pause?   mingetty-login-pause?           ;Boolean
-                  (default #f)))
+                  (default #f))
+  ;; Boolean
+  ;; XXX: This should really be handled in an orthogonal way, for instance as
+  ;; proposed in <https://bugs.gnu.org/27155>.  Keep it internal/undocumented
+  ;; for now.
+  (%auto-start?   mingetty-auto-start?
+                  (default #t)))
 
 (define mingetty-shepherd-service
   (match-lambda
     (($ <mingetty-configuration> mingetty tty auto-login login-program
-                                 login-pause?)
+                                 login-pause? %auto-start?)
      (list
       (shepherd-service
        (documentation "Run mingetty on an tty.")
@@ -1140,7 +1146,8 @@ the tty to run, among other things."
                         #$@(if login-pause?
                                #~("--loginpause")
                                #~()))))
-       (stop   #~(make-kill-destructor)))))))
+       (stop   #~(make-kill-destructor))
+       (auto-start? %auto-start?))))))
 
 (define mingetty-service-type
   (service-type (name 'mingetty)
@@ -2146,7 +2153,13 @@ This service is not part of @var{%base-services}."
   (auto-login              kmscon-configuration-auto-login
                            (default #f))
   (hardware-acceleration?  kmscon-configuration-hardware-acceleration?
-                           (default #f))) ; #t causes failure
+                           (default #f))  ; #t causes failure
+  ;; Boolean
+  ;; XXX: This should really be handled in an orthogonal way, for instance as
+  ;; proposed in <https://bugs.gnu.org/27155>.  Keep it internal/undocumented
+  ;; for now.
+  (%auto-start?            kmscon-configuration-auto-start?
+                           (default #t)))
 
 (define kmscon-service-type
   (shepherd-service-type
@@ -2157,7 +2170,8 @@ This service is not part of @var{%base-services}."
            (login-program (kmscon-configuration-login-program config))
            (login-arguments (kmscon-configuration-login-arguments config))
            (auto-login (kmscon-configuration-auto-login config))
-           (hardware-acceleration? (kmscon-configuration-hardware-acceleration? config)))
+           (hardware-acceleration? (kmscon-configuration-hardware-acceleration? config))
+           (auto-start? (kmscon-configuration-auto-start? config)))
 
        (define kmscon-command
          #~(list
@@ -2174,9 +2188,10 @@ This service is not part of @var{%base-services}."
        (shepherd-service
         (documentation "kmscon virtual terminal")
         (requirement '(user-processes udev dbus-system))
-        (provision (list (symbol-append 'term- (string->symbol virtual-terminal))))
+        (provision (list (symbol-append 'kmscon- (string->symbol virtual-terminal))))
         (start #~(make-forkexec-constructor #$kmscon-command))
-        (stop #~(make-kill-destructor)))))))
+        (stop #~(make-kill-destructor))
+        (auto-start? auto-start?))))))
 
 (define-record-type* <static-networking>
   static-networking make-static-networking
diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index aad1deb913..b9c58691d4 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -209,6 +209,45 @@ the user's target storage device rather than on the RAM disk."
                     (persistent? #f)
                     (max-database-size (* 5 (expt 2 20)))))) ;5 MiB
 
+(define (installer-services)
+  (define is-kmscon-supported?
+    #~(let ((drm-regex (make-regexp "(card|render).*$")))
+        (not (null? (scandir "/sys/class/drm"
+                             (cut regexp-exec drm-regex <>))))))
+
+  (let ((mingetty
+         (service mingetty-service-type
+                  (mingetty-configuration
+                   (tty "tty1")
+                   (auto-login "root")
+                   (%auto-start? #f))))
+        (kmscon
+         (service kmscon-service-type
+                  (kmscon-configuration
+                   (virtual-terminal "tty1")
+                   (login-program (installer-program))
+                   (%auto-start? #f)))))
+    (list
+     mingetty
+     kmscon
+     (service
+      (shepherd-service-type
+       'installer-tty
+       (lambda _
+         (shepherd-service
+          (provision '(installer-tty))
+          (requirement '(user-processes host-name udev virtual-terminal))
+          (start #~(lambda _
+                     (if #$is-kmscon-supported?
+                         (start 'kmscon-tty1)
+                         (start 'term-tty1))))
+          (stop #~(make-kill-destructor))
+          (modules `((ice-9 ftw)
+                     (ice-9 regex)
+                     (srfi srfi-26)
+                     ,@%default-modules)))))
+      '()))))
+
 (define %installation-services
   ;; List of services of the installation system.
   (let ((motd (plain-file "motd" "
@@ -228,108 +267,105 @@ You have been warned.  Thanks for being so brave.\x1b[0m
     (define bare-bones-os
       (load "examples/bare-bones.tmpl"))
 
-    (list (service virtual-terminal-service-type)
-
-          (service kmscon-service-type
-                   (kmscon-configuration
-                    (virtual-terminal "tty1")
-                    (login-program (installer-program))))
-
-          (login-service (login-configuration
-                          (motd motd)))
-
-          ;; Documentation.  The manual is in UTF-8, but
-          ;; 'console-font-service' sets up Unicode support and loads a font
-          ;; with all the useful glyphs like em dash and quotation marks.
-          (mingetty-service (mingetty-configuration
-                             (tty "tty2")
-                             (auto-login "guest")
-                             (login-program (log-to-info))))
-
-          ;; Documentation add-on.
-          %configuration-template-service
-
-          ;; A bunch of 'root' ttys.
-          (normal-tty "tty3")
-          (normal-tty "tty4")
-          (normal-tty "tty5")
-          (normal-tty "tty6")
-
-          ;; The usual services.
-          (syslog-service)
-
-          ;; The build daemon.  Register the hydra.gnu.org key as trusted.
-          ;; This allows the installation process to use substitutes by
-          ;; default.
-          (service guix-service-type
-                   (guix-configuration (authorize-key? #t)))
-
-          ;; Start udev so that useful device nodes are available.
-          ;; Use device-mapper rules for cryptsetup & co; enable the CRDA for
-          ;; regulations-compliant WiFi access.
-          (udev-service #:rules (list lvm2 crda))
-
-          ;; Add the 'cow-store' service, which users have to start manually
-          ;; since it takes the installation directory as an argument.
-          (cow-store-service)
-
-          ;; Install Unicode support and a suitable font.  Use a font that
-          ;; doesn't have more than 256 glyphs so that we can use colors with
-          ;; varying brightness levels (see note in setfont(8)).
-          (service console-font-service-type
-                   (map (lambda (tty)
-                          (cons tty "lat9u-16"))
-                        '("tty1" "tty2" "tty3" "tty4" "tty5" "tty6")))
-
-          ;; To facilitate copy/paste.
-          (service gpm-service-type)
-
-          ;; Add an SSH server to facilitate remote installs.
-          (service openssh-service-type
-                   (openssh-configuration
-                    (port-number 22)
-                    (permit-root-login #t)
-                    ;; The root account is passwordless, so make sure
-                    ;; a password is set before allowing logins.
-                    (allow-empty-passwords? #f)
-                    (password-authentication? #t)
-
-                    ;; Don't start it upfront.
-                    (%auto-start? #f)))
-
-          ;; Since this is running on a USB stick with a overlayfs as the root
-          ;; file system, use an appropriate cache configuration.
-          (nscd-service (nscd-configuration
-                         (caches %nscd-minimal-caches)))
-
-          ;; Having /bin/sh is a good idea.  In particular it allows Tramp
-          ;; connections to this system to work.
-          (service special-files-service-type
-                   `(("/bin/sh" ,(file-append (canonical-package bash)
-                                              "/bin/sh"))))
-
-          ;; Loopback device, needed by OpenSSH notably.
-          (service static-networking-service-type
-                   (list (static-networking (interface "lo")
-                                            (ip "127.0.0.1")
-                                            (requirement '())
-                                            (provision '(loopback)))))
-
-          (service wpa-supplicant-service-type)
-          (dbus-service)
-          (service connman-service-type
-                   (connman-configuration
-                    (disable-vpn? #t)))
-
-          ;; Keep a reference to BARE-BONES-OS to make sure it can be
-          ;; installed without downloading/building anything.  Also keep the
-          ;; things needed by 'profile-derivation' to minimize the amount of
-          ;; download.
-          (service gc-root-service-type
-                   (list bare-bones-os
-                         glibc-utf8-locales
-                         texinfo
-                         (canonical-package guile-2.2))))))
+    (append
+     (installer-services)
+     (list (service virtual-terminal-service-type)
+
+           (login-service (login-configuration
+                           (motd motd)))
+
+           ;; Documentation.  The manual is in UTF-8, but
+           ;; 'console-font-service' sets up Unicode support and loads a font
+           ;; with all the useful glyphs like em dash and quotation marks.
+           (mingetty-service (mingetty-configuration
+                              (tty "tty2")
+                              (auto-login "guest")
+                              (login-program (log-to-info))))
+
+           ;; Documentation add-on.
+           %configuration-template-service
+
+           ;; A bunch of 'root' ttys.
+           (normal-tty "tty3")
+           (normal-tty "tty4")
+           (normal-tty "tty5")
+           (normal-tty "tty6")
+
+           ;; The usual services.
+           (syslog-service)
+
+           ;; The build daemon.  Register the hydra.gnu.org key as trusted.
+           ;; This allows the installation process to use substitutes by
+           ;; default.
+           (service guix-service-type
+                    (guix-configuration (authorize-key? #t)))
+
+           ;; Start udev so that useful device nodes are available.
+           ;; Use device-mapper rules for cryptsetup & co; enable the CRDA for
+           ;; regulations-compliant WiFi access.
+           (udev-service #:rules (list lvm2 crda))
+
+           ;; Add the 'cow-store' service, which users have to start manually
+           ;; since it takes the installation directory as an argument.
+           (cow-store-service)
+
+           ;; Install Unicode support and a suitable font.  Use a font that
+           ;; doesn't have more than 256 glyphs so that we can use colors with
+           ;; varying brightness levels (see note in setfont(8)).
+           (service console-font-service-type
+                    (map (lambda (tty)
+                           (cons tty "lat9u-16"))
+                         '("tty1" "tty2" "tty3" "tty4" "tty5" "tty6")))
+
+           ;; To facilitate copy/paste.
+           (service gpm-service-type)
+
+           ;; Add an SSH server to facilitate remote installs.
+           (service openssh-service-type
+                    (openssh-configuration
+                     (port-number 22)
+                     (permit-root-login #t)
+                     ;; The root account is passwordless, so make sure
+                     ;; a password is set before allowing logins.
+                     (allow-empty-passwords? #f)
+                     (password-authentication? #t)
+
+                     ;; Don't start it upfront.
+                     (%auto-start? #f)))
+
+           ;; Since this is running on a USB stick with a overlayfs as the root
+           ;; file system, use an appropriate cache configuration.
+           (nscd-service (nscd-configuration
+                          (caches %nscd-minimal-caches)))
+
+           ;; Having /bin/sh is a good idea.  In particular it allows Tramp
+           ;; connections to this system to work.
+           (service special-files-service-type
+                    `(("/bin/sh" ,(file-append (canonical-package bash)
+                                               "/bin/sh"))))
+
+           ;; Loopback device, needed by OpenSSH notably.
+           (service static-networking-service-type
+                    (list (static-networking (interface "lo")
+                                             (ip "127.0.0.1")
+                                             (requirement '())
+                                             (provision '(loopback)))))
+
+           (service wpa-supplicant-service-type)
+           (dbus-service)
+           (service connman-service-type
+                    (connman-configuration
+                     (disable-vpn? #t)))
+
+           ;; Keep a reference to BARE-BONES-OS to make sure it can be
+           ;; installed without downloading/building anything.  Also keep the
+           ;; things needed by 'profile-derivation' to minimize the amount of
+           ;; download.
+           (service gc-root-service-type
+                    (list bare-bones-os
+                          glibc-utf8-locales
+                          texinfo
+                          (canonical-package guile-2.2)))))))
 
 (define %issue
   ;; Greeting.
-- 
2.17.1


  reply	other threads:[~2019-04-01 13:58 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13 15:17 Status update on 1.0 Ludovic Courtès
2019-03-13 15:32 ` Tobias Geerinckx-Rice
2019-03-13 16:00   ` Pierre Neidhardt
2019-03-13 18:33     ` Danny Milosavljevic
2019-03-13 18:47       ` Pierre Neidhardt
2019-03-15 12:54         ` Ludovic Courtès
2019-03-15 13:06           ` Pierre Neidhardt
2019-03-15 16:48           ` Mathieu Othacehe
2019-03-14  2:26       ` Maxim Cournoyer
2019-03-15 12:53   ` Ludovic Courtès
2019-03-13 16:34 ` mikadoZero
2019-03-13 17:08   ` Ricardo Wurmus
2019-03-13 18:14     ` pelzflorian (Florian Pelz)
2019-03-13 19:43       ` L p R n d n
2019-03-14 13:54       ` L p R n d n
2019-03-15 12:57       ` Ludovic Courtès
2019-03-15 13:56         ` pelzflorian (Florian Pelz)
2019-03-13 20:53     ` mikadoZero
2019-03-14  3:54 ` Timothy Sample
2019-03-15 13:47   ` Ludovic Courtès
2019-03-15 17:44     ` Timothy Sample
2019-03-23 16:36       ` Ludovic Courtès
2019-03-21 18:49     ` Timothy Sample
2019-03-23 16:42       ` Ludovic Courtès
2019-03-28  3:28         ` Timothy Sample
2019-03-14 21:16 ` Gábor Boskovits
2019-03-15 13:51   ` Ludovic Courtès
2019-03-15 18:31     ` Thompson, David
2019-03-15 19:20       ` Gábor Boskovits
     [not found]         ` <CAN1Dt4SQzXJOK2bJF47cFO5ERg9=uf8wktH=arJ=AypEUnO2yw@mail.gmail.com>
2019-03-21  0:52           ` Fwd: " Kristofer Buffington
2019-03-21 14:59             ` Gábor Boskovits
2019-03-27 15:26 ` Ludovic Courtès
2019-03-27 15:29   ` znavko
2019-03-27 23:10   ` Danny Milosavljevic
2019-03-29 16:07     ` Ludovic Courtès
2019-03-28  0:09   ` pelzflorian (Florian Pelz)
2019-03-29 16:13     ` KMScon vs. AMD Radeon Ludovic Courtès
2019-03-29 16:35       ` Mathieu Othacehe
2019-03-29 18:00         ` pelzflorian (Florian Pelz)
2019-03-30  7:25           ` Mathieu Othacehe
2019-03-30  8:40             ` Pierre Neidhardt
2019-03-30 15:22               ` pelzflorian (Florian Pelz)
2019-04-01 13:58                 ` Mathieu Othacehe [this message]
2019-04-01 20:01                   ` Ludovic Courtès
2019-04-02  7:53                     ` Mathieu Othacehe
2019-04-02 16:31                       ` Danny Milosavljevic
2019-04-03  5:11                         ` pelzflorian (Florian Pelz)
2019-04-03  7:19                           ` Mathieu Othacehe
2019-04-03  7:34                             ` pelzflorian (Florian Pelz)
2019-04-03 11:13                             ` Danny Milosavljevic
2019-04-03 20:46                               ` Ludovic Courtès
2019-04-03  7:37                         ` Mathieu Othacehe
2019-04-03 11:19                           ` Danny Milosavljevic
2019-04-03 18:56                             ` Danny Milosavljevic
2019-04-03 20:48                               ` Ludovic Courtès
2019-04-03 21:02                                 ` Danny Milosavljevic
2019-04-04  5:02                                   ` pelzflorian (Florian Pelz)
2019-04-04  7:38                                     ` Mathieu Othacehe
2019-04-04 13:49                                       ` Mathieu Othacehe
2019-04-04 16:07                                         ` pelzflorian (Florian Pelz)
2019-04-06  9:05                                           ` Danny Milosavljevic
2019-04-06 11:03                                             ` pelzflorian (Florian Pelz)
2019-04-14  9:48                                           ` pelzflorian (Florian Pelz)
2019-04-14 20:54                                             ` pelzflorian (Florian Pelz)
2019-04-15 12:09                                               ` Ludovic Courtès
2019-04-17 17:26                                                 ` pelzflorian (Florian Pelz)
2019-04-18  7:05                                                   ` pelzflorian (Florian Pelz)
2019-04-19 12:19                                                     ` pelzflorian (Florian Pelz)
2019-04-18 21:47                                                   ` Ludovic Courtès
2019-04-19 12:17                                                     ` pelzflorian (Florian Pelz)
2019-04-19 15:17                                                       ` Ludovic Courtès
2019-04-19 17:11                                                         ` pelzflorian (Florian Pelz)
2019-04-20  8:59                                                           ` pelzflorian (Florian Pelz)
2019-04-20  9:47                                                           ` Ludovic Courtès
2019-04-20 10:10                                                             ` pelzflorian (Florian Pelz)
2019-04-20 10:16                                                             ` Pierre Neidhardt
2019-04-20 10:39                                                               ` pelzflorian (Florian Pelz)
2019-04-20 11:21                                                                 ` Félicien Pillot
2019-04-20 12:30                                                                   ` Pierre Neidhardt
2019-04-20 12:37                                                                     ` Pierre Neidhardt
2019-04-21 19:57                                                                       ` Ludovic Courtès
2019-04-22  8:46                                                                         ` Pierre Neidhardt
2019-04-22 11:48                                                                       ` pelzflorian (Florian Pelz)
2019-04-22 18:34                                                                         ` pelzflorian (Florian Pelz)
2019-04-26  8:35                                                             ` pelzflorian (Florian Pelz)
2019-04-02  9:26                     ` pelzflorian (Florian Pelz)
2019-04-02 11:42                       ` pelzflorian (Florian Pelz)
2019-04-03  4:17                         ` pelzflorian (Florian Pelz)
2019-04-03  9:17                           ` pelzflorian (Florian Pelz)
2019-04-03  9:00                     ` Pierre Neidhardt
2019-04-07 16:10     ` Installer & locales Ludovic Courtès
2019-04-07 16:12     ` Installer & services Ludovic Courtès
2019-04-08  9:26       ` Ludovic Courtès
2019-04-01 19:34   ` Status update on 1.0 mikadoZero
2019-04-02  8:05     ` Ludovic Courtès
2019-03-28 13:46 ` Marius Bakke
2019-03-29 16:11   ` Ludovic Courtès
2019-03-29 18:56     ` Ricardo Wurmus
2019-03-31 20:52       ` ‘staging’ and GNOME updates Ludovic Courtès
2019-04-01 17:16         ` Efraim Flashner
2019-04-01 19:36           ` Ludovic Courtès
2019-04-10 16:53         ` Ricardo Wurmus
2019-04-10 21:13           ` Ludovic Courtès
2019-04-10 21:13           ` Ludovic Courtès
2019-04-11 19:33             ` Ricardo Wurmus
2019-04-13 17:46               ` Timothy Sample
2019-04-13 18:07                 ` Ricardo Wurmus
2019-04-15 12:13                   ` Ludovic Courtès
2019-04-15 12:34               ` Ludovic Courtès
2019-04-15 21:55                 ` Ludovic Courtès
2019-04-15 22:33                   ` Ricardo Wurmus
2019-04-16  4:59                     ` Timothy Sample
2019-04-16  9:31                       ` Ricardo Wurmus
2019-04-16 20:14                       ` Ludovic Courtès
2019-04-22 10:15                         ` Ludovic Courtès
2019-04-23  7:17                           ` Ricardo Wurmus
2019-04-23  7:20                             ` Ricardo Wurmus
2019-04-23 10:28                             ` Ludovic Courtès
2019-04-23 18:18                               ` Ricardo Wurmus
2019-04-24  4:10                                 ` Timothy Sample
2019-04-24  6:54                                   ` Ricardo Wurmus
2019-04-24 19:19                                     ` Timothy Sample
2019-04-25 12:57                                       ` Ricardo Wurmus
2019-04-25 15:33                                       ` Giovanni Biscuolo
2019-04-10 13:41       ` Status update on 1.0 Jonathan Brielmaier
2019-04-10 16:56         ` Ricardo Wurmus
2019-04-10 17:57           ` Jonathan Brielmaier
2019-04-10 19:05             ` Ricardo Wurmus
2019-04-17 12:49 ` Pierre Neidhardt
2019-04-17 13:38   ` TeX Live Ludovic Courtès
2019-04-17 14:04     ` Pierre Neidhardt
2019-04-18 14:39       ` Ricardo Wurmus

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871s2lkesq.fsf@gmail.com \
    --to=m.othacehe@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    --cc=mail@ambrevar.xyz \
    --cc=pelzflorian@pelzflorian.de \
    /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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.