gnu: xterm: Update to 350.
[jackhill/guix/guix.git] / gnu / bootloader / u-boot.scm
CommitLineData
8d858010
DM
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/>.
19
20(define-module (gnu bootloader u-boot)
21 #:use-module (gnu bootloader extlinux)
22 #:use-module (gnu bootloader)
8d858010
DM
23 #:use-module (gnu packages bootloaders)
24 #:use-module (guix gexp)
ceb39527 25 #:export (u-boot-bootloader
c55c6985 26 u-boot-a20-olinuxino-lime-bootloader
4b9e9abb 27 u-boot-a20-olinuxino-lime2-bootloader
a7bb327e 28 u-boot-a20-olinuxino-micro-bootloader
e830c9d0 29 u-boot-bananapi-m2-ultra-bootloader
84ee3378 30 u-boot-beaglebone-black-bootloader
545ff7b7 31 u-boot-firefly-rk3399-bootloader
07ca9045 32 u-boot-mx6cuboxi-bootloader
fd5536e3 33 u-boot-nintendo-nes-classic-edition-bootloader
1b960787 34 u-boot-novena-bootloader
9f7d6665 35 u-boot-pine64-plus-bootloader
74e35e8c 36 u-boot-pinebook-bootloader
6fe16577 37 u-boot-puma-rk3399-bootloader
2fce14af 38 u-boot-rock64-rk3328-bootloader
fa747018 39 u-boot-rockpro64-rk3399-bootloader
fd5536e3 40 u-boot-wandboard-bootloader))
8d858010
DM
41
42(define install-u-boot
43 #~(lambda (bootloader device mount-point)
44 (if bootloader
45 (error "Failed to install U-Boot"))))
46
ceb39527
MO
47(define install-beaglebone-black-u-boot
48 ;; http://wiki.beyondlogic.org/index.php?title=BeagleBoneBlack_Upgrading_uBoot
49 ;; This first stage bootloader called MLO (U-Boot SPL) is expected at
50 ;; 0x20000 by BBB ROM code. The second stage bootloader will be loaded by
51 ;; the MLO and is expected at 0x60000. Write both first stage ("MLO") and
52 ;; second stage ("u-boot.img") images, read in BOOTLOADER directory, to the
53 ;; specified DEVICE.
54 #~(lambda (bootloader device mount-point)
55 (let ((mlo (string-append bootloader "/libexec/MLO"))
56 (u-boot (string-append bootloader "/libexec/u-boot.img")))
57 (write-file-on-device mlo (* 256 512)
58 device (* 256 512))
59 (write-file-on-device u-boot (* 1024 512)
60 device (* 768 512)))))
61
30aeb846
DM
62(define install-allwinner-u-boot
63 #~(lambda (bootloader device mount-point)
64 (let ((u-boot (string-append bootloader
65 "/libexec/u-boot-sunxi-with-spl.bin")))
66 (write-file-on-device u-boot (stat:size (stat u-boot))
67 device (* 8 1024)))))
68
9f7d6665
VC
69(define install-allwinner64-u-boot
70 #~(lambda (bootloader device mount-point)
71 (let ((spl (string-append bootloader "/libexec/spl/sunxi-spl.bin"))
72 (u-boot (string-append bootloader "/libexec/u-boot.itb")))
73 (write-file-on-device spl (stat:size (stat spl))
74 device (* 8 1024))
75 (write-file-on-device u-boot (stat:size (stat u-boot))
76 device (* 40 1024)))))
77
07ca9045
VC
78(define install-imx-u-boot
79 #~(lambda (bootloader device mount-point)
80 (let ((spl (string-append bootloader "/libexec/SPL"))
81 (u-boot (string-append bootloader "/libexec/u-boot.img")))
82 (write-file-on-device spl (stat:size (stat spl))
83 device (* 1 1024))
84 (write-file-on-device u-boot (stat:size (stat u-boot))
85 device (* 69 1024)))))
86
6fe16577
VC
87(define install-puma-rk3399-u-boot
88 #~(lambda (bootloader device mount-point)
89 (let ((spl (string-append bootloader "/libexec/u-boot-spl.rksd"))
90 (u-boot (string-append bootloader "/libexec/u-boot.itb")))
91 (write-file-on-device spl (stat:size (stat spl))
92 device (* 64 512))
93 (write-file-on-device u-boot (stat:size (stat u-boot))
94 device (* 512 512)))))
95
545ff7b7
VC
96(define install-firefly-rk3399-u-boot
97 #~(lambda (bootloader device mount-point)
98 (let ((idb (string-append bootloader "/libexec/idbloader.img"))
99 (u-boot (string-append bootloader "/libexec/u-boot.itb")))
100 (write-file-on-device idb (stat:size (stat idb))
101 device (* 64 512))
102 (write-file-on-device u-boot (stat:size (stat u-boot))
103 device (* 16384 512)))))
104
2fce14af
VC
105(define install-rock64-rk3328-u-boot
106 #~(lambda (bootloader device mount-point)
107 (let ((idb (string-append bootloader "/libexec/idbloader.img"))
108 (u-boot (string-append bootloader "/libexec/u-boot.itb")))
109 (write-file-on-device idb (stat:size (stat idb))
110 device (* 64 512))
111 (write-file-on-device u-boot (stat:size (stat u-boot))
112 device (* 16384 512)))))
113
fa747018
CN
114(define install-rockpro64-rk3399-u-boot
115 #~(lambda (bootloader device mount-point)
116 (let ((idb (string-append bootloader "/libexec/idbloader.img"))
117 (u-boot (string-append bootloader "/libexec/u-boot.itb")))
118 (write-file-on-device idb (stat:size (stat idb))
119 device (* 64 512))
120 (write-file-on-device u-boot (stat:size (stat u-boot))
121 device (* 16384 512)))))
122
8d858010
DM
123\f
124
125;;;
126;;; Bootloader definitions.
127;;;
128
129(define u-boot-bootloader
130 (bootloader
131 (inherit extlinux-bootloader)
132 (name 'u-boot)
133 (package #f)
134 (installer install-u-boot)))
ceb39527
MO
135
136(define u-boot-beaglebone-black-bootloader
137 (bootloader
138 (inherit u-boot-bootloader)
6b99afee 139 (package u-boot-am335x-boneblack)
ceb39527 140 (installer install-beaglebone-black-u-boot)))
30aeb846
DM
141
142(define u-boot-allwinner-bootloader
143 (bootloader
144 (inherit u-boot-bootloader)
145 (installer install-allwinner-u-boot)))
146
9f7d6665
VC
147(define u-boot-allwinner64-bootloader
148 (bootloader
149 (inherit u-boot-bootloader)
150 (installer install-allwinner64-u-boot)))
151
07ca9045
VC
152(define u-boot-imx-bootloader
153 (bootloader
154 (inherit u-boot-bootloader)
155 (installer install-imx-u-boot)))
156
84ee3378
DM
157(define u-boot-nintendo-nes-classic-edition-bootloader
158 (bootloader
159 (inherit u-boot-allwinner-bootloader)
160 (package u-boot-nintendo-nes-classic-edition)))
161
c55c6985
DM
162(define u-boot-a20-olinuxino-lime-bootloader
163 (bootloader
164 (inherit u-boot-allwinner-bootloader)
165 (package u-boot-a20-olinuxino-lime)))
166
4b9e9abb
DM
167(define u-boot-a20-olinuxino-lime2-bootloader
168 (bootloader
169 (inherit u-boot-allwinner-bootloader)
170 (package u-boot-a20-olinuxino-lime2)))
171
a7bb327e
DM
172(define u-boot-a20-olinuxino-micro-bootloader
173 (bootloader
174 (inherit u-boot-allwinner-bootloader)
175 (package u-boot-a20-olinuxino-micro)))
176
e830c9d0 177(define u-boot-bananapi-m2-ultra-bootloader
30aeb846
DM
178 (bootloader
179 (inherit u-boot-allwinner-bootloader)
e830c9d0 180 (package u-boot-bananapi-m2-ultra)))
07ca9045 181
545ff7b7
VC
182(define u-boot-firefly-rk3399-bootloader
183 ;; SD and eMMC use the same format
184 (bootloader
185 (inherit u-boot-bootloader)
186 (package u-boot-firefly-rk3399)
187 (installer install-firefly-rk3399-u-boot)))
188
07ca9045
VC
189(define u-boot-mx6cuboxi-bootloader
190 (bootloader
191 (inherit u-boot-imx-bootloader)
192 (package u-boot-mx6cuboxi)))
fd5536e3
VC
193
194(define u-boot-wandboard-bootloader
195 (bootloader
196 (inherit u-boot-imx-bootloader)
197 (package u-boot-wandboard)))
1b960787
VC
198
199(define u-boot-novena-bootloader
200 (bootloader
201 (inherit u-boot-imx-bootloader)
202 (package u-boot-novena)))
9f7d6665
VC
203
204(define u-boot-pine64-plus-bootloader
205 (bootloader
206 (inherit u-boot-allwinner64-bootloader)
207 (package u-boot-pine64-plus)))
6fe16577 208
74e35e8c
VC
209(define u-boot-pinebook-bootloader
210 (bootloader
211 (inherit u-boot-allwinner64-bootloader)
212 (package u-boot-pinebook)))
213
6fe16577
VC
214(define u-boot-puma-rk3399-bootloader
215 (bootloader
216 (inherit u-boot-bootloader)
217 (package u-boot-puma-rk3399)
218 (installer install-puma-rk3399-u-boot)))
fa747018 219
2fce14af
VC
220(define u-boot-rock64-rk3328-bootloader
221 ;; SD and eMMC use the same format
222 (bootloader
223 (inherit u-boot-bootloader)
224 (package u-boot-rock64-rk3328)
225 (installer install-rock64-rk3328-u-boot)))
226
fa747018
CN
227(define u-boot-rockpro64-rk3399-bootloader
228 ;; SD and eMMC use the same format
229 (bootloader
230 (inherit u-boot-bootloader)
231 (package u-boot-rockpro64-rk3399)
232 (installer install-rockpro64-rk3399-u-boot)))