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