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