summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Othacehe <m.othacehe@gmail.com>2017-12-12 16:41:56 +0100
committerMathieu Othacehe <m.othacehe@gmail.com>2017-12-15 12:15:15 +0100
commitceb3952764e49400d4419fea64a9201a32dad3de (patch)
tree4ea6bf263e780b514edfa39936d76f07c72a98ab
parent5a72ddf176d53a7f4df922985d9d7fd4cfa160f5 (diff)
system: Add BeagleBone Black installer.
* gnu/bootloader/u-boot.scm (u-boot-beaglebone-black-bootloader): New exported bootloader. * gnu/system/install.scm (beaglebone-black-installation-os): New exported variable.
-rw-r--r--gnu/bootloader/u-boot.scm25
-rw-r--r--gnu/system/install.scm29
2 files changed, 51 insertions, 3 deletions
diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index 963b0d7597e..397eb8181cf 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -21,18 +21,35 @@
21 #:use-module (gnu bootloader extlinux) 21 #:use-module (gnu bootloader extlinux)
22 #:use-module (gnu bootloader) 22 #:use-module (gnu bootloader)
23 #:use-module (gnu system) 23 #:use-module (gnu system)
24 #:use-module (gnu build bootloader)
24 #:use-module (gnu packages bootloaders) 25 #:use-module (gnu packages bootloaders)
25 #:use-module (guix gexp) 26 #:use-module (guix gexp)
26 #:use-module (guix monads) 27 #:use-module (guix monads)
27 #:use-module (guix records) 28 #:use-module (guix records)
28 #:use-module (guix utils) 29 #:use-module (guix utils)
29 #:export (u-boot-bootloader)) 30 #:export (u-boot-bootloader
31 u-boot-beaglebone-black-bootloader))
30 32
31(define install-u-boot 33(define install-u-boot
32 #~(lambda (bootloader device mount-point) 34 #~(lambda (bootloader device mount-point)
33 (if bootloader 35 (if bootloader
34 (error "Failed to install U-Boot")))) 36 (error "Failed to install U-Boot"))))
35 37
38(define install-beaglebone-black-u-boot
39 ;; http://wiki.beyondlogic.org/index.php?title=BeagleBoneBlack_Upgrading_uBoot
40 ;; This first stage bootloader called MLO (U-Boot SPL) is expected at
41 ;; 0x20000 by BBB ROM code. The second stage bootloader will be loaded by
42 ;; the MLO and is expected at 0x60000. Write both first stage ("MLO") and
43 ;; second stage ("u-boot.img") images, read in BOOTLOADER directory, to the
44 ;; specified DEVICE.
45 #~(lambda (bootloader device mount-point)
46 (let ((mlo (string-append bootloader "/libexec/MLO"))
47 (u-boot (string-append bootloader "/libexec/u-boot.img")))
48 (write-file-on-device mlo (* 256 512)
49 device (* 256 512))
50 (write-file-on-device u-boot (* 1024 512)
51 device (* 768 512)))))
52
36 53
37 54
38;;; 55;;;
@@ -45,3 +62,9 @@
45 (name 'u-boot) 62 (name 'u-boot)
46 (package #f) 63 (package #f)
47 (installer install-u-boot))) 64 (installer install-u-boot)))
65
66(define u-boot-beaglebone-black-bootloader
67 (bootloader
68 (inherit u-boot-bootloader)
69 (package u-boot-beagle-bone-black)
70 (installer install-beaglebone-black-u-boot)))
diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index c2f73f7e8fa..8864415d7cd 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -22,6 +22,7 @@
22 22
23(define-module (gnu system install) 23(define-module (gnu system install)
24 #:use-module (gnu) 24 #:use-module (gnu)
25 #:use-module (gnu bootloader u-boot)
25 #:use-module (guix gexp) 26 #:use-module (guix gexp)
26 #:use-module (guix store) 27 #:use-module (guix store)
27 #:use-module (guix monads) 28 #:use-module (guix monads)
@@ -42,7 +43,8 @@
42 #:use-module (gnu packages nvi) 43 #:use-module (gnu packages nvi)
43 #:use-module (ice-9 match) 44 #:use-module (ice-9 match)
44 #:use-module (srfi srfi-26) 45 #:use-module (srfi srfi-26)
45 #:export (installation-os)) 46 #:export (installation-os
47 beaglebone-black-installation-os))
46 48
47;;; Commentary: 49;;; Commentary:
48;;; 50;;;
@@ -372,7 +374,30 @@ You have been warned. Thanks for being so brave.\x1b[0m
372 nvi ;:wq! 374 nvi ;:wq!
373 %base-packages)))) 375 %base-packages))))
374 376
375;; Return it here so 'guix system' can consume it directly. 377(define beaglebone-black-installation-os
378 (operating-system
379 (inherit installation-os)
380 (bootloader (bootloader-configuration
381 (bootloader u-boot-beaglebone-black-bootloader)
382 (target "/dev/sda")))
383 (kernel linux-libre)
384 (initrd (lambda (fs . rest)
385 (apply base-initrd fs
386 ;; This module is required to mount the sd card.
387 #:extra-modules (list "omap_hsmmc")
388 rest)))
389 (services (append
390 ;; mingetty does not work on serial lines.
391 ;; Use agetty with board-specific serial parameters.
392 (list (agetty-service
393 (agetty-configuration
394 (extra-options '("-L"))
395 (baud-rate "115200")
396 (term "vt100")
397 (tty "ttyO0"))))
398 (operating-system-user-services installation-os)))))
399
400;; Return the default os here so 'guix system' can consume it directly.
376installation-os 401installation-os
377 402
378;;; install.scm ends here 403;;; install.scm ends here