bootloader: grub: Remove unneeded 'terminal_output'.
[guix.git] / gnu / bootloader / u-boot.scm
blob54abfe1c69d2cab55bbcd9511819fc08eadd5343
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017 David Craven <david@craven.ch>
3 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
20 (define-module (gnu bootloader u-boot)
21   #:use-module (gnu bootloader extlinux)
22   #:use-module (gnu bootloader)
23   #:use-module (gnu packages bootloaders)
24   #:use-module (guix gexp)
25   #:export (u-boot-bootloader
26             u-boot-a20-olinuxino-lime-bootloader
27             u-boot-a20-olinuxino-lime2-bootloader
28             u-boot-a20-olinuxino-micro-bootloader
29             u-boot-bananapi-m2-ultra-bootloader
30             u-boot-beaglebone-black-bootloader
31             u-boot-mx6cuboxi-bootloader
32             u-boot-nintendo-nes-classic-edition-bootloader
33             u-boot-novena-bootloader
34             u-boot-pine64-plus-bootloader
35             u-boot-pinebook-bootloader
36             u-boot-puma-rk3399-bootloader
37             u-boot-wandboard-bootloader))
39 (define install-u-boot
40   #~(lambda (bootloader device mount-point)
41       (if bootloader
42         (error "Failed to install U-Boot"))))
44 (define install-beaglebone-black-u-boot
45   ;; http://wiki.beyondlogic.org/index.php?title=BeagleBoneBlack_Upgrading_uBoot
46   ;; This first stage bootloader called MLO (U-Boot SPL) is expected at
47   ;; 0x20000 by BBB ROM code. The second stage bootloader will be loaded by
48   ;; the MLO and is expected at 0x60000.  Write both first stage ("MLO") and
49   ;; second stage ("u-boot.img") images, read in BOOTLOADER directory, to the
50   ;; specified DEVICE.
51   #~(lambda (bootloader device mount-point)
52       (let ((mlo (string-append bootloader "/libexec/MLO"))
53             (u-boot (string-append bootloader "/libexec/u-boot.img")))
54         (write-file-on-device mlo (* 256 512)
55                               device (* 256 512))
56         (write-file-on-device u-boot (* 1024 512)
57                               device (* 768 512)))))
59 (define install-allwinner-u-boot
60   #~(lambda (bootloader device mount-point)
61       (let ((u-boot (string-append bootloader
62                                    "/libexec/u-boot-sunxi-with-spl.bin")))
63         (write-file-on-device u-boot (stat:size (stat u-boot))
64                               device (* 8 1024)))))
66 (define install-allwinner64-u-boot
67   #~(lambda (bootloader device mount-point)
68       (let ((spl (string-append bootloader "/libexec/spl/sunxi-spl.bin"))
69             (u-boot (string-append bootloader "/libexec/u-boot.itb")))
70         (write-file-on-device spl (stat:size (stat spl))
71                               device (* 8 1024))
72         (write-file-on-device u-boot (stat:size (stat u-boot))
73                               device (* 40 1024)))))
75 (define install-imx-u-boot
76   #~(lambda (bootloader device mount-point)
77       (let ((spl (string-append bootloader "/libexec/SPL"))
78             (u-boot (string-append bootloader "/libexec/u-boot.img")))
79         (write-file-on-device spl (stat:size (stat spl))
80                               device (* 1 1024))
81         (write-file-on-device u-boot (stat:size (stat u-boot))
82                               device (* 69 1024)))))
84 (define install-puma-rk3399-u-boot
85   #~(lambda (bootloader device mount-point)
86       (let ((spl (string-append bootloader "/libexec/u-boot-spl.rksd"))
87             (u-boot (string-append bootloader "/libexec/u-boot.itb")))
88         (write-file-on-device spl (stat:size (stat spl))
89                               device (* 64 512))
90         (write-file-on-device u-boot (stat:size (stat u-boot))
91                               device (* 512 512)))))
95 ;;;
96 ;;; Bootloader definitions.
97 ;;;
99 (define u-boot-bootloader
100   (bootloader
101    (inherit extlinux-bootloader)
102    (name 'u-boot)
103    (package #f)
104    (installer install-u-boot)))
106 (define u-boot-beaglebone-black-bootloader
107   (bootloader
108    (inherit u-boot-bootloader)
109    (package u-boot-am335x-boneblack)
110    (installer install-beaglebone-black-u-boot)))
112 (define u-boot-allwinner-bootloader
113   (bootloader
114    (inherit u-boot-bootloader)
115    (installer install-allwinner-u-boot)))
117 (define u-boot-allwinner64-bootloader
118   (bootloader
119    (inherit u-boot-bootloader)
120    (installer install-allwinner64-u-boot)))
122 (define u-boot-imx-bootloader
123   (bootloader
124    (inherit u-boot-bootloader)
125    (installer install-imx-u-boot)))
127 (define u-boot-nintendo-nes-classic-edition-bootloader
128   (bootloader
129     (inherit u-boot-allwinner-bootloader)
130     (package u-boot-nintendo-nes-classic-edition)))
132 (define u-boot-a20-olinuxino-lime-bootloader
133   (bootloader
134    (inherit u-boot-allwinner-bootloader)
135    (package u-boot-a20-olinuxino-lime)))
137 (define u-boot-a20-olinuxino-lime2-bootloader
138   (bootloader
139    (inherit u-boot-allwinner-bootloader)
140    (package u-boot-a20-olinuxino-lime2)))
142 (define u-boot-a20-olinuxino-micro-bootloader
143   (bootloader
144    (inherit u-boot-allwinner-bootloader)
145    (package u-boot-a20-olinuxino-micro)))
147 (define u-boot-bananapi-m2-ultra-bootloader
148   (bootloader
149    (inherit u-boot-allwinner-bootloader)
150    (package u-boot-bananapi-m2-ultra)))
152 (define u-boot-mx6cuboxi-bootloader
153   (bootloader
154    (inherit u-boot-imx-bootloader)
155    (package u-boot-mx6cuboxi)))
157 (define u-boot-wandboard-bootloader
158   (bootloader
159    (inherit u-boot-imx-bootloader)
160    (package u-boot-wandboard)))
162 (define u-boot-novena-bootloader
163   (bootloader
164    (inherit u-boot-imx-bootloader)
165    (package u-boot-novena)))
167 (define u-boot-pine64-plus-bootloader
168   (bootloader
169    (inherit u-boot-allwinner64-bootloader)
170    (package u-boot-pine64-plus)))
172 (define u-boot-pinebook-bootloader
173   (bootloader
174    (inherit u-boot-allwinner64-bootloader)
175    (package u-boot-pinebook)))
177 (define u-boot-puma-rk3399-bootloader
178   (bootloader
179    (inherit u-boot-bootloader)
180    (package u-boot-puma-rk3399)
181    (installer install-puma-rk3399-u-boot)))