diff options
| author | Rutherther <rutherther@ditigal.xyz> | 2026-01-03 15:36:00 +0100 |
|---|---|---|
| committer | Rutherther <rutherther@ditigal.xyz> | 2026-01-14 09:17:33 +0100 |
| commit | ab22501915fa57cf3a3f94dcc7fec86b433d85ad (patch) | |
| tree | 5008e84b52279284d7467ae78cc78b569a89e850 /gnu/services/base.scm | |
| parent | 84a018b3569a26fbb99d0c71fdbd2addb5686467 (diff) | |
install: Register agetty on primary console on AArch64.
This adds the possibility to parse /proc/consoles to find a primary console.
Then, on AArch64 this is used in the installation image. On AArch64, the boot
usually happens with chosen device tree that contains the serial console.
On x86_64, this does not happen so often, so we keep the installation iso
minimal there.
The primary console is chosen, but there is a fallback to any non-virtual one.
Virtual console (/dev/tty0) is skipped, because that one can point to any
console, like /dev/tty1 and so on. So it's not safe to register agetty on it.
* gnu/build/linux-boot.scm (read-linux-consoles): New variable.
* gnu/services/base.scm (default-serial-console): Use primary console as
fallback.
* gnu/system/install.scm (%installation-services): Add agetty tty for
consoles.
Change-Id: Iae01f7bc85b5ffdef2e52b1d0710889915b0f54a
Signed-off-by: Rutherther <rutherther@ditigal.xyz>
Diffstat (limited to 'gnu/services/base.scm')
| -rw-r--r-- | gnu/services/base.scm | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 4a4f1d17c18..850b651b9a3 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm | |||
| @@ -1060,6 +1060,9 @@ to use as the tty. This is primarily useful for headless systems." | |||
| 1060 | (with-imported-modules (source-module-closure | 1060 | (with-imported-modules (source-module-closure |
| 1061 | '((gnu build linux-boot))) ;for 'find-long-options' | 1061 | '((gnu build linux-boot))) ;for 'find-long-options' |
| 1062 | #~(begin | 1062 | #~(begin |
| 1063 | (use-modules (gnu build linux-boot) | ||
| 1064 | (srfi srfi-1)) | ||
| 1065 | |||
| 1063 | ;; console=device,options | 1066 | ;; console=device,options |
| 1064 | ;; device: can be tty0, ttyS0, lp0, ttyUSB0 (serial). | 1067 | ;; device: can be tty0, ttyS0, lp0, ttyUSB0 (serial). |
| 1065 | ;; options: BBBBPNF. P n|o|e, N number of bits, | 1068 | ;; options: BBBBPNF. P n|o|e, N number of bits, |
| @@ -1083,7 +1086,20 @@ to use as the tty. This is primarily useful for headless systems." | |||
| 1083 | (find-long-options "console" command))) | 1086 | (find-long-options "console" command))) |
| 1084 | (specs (append agetty-specs console-specs))) | 1087 | (specs (append agetty-specs console-specs))) |
| 1085 | (match specs | 1088 | (match specs |
| 1086 | (() #f) | 1089 | ;; Fallback to a physical console registered in /proc/consoles. |
| 1090 | (() (let* ((consoles (read-linux-consoles)) | ||
| 1091 | (chosen-console | ||
| 1092 | ;; Prioritize preferred, if none, choose any enabled. | ||
| 1093 | (or (find (lambda (c) | ||
| 1094 | (and (not (linux-console-virtual? c)) | ||
| 1095 | (linux-console-preferred? c))) | ||
| 1096 | consoles) | ||
| 1097 | (find (lambda (c) | ||
| 1098 | (and (not (linux-console-virtual? c)) | ||
| 1099 | (linux-console-enabled? c))) | ||
| 1100 | consoles)))) | ||
| 1101 | (and chosen-console | ||
| 1102 | (linux-console-device chosen-console)))) | ||
| 1087 | ((spec _ ...) | 1103 | ((spec _ ...) |
| 1088 | ;; Extract device name from first spec. | 1104 | ;; Extract device name from first spec. |
| 1089 | (match (string-tokenize spec not-comma) | 1105 | (match (string-tokenize spec not-comma) |
| @@ -1111,7 +1127,8 @@ to use as the tty. This is primarily useful for headless systems." | |||
| 1111 | (requirement (cons* 'user-processes 'host-name 'udev | 1127 | (requirement (cons* 'user-processes 'host-name 'udev |
| 1112 | shepherd-requirement)) | 1128 | shepherd-requirement)) |
| 1113 | 1129 | ||
| 1114 | (modules '((ice-9 match) (gnu build linux-boot))) | 1130 | (modules '((ice-9 match) (gnu build linux-boot) |
| 1131 | (srfi srfi-1))) | ||
| 1115 | (start | 1132 | (start |
| 1116 | (with-imported-modules (source-module-closure | 1133 | (with-imported-modules (source-module-closure |
| 1117 | '((gnu build linux-boot))) | 1134 | '((gnu build linux-boot))) |
