Commit | Line | Data |
---|---|---|
8d858010 DM |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2017 David Craven <david@craven.ch> | |
94de8d0a | 3 | ;;; Copyright © 2017, 2019 Mathieu Othacehe <m.othacehe@gmail.com> |
079901d7 | 4 | ;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu> |
5327b399 | 5 | ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> |
8d858010 DM |
6 | ;;; |
7 | ;;; This file is part of GNU Guix. | |
8 | ;;; | |
9 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
10 | ;;; under the terms of the GNU General Public License as published by | |
11 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
12 | ;;; your option) any later version. | |
13 | ;;; | |
14 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
15 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | ;;; GNU General Public License for more details. | |
18 | ;;; | |
19 | ;;; You should have received a copy of the GNU General Public License | |
20 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
21 | ||
22 | (define-module (gnu bootloader u-boot) | |
23 | #:use-module (gnu bootloader extlinux) | |
24 | #:use-module (gnu bootloader) | |
8d858010 DM |
25 | #:use-module (gnu packages bootloaders) |
26 | #:use-module (guix gexp) | |
ceb39527 | 27 | #:export (u-boot-bootloader |
c55c6985 | 28 | u-boot-a20-olinuxino-lime-bootloader |
4b9e9abb | 29 | u-boot-a20-olinuxino-lime2-bootloader |
a7bb327e | 30 | u-boot-a20-olinuxino-micro-bootloader |
e830c9d0 | 31 | u-boot-bananapi-m2-ultra-bootloader |
84ee3378 | 32 | u-boot-beaglebone-black-bootloader |
079901d7 | 33 | u-boot-cubietruck-bootloader |
545ff7b7 | 34 | u-boot-firefly-rk3399-bootloader |
07ca9045 | 35 | u-boot-mx6cuboxi-bootloader |
fd5536e3 | 36 | u-boot-nintendo-nes-classic-edition-bootloader |
1b960787 | 37 | u-boot-novena-bootloader |
9f7d6665 | 38 | u-boot-pine64-plus-bootloader |
94de8d0a | 39 | u-boot-pine64-lts-bootloader |
74e35e8c | 40 | u-boot-pinebook-bootloader |
5327b399 | 41 | u-boot-pinebook-pro-rk3399-bootloader |
6fe16577 | 42 | u-boot-puma-rk3399-bootloader |
2fce14af | 43 | u-boot-rock64-rk3328-bootloader |
fa747018 | 44 | u-boot-rockpro64-rk3399-bootloader |
fd5536e3 | 45 | u-boot-wandboard-bootloader)) |
8d858010 DM |
46 | |
47 | (define install-u-boot | |
48 | #~(lambda (bootloader device mount-point) | |
49 | (if bootloader | |
50 | (error "Failed to install U-Boot")))) | |
51 | ||
ceb39527 MO |
52 | (define install-beaglebone-black-u-boot |
53 | ;; http://wiki.beyondlogic.org/index.php?title=BeagleBoneBlack_Upgrading_uBoot | |
54 | ;; This first stage bootloader called MLO (U-Boot SPL) is expected at | |
55 | ;; 0x20000 by BBB ROM code. The second stage bootloader will be loaded by | |
56 | ;; the MLO and is expected at 0x60000. Write both first stage ("MLO") and | |
57 | ;; second stage ("u-boot.img") images, read in BOOTLOADER directory, to the | |
58 | ;; specified DEVICE. | |
59 | #~(lambda (bootloader device mount-point) | |
60 | (let ((mlo (string-append bootloader "/libexec/MLO")) | |
61 | (u-boot (string-append bootloader "/libexec/u-boot.img"))) | |
62 | (write-file-on-device mlo (* 256 512) | |
63 | device (* 256 512)) | |
64 | (write-file-on-device u-boot (* 1024 512) | |
65 | device (* 768 512))))) | |
66 | ||
30aeb846 DM |
67 | (define install-allwinner-u-boot |
68 | #~(lambda (bootloader device mount-point) | |
69 | (let ((u-boot (string-append bootloader | |
70 | "/libexec/u-boot-sunxi-with-spl.bin"))) | |
71 | (write-file-on-device u-boot (stat:size (stat u-boot)) | |
72 | device (* 8 1024))))) | |
73 | ||
9f7d6665 VC |
74 | (define install-allwinner64-u-boot |
75 | #~(lambda (bootloader device mount-point) | |
76 | (let ((spl (string-append bootloader "/libexec/spl/sunxi-spl.bin")) | |
77 | (u-boot (string-append bootloader "/libexec/u-boot.itb"))) | |
78 | (write-file-on-device spl (stat:size (stat spl)) | |
79 | device (* 8 1024)) | |
80 | (write-file-on-device u-boot (stat:size (stat u-boot)) | |
81 | device (* 40 1024))))) | |
82 | ||
07ca9045 VC |
83 | (define install-imx-u-boot |
84 | #~(lambda (bootloader device mount-point) | |
85 | (let ((spl (string-append bootloader "/libexec/SPL")) | |
86 | (u-boot (string-append bootloader "/libexec/u-boot.img"))) | |
87 | (write-file-on-device spl (stat:size (stat spl)) | |
88 | device (* 1 1024)) | |
89 | (write-file-on-device u-boot (stat:size (stat u-boot)) | |
90 | device (* 69 1024))))) | |
91 | ||
6fe16577 VC |
92 | (define install-puma-rk3399-u-boot |
93 | #~(lambda (bootloader device mount-point) | |
94 | (let ((spl (string-append bootloader "/libexec/u-boot-spl.rksd")) | |
95 | (u-boot (string-append bootloader "/libexec/u-boot.itb"))) | |
96 | (write-file-on-device spl (stat:size (stat spl)) | |
97 | device (* 64 512)) | |
98 | (write-file-on-device u-boot (stat:size (stat u-boot)) | |
99 | device (* 512 512))))) | |
100 | ||
545ff7b7 VC |
101 | (define install-firefly-rk3399-u-boot |
102 | #~(lambda (bootloader device mount-point) | |
103 | (let ((idb (string-append bootloader "/libexec/idbloader.img")) | |
104 | (u-boot (string-append bootloader "/libexec/u-boot.itb"))) | |
105 | (write-file-on-device idb (stat:size (stat idb)) | |
106 | device (* 64 512)) | |
107 | (write-file-on-device u-boot (stat:size (stat u-boot)) | |
108 | device (* 16384 512))))) | |
109 | ||
2fce14af VC |
110 | (define install-rock64-rk3328-u-boot |
111 | #~(lambda (bootloader device mount-point) | |
112 | (let ((idb (string-append bootloader "/libexec/idbloader.img")) | |
113 | (u-boot (string-append bootloader "/libexec/u-boot.itb"))) | |
114 | (write-file-on-device idb (stat:size (stat idb)) | |
115 | device (* 64 512)) | |
116 | (write-file-on-device u-boot (stat:size (stat u-boot)) | |
117 | device (* 16384 512))))) | |
118 | ||
fa747018 CN |
119 | (define install-rockpro64-rk3399-u-boot |
120 | #~(lambda (bootloader device mount-point) | |
121 | (let ((idb (string-append bootloader "/libexec/idbloader.img")) | |
122 | (u-boot (string-append bootloader "/libexec/u-boot.itb"))) | |
123 | (write-file-on-device idb (stat:size (stat idb)) | |
124 | device (* 64 512)) | |
125 | (write-file-on-device u-boot (stat:size (stat u-boot)) | |
126 | device (* 16384 512))))) | |
127 | ||
5327b399 VC |
128 | (define install-pinebook-pro-rk3399-u-boot install-rockpro64-rk3399-u-boot) |
129 | ||
8d858010 DM |
130 | \f |
131 | ||
132 | ;;; | |
133 | ;;; Bootloader definitions. | |
134 | ;;; | |
135 | ||
136 | (define u-boot-bootloader | |
137 | (bootloader | |
138 | (inherit extlinux-bootloader) | |
139 | (name 'u-boot) | |
140 | (package #f) | |
141 | (installer install-u-boot))) | |
ceb39527 MO |
142 | |
143 | (define u-boot-beaglebone-black-bootloader | |
144 | (bootloader | |
145 | (inherit u-boot-bootloader) | |
6b99afee | 146 | (package u-boot-am335x-boneblack) |
ceb39527 | 147 | (installer install-beaglebone-black-u-boot))) |
30aeb846 DM |
148 | |
149 | (define u-boot-allwinner-bootloader | |
150 | (bootloader | |
151 | (inherit u-boot-bootloader) | |
152 | (installer install-allwinner-u-boot))) | |
153 | ||
9f7d6665 VC |
154 | (define u-boot-allwinner64-bootloader |
155 | (bootloader | |
156 | (inherit u-boot-bootloader) | |
157 | (installer install-allwinner64-u-boot))) | |
158 | ||
07ca9045 VC |
159 | (define u-boot-imx-bootloader |
160 | (bootloader | |
161 | (inherit u-boot-bootloader) | |
162 | (installer install-imx-u-boot))) | |
163 | ||
84ee3378 DM |
164 | (define u-boot-nintendo-nes-classic-edition-bootloader |
165 | (bootloader | |
166 | (inherit u-boot-allwinner-bootloader) | |
167 | (package u-boot-nintendo-nes-classic-edition))) | |
168 | ||
c55c6985 DM |
169 | (define u-boot-a20-olinuxino-lime-bootloader |
170 | (bootloader | |
171 | (inherit u-boot-allwinner-bootloader) | |
172 | (package u-boot-a20-olinuxino-lime))) | |
173 | ||
4b9e9abb DM |
174 | (define u-boot-a20-olinuxino-lime2-bootloader |
175 | (bootloader | |
176 | (inherit u-boot-allwinner-bootloader) | |
177 | (package u-boot-a20-olinuxino-lime2))) | |
178 | ||
a7bb327e DM |
179 | (define u-boot-a20-olinuxino-micro-bootloader |
180 | (bootloader | |
181 | (inherit u-boot-allwinner-bootloader) | |
182 | (package u-boot-a20-olinuxino-micro))) | |
183 | ||
e830c9d0 | 184 | (define u-boot-bananapi-m2-ultra-bootloader |
30aeb846 DM |
185 | (bootloader |
186 | (inherit u-boot-allwinner-bootloader) | |
e830c9d0 | 187 | (package u-boot-bananapi-m2-ultra))) |
07ca9045 | 188 | |
079901d7 JL |
189 | (define u-boot-cubietruck-bootloader |
190 | (bootloader | |
191 | (inherit u-boot-allwinner-bootloader) | |
192 | (package u-boot-cubietruck))) | |
193 | ||
545ff7b7 VC |
194 | (define u-boot-firefly-rk3399-bootloader |
195 | ;; SD and eMMC use the same format | |
196 | (bootloader | |
197 | (inherit u-boot-bootloader) | |
198 | (package u-boot-firefly-rk3399) | |
199 | (installer install-firefly-rk3399-u-boot))) | |
200 | ||
07ca9045 VC |
201 | (define u-boot-mx6cuboxi-bootloader |
202 | (bootloader | |
203 | (inherit u-boot-imx-bootloader) | |
204 | (package u-boot-mx6cuboxi))) | |
fd5536e3 VC |
205 | |
206 | (define u-boot-wandboard-bootloader | |
207 | (bootloader | |
208 | (inherit u-boot-imx-bootloader) | |
209 | (package u-boot-wandboard))) | |
1b960787 VC |
210 | |
211 | (define u-boot-novena-bootloader | |
212 | (bootloader | |
213 | (inherit u-boot-imx-bootloader) | |
214 | (package u-boot-novena))) | |
9f7d6665 VC |
215 | |
216 | (define u-boot-pine64-plus-bootloader | |
217 | (bootloader | |
218 | (inherit u-boot-allwinner64-bootloader) | |
219 | (package u-boot-pine64-plus))) | |
6fe16577 | 220 | |
94de8d0a MO |
221 | (define u-boot-pine64-lts-bootloader |
222 | (bootloader | |
223 | (inherit u-boot-allwinner-bootloader) | |
224 | (package u-boot-pine64-lts))) | |
225 | ||
74e35e8c VC |
226 | (define u-boot-pinebook-bootloader |
227 | (bootloader | |
228 | (inherit u-boot-allwinner64-bootloader) | |
229 | (package u-boot-pinebook))) | |
230 | ||
6fe16577 VC |
231 | (define u-boot-puma-rk3399-bootloader |
232 | (bootloader | |
233 | (inherit u-boot-bootloader) | |
234 | (package u-boot-puma-rk3399) | |
235 | (installer install-puma-rk3399-u-boot))) | |
fa747018 | 236 | |
2fce14af VC |
237 | (define u-boot-rock64-rk3328-bootloader |
238 | ;; SD and eMMC use the same format | |
239 | (bootloader | |
240 | (inherit u-boot-bootloader) | |
241 | (package u-boot-rock64-rk3328) | |
242 | (installer install-rock64-rk3328-u-boot))) | |
243 | ||
fa747018 CN |
244 | (define u-boot-rockpro64-rk3399-bootloader |
245 | ;; SD and eMMC use the same format | |
246 | (bootloader | |
247 | (inherit u-boot-bootloader) | |
248 | (package u-boot-rockpro64-rk3399) | |
249 | (installer install-rockpro64-rk3399-u-boot))) | |
5327b399 VC |
250 | |
251 | (define u-boot-pinebook-pro-rk3399-bootloader | |
252 | ;; SD and eMMC use the same format | |
253 | (bootloader | |
254 | (inherit u-boot-bootloader) | |
255 | (package u-boot-pinebook-pro-rk3399) | |
256 | (installer install-pinebook-pro-rk3399-u-boot))) |