Commit | Line | Data |
---|---|---|
fc91c17a | 1 | ;;; GNU Guix --- Functional package management for GNU |
5c215c9e | 2 | ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> |
b2a5fa59 | 3 | ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> |
f0fbf2c1 | 4 | ;;; Copyright © 2016 Andreas Enge <andreas@enge.fr> |
c80cd4df | 5 | ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com> |
b24f561c | 6 | ;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr> |
557e6820 | 7 | ;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de> |
4170af49 | 8 | ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> |
fc91c17a LC |
9 | ;;; |
10 | ;;; This file is part of GNU Guix. | |
11 | ;;; | |
12 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
13 | ;;; under the terms of the GNU General Public License as published by | |
14 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
15 | ;;; your option) any later version. | |
16 | ;;; | |
17 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
18 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | ;;; GNU General Public License for more details. | |
21 | ;;; | |
22 | ;;; You should have received a copy of the GNU General Public License | |
23 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
24 | ||
25 | (define-module (gnu system install) | |
26 | #:use-module (gnu) | |
d0f3a672 | 27 | #:use-module (gnu system) |
ceb39527 | 28 | #:use-module (gnu bootloader u-boot) |
fc91c17a | 29 | #:use-module (guix gexp) |
e87f0591 | 30 | #:use-module (guix store) |
fc91c17a | 31 | #:use-module (guix monads) |
557e6820 | 32 | #:use-module (guix modules) |
0134ebc5 | 33 | #:use-module ((guix packages) #:select (package-version)) |
83a17b62 | 34 | #:use-module ((guix store) #:select (%store-prefix)) |
a49d633c | 35 | #:use-module (gnu installer) |
ea5d9bf9 | 36 | #:use-module (gnu system locale) |
8361817b | 37 | #:use-module (gnu services avahi) |
d0f3a672 MO |
38 | #:use-module (gnu services dbus) |
39 | #:use-module (gnu services networking) | |
0190c1c0 | 40 | #:use-module (gnu services shepherd) |
c80cd4df | 41 | #:use-module (gnu services ssh) |
db84467a | 42 | #:use-module (gnu packages admin) |
f4bdfe73 | 43 | #:use-module (gnu packages bash) |
862e38d5 | 44 | #:use-module (gnu packages bootloaders) |
9ce09a76 | 45 | #:use-module (gnu packages certs) |
4170af49 | 46 | #:use-module (gnu packages compression) |
d0f3a672 MO |
47 | #:use-module (gnu packages fonts) |
48 | #:use-module (gnu packages fontutils) | |
af4a761e | 49 | #:use-module (gnu packages guile) |
fc91c17a | 50 | #:use-module (gnu packages linux) |
fc91c17a | 51 | #:use-module (gnu packages package-management) |
fc91c17a | 52 | #:use-module (gnu packages texinfo) |
557e6820 | 53 | #:use-module (gnu packages xorg) |
e1fbc32a LC |
54 | #:use-module (ice-9 match) |
55 | #:use-module (srfi srfi-26) | |
ceb39527 | 56 | #:export (installation-os |
c55c6985 | 57 | a20-olinuxino-lime-installation-os |
4b9e9abb | 58 | a20-olinuxino-lime2-emmc-installation-os |
a7bb327e | 59 | a20-olinuxino-micro-installation-os |
e830c9d0 | 60 | bananapi-m2-ultra-installation-os |
84ee3378 | 61 | beaglebone-black-installation-os |
07ca9045 | 62 | mx6cuboxi-installation-os |
fd5536e3 | 63 | nintendo-nes-classic-edition-installation-os |
1b960787 | 64 | novena-installation-os |
545ff7b7 | 65 | firefly-rk3399-installation-os |
9f7d6665 | 66 | pine64-plus-installation-os |
74e35e8c | 67 | pinebook-installation-os |
2fce14af | 68 | rock64-installation-os |
fa747018 | 69 | rockpro64-installation-os |
6fe16577 | 70 | rk3399-puma-installation-os |
4ce4fc50 DM |
71 | wandboard-installation-os |
72 | os-with-u-boot)) | |
fc91c17a LC |
73 | |
74 | ;;; Commentary: | |
75 | ;;; | |
76 | ;;; This module provides an 'operating-system' definition for use on images | |
77 | ;;; for USB sticks etc., for the installation of the GNU system. | |
78 | ;;; | |
79 | ;;; Code: | |
80 | ||
9d3fb6c7 | 81 | \f |
126d4c12 LC |
82 | ;;; |
83 | ;;; Documentation service. | |
84 | ;;; | |
85 | ||
c7dc6042 LC |
86 | (define %installation-node-names |
87 | ;; Translated name of the "System Installation" node of the manual. Ideally | |
88 | ;; we'd extract it from the 'guix-manual' gettext domain, but that one is | |
89 | ;; usually not available at run time, hence this hack. | |
90 | '(("de" . "Systeminstallation") | |
91 | ("en" . "System Installation") | |
55111549 | 92 | ("es" . "Instalación del sistema") |
7059cfc8 LC |
93 | ("fr" . "Installation du système") |
94 | ("ru" . "Установка системы"))) | |
c7dc6042 | 95 | |
126d4c12 | 96 | (define (log-to-info tty user) |
fc91c17a LC |
97 | "Return a script that spawns the Info reader on the right section of the |
98 | manual." | |
ce8a6dfc | 99 | (program-file "log-to-info" |
c7dc6042 LC |
100 | #~(let* ((tty (open-file #$(string-append "/dev/" tty) |
101 | "r0+")) | |
102 | (locale (cadr (command-line))) | |
103 | (language (string-take locale | |
104 | (string-index locale #\_))) | |
105 | (infodir "/run/current-system/profile/share/info") | |
106 | (per-lang (string-append infodir "/guix." language | |
107 | ".info.gz")) | |
108 | (file (if (file-exists? per-lang) | |
109 | per-lang | |
110 | (string-append infodir "/guix.info"))) | |
111 | (node (or (assoc-ref '#$%installation-node-names | |
112 | language) | |
113 | "System Installation"))) | |
126d4c12 LC |
114 | (redirect-port tty (current-output-port)) |
115 | (redirect-port tty (current-error-port)) | |
116 | (redirect-port tty (current-input-port)) | |
117 | ||
118 | (let ((pw (getpwnam #$user))) | |
119 | (setgid (passwd:gid pw)) | |
120 | (setuid (passwd:uid pw))) | |
121 | ||
dd6b28d1 LC |
122 | ;; 'gunzip' is needed to decompress the doc. |
123 | (setenv "PATH" (string-append #$gzip "/bin")) | |
124 | ||
c7dc6042 LC |
125 | ;; Change this process' locale so that command-line |
126 | ;; arguments to 'info' are properly encoded. | |
127 | (catch #t | |
128 | (lambda () | |
129 | (setlocale LC_ALL locale) | |
130 | (setenv "LC_ALL" locale)) | |
131 | (lambda _ | |
132 | ;; Sometimes LOCALE itself is not available. In that | |
133 | ;; case pick the one UTF-8 locale that's known to work | |
134 | ;; instead of failing. | |
135 | (setlocale LC_ALL "en_US.utf8") | |
136 | (setenv "LC_ALL" "en_US.utf8"))) | |
137 | ||
138 | (execl #$(file-append info-reader "/bin/info") | |
139 | "info" "-d" infodir "-f" file "-n" node)))) | |
fc91c17a | 140 | |
126d4c12 LC |
141 | (define (documentation-shepherd-service tty) |
142 | (list (shepherd-service | |
143 | (provision (list (symbol-append 'term- (string->symbol tty)))) | |
144 | (requirement '(user-processes host-name udev virtual-terminal)) | |
c7dc6042 LC |
145 | (start #~(lambda* (#:optional (locale "en_US.utf8")) |
146 | (fork+exec-command | |
147 | (list #$(log-to-info tty "documentation") locale) | |
148 | #:environment-variables | |
149 | `("GUIX_LOCPATH=/run/current-system/locale" | |
150 | "TERM=linux")))) | |
126d4c12 LC |
151 | (stop #~(make-kill-destructor))))) |
152 | ||
153 | (define %documentation-users | |
154 | ;; User account for the Info viewer. | |
155 | (list (user-account (name "documentation") | |
156 | (system? #t) | |
157 | (group "nogroup") | |
158 | (home-directory "/var/empty")))) | |
159 | ||
160 | (define documentation-service-type | |
161 | ;; Documentation viewer service. | |
162 | (service-type (name 'documentation) | |
163 | (extensions | |
164 | (list (service-extension shepherd-root-service-type | |
165 | documentation-shepherd-service) | |
166 | (service-extension account-service-type | |
167 | (const %documentation-users)))) | |
168 | (description "Run the Info reader on a tty."))) | |
169 | ||
170 | \f | |
83a17b62 LC |
171 | (define %backing-directory |
172 | ;; Sub-directory used as the backing store for copy-on-write. | |
173 | "/tmp/guix-inst") | |
174 | ||
0adfe95a | 175 | (define cow-store-service-type |
d4053c71 | 176 | (shepherd-service-type |
00184239 | 177 | 'cow-store |
0adfe95a | 178 | (lambda _ |
d4053c71 | 179 | (shepherd-service |
0adfe95a LC |
180 | (requirement '(root-file-system user-processes)) |
181 | (provision '(cow-store)) | |
182 | (documentation | |
183 | "Make the store copy-on-write, with writes going to \ | |
184 | the given target.") | |
185 | ||
186 | ;; This is meant to be explicitly started by the user. | |
187 | (auto-start? #f) | |
188 | ||
22827396 MO |
189 | (modules `((gnu build install) |
190 | ,@%default-modules)) | |
191 | (start | |
192 | (with-imported-modules (source-module-closure | |
193 | '((gnu build install))) | |
194 | #~(case-lambda | |
195 | ((target) | |
196 | (mount-cow-store target #$%backing-directory) | |
197 | target) | |
198 | (else | |
199 | ;; Do nothing, and mark the service as stopped. | |
200 | #f)))) | |
0adfe95a LC |
201 | (stop #~(lambda (target) |
202 | ;; Delete the temporary directory, but leave everything | |
203 | ;; mounted as there may still be processes using it since | |
6c445817 | 204 | ;; 'user-processes' doesn't depend on us. The 'user-file-systems' |
0adfe95a LC |
205 | ;; service will unmount TARGET eventually. |
206 | (delete-file-recursively | |
207 | (string-append target #$%backing-directory)))))))) | |
208 | ||
83a17b62 LC |
209 | (define (cow-store-service) |
210 | "Return a service that makes the store copy-on-write, such that writes go to | |
211 | the user's target storage device rather than on the RAM disk." | |
212 | ;; See <http://bugs.gnu.org/18061> for the initial report. | |
0adfe95a LC |
213 | (service cow-store-service-type 'mooooh!)) |
214 | ||
215 | ||
216 | (define (/etc/configuration-files _) | |
217 | "Return a list of tuples representing configuration templates to add to | |
218 | /etc." | |
0adfe95a LC |
219 | (define directory |
220 | (computed-file "configuration-templates" | |
4ee96a79 LC |
221 | (with-imported-modules '((guix build utils)) |
222 | #~(begin | |
223 | (mkdir #$output) | |
224 | (for-each (lambda (file target) | |
225 | (copy-file file | |
226 | (string-append #$output "/" | |
227 | target))) | |
33d1c970 LC |
228 | '(#$(local-file "examples/bare-bones.tmpl") |
229 | #$(local-file "examples/beaglebone-black.tmpl") | |
230 | #$(local-file "examples/desktop.tmpl") | |
231 | #$(local-file "examples/lightweight-desktop.tmpl")) | |
4ee96a79 | 232 | '("bare-bones.scm" |
9f1e39d1 | 233 | "beaglebone-black.scm" |
4ee96a79 LC |
234 | "desktop.scm" |
235 | "lightweight-desktop.scm")) | |
236 | #t)))) | |
0adfe95a LC |
237 | |
238 | `(("configuration" ,directory))) | |
239 | ||
240 | (define configuration-template-service-type | |
241 | (service-type (name 'configuration-template) | |
242 | (extensions | |
243 | (list (service-extension etc-service-type | |
244 | /etc/configuration-files))))) | |
245 | ||
246 | (define %configuration-template-service | |
247 | (service configuration-template-service-type #t)) | |
be1c2c54 | 248 | |
1dac8566 | 249 | |
61ff0a3a LC |
250 | (define %nscd-minimal-caches |
251 | ;; Minimal in-memory caching policy for nscd. | |
252 | (list (nscd-cache (database 'hosts) | |
253 | (positive-time-to-live (* 3600 12)) | |
c96ba2cf LC |
254 | |
255 | ;; Do not cache lookup failures at all since they are | |
256 | ;; quite likely (for instance when someone tries to ping a | |
257 | ;; host before networking is functional.) | |
258 | (negative-time-to-live 0) | |
259 | ||
61ff0a3a LC |
260 | (persistent? #f) |
261 | (max-database-size (* 5 (expt 2 20)))))) ;5 MiB | |
262 | ||
557e6820 FP |
263 | \f |
264 | ;; These define a service to load the uvesafb kernel module with the | |
265 | ;; appropriate options. The GUI installer needs it when the machine does not | |
266 | ;; support Kernel Mode Setting. Otherwise kmscon is missing /dev/fb0. | |
267 | (define (uvesafb-shepherd-service _) | |
268 | (list (shepherd-service | |
80dbad18 FP |
269 | (documentation "Load the uvesafb kernel module if needed.") |
270 | (provision '(maybe-uvesafb)) | |
557e6820 FP |
271 | (requirement '(file-systems)) |
272 | (start #~(lambda () | |
273 | ;; uvesafb is only supported on x86 and x86_64. | |
274 | (or (not (and (string-suffix? "linux-gnu" %host-type) | |
275 | (or (string-prefix? "x86_64" %host-type) | |
276 | (string-prefix? "i686" %host-type)))) | |
0ad60b2a | 277 | (file-exists? "/dev/fb0") |
557e6820 FP |
278 | (invoke #+(file-append kmod "/bin/modprobe") |
279 | "uvesafb" | |
280 | (string-append "v86d=" #$v86d "/sbin/v86d") | |
281 | "mode_option=1024x768")))) | |
282 | (respawn? #f) | |
283 | (one-shot? #t)))) | |
284 | ||
285 | (define uvesafb-service-type | |
286 | (service-type | |
287 | (name 'uvesafb) | |
288 | (extensions | |
289 | (list (service-extension shepherd-root-service-type | |
290 | uvesafb-shepherd-service))) | |
291 | (description | |
292 | "Load the @code{uvesafb} kernel module with the right options.") | |
293 | (default-value #t))) | |
294 | ||
58b21e1e LC |
295 | (define %installation-services |
296 | ;; List of services of the installation system. | |
a7961746 | 297 | (let ((motd (plain-file "motd" " |
6fb6dd13 | 298 | \x1b[1;37mWelcome to the installation of GNU Guix!\x1b[0m |
a7961746 | 299 | |
5a663d87 LC |
300 | \x1b[2m\ |
301 | Using this shell, you can carry out the installation process \"manually.\" | |
302 | Access documentation at any time by pressing Alt-F2.\x1b[0m | |
a7961746 MO |
303 | "))) |
304 | (define (normal-tty tty) | |
305 | (mingetty-service (mingetty-configuration (tty tty) | |
306 | (auto-login "root") | |
307 | (login-pause? #t)))) | |
308 | ||
309 | (define bare-bones-os | |
310 | (load "examples/bare-bones.tmpl")) | |
311 | ||
312 | (list (service virtual-terminal-service-type) | |
313 | ||
314 | (service kmscon-service-type | |
315 | (kmscon-configuration | |
316 | (virtual-terminal "tty1") | |
a49d633c | 317 | (login-program (installer-program)))) |
a7961746 MO |
318 | |
319 | (login-service (login-configuration | |
320 | (motd motd))) | |
321 | ||
322 | ;; Documentation. The manual is in UTF-8, but | |
323 | ;; 'console-font-service' sets up Unicode support and loads a font | |
324 | ;; with all the useful glyphs like em dash and quotation marks. | |
126d4c12 | 325 | (service documentation-service-type "tty2") |
a7961746 MO |
326 | |
327 | ;; Documentation add-on. | |
328 | %configuration-template-service | |
329 | ||
330 | ;; A bunch of 'root' ttys. | |
331 | (normal-tty "tty3") | |
332 | (normal-tty "tty4") | |
333 | (normal-tty "tty5") | |
334 | (normal-tty "tty6") | |
335 | ||
336 | ;; The usual services. | |
337 | (syslog-service) | |
338 | ||
8361817b MO |
339 | ;; Use the Avahi daemon to discover substitute servers on the local |
340 | ;; network. It can be faster than fetching from remote servers. | |
341 | (service avahi-service-type) | |
342 | ||
3a8bfebe TGR |
343 | ;; The build daemon. Register the default substitute server key(s) |
344 | ;; as trusted to allow the installation process to use substitutes by | |
a7961746 MO |
345 | ;; default. |
346 | (service guix-service-type | |
347 | (guix-configuration (authorize-key? #t))) | |
348 | ||
349 | ;; Start udev so that useful device nodes are available. | |
350 | ;; Use device-mapper rules for cryptsetup & co; enable the CRDA for | |
351 | ;; regulations-compliant WiFi access. | |
352 | (udev-service #:rules (list lvm2 crda)) | |
353 | ||
354 | ;; Add the 'cow-store' service, which users have to start manually | |
355 | ;; since it takes the installation directory as an argument. | |
356 | (cow-store-service) | |
357 | ||
13fd0a30 | 358 | ;; Install Unicode support and a suitable font. |
a7961746 | 359 | (service console-font-service-type |
13fd0a30 LC |
360 | (map (match-lambda |
361 | ("tty2" | |
362 | ;; Use a font that contains characters such as | |
363 | ;; curly quotes as found in the manual. | |
364 | '("tty2" . "LatGrkCyr-8x16")) | |
365 | (tty | |
366 | ;; Use a font that doesn't have more than 256 | |
367 | ;; glyphs so that we can use colors with varying | |
368 | ;; brightness levels (see note in setfont(8)). | |
369 | `(,tty . "lat9u-16"))) | |
a7961746 MO |
370 | '("tty1" "tty2" "tty3" "tty4" "tty5" "tty6"))) |
371 | ||
372 | ;; To facilitate copy/paste. | |
373 | (service gpm-service-type) | |
374 | ||
375 | ;; Add an SSH server to facilitate remote installs. | |
376 | (service openssh-service-type | |
377 | (openssh-configuration | |
378 | (port-number 22) | |
379 | (permit-root-login #t) | |
380 | ;; The root account is passwordless, so make sure | |
381 | ;; a password is set before allowing logins. | |
382 | (allow-empty-passwords? #f) | |
383 | (password-authentication? #t) | |
384 | ||
385 | ;; Don't start it upfront. | |
386 | (%auto-start? #f))) | |
387 | ||
388 | ;; Since this is running on a USB stick with a overlayfs as the root | |
389 | ;; file system, use an appropriate cache configuration. | |
390 | (nscd-service (nscd-configuration | |
391 | (caches %nscd-minimal-caches))) | |
392 | ||
393 | ;; Having /bin/sh is a good idea. In particular it allows Tramp | |
394 | ;; connections to this system to work. | |
395 | (service special-files-service-type | |
dfc8ccbf | 396 | `(("/bin/sh" ,(file-append bash "/bin/sh")))) |
a7961746 MO |
397 | |
398 | ;; Loopback device, needed by OpenSSH notably. | |
399 | (service static-networking-service-type | |
400 | (list (static-networking (interface "lo") | |
401 | (ip "127.0.0.1") | |
402 | (requirement '()) | |
403 | (provision '(loopback))))) | |
404 | ||
405 | (service wpa-supplicant-service-type) | |
406 | (dbus-service) | |
407 | (service connman-service-type | |
408 | (connman-configuration | |
409 | (disable-vpn? #t))) | |
410 | ||
411 | ;; Keep a reference to BARE-BONES-OS to make sure it can be | |
412 | ;; installed without downloading/building anything. Also keep the | |
413 | ;; things needed by 'profile-derivation' to minimize the amount of | |
414 | ;; download. | |
415 | (service gc-root-service-type | |
ea5d9bf9 MO |
416 | (append |
417 | (list bare-bones-os | |
418 | glibc-utf8-locales | |
419 | texinfo | |
420 | guile-3.0) | |
421 | %default-locale-libcs)) | |
557e6820 FP |
422 | |
423 | ;; Machines without Kernel Mode Setting (those with many old and | |
424 | ;; current AMD GPUs, SiS GPUs, ...) need uvesafb to show the GUI | |
425 | ;; installer. Some may also need a kernel parameter like nomodeset | |
426 | ;; or vga=793, but we leave that for the user to specify in GRUB. | |
427 | (service uvesafb-service-type)))) | |
fc91c17a LC |
428 | |
429 | (define %issue | |
430 | ;; Greeting. | |
431 | " | |
8638362f | 432 | \x1b[1;37mThis is an installation image of the GNU system. Welcome.\x1b[0m |
fc91c17a | 433 | |
8638362f | 434 | \x1b[1;33mUse Alt-F2 for documentation.\x1b[0m |
fc91c17a LC |
435 | ") |
436 | ||
437 | (define installation-os | |
438 | ;; The operating system used on installation images for USB sticks etc. | |
439 | (operating-system | |
440 | (host-name "gnu") | |
441 | (timezone "Europe/Paris") | |
9cd0dfaa | 442 | (locale "en_US.utf8") |
8361817b | 443 | (name-service-switch %mdns-host-lookup-nss) |
fdfdecdb TGR |
444 | (bootloader (bootloader-configuration |
445 | (bootloader grub-bootloader) | |
446 | (target "/dev/sda"))) | |
0134ebc5 LC |
447 | (label (string-append "GNU Guix installation " |
448 | (package-version guix))) | |
449 | ||
34d436a4 FP |
450 | ;; XXX: The AMD Radeon driver is reportedly broken, which makes kmscon |
451 | ;; non-functional: | |
452 | ;; <https://lists.gnu.org/archive/html/guix-devel/2019-03/msg00441.html>. | |
453 | ;; Thus, blacklist it. | |
454 | (kernel-arguments '("quiet" "modprobe.blacklist=radeon")) | |
455 | ||
fc91c17a LC |
456 | (file-systems |
457 | ;; Note: the disk image build code overrides this root file system with | |
458 | ;; the appropriate one. | |
ee03b75d LC |
459 | (cons* (file-system |
460 | (mount-point "/") | |
59e80445 | 461 | (device (file-system-label "Guix_image")) |
ee03b75d LC |
462 | (type "ext4")) |
463 | ||
d9565f7d HG |
464 | ;; Make /tmp a tmpfs instead of keeping the overlayfs. This |
465 | ;; originally was used for unionfs because FUSE creates | |
466 | ;; '.fuse_hiddenXYZ' files for each open file, and this confuses | |
467 | ;; Guix's test suite, for instance (see | |
468 | ;; <http://bugs.gnu.org/23056>). We keep this for overlayfs to be | |
795ec760 | 469 | ;; on the safe side. |
ee03b75d LC |
470 | (file-system |
471 | (mount-point "/tmp") | |
472 | (device "none") | |
ee03b75d LC |
473 | (type "tmpfs") |
474 | (check? #f)) | |
475 | ||
0feefb53 LC |
476 | ;; XXX: This should be %BASE-FILE-SYSTEMS but we don't need |
477 | ;; elogind's cgroup file systems. | |
478 | (list %pseudo-terminal-file-system | |
479 | %shared-memory-file-system | |
f94835a9 | 480 | %efivars-file-system |
0feefb53 | 481 | %immutable-store))) |
fc91c17a | 482 | |
a7961746 MO |
483 | (users (list (user-account |
484 | (name "guest") | |
485 | (group "users") | |
486 | (supplementary-groups '("wheel")) ; allow use of sudo | |
487 | (password "") | |
cf848cc0 | 488 | (comment "Guest of GNU")))) |
fc91c17a LC |
489 | |
490 | (issue %issue) | |
58b21e1e | 491 | (services %installation-services) |
fc91c17a | 492 | |
903ae630 LC |
493 | ;; We don't need setuid programs, except for 'passwd', which can be handy |
494 | ;; if one is to allow remote SSH login to the machine being installed. | |
495 | (setuid-programs (list (file-append shadow "/bin/passwd"))) | |
fc91c17a LC |
496 | |
497 | (pam-services | |
498 | ;; Explicitly allow for empty passwords. | |
499 | (base-pam-services #:allow-empty-passwords? #t)) | |
500 | ||
4170af49 EF |
501 | (packages (append |
502 | (list glibc ; for 'tzselect' & co. | |
503 | fontconfig | |
504 | font-dejavu font-gnu-unifont | |
505 | grub ; mostly so xrefs to its manual work | |
506 | nss-certs) ; To access HTTPS, use git, etc. | |
507 | %base-packages-disk-utilities | |
508 | %base-packages)))) | |
fc91c17a | 509 | |
4ce4fc50 DM |
510 | (define* (os-with-u-boot os board #:key (bootloader-target "/dev/mmcblk0") |
511 | (triplet "arm-linux-gnueabihf")) | |
512 | "Given OS, amend it with the u-boot bootloader for BOARD, | |
513 | installed to BOOTLOADER-TARGET (a drive), compiled for TRIPLET. | |
514 | ||
515 | If you want a serial console, make sure to specify one in your | |
516 | operating-system's kernel-arguments (\"console=ttyS0\" or similar)." | |
517 | (operating-system (inherit os) | |
518 | (bootloader (bootloader-configuration | |
519 | (bootloader (bootloader (inherit u-boot-bootloader) | |
520 | (package (make-u-boot-package board triplet)))) | |
521 | (target bootloader-target))))) | |
522 | ||
fccdc8c8 DM |
523 | (define* (embedded-installation-os bootloader bootloader-target tty |
524 | #:key (extra-modules '())) | |
525 | "Return an installation os for embedded systems. | |
526 | The initrd gets the extra modules EXTRA-MODULES. | |
527 | A getty is provided on TTY. | |
528 | The bootloader BOOTLOADER is installed to BOOTLOADER-TARGET." | |
ceb39527 MO |
529 | (operating-system |
530 | (inherit installation-os) | |
531 | (bootloader (bootloader-configuration | |
fccdc8c8 DM |
532 | (bootloader bootloader) |
533 | (target bootloader-target))) | |
ceb39527 | 534 | (kernel linux-libre) |
5a9902c8 DM |
535 | (kernel-arguments |
536 | (cons (string-append "console=" tty) | |
537 | (operating-system-user-kernel-arguments installation-os))) | |
bc499b11 | 538 | (initrd-modules (append extra-modules %base-initrd-modules)))) |
ceb39527 | 539 | |
fccdc8c8 DM |
540 | (define beaglebone-black-installation-os |
541 | (embedded-installation-os u-boot-beaglebone-black-bootloader | |
542 | "/dev/sda" | |
543 | "ttyO0" | |
544 | #:extra-modules | |
545 | ;; This module is required to mount the sd card. | |
546 | '("omap_hsmmc"))) | |
547 | ||
548 | ||
0db22b32 | 549 | (define a20-olinuxino-lime-installation-os |
c55c6985 DM |
550 | (embedded-installation-os u-boot-a20-olinuxino-lime-bootloader |
551 | "/dev/mmcblk0" ; SD card storage | |
552 | "ttyS0")) | |
553 | ||
4b9e9abb | 554 | (define a20-olinuxino-lime2-emmc-installation-os |
fccdc8c8 DM |
555 | (embedded-installation-os u-boot-a20-olinuxino-lime2-bootloader |
556 | "/dev/mmcblk1" ; eMMC storage | |
557 | "ttyS0")) | |
a7bb327e DM |
558 | |
559 | (define a20-olinuxino-micro-installation-os | |
fccdc8c8 DM |
560 | (embedded-installation-os u-boot-a20-olinuxino-micro-bootloader |
561 | "/dev/mmcblk0" ; SD card storage | |
562 | "ttyS0")) | |
4b9e9abb | 563 | |
e830c9d0 DM |
564 | (define bananapi-m2-ultra-installation-os |
565 | (embedded-installation-os u-boot-bananapi-m2-ultra-bootloader | |
fccdc8c8 DM |
566 | "/dev/mmcblk1" ; eMMC storage |
567 | "ttyS0")) | |
30aeb846 | 568 | |
545ff7b7 VC |
569 | (define firefly-rk3399-installation-os |
570 | (embedded-installation-os u-boot-firefly-rk3399-bootloader | |
571 | "/dev/mmcblk0" ; SD card/eMMC (SD priority) storage | |
572 | "ttyS2")) ; UART2 connected on the Pi2 bus | |
573 | ||
07ca9045 VC |
574 | (define mx6cuboxi-installation-os |
575 | (embedded-installation-os u-boot-mx6cuboxi-bootloader | |
576 | "/dev/mmcblk0" ; SD card storage | |
577 | "ttymxc0")) | |
578 | ||
1b960787 VC |
579 | (define novena-installation-os |
580 | (embedded-installation-os u-boot-novena-bootloader | |
581 | "/dev/mmcblk1" ; SD card storage | |
582 | "ttymxc1")) | |
583 | ||
84ee3378 DM |
584 | (define nintendo-nes-classic-edition-installation-os |
585 | (embedded-installation-os u-boot-nintendo-nes-classic-edition-bootloader | |
586 | "/dev/mmcblk0" ; SD card (solder it yourself) | |
587 | "ttyS0")) | |
588 | ||
9f7d6665 VC |
589 | (define pine64-plus-installation-os |
590 | (embedded-installation-os u-boot-pine64-plus-bootloader | |
591 | "/dev/mmcblk0" ; SD card storage | |
592 | "ttyS0")) | |
593 | ||
74e35e8c VC |
594 | (define pinebook-installation-os |
595 | (embedded-installation-os u-boot-pinebook-bootloader | |
596 | "/dev/mmcblk0" ; SD card storage | |
597 | "ttyS0")) | |
598 | ||
2fce14af VC |
599 | (define rock64-installation-os |
600 | (embedded-installation-os u-boot-rock64-rk3328-bootloader | |
601 | "/dev/mmcblk0" ; SD card/eMMC (SD priority) storage | |
602 | "ttyS2")) ; UART2 connected on the Pi2 bus | |
603 | ||
fa747018 CN |
604 | (define rockpro64-installation-os |
605 | (embedded-installation-os u-boot-rockpro64-rk3399-bootloader | |
606 | "/dev/mmcblk0" ; SD card/eMMC (SD priority) storage | |
607 | "ttyS2")) ; UART2 connected on the Pi2 bus | |
608 | ||
6fe16577 VC |
609 | (define rk3399-puma-installation-os |
610 | (embedded-installation-os u-boot-puma-rk3399-bootloader | |
611 | "/dev/mmcblk0" ; SD card storage | |
612 | "ttyS0")) | |
613 | ||
fd5536e3 VC |
614 | (define wandboard-installation-os |
615 | (embedded-installation-os u-boot-wandboard-bootloader | |
616 | "/dev/mmcblk0" ; SD card storage | |
617 | "ttymxc0")) | |
618 | ||
ceb39527 | 619 | ;; Return the default os here so 'guix system' can consume it directly. |
fc91c17a LC |
620 | installation-os |
621 | ||
622 | ;;; install.scm ends here |