| 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> |
| 4 | ;;; Copyright © 2016 Andreas Enge <andreas@enge.fr> |
| 5 | ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com> |
| 6 | ;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr> |
| 7 | ;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de> |
| 8 | ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> |
| 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) |
| 27 | #:use-module (gnu system) |
| 28 | #:use-module (gnu bootloader u-boot) |
| 29 | #:use-module (guix gexp) |
| 30 | #:use-module (guix store) |
| 31 | #:use-module (guix monads) |
| 32 | #:use-module (guix modules) |
| 33 | #:use-module ((guix packages) #:select (package-version)) |
| 34 | #:use-module ((guix store) #:select (%store-prefix)) |
| 35 | #:use-module (gnu installer) |
| 36 | #:use-module (gnu system locale) |
| 37 | #:use-module (gnu services avahi) |
| 38 | #:use-module (gnu services dbus) |
| 39 | #:use-module (gnu services networking) |
| 40 | #:use-module (gnu services shepherd) |
| 41 | #:use-module (gnu services ssh) |
| 42 | #:use-module (gnu packages admin) |
| 43 | #:use-module (gnu packages bash) |
| 44 | #:use-module (gnu packages bootloaders) |
| 45 | #:use-module (gnu packages certs) |
| 46 | #:use-module (gnu packages compression) |
| 47 | #:use-module (gnu packages fonts) |
| 48 | #:use-module (gnu packages fontutils) |
| 49 | #:use-module (gnu packages guile) |
| 50 | #:use-module (gnu packages linux) |
| 51 | #:use-module (gnu packages package-management) |
| 52 | #:use-module (gnu packages texinfo) |
| 53 | #:use-module (gnu packages xorg) |
| 54 | #:use-module (ice-9 match) |
| 55 | #:use-module (srfi srfi-26) |
| 56 | #:export (installation-os |
| 57 | a20-olinuxino-lime-installation-os |
| 58 | a20-olinuxino-lime2-emmc-installation-os |
| 59 | a20-olinuxino-micro-installation-os |
| 60 | bananapi-m2-ultra-installation-os |
| 61 | beaglebone-black-installation-os |
| 62 | mx6cuboxi-installation-os |
| 63 | nintendo-nes-classic-edition-installation-os |
| 64 | novena-installation-os |
| 65 | firefly-rk3399-installation-os |
| 66 | pine64-plus-installation-os |
| 67 | pinebook-installation-os |
| 68 | rock64-installation-os |
| 69 | rockpro64-installation-os |
| 70 | rk3399-puma-installation-os |
| 71 | wandboard-installation-os |
| 72 | os-with-u-boot)) |
| 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 | |
| 81 | \f |
| 82 | ;;; |
| 83 | ;;; Documentation service. |
| 84 | ;;; |
| 85 | |
| 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") |
| 92 | ("es" . "Instalación del sistema") |
| 93 | ("fr" . "Installation du système") |
| 94 | ("ru" . "Установка системы"))) |
| 95 | |
| 96 | (define (log-to-info tty user) |
| 97 | "Return a script that spawns the Info reader on the right section of the |
| 98 | manual." |
| 99 | (program-file "log-to-info" |
| 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"))) |
| 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 | |
| 122 | ;; 'gunzip' is needed to decompress the doc. |
| 123 | (setenv "PATH" (string-append #$gzip "/bin")) |
| 124 | |
| 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)))) |
| 140 | |
| 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)) |
| 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")))) |
| 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 |
| 171 | (define %backing-directory |
| 172 | ;; Sub-directory used as the backing store for copy-on-write. |
| 173 | "/tmp/guix-inst") |
| 174 | |
| 175 | (define cow-store-service-type |
| 176 | (shepherd-service-type |
| 177 | 'cow-store |
| 178 | (lambda _ |
| 179 | (define (import-module? module) |
| 180 | ;; Since we don't use deduplication support in 'populate-store', don't |
| 181 | ;; import (guix store deduplication) and its dependencies, which |
| 182 | ;; includes Guile-Gcrypt. |
| 183 | (and (guix-module-name? module) |
| 184 | (not (equal? module '(guix store deduplication))))) |
| 185 | |
| 186 | (shepherd-service |
| 187 | (requirement '(root-file-system user-processes)) |
| 188 | (provision '(cow-store)) |
| 189 | (documentation |
| 190 | "Make the store copy-on-write, with writes going to \ |
| 191 | the given target.") |
| 192 | |
| 193 | ;; This is meant to be explicitly started by the user. |
| 194 | (auto-start? #f) |
| 195 | |
| 196 | (modules `((gnu build install) |
| 197 | ,@%default-modules)) |
| 198 | (start |
| 199 | (with-imported-modules (source-module-closure |
| 200 | '((gnu build install)) |
| 201 | #:select? import-module?) |
| 202 | #~(case-lambda |
| 203 | ((target) |
| 204 | (mount-cow-store target #$%backing-directory) |
| 205 | target) |
| 206 | (else |
| 207 | ;; Do nothing, and mark the service as stopped. |
| 208 | #f)))) |
| 209 | (stop #~(lambda (target) |
| 210 | ;; Delete the temporary directory, but leave everything |
| 211 | ;; mounted as there may still be processes using it since |
| 212 | ;; 'user-processes' doesn't depend on us. The 'user-file-systems' |
| 213 | ;; service will unmount TARGET eventually. |
| 214 | (delete-file-recursively |
| 215 | (string-append target #$%backing-directory)))))) |
| 216 | (description "Make the store copy-on-write, with writes going to \ |
| 217 | the given target."))) |
| 218 | |
| 219 | (define (cow-store-service) |
| 220 | "Return a service that makes the store copy-on-write, such that writes go to |
| 221 | the user's target storage device rather than on the RAM disk." |
| 222 | ;; See <http://bugs.gnu.org/18061> for the initial report. |
| 223 | (service cow-store-service-type 'mooooh!)) |
| 224 | |
| 225 | |
| 226 | (define (/etc/configuration-files _) |
| 227 | "Return a list of tuples representing configuration templates to add to |
| 228 | /etc." |
| 229 | (define directory |
| 230 | (computed-file "configuration-templates" |
| 231 | (with-imported-modules '((guix build utils)) |
| 232 | #~(begin |
| 233 | (mkdir #$output) |
| 234 | (for-each (lambda (file target) |
| 235 | (copy-file file |
| 236 | (string-append #$output "/" |
| 237 | target))) |
| 238 | '(#$(local-file "examples/bare-bones.tmpl") |
| 239 | #$(local-file "examples/beaglebone-black.tmpl") |
| 240 | #$(local-file "examples/desktop.tmpl") |
| 241 | #$(local-file "examples/lightweight-desktop.tmpl")) |
| 242 | '("bare-bones.scm" |
| 243 | "beaglebone-black.scm" |
| 244 | "desktop.scm" |
| 245 | "lightweight-desktop.scm")) |
| 246 | #t)))) |
| 247 | |
| 248 | `(("configuration" ,directory))) |
| 249 | |
| 250 | (define configuration-template-service-type |
| 251 | (service-type (name 'configuration-template) |
| 252 | (extensions |
| 253 | (list (service-extension etc-service-type |
| 254 | /etc/configuration-files))))) |
| 255 | |
| 256 | (define %configuration-template-service |
| 257 | (service configuration-template-service-type #t)) |
| 258 | |
| 259 | |
| 260 | (define %nscd-minimal-caches |
| 261 | ;; Minimal in-memory caching policy for nscd. |
| 262 | (list (nscd-cache (database 'hosts) |
| 263 | (positive-time-to-live (* 3600 12)) |
| 264 | |
| 265 | ;; Do not cache lookup failures at all since they are |
| 266 | ;; quite likely (for instance when someone tries to ping a |
| 267 | ;; host before networking is functional.) |
| 268 | (negative-time-to-live 0) |
| 269 | |
| 270 | (persistent? #f) |
| 271 | (max-database-size (* 5 (expt 2 20)))))) ;5 MiB |
| 272 | |
| 273 | \f |
| 274 | ;; These define a service to load the uvesafb kernel module with the |
| 275 | ;; appropriate options. The GUI installer needs it when the machine does not |
| 276 | ;; support Kernel Mode Setting. Otherwise kmscon is missing /dev/fb0. |
| 277 | (define (uvesafb-shepherd-service _) |
| 278 | (list (shepherd-service |
| 279 | (documentation "Load the uvesafb kernel module if needed.") |
| 280 | (provision '(maybe-uvesafb)) |
| 281 | (requirement '(file-systems)) |
| 282 | (start #~(lambda () |
| 283 | ;; uvesafb is only supported on x86 and x86_64. |
| 284 | (or (not (and (string-suffix? "linux-gnu" %host-type) |
| 285 | (or (string-prefix? "x86_64" %host-type) |
| 286 | (string-prefix? "i686" %host-type)))) |
| 287 | (file-exists? "/dev/fb0") |
| 288 | (invoke #+(file-append kmod "/bin/modprobe") |
| 289 | "uvesafb" |
| 290 | (string-append "v86d=" #$v86d "/sbin/v86d") |
| 291 | "mode_option=1024x768")))) |
| 292 | (respawn? #f) |
| 293 | (one-shot? #t)))) |
| 294 | |
| 295 | (define uvesafb-service-type |
| 296 | (service-type |
| 297 | (name 'uvesafb) |
| 298 | (extensions |
| 299 | (list (service-extension shepherd-root-service-type |
| 300 | uvesafb-shepherd-service))) |
| 301 | (description |
| 302 | "Load the @code{uvesafb} kernel module with the right options.") |
| 303 | (default-value #t))) |
| 304 | |
| 305 | (define %installation-services |
| 306 | ;; List of services of the installation system. |
| 307 | (let ((motd (plain-file "motd" " |
| 308 | \x1b[1;37mWelcome to the installation of GNU Guix!\x1b[0m |
| 309 | |
| 310 | \x1b[2m\ |
| 311 | Using this shell, you can carry out the installation process \"manually.\" |
| 312 | Access documentation at any time by pressing Alt-F2.\x1b[0m |
| 313 | "))) |
| 314 | (define (normal-tty tty) |
| 315 | (mingetty-service (mingetty-configuration (tty tty) |
| 316 | (auto-login "root") |
| 317 | (login-pause? #t)))) |
| 318 | |
| 319 | (define bare-bones-os |
| 320 | (load "examples/bare-bones.tmpl")) |
| 321 | |
| 322 | (list (service virtual-terminal-service-type) |
| 323 | |
| 324 | (service kmscon-service-type |
| 325 | (kmscon-configuration |
| 326 | (virtual-terminal "tty1") |
| 327 | (login-program (installer-program)))) |
| 328 | |
| 329 | (login-service (login-configuration |
| 330 | (motd motd))) |
| 331 | |
| 332 | ;; Documentation. The manual is in UTF-8, but |
| 333 | ;; 'console-font-service' sets up Unicode support and loads a font |
| 334 | ;; with all the useful glyphs like em dash and quotation marks. |
| 335 | (service documentation-service-type "tty2") |
| 336 | |
| 337 | ;; Documentation add-on. |
| 338 | %configuration-template-service |
| 339 | |
| 340 | ;; A bunch of 'root' ttys. |
| 341 | (normal-tty "tty3") |
| 342 | (normal-tty "tty4") |
| 343 | (normal-tty "tty5") |
| 344 | (normal-tty "tty6") |
| 345 | |
| 346 | ;; The usual services. |
| 347 | (syslog-service) |
| 348 | |
| 349 | ;; Use the Avahi daemon to discover substitute servers on the local |
| 350 | ;; network. It can be faster than fetching from remote servers. |
| 351 | (service avahi-service-type) |
| 352 | |
| 353 | ;; The build daemon. Register the default substitute server key(s) |
| 354 | ;; as trusted to allow the installation process to use substitutes by |
| 355 | ;; default. |
| 356 | (service guix-service-type |
| 357 | (guix-configuration (authorize-key? #t))) |
| 358 | |
| 359 | ;; Start udev so that useful device nodes are available. |
| 360 | ;; Use device-mapper rules for cryptsetup & co; enable the CRDA for |
| 361 | ;; regulations-compliant WiFi access. |
| 362 | (udev-service #:rules (list lvm2 crda)) |
| 363 | |
| 364 | ;; Add the 'cow-store' service, which users have to start manually |
| 365 | ;; since it takes the installation directory as an argument. |
| 366 | (cow-store-service) |
| 367 | |
| 368 | ;; Install Unicode support and a suitable font. |
| 369 | (service console-font-service-type |
| 370 | (map (match-lambda |
| 371 | ("tty2" |
| 372 | ;; Use a font that contains characters such as |
| 373 | ;; curly quotes as found in the manual. |
| 374 | '("tty2" . "LatGrkCyr-8x16")) |
| 375 | (tty |
| 376 | ;; Use a font that doesn't have more than 256 |
| 377 | ;; glyphs so that we can use colors with varying |
| 378 | ;; brightness levels (see note in setfont(8)). |
| 379 | `(,tty . "lat9u-16"))) |
| 380 | '("tty1" "tty2" "tty3" "tty4" "tty5" "tty6"))) |
| 381 | |
| 382 | ;; To facilitate copy/paste. |
| 383 | (service gpm-service-type) |
| 384 | |
| 385 | ;; Add an SSH server to facilitate remote installs. |
| 386 | (service openssh-service-type |
| 387 | (openssh-configuration |
| 388 | (port-number 22) |
| 389 | (permit-root-login #t) |
| 390 | ;; The root account is passwordless, so make sure |
| 391 | ;; a password is set before allowing logins. |
| 392 | (allow-empty-passwords? #f) |
| 393 | (password-authentication? #t) |
| 394 | |
| 395 | ;; Don't start it upfront. |
| 396 | (%auto-start? #f))) |
| 397 | |
| 398 | ;; Since this is running on a USB stick with a overlayfs as the root |
| 399 | ;; file system, use an appropriate cache configuration. |
| 400 | (nscd-service (nscd-configuration |
| 401 | (caches %nscd-minimal-caches))) |
| 402 | |
| 403 | ;; Having /bin/sh is a good idea. In particular it allows Tramp |
| 404 | ;; connections to this system to work. |
| 405 | (service special-files-service-type |
| 406 | `(("/bin/sh" ,(file-append bash "/bin/sh")))) |
| 407 | |
| 408 | ;; Loopback device, needed by OpenSSH notably. |
| 409 | (service static-networking-service-type |
| 410 | (list (static-networking (interface "lo") |
| 411 | (ip "127.0.0.1") |
| 412 | (requirement '()) |
| 413 | (provision '(loopback))))) |
| 414 | |
| 415 | (service wpa-supplicant-service-type) |
| 416 | (dbus-service) |
| 417 | (service connman-service-type |
| 418 | (connman-configuration |
| 419 | (disable-vpn? #t))) |
| 420 | |
| 421 | ;; Keep a reference to BARE-BONES-OS to make sure it can be |
| 422 | ;; installed without downloading/building anything. Also keep the |
| 423 | ;; things needed by 'profile-derivation' to minimize the amount of |
| 424 | ;; download. |
| 425 | (service gc-root-service-type |
| 426 | (append |
| 427 | (list bare-bones-os |
| 428 | glibc-utf8-locales |
| 429 | texinfo |
| 430 | guile-3.0) |
| 431 | %default-locale-libcs)) |
| 432 | |
| 433 | ;; Machines without Kernel Mode Setting (those with many old and |
| 434 | ;; current AMD GPUs, SiS GPUs, ...) need uvesafb to show the GUI |
| 435 | ;; installer. Some may also need a kernel parameter like nomodeset |
| 436 | ;; or vga=793, but we leave that for the user to specify in GRUB. |
| 437 | (service uvesafb-service-type)))) |
| 438 | |
| 439 | (define %issue |
| 440 | ;; Greeting. |
| 441 | " |
| 442 | \x1b[1;37mThis is an installation image of the GNU system. Welcome.\x1b[0m |
| 443 | |
| 444 | \x1b[1;33mUse Alt-F2 for documentation.\x1b[0m |
| 445 | ") |
| 446 | |
| 447 | (define installation-os |
| 448 | ;; The operating system used on installation images for USB sticks etc. |
| 449 | (operating-system |
| 450 | (host-name "gnu") |
| 451 | (timezone "Europe/Paris") |
| 452 | (locale "en_US.utf8") |
| 453 | (name-service-switch %mdns-host-lookup-nss) |
| 454 | (bootloader (bootloader-configuration |
| 455 | (bootloader grub-bootloader) |
| 456 | (target "/dev/sda"))) |
| 457 | (label (string-append "GNU Guix installation " |
| 458 | (package-version guix))) |
| 459 | |
| 460 | ;; XXX: The AMD Radeon driver is reportedly broken, which makes kmscon |
| 461 | ;; non-functional: |
| 462 | ;; <https://lists.gnu.org/archive/html/guix-devel/2019-03/msg00441.html>. |
| 463 | ;; Thus, blacklist it. |
| 464 | (kernel-arguments '("quiet" "modprobe.blacklist=radeon")) |
| 465 | |
| 466 | (file-systems |
| 467 | ;; Note: the disk image build code overrides this root file system with |
| 468 | ;; the appropriate one. |
| 469 | (cons* (file-system |
| 470 | (mount-point "/") |
| 471 | (device (file-system-label "Guix_image")) |
| 472 | (type "ext4")) |
| 473 | |
| 474 | ;; Make /tmp a tmpfs instead of keeping the overlayfs. This |
| 475 | ;; originally was used for unionfs because FUSE creates |
| 476 | ;; '.fuse_hiddenXYZ' files for each open file, and this confuses |
| 477 | ;; Guix's test suite, for instance (see |
| 478 | ;; <http://bugs.gnu.org/23056>). We keep this for overlayfs to be |
| 479 | ;; on the safe side. |
| 480 | (file-system |
| 481 | (mount-point "/tmp") |
| 482 | (device "none") |
| 483 | (type "tmpfs") |
| 484 | (check? #f)) |
| 485 | |
| 486 | ;; XXX: This should be %BASE-FILE-SYSTEMS but we don't need |
| 487 | ;; elogind's cgroup file systems. |
| 488 | (list %pseudo-terminal-file-system |
| 489 | %shared-memory-file-system |
| 490 | %efivars-file-system |
| 491 | %immutable-store))) |
| 492 | |
| 493 | (users (list (user-account |
| 494 | (name "guest") |
| 495 | (group "users") |
| 496 | (supplementary-groups '("wheel")) ; allow use of sudo |
| 497 | (password "") |
| 498 | (comment "Guest of GNU")))) |
| 499 | |
| 500 | (issue %issue) |
| 501 | (services %installation-services) |
| 502 | |
| 503 | ;; We don't need setuid programs, except for 'passwd', which can be handy |
| 504 | ;; if one is to allow remote SSH login to the machine being installed. |
| 505 | (setuid-programs (list (file-append shadow "/bin/passwd"))) |
| 506 | |
| 507 | (pam-services |
| 508 | ;; Explicitly allow for empty passwords. |
| 509 | (base-pam-services #:allow-empty-passwords? #t)) |
| 510 | |
| 511 | (packages (append |
| 512 | (list glibc ; for 'tzselect' & co. |
| 513 | fontconfig |
| 514 | font-dejavu font-gnu-unifont |
| 515 | grub ; mostly so xrefs to its manual work |
| 516 | nss-certs) ; To access HTTPS, use git, etc. |
| 517 | %base-packages-disk-utilities |
| 518 | %base-packages)))) |
| 519 | |
| 520 | (define* (os-with-u-boot os board #:key (bootloader-target "/dev/mmcblk0") |
| 521 | (triplet "arm-linux-gnueabihf")) |
| 522 | "Given OS, amend it with the u-boot bootloader for BOARD, |
| 523 | installed to BOOTLOADER-TARGET (a drive), compiled for TRIPLET. |
| 524 | |
| 525 | If you want a serial console, make sure to specify one in your |
| 526 | operating-system's kernel-arguments (\"console=ttyS0\" or similar)." |
| 527 | (operating-system (inherit os) |
| 528 | (bootloader (bootloader-configuration |
| 529 | (bootloader (bootloader (inherit u-boot-bootloader) |
| 530 | (package (make-u-boot-package board triplet)))) |
| 531 | (target bootloader-target))))) |
| 532 | |
| 533 | (define* (embedded-installation-os bootloader bootloader-target tty |
| 534 | #:key (extra-modules '())) |
| 535 | "Return an installation os for embedded systems. |
| 536 | The initrd gets the extra modules EXTRA-MODULES. |
| 537 | A getty is provided on TTY. |
| 538 | The bootloader BOOTLOADER is installed to BOOTLOADER-TARGET." |
| 539 | (operating-system |
| 540 | (inherit installation-os) |
| 541 | (bootloader (bootloader-configuration |
| 542 | (bootloader bootloader) |
| 543 | (target bootloader-target))) |
| 544 | (kernel linux-libre) |
| 545 | (kernel-arguments |
| 546 | (cons (string-append "console=" tty) |
| 547 | (operating-system-user-kernel-arguments installation-os))) |
| 548 | (initrd-modules (append extra-modules %base-initrd-modules)))) |
| 549 | |
| 550 | (define beaglebone-black-installation-os |
| 551 | (embedded-installation-os u-boot-beaglebone-black-bootloader |
| 552 | "/dev/sda" |
| 553 | "ttyO0" |
| 554 | #:extra-modules |
| 555 | ;; This module is required to mount the sd card. |
| 556 | '("omap_hsmmc"))) |
| 557 | |
| 558 | |
| 559 | (define a20-olinuxino-lime-installation-os |
| 560 | (embedded-installation-os u-boot-a20-olinuxino-lime-bootloader |
| 561 | "/dev/mmcblk0" ; SD card storage |
| 562 | "ttyS0")) |
| 563 | |
| 564 | (define a20-olinuxino-lime2-emmc-installation-os |
| 565 | (embedded-installation-os u-boot-a20-olinuxino-lime2-bootloader |
| 566 | "/dev/mmcblk1" ; eMMC storage |
| 567 | "ttyS0")) |
| 568 | |
| 569 | (define a20-olinuxino-micro-installation-os |
| 570 | (embedded-installation-os u-boot-a20-olinuxino-micro-bootloader |
| 571 | "/dev/mmcblk0" ; SD card storage |
| 572 | "ttyS0")) |
| 573 | |
| 574 | (define bananapi-m2-ultra-installation-os |
| 575 | (embedded-installation-os u-boot-bananapi-m2-ultra-bootloader |
| 576 | "/dev/mmcblk1" ; eMMC storage |
| 577 | "ttyS0")) |
| 578 | |
| 579 | (define firefly-rk3399-installation-os |
| 580 | (embedded-installation-os u-boot-firefly-rk3399-bootloader |
| 581 | "/dev/mmcblk0" ; SD card/eMMC (SD priority) storage |
| 582 | "ttyS2")) ; UART2 connected on the Pi2 bus |
| 583 | |
| 584 | (define mx6cuboxi-installation-os |
| 585 | (embedded-installation-os u-boot-mx6cuboxi-bootloader |
| 586 | "/dev/mmcblk0" ; SD card storage |
| 587 | "ttymxc0")) |
| 588 | |
| 589 | (define novena-installation-os |
| 590 | (embedded-installation-os u-boot-novena-bootloader |
| 591 | "/dev/mmcblk1" ; SD card storage |
| 592 | "ttymxc1")) |
| 593 | |
| 594 | (define nintendo-nes-classic-edition-installation-os |
| 595 | (embedded-installation-os u-boot-nintendo-nes-classic-edition-bootloader |
| 596 | "/dev/mmcblk0" ; SD card (solder it yourself) |
| 597 | "ttyS0")) |
| 598 | |
| 599 | (define pine64-plus-installation-os |
| 600 | (embedded-installation-os u-boot-pine64-plus-bootloader |
| 601 | "/dev/mmcblk0" ; SD card storage |
| 602 | "ttyS0")) |
| 603 | |
| 604 | (define pinebook-installation-os |
| 605 | (embedded-installation-os u-boot-pinebook-bootloader |
| 606 | "/dev/mmcblk0" ; SD card storage |
| 607 | "ttyS0")) |
| 608 | |
| 609 | (define rock64-installation-os |
| 610 | (embedded-installation-os u-boot-rock64-rk3328-bootloader |
| 611 | "/dev/mmcblk0" ; SD card/eMMC (SD priority) storage |
| 612 | "ttyS2")) ; UART2 connected on the Pi2 bus |
| 613 | |
| 614 | (define rockpro64-installation-os |
| 615 | (embedded-installation-os u-boot-rockpro64-rk3399-bootloader |
| 616 | "/dev/mmcblk0" ; SD card/eMMC (SD priority) storage |
| 617 | "ttyS2")) ; UART2 connected on the Pi2 bus |
| 618 | |
| 619 | (define rk3399-puma-installation-os |
| 620 | (embedded-installation-os u-boot-puma-rk3399-bootloader |
| 621 | "/dev/mmcblk0" ; SD card storage |
| 622 | "ttyS0")) |
| 623 | |
| 624 | (define wandboard-installation-os |
| 625 | (embedded-installation-os u-boot-wandboard-bootloader |
| 626 | "/dev/mmcblk0" ; SD card storage |
| 627 | "ttymxc0")) |
| 628 | |
| 629 | ;; Return the default os here so 'guix system' can consume it directly. |
| 630 | installation-os |
| 631 | |
| 632 | ;;; install.scm ends here |