summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-11-03 17:57:51 +0100
committerLudovic Courtès <ludo@gnu.org>2022-11-15 12:16:43 +0100
commit514fedbf3966b7fbab31a6c63b4210ec8b5b0c9a (patch)
treea52de4c819000a1f8507567f4f43eebdc0fab63a /gnu
parent6b39c3afccbc2fa91746f379f46f6acfa47c8f62 (diff)
installer: Report known-unsupported PCI devices.
* gnu/installer/hardware.scm: New file. * gnu/local.mk (INSTALLER_MODULES): Add it. * po/guix/POTFILES.in: Add it. * gnu/installer.scm (installer-steps): Pass #:pci-database to the 'welcome' step procedure. * gnu/installer/newt.scm (welcome-page): Add #:pci-database and pass it to 'run-welcome-page'. * gnu/installer/newt/welcome.scm (check-hardware-support): Add #:pci-database. Enumerate unsupported PCI devices and run an error page when unsupported devices are found. (run-welcome-page): Add #:pci-database and pass it to 'check-hardware-support' and to the recursive call. * gnu/installer/record.scm (<installer>)[welcome-page]: Adjust comment. * doc/guix.texi (Hardware Considerations): Mention it.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/installer.scm6
-rw-r--r--gnu/installer/hardware.scm90
-rw-r--r--gnu/installer/newt.scm4
-rw-r--r--gnu/installer/newt/welcome.scm38
-rw-r--r--gnu/installer/record.scm2
-rw-r--r--gnu/local.mk1
6 files changed, 130 insertions, 11 deletions
diff --git a/gnu/installer.scm b/gnu/installer.scm
index df7625e05c1..e1b040088b4 100644
--- a/gnu/installer.scm
+++ b/gnu/installer.scm
@@ -46,6 +46,7 @@
46 #:use-module (gnu packages nano) 46 #:use-module (gnu packages nano)
47 #:use-module (gnu packages ncurses) 47 #:use-module (gnu packages ncurses)
48 #:use-module (gnu packages package-management) 48 #:use-module (gnu packages package-management)
49 #:use-module (gnu packages pciutils)
49 #:use-module (gnu packages tls) 50 #:use-module (gnu packages tls)
50 #:use-module (gnu packages xorg) 51 #:use-module (gnu packages xorg)
51 #:use-module (gnu system locale) 52 #:use-module (gnu system locale)
@@ -226,7 +227,9 @@ selected keymap."
226 (id 'welcome) 227 (id 'welcome)
227 (compute (lambda _ 228 (compute (lambda _
228 ((installer-welcome-page current-installer) 229 ((installer-welcome-page current-installer)
229 #$(local-file "installer/aux-files/logo.txt"))))) 230 #$(local-file "installer/aux-files/logo.txt")
231 #:pci-database
232 #$(file-append pciutils "/share/hwdata/pci.ids.gz")))))
230 233
231 ;; Ask the user to select a timezone under glibc format. 234 ;; Ask the user to select a timezone under glibc format.
232 (installer-step 235 (installer-step
@@ -358,6 +361,7 @@ selected keymap."
358 (with-extensions (list guile-gcrypt guile-newt 361 (with-extensions (list guile-gcrypt guile-newt
359 guile-parted guile-bytestructures 362 guile-parted guile-bytestructures
360 guile-json-3 guile-git guile-webutils 363 guile-json-3 guile-git guile-webutils
364 guile-zlib ;for (gnu build linux-modules)
361 (current-guix) gnutls) 365 (current-guix) gnutls)
362 (with-imported-modules `(,@(source-module-closure 366 (with-imported-modules `(,@(source-module-closure
363 `(,@modules 367 `(,@modules
diff --git a/gnu/installer/hardware.scm b/gnu/installer/hardware.scm
new file mode 100644
index 00000000000..cd1a1767d82
--- /dev/null
+++ b/gnu/installer/hardware.scm
@@ -0,0 +1,90 @@
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2022 Ludovic Courtès <ludo@gnu.org>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;;
15;;; You should have received a copy of the GNU General Public License
16;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
17
18(define-module (gnu installer hardware)
19 #:use-module (gnu build linux-modules)
20 #:use-module (guix i18n)
21 #:use-module (srfi srfi-1)
22 #:use-module (srfi srfi-71)
23 #:export (unsupported-pci-device?
24 pci-device-description))
25
26(define %unsupported-linux-modules
27 ;; List of Linux modules that are useless without non-free firmware.
28 ;;
29 ;; Currently only drivers for PCI devices are listed. USB devices such as
30 ;; "btintel" would require support to list USB devices and read the USB
31 ;; device ID database. Punt for now as this is usually less critical.
32 ;;
33 ;; This list is currently manually maintained based on information on
34 ;; non-free firmware available from
35 ;; <https://packages.debian.org/search?keywords=firmware&searchon=names&suite=stable&section=all>.
36 '(;; WiFi.
37 "brcmfmac"
38 "ipw2100"
39 "ipw2200"
40 "iwlwifi"
41 "mwl8k"
42 "rtl8188ee"
43 "rtl818x_pci"
44 "rtl8192ce"
45 "rtl8192de"
46 "rtl8192ee"
47
48 ;; Ethernet.
49 "bnx2"
50 "bnx2x"
51 "liquidio"
52
53 ;; Graphics.
54 "amdgpu"
55 "radeon"
56
57 ;; Multimedia.
58 "ivtv"))
59
60(define unsupported-pci-device?
61 ;; Arrange to load the module alias database only once.
62 (let ((aliases (delay (known-module-aliases))))
63 (lambda (device)
64 "Return true if DEVICE is known to not be supported by free software."
65 (any (lambda (module)
66 (member module %unsupported-linux-modules))
67 (matching-modules (pci-device-module-alias device)
68 (force aliases))))))
69
70(define (pci-device-description pci-database)
71 "Return a procedure that, given a PCI device, returns a string describing
72it."
73 (define (with-fallback lookup)
74 (lambda (vendor-id id)
75 (let ((vendor name (lookup vendor-id id)))
76 (values (or vendor (number->string vendor-id 16))
77 (or name (number->string id 16))))))
78
79 (define pci-lookup
80 (with-fallback (load-pci-device-database pci-database)))
81
82 (lambda (device)
83 (let ((vendor name (pci-lookup (pci-device-vendor device)
84 (pci-device-id device))))
85 (if (network-pci-device? device)
86 ;; TRANSLATORS: The two placeholders are the manufacturer
87 ;; and name of a PCI device.
88 (format #f (G_ "~a ~a (networking device)")
89 vendor name)
90 (string-append vendor " " name)))))
diff --git a/gnu/installer/newt.scm b/gnu/installer/newt.scm
index c486788ed44..798ff53af25 100644
--- a/gnu/installer/newt.scm
+++ b/gnu/installer/newt.scm
@@ -172,8 +172,8 @@ report it by email to ~a.") uploaded-name %guix-bug-report-address)
172(define (timezone-page zonetab) 172(define (timezone-page zonetab)
173 (run-timezone-page zonetab)) 173 (run-timezone-page zonetab))
174 174
175(define (welcome-page logo) 175(define* (welcome-page logo #:key pci-database)
176 (run-welcome-page logo)) 176 (run-welcome-page logo #:pci-database pci-database))
177 177
178(define (menu-page steps) 178(define (menu-page steps)
179 (run-menu-page steps)) 179 (run-menu-page steps))
diff --git a/gnu/installer/newt/welcome.scm b/gnu/installer/newt/welcome.scm
index 1c7372b3be7..f821374cb78 100644
--- a/gnu/installer/newt/welcome.scm
+++ b/gnu/installer/newt/welcome.scm
@@ -19,8 +19,10 @@
19 19
20(define-module (gnu installer newt welcome) 20(define-module (gnu installer newt welcome)
21 #:use-module ((gnu build linux-modules) 21 #:use-module ((gnu build linux-modules)
22 #:select (modules-loaded)) 22 #:select (modules-loaded
23 pci-devices))
23 #:use-module (gnu installer dump) 24 #:use-module (gnu installer dump)
25 #:use-module (gnu installer hardware)
24 #:use-module (gnu installer steps) 26 #:use-module (gnu installer steps)
25 #:use-module (gnu installer utils) 27 #:use-module (gnu installer utils)
26 #:use-module (gnu installer newt page) 28 #:use-module (gnu installer newt page)
@@ -30,6 +32,8 @@
30 #:use-module (srfi srfi-1) 32 #:use-module (srfi srfi-1)
31 #:use-module (srfi srfi-34) 33 #:use-module (srfi srfi-34)
32 #:use-module (srfi srfi-35) 34 #:use-module (srfi srfi-35)
35 #:use-module (srfi srfi-71)
36 #:use-module (ice-9 format)
33 #:use-module (ice-9 match) 37 #:use-module (ice-9 match)
34 #:use-module (ice-9 receive) 38 #:use-module (ice-9 receive)
35 #:use-module (newt) 39 #:use-module (newt)
@@ -121,7 +125,7 @@ we want this page to occupy all the screen space available."
121 (lambda () 125 (lambda ()
122 (destroy-form-and-pop form)))))) 126 (destroy-form-and-pop form))))))
123 127
124(define (check-hardware-support) 128(define (check-hardware-support pci-database)
125 "Warn about unsupported devices." 129 "Warn about unsupported devices."
126 (when (member "uvesafb" (modules-loaded)) 130 (when (member "uvesafb" (modules-loaded))
127 (run-error-page (G_ "\ 131 (run-error-page (G_ "\
@@ -129,9 +133,28 @@ This may be a false alarm, but possibly your graphics hardware does not
129work well with only free software. Expect trouble. If after installation, 133work well with only free software. Expect trouble. If after installation,
130the system does not boot, perhaps you will need to add nomodeset to the 134the system does not boot, perhaps you will need to add nomodeset to the
131kernel arguments and need to configure the uvesafb kernel module.") 135kernel arguments and need to configure the uvesafb kernel module.")
132 (G_ "Pre-install warning")))) 136 (G_ "Pre-install warning")))
133 137
134(define (run-welcome-page logo) 138 (let ((devices (pci-devices)))
139 (match (filter unsupported-pci-device? devices)
140 (() ;no unsupported device
141 #t)
142 (unsupported
143 (run-error-page (format #f (G_ "\
144Devices not supported by free software were found on your computer:
145
146~{ - ~a~%~}
147Unfortunately, it means those devices will not be usable.
148
149To address it, we recommend choosing hardware that respects your freedom as a \
150user--hardware for which free drivers and firmware exist. See \"Hardware \
151Considerations\" in the manual for more information.")
152 (map (pci-device-description pci-database)
153 unsupported))
154 (G_ "Hardware support warning")
155 #:width 76)))))
156
157(define* (run-welcome-page logo #:key pci-database)
135 "Run a welcome page with the given textual LOGO displayed at the center of 158 "Run a welcome page with the given textual LOGO displayed at the center of
136the page. Ask the user to choose between manual installation, graphical 159the page. Ask the user to choose between manual installation, graphical
137installation and reboot." 160installation and reboot."
@@ -161,15 +184,16 @@ Documentation is accessible at any time by pressing Ctrl-Alt-F2.")
161 #:listbox-items 184 #:listbox-items
162 `((,(G_ "Graphical install using a terminal based interface") 185 `((,(G_ "Graphical install using a terminal based interface")
163 . 186 .
164 ,check-hardware-support) 187 ,(lambda ()
188 (check-hardware-support pci-database)))
165 (,(G_ "Install using the shell based process") 189 (,(G_ "Install using the shell based process")
166 . 190 .
167 ,(lambda () 191 ,(lambda ()
168 (check-hardware-support) 192 (check-hardware-support pci-database)
169 ;; Switch to TTY3, where a root shell is available for shell based 193 ;; Switch to TTY3, where a root shell is available for shell based
170 ;; install. The other root TTY's would have been ok too. 194 ;; install. The other root TTY's would have been ok too.
171 (system* "chvt" "3") 195 (system* "chvt" "3")
172 (run-welcome-page logo))) 196 (run-welcome-page logo #:pci-database pci-database)))
173 (,(G_ "Reboot") 197 (,(G_ "Reboot")
174 . 198 .
175 ,(lambda () 199 ,(lambda ()
diff --git a/gnu/installer/record.scm b/gnu/installer/record.scm
index 20519a26c3f..5e0264682fc 100644
--- a/gnu/installer/record.scm
+++ b/gnu/installer/record.scm
@@ -89,7 +89,7 @@
89 (partition-page installer-partition-page) 89 (partition-page installer-partition-page)
90 ;; procedure void -> void 90 ;; procedure void -> void
91 (services-page installer-services-page) 91 (services-page installer-services-page)
92 ;; procedure (logo) -> void 92 ;; procedure (logo #:pci-database) -> void
93 (welcome-page installer-welcome-page) 93 (welcome-page installer-welcome-page)
94 ;; procedure (menu-proc) -> void 94 ;; procedure (menu-proc) -> void
95 (parameters-menu installer-parameters-menu) 95 (parameters-menu installer-parameters-menu)
diff --git a/gnu/local.mk b/gnu/local.mk
index cae972cfe36..71472f84104 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -787,6 +787,7 @@ INSTALLER_MODULES = \
787 %D%/installer/connman.scm \ 787 %D%/installer/connman.scm \
788 %D%/installer/dump.scm \ 788 %D%/installer/dump.scm \
789 %D%/installer/final.scm \ 789 %D%/installer/final.scm \
790 %D%/installer/hardware.scm \
790 %D%/installer/hostname.scm \ 791 %D%/installer/hostname.scm \
791 %D%/installer/keymap.scm \ 792 %D%/installer/keymap.scm \
792 %D%/installer/locale.scm \ 793 %D%/installer/locale.scm \