Commit | Line | Data |
---|---|---|
65d8b777 | 1 | ;;; GNU Guix --- Functional package management for GNU |
bc64d955 | 2 | ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2021 Ludovic Courtès <ludo@gnu.org> |
0a2a7053 | 3 | ;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org> |
f0150f87 | 4 | ;;; Copyright © 2015 Leo Famulari <leo@famulari.name> |
d613991a | 5 | ;;; Copyright © 2016, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> |
c87ebc1b | 6 | ;;; Copyright © 2016, 2017, 2018, 2021 Marius Bakke <marius@gnu.org> |
862e38d5 DC |
7 | ;;; Copyright © 2016, 2017 Danny Milosavljevic <dannym@scratchpost.org> |
8 | ;;; Copyright © 2016, 2017 David Craven <david@craven.ch> | |
0dc99fd1 | 9 | ;;; Copyright © 2017, 2018, 2020, 2021, 2022 Efraim Flashner <efraim@flashner.co.il> |
25e9bb05 | 10 | ;;; Copyright © 2018–2022 Tobias Geerinckx-Rice <me@tobias.gr> |
ab100b90 | 11 | ;;; Copyright © 2019 nee <nee@cock.li> |
af58b275 | 12 | ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com> |
5664a471 | 13 | ;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de> |
5327b399 | 14 | ;;; Copyright © 2018, 2019, 2020 Vagrant Cascadian <vagrant@debian.org> |
adb84ae8 | 15 | ;;; Copyright © 2020, 2021 Pierre Langlois <pierre.langlois@gmx.com> |
aeed7218 VL |
16 | ;;; Copyright © 2021 Vincent Legoll <vincent.legoll@gmail.com> |
17 | ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re> | |
62c86c83 | 18 | ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> |
65d8b777 LC |
19 | ;;; |
20 | ;;; This file is part of GNU Guix. | |
21 | ;;; | |
22 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
23 | ;;; under the terms of the GNU General Public License as published by | |
24 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
25 | ;;; your option) any later version. | |
26 | ;;; | |
27 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
28 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
29 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
30 | ;;; GNU General Public License for more details. | |
31 | ;;; | |
32 | ;;; You should have received a copy of the GNU General Public License | |
33 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
34 | ||
862e38d5 | 35 | (define-module (gnu packages bootloaders) |
65d8b777 | 36 | #:use-module (gnu packages) |
862e38d5 | 37 | #:use-module (gnu packages admin) |
178e5500 | 38 | #:use-module (gnu packages algebra) |
862e38d5 | 39 | #:use-module (gnu packages assembly) |
a60f1319 | 40 | #:use-module (gnu packages base) |
7febe3a2 | 41 | #:use-module (gnu packages disk) |
65d8b777 | 42 | #:use-module (gnu packages bison) |
862e38d5 | 43 | #:use-module (gnu packages cdrom) |
65212c42 | 44 | #:use-module (gnu packages check) |
0c7707d5 | 45 | #:use-module (gnu packages compression) |
862e38d5 DC |
46 | #:use-module (gnu packages cross-base) |
47 | #:use-module (gnu packages disk) | |
29be6cfb | 48 | #:use-module (gnu packages firmware) |
862e38d5 | 49 | #:use-module (gnu packages flex) |
a86177d6 | 50 | #:use-module (gnu packages fontutils) |
f074f5e8 | 51 | #:use-module (gnu packages gcc) |
862e38d5 | 52 | #:use-module (gnu packages gettext) |
65d8b777 | 53 | #:use-module (gnu packages linux) |
862e38d5 | 54 | #:use-module (gnu packages man) |
444f9dcc | 55 | #:use-module (gnu packages mtools) |
862e38d5 | 56 | #:use-module (gnu packages ncurses) |
96b714f5 | 57 | #:use-module (gnu packages perl) |
a60f1319 | 58 | #:use-module (gnu packages pkg-config) |
96b714f5 | 59 | #:use-module (gnu packages python) |
eb46c6c5 | 60 | #:use-module (gnu packages python-crypto) |
58301666 | 61 | #:use-module (gnu packages texinfo) |
a60f1319 | 62 | #:use-module (gnu packages tls) |
65212c42 | 63 | #:use-module (gnu packages sdl) |
e8122816 | 64 | #:use-module (gnu packages serialization) |
12c613b5 | 65 | #:use-module (gnu packages swig) |
5d706f18 | 66 | #:use-module (gnu packages valgrind) |
59132b80 | 67 | #:use-module (gnu packages virtualization) |
ab100b90 | 68 | #:use-module (gnu packages xorg) |
862e38d5 DC |
69 | #:use-module (guix build-system gnu) |
70 | #:use-module (guix download) | |
71 | #:use-module (guix git-download) | |
72 | #:use-module ((guix licenses) #:prefix license:) | |
73 | #:use-module (guix packages) | |
63087721 EF |
74 | #:use-module (guix utils) |
75 | #:use-module (srfi srfi-1) | |
a7c87169 MW |
76 | #:use-module (srfi srfi-26) |
77 | #:use-module (ice-9 regex)) | |
65d8b777 | 78 | |
9b24c768 LC |
79 | (define unifont |
80 | ;; GNU Unifont, <http://gnu.org/s/unifont>. | |
81 | ;; GRUB needs it for its graphical terminal, gfxterm. | |
82 | (origin | |
83 | (method url-fetch) | |
84 | (uri | |
85 | "http://unifoundry.com/pub/unifont-7.0.06/font-builds/unifont-7.0.06.bdf.gz") | |
86 | (sha256 | |
87 | (base32 | |
88 | "0p2vhnc18cnbmb39vq4m7hzv4mhnm2l0a2s7gx3ar277fwng3hys")))) | |
89 | ||
65d8b777 LC |
90 | (define-public grub |
91 | (package | |
92 | (name "grub") | |
2d115ea7 | 93 | (version "2.06") |
65d8b777 LC |
94 | (source (origin |
95 | (method url-fetch) | |
3586a3e9 | 96 | (uri (string-append "mirror://gnu/grub/grub-" version ".tar.xz")) |
65d8b777 LC |
97 | (sha256 |
98 | (base32 | |
2d115ea7 | 99 | "1qbycnxkx07arj9f2nlsi9kp0dyldspbv07ysdyd34qvz55a97mp")) |
654de94e JN |
100 | (patches (search-patches |
101 | "grub-efi-fat-serial-number.patch" | |
c87ebc1b MB |
102 | "grub-setup-root.patch")) |
103 | (modules '((guix build utils))) | |
104 | (snippet | |
105 | '(begin | |
106 | ;; Adjust QEMU invocation to not use a deprecated device | |
107 | ;; name that was removed in QEMU 6.0. Remove for >2.06. | |
108 | (substitute* "tests/ahci_test.in" | |
109 | (("ide-drive") | |
110 | "ide-hd")))))) | |
65d8b777 LC |
111 | (build-system gnu-build-system) |
112 | (arguments | |
069ab3bb TGR |
113 | `(#:configure-flags |
114 | ;; Counterintuitively, this *disables* a spurious Python dependency by | |
115 | ;; calling the ‘true’ binary instead. Python is only needed during | |
116 | ;; bootstrapping (for genptl.py), not when building from a release. | |
117 | (list "PYTHON=true") | |
650e85d8 MO |
118 | ;; Grub fails to load modules stripped with --strip-unneeded. |
119 | #:strip-flags '("--strip-debug" "--enable-deterministic-archives") | |
069ab3bb | 120 | #:phases (modify-phases %standard-phases |
358db004 | 121 | (add-after 'unpack 'patch-stuff |
7c353424 | 122 | (lambda* (#:key native-inputs inputs #:allow-other-keys) |
04e0eac1 MW |
123 | (substitute* "grub-core/Makefile.in" |
124 | (("/bin/sh") (which "sh"))) | |
65d8b777 | 125 | |
358db004 LC |
126 | ;; Give the absolute file name of 'mdadm', used to |
127 | ;; determine the root file system when it's a RAID | |
128 | ;; device. Failing to do that, 'grub-probe' silently | |
129 | ;; fails if 'mdadm' is not in $PATH. | |
149666df EF |
130 | (when (assoc-ref inputs "mdadm") |
131 | (substitute* "grub-core/osdep/linux/getroot.c" | |
132 | (("argv\\[0\\] = \"mdadm\"") | |
133 | (string-append "argv[0] = \"" | |
134 | (assoc-ref inputs "mdadm") | |
135 | "/sbin/mdadm\"")))) | |
358db004 | 136 | |
04e0eac1 | 137 | ;; Make the font visible. |
7c353424 MO |
138 | (copy-file (assoc-ref (or native-inputs inputs) |
139 | "unifont") | |
140 | "unifont.bdf.gz") | |
04e0eac1 | 141 | (system* "gunzip" "unifont.bdf.gz") |
ab100b90 | 142 | |
143 | ;; Give the absolute file name of 'ckbcomp'. | |
144 | (substitute* "util/grub-kbdcomp.in" | |
145 | (("^ckbcomp ") | |
bc64d955 LC |
146 | (string-append |
147 | (search-input-file inputs "/bin/ckbcomp") | |
148 | " "))))) | |
34a6f123 EF |
149 | (add-after 'unpack 'set-freetype-variables |
150 | ;; These variables need to be set to the native versions | |
151 | ;; of the dependencies because they are used to build | |
152 | ;; programs which are executed during build time. | |
77b7d990 EF |
153 | (lambda* (#:key native-inputs #:allow-other-keys) |
154 | (when (assoc-ref native-inputs "freetype") | |
155 | (let ((freetype (assoc-ref native-inputs "freetype"))) | |
156 | (setenv "BUILD_FREETYPE_LIBS" | |
157 | (string-append "-L" freetype | |
158 | "/lib -lfreetype")) | |
159 | (setenv "BUILD_FREETYPE_CFLAGS" | |
160 | (string-append "-I" freetype | |
161 | "/include/freetype2")))) | |
34a6f123 | 162 | #t)) |
23a53a95 LF |
163 | (add-before 'check 'disable-flaky-test |
164 | (lambda _ | |
165 | ;; This test is unreliable. For more information, see: | |
166 | ;; <https://bugs.gnu.org/26936>. | |
167 | (substitute* "Makefile.in" | |
168 | (("grub_cmd_date grub_cmd_set_date grub_cmd_sleep") | |
169 | "grub_cmd_date grub_cmd_sleep")) | |
069ab3bb TGR |
170 | #t)) |
171 | (add-before 'check 'disable-pixel-perfect-test | |
172 | (lambda _ | |
173 | ;; This test compares many screenshots rendered with an | |
174 | ;; older Unifont (9.0.06) than that packaged in Guix. | |
175 | (substitute* "Makefile.in" | |
176 | (("test_unset grub_func_test") | |
177 | "test_unset")) | |
56f0feb6 | 178 | #t))) |
66f76912 EF |
179 | ;; Disable tests on ARM and AARCH64 platforms or when cross-compiling. |
180 | #:tests? ,(not (or (any (cute string-prefix? <> (or (%current-target-system) | |
181 | (%current-system))) | |
182 | '("arm" "aarch64")) | |
183 | (%current-target-system))))) | |
65d8b777 | 184 | (inputs |
10da75df LC |
185 | `(("gettext" ,gettext-minimal) |
186 | ||
187 | ;; Depend on LVM2 for libdevmapper, used by 'grub-probe' and | |
188 | ;; 'grub-install' to recognize mapped devices (LUKS, etc.) | |
654de94e JN |
189 | ,@(if (member (or (%current-target-system) |
190 | (%current-system)) | |
191 | (package-supported-systems lvm2)) | |
192 | `(("lvm2" ,lvm2)) | |
193 | '()) | |
10da75df LC |
194 | |
195 | ;; Depend on mdadm, which is invoked by 'grub-probe' and 'grub-install' | |
196 | ;; to determine whether the root file system is RAID. | |
654de94e JN |
197 | ,@(if (member (or (%current-target-system) |
198 | (%current-system)) | |
199 | (package-supported-systems mdadm)) | |
200 | `(("mdadm" ,mdadm)) | |
201 | '()) | |
10da75df | 202 | |
ab100b90 | 203 | ;; Console-setup's ckbcomp is invoked by grub-kbdcomp. It is required |
204 | ;; for generating alternative keyboard layouts. | |
205 | ("console-setup" ,console-setup) | |
206 | ||
35014c40 TGR |
207 | ;; Needed for ‘grub-mount’, the only reliable way to tell whether a given |
208 | ;; file system will be readable by GRUB without rebooting. | |
654de94e JN |
209 | ,@(if (member (or (%current-target-system) |
210 | (%current-system)) | |
211 | (package-supported-systems fuse)) | |
212 | `(("fuse" ,fuse)) | |
213 | '()) | |
35014c40 | 214 | |
65d8b777 LC |
215 | ("freetype" ,freetype) |
216 | ;; ("libusb" ,libusb) | |
01eafd38 | 217 | ("ncurses" ,ncurses))) |
65d8b777 | 218 | (native-inputs |
0a2a7053 MW |
219 | `(("pkg-config" ,pkg-config) |
220 | ("unifont" ,unifont) | |
9b24c768 | 221 | ("bison" ,bison) |
f142c077 | 222 | ("flex" ,flex) |
58301666 MW |
223 | ("texinfo" ,texinfo) |
224 | ("help2man" ,help2man) | |
34a6f123 | 225 | ("freetype" ,freetype) ; native version needed for build-grub-mkfont |
65d8b777 | 226 | |
a7c87169 MW |
227 | ;; XXX: When building GRUB 2.02 on 32-bit x86, we need a binutils |
228 | ;; capable of assembling 64-bit instructions. However, our default | |
229 | ;; binutils on 32-bit x86 is not 64-bit capable. | |
230 | ,@(if (string-match "^i[3456]86-" (%current-system)) | |
231 | (let ((binutils (package/inherit | |
232 | binutils | |
233 | (name "binutils-i386") | |
234 | (arguments | |
235 | (substitute-keyword-arguments (package-arguments binutils) | |
236 | ((#:configure-flags flags ''()) | |
237 | `(cons "--enable-64-bit-bfd" ,flags))))))) | |
238 | `(("ld-wrapper" ,(make-ld-wrapper "ld-wrapper-i386" | |
239 | #:binutils binutils)) | |
240 | ("binutils" ,binutils))) | |
241 | '()) | |
242 | ||
65d8b777 LC |
243 | ;; Dependencies for the test suite. The "real" QEMU is needed here, |
244 | ;; because several targets are used. | |
7febe3a2 | 245 | ("parted" ,parted) |
654de94e JN |
246 | ,@(if (member (%current-system) (package-supported-systems qemu-minimal)) |
247 | `(("qemu" ,qemu-minimal)) | |
248 | '()) | |
65d8b777 | 249 | ("xorriso" ,xorriso))) |
175b259c | 250 | (home-page "https://www.gnu.org/software/grub/") |
79c311b8 | 251 | (synopsis "GRand Unified Boot loader") |
65d8b777 | 252 | (description |
a22dc0c4 | 253 | "GRUB is a multiboot bootloader. It is used for initially loading the |
35b9e423 | 254 | kernel of an operating system and then transferring control to it. The kernel |
c5779c93 | 255 | then goes on to load the rest of the operating system. As a multiboot |
574e86f9 LC |
256 | bootloader, GRUB handles the presence of multiple operating systems installed |
257 | on the same computer; upon booting the computer, the user is presented with a | |
a22dc0c4 | 258 | menu to select one of the installed operating systems.") |
3f73aa1a | 259 | (license license:gpl3+) |
99effc8f | 260 | (properties '((cpe-name . "grub2"))))) |
acb5f7c3 | 261 | |
0c962369 JN |
262 | (define-public grub-minimal |
263 | (package | |
264 | (inherit grub) | |
265 | (name "grub-minimal") | |
266 | (inputs | |
8394619b LC |
267 | (modify-inputs (package-inputs grub) |
268 | (delete "lvm2" "mdadm" "fuse" "console-setup"))) | |
0c962369 | 269 | (native-inputs |
8394619b LC |
270 | (modify-inputs (package-native-inputs grub) |
271 | (delete "help2man" "texinfo" "parted" "qemu" "xorriso"))) | |
0c962369 | 272 | (arguments |
097b7255 LC |
273 | (substitute-keyword-arguments (package-arguments grub) |
274 | ((#:configure-flags _ ''()) | |
275 | '(list "PYTHON=true")) | |
276 | ((#:tests? _ #t) | |
277 | #f) | |
278 | ((#:phases phases '%standard-phases) | |
279 | `(modify-phases ,phases | |
280 | (replace 'patch-stuff | |
281 | (lambda* (#:key native-inputs inputs #:allow-other-keys) | |
282 | (substitute* "grub-core/Makefile.in" | |
283 | (("/bin/sh") (which "sh"))) | |
0c962369 | 284 | |
097b7255 LC |
285 | ;; Make the font visible. |
286 | (copy-file (assoc-ref (or native-inputs inputs) | |
287 | "unifont") | |
288 | "unifont.bdf.gz") | |
289 | (system* "gunzip" "unifont.bdf.gz") | |
0c962369 | 290 | |
097b7255 | 291 | #t)))))))) |
0c962369 | 292 | |
acb5f7c3 MB |
293 | (define-public grub-efi |
294 | (package | |
295 | (inherit grub) | |
296 | (name "grub-efi") | |
297 | (synopsis "GRand Unified Boot loader (UEFI version)") | |
298 | (inputs | |
8394619b LC |
299 | (modify-inputs (package-inputs grub) |
300 | (prepend efibootmgr mtools))) | |
acb5f7c3 MB |
301 | (arguments |
302 | `(;; TODO: Tests need a UEFI firmware for qemu. There is one at | |
303 | ;; https://github.com/tianocore/edk2/tree/master/OvmfPkg . | |
304 | ;; Search for 'OVMF' in "tests/util/grub-shell.in". | |
acb5f7c3 | 305 | ,@(substitute-keyword-arguments (package-arguments grub) |
46ff2dbb | 306 | ((#:tests? _ #f) #f) |
ef753a1a | 307 | ((#:configure-flags flags ''()) |
018f9509 | 308 | `(cons* "--with-platform=efi" |
fd549750 CB |
309 | ,@(if (string-prefix? "x86_64" |
310 | (or (%current-target-system) | |
311 | (%current-system))) | |
312 | '("--enable-stack-protector") ; EFI-only for now | |
313 | '()) | |
018f9509 | 314 | ,flags)) |
acb5f7c3 MB |
315 | ((#:phases phases) |
316 | `(modify-phases ,phases | |
317 | (add-after 'patch-stuff 'use-absolute-efibootmgr-path | |
318 | (lambda* (#:key inputs #:allow-other-keys) | |
319 | (substitute* "grub-core/osdep/unix/platform.c" | |
320 | (("efibootmgr") | |
bc64d955 LC |
321 | (search-input-file inputs |
322 | "/sbin/efibootmgr"))))) | |
444f9dcc DM |
323 | (add-after 'patch-stuff 'use-absolute-mtools-path |
324 | (lambda* (#:key inputs #:allow-other-keys) | |
325 | (let ((mtools (assoc-ref inputs "mtools"))) | |
326 | (substitute* "util/grub-mkrescue.c" | |
327 | (("\"mformat\"") | |
328 | (string-append "\"" mtools | |
329 | "/bin/mformat\""))) | |
330 | (substitute* "util/grub-mkrescue.c" | |
331 | (("\"mcopy\"") | |
332 | (string-append "\"" mtools | |
333 | "/bin/mcopy\""))) | |
334 | #t)))))))))) | |
96b714f5 | 335 | |
62c86c83 DGC |
336 | (define-public grub-efi32 |
337 | (package | |
338 | (inherit grub-efi) | |
339 | (name "grub-efi32") | |
340 | (synopsis "GRand Unified Boot loader (UEFI 32bit version)") | |
341 | (arguments | |
342 | `(,@(substitute-keyword-arguments (package-arguments grub-efi) | |
116c0268 EF |
343 | ((#:configure-flags flags ''()) |
344 | `(cons* | |
345 | ,@(cond ((target-x86?) '("--target=i386")) | |
346 | ((target-aarch64?) | |
347 | (list "--target=arm" | |
348 | (string-append "TARGET_CC=" | |
349 | (cc-for-target "arm-linux-gnueabihf")))) | |
350 | ((target-arm?) '("--target=arm")) | |
351 | (else '())) | |
352 | ,flags))))) | |
353 | (native-inputs | |
354 | (if (target-aarch64?) | |
355 | (modify-inputs (package-native-inputs grub-efi) | |
356 | (prepend | |
357 | (cross-gcc "arm-linux-gnueabihf") | |
358 | (cross-binutils "arm-linux-gnueabihf"))) | |
359 | (package-native-inputs grub-efi))))) | |
62c86c83 | 360 | |
dd4b7476 DM |
361 | ;; Because grub searches hardcoded paths it's easiest to just build grub |
362 | ;; again to make it find both grub-pc and grub-efi. There is a command | |
363 | ;; line argument which allows you to specify ONE platform - but | |
364 | ;; grub-mkrescue will use multiple platforms if they are available | |
365 | ;; in the installation directory (without command line argument). | |
366 | (define-public grub-hybrid | |
367 | (package | |
368 | (inherit grub-efi) | |
369 | (name "grub-hybrid") | |
370 | (synopsis "GRand Unified Boot loader (hybrid version)") | |
371 | (inputs | |
8394619b LC |
372 | (modify-inputs (package-inputs grub-efi) |
373 | (prepend grub))) | |
dd4b7476 DM |
374 | (arguments |
375 | (substitute-keyword-arguments (package-arguments grub-efi) | |
376 | ((#:modules modules `((guix build utils) (guix build gnu-build-system))) | |
377 | `((ice-9 ftw) ,@modules)) | |
378 | ((#:phases phases) | |
379 | `(modify-phases ,phases | |
380 | (add-after 'install 'install-non-efi | |
381 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
d468a03a LC |
382 | (let ((input-dir (search-input-directory inputs |
383 | "/lib/grub")) | |
dd4b7476 DM |
384 | (output-dir (string-append (assoc-ref outputs "out") |
385 | "/lib/grub"))) | |
386 | (for-each | |
387 | (lambda (basename) | |
db34d4bb EF |
388 | (if (not (or (string-prefix? "." basename) |
389 | (file-exists? (string-append output-dir "/" basename)))) | |
dd4b7476 DM |
390 | (symlink (string-append input-dir "/" basename) |
391 | (string-append output-dir "/" basename)))) | |
392 | (scandir input-dir)) | |
393 | #t))))))))) | |
394 | ||
96b714f5 DC |
395 | (define-public syslinux |
396 | (let ((commit "bb41e935cc83c6242de24d2271e067d76af3585c")) | |
397 | (package | |
398 | (name "syslinux") | |
399 | (version (git-version "6.04-pre" "1" commit)) | |
400 | (source (origin | |
401 | (method git-fetch) | |
402 | (uri (git-reference | |
403 | (url "https://github.com/geneC/syslinux") | |
404 | (commit commit))) | |
405 | (file-name (git-file-name name version)) | |
406 | (sha256 | |
407 | (base32 | |
26cb0c39 MO |
408 | "0k8dvafd6410kqxf3kyr4y8jzmpmrih6wbjqg6gklak7945yflrc")) |
409 | (patches | |
410 | (search-patches "syslinux-gcc10.patch" | |
411 | "syslinux-strip-gnu-property.patch")))) | |
96b714f5 DC |
412 | (build-system gnu-build-system) |
413 | (native-inputs | |
414 | `(("nasm" ,nasm) | |
415 | ("perl" ,perl) | |
416 | ("python-2" ,python-2))) | |
417 | (inputs | |
bb93042c | 418 | `(("libuuid" ,util-linux "lib") |
0b4dbb40 | 419 | ("mtools" ,mtools))) |
96b714f5 DC |
420 | (arguments |
421 | `(#:parallel-build? #f | |
422 | #:make-flags | |
423 | (list (string-append "BINDIR=" %output "/bin") | |
424 | (string-append "SBINDIR=" %output "/sbin") | |
425 | (string-append "LIBDIR=" %output "/lib") | |
426 | (string-append "INCDIR=" %output "/include") | |
427 | (string-append "DATADIR=" %output "/share") | |
428 | (string-append "MANDIR=" %output "/share/man") | |
429 | "PERL=perl" | |
430 | "bios") | |
26cb0c39 | 431 | #:strip-flags '("--strip-debug" "--enable-deterministic-archives") |
96b714f5 DC |
432 | #:phases |
433 | (modify-phases %standard-phases | |
434 | (add-after 'unpack 'patch-files | |
0b4dbb40 | 435 | (lambda* (#:key inputs #:allow-other-keys) |
96b714f5 DC |
436 | (substitute* (find-files "." "Makefile.*|ppmtolss16") |
437 | (("/bin/pwd") (which "pwd")) | |
438 | (("/bin/echo") (which "echo")) | |
439 | (("/usr/bin/perl") (which "perl"))) | |
0b4dbb40 LC |
440 | (let ((mtools (assoc-ref inputs "mtools"))) |
441 | (substitute* (find-files "." "\\.c$") | |
442 | (("mcopy") | |
443 | (string-append mtools "/bin/mcopy")) | |
444 | (("mattrib") | |
445 | (string-append mtools "/bin/mattrib")))) | |
96b714f5 DC |
446 | #t)) |
447 | (delete 'configure) | |
448 | (add-before 'build 'set-permissions | |
449 | (lambda _ | |
60d8db74 | 450 | (invoke "chmod" "a+w" "utils/isohybrid.in"))) |
96b714f5 DC |
451 | (replace 'check |
452 | (lambda _ | |
453 | (setenv "CC" "gcc") | |
454 | (substitute* "tests/unittest/include/unittest/unittest.h" | |
455 | ;; Don't look up headers under /usr. | |
456 | (("/usr/include/") "")) | |
60d8db74 | 457 | (invoke "make" "unittest")))))) |
0f304ba7 | 458 | (home-page "https://www.syslinux.org") |
96b714f5 DC |
459 | (synopsis "Lightweight Linux bootloader") |
460 | (description "Syslinux is a lightweight Linux bootloader.") | |
8d3f604d EF |
461 | ;; The Makefile specifically targets i386 and x86_64 using nasm. |
462 | (supported-systems '("i686-linux" "x86_64-linux")) | |
96b714f5 DC |
463 | (license (list license:gpl2+ |
464 | license:bsd-3 ; gnu-efi/* | |
465 | license:bsd-4 ; gnu-efi/inc/* gnu-efi/lib/* | |
466 | ;; Also contains: | |
467 | license:expat license:isc license:zlib))))) | |
862e38d5 DC |
468 | |
469 | (define-public dtc | |
470 | (package | |
471 | (name "dtc") | |
402f544c | 472 | (version "1.6.1") |
862e38d5 DC |
473 | (source (origin |
474 | (method url-fetch) | |
475 | (uri (string-append | |
3b4efb1f | 476 | "mirror://kernel.org/software/utils/dtc/" |
54933a40 | 477 | "dtc-" version ".tar.gz")) |
862e38d5 DC |
478 | (sha256 |
479 | (base32 | |
54933a40 | 480 | "0xm38h31jb29xfh2sfyk48d8wdfq4b8lmb412zx9vjr35izjb9iq")))) |
862e38d5 DC |
481 | (build-system gnu-build-system) |
482 | (native-inputs | |
0dc99fd1 EF |
483 | (append |
484 | (list bison | |
485 | flex | |
486 | libyaml | |
487 | pkg-config | |
488 | swig) | |
489 | (if (member (%current-system) (package-supported-systems valgrind)) | |
490 | (list valgrind) | |
491 | '()))) | |
12c613b5 | 492 | (inputs |
8394619b | 493 | (list python)) |
862e38d5 DC |
494 | (arguments |
495 | `(#:make-flags | |
6cc86492 | 496 | (list (string-append "CC=" ,(cc-for-target)) |
91af1031 TGR |
497 | |
498 | ;; /bin/fdt{get,overlay,put} need help finding libfdt.so.1. | |
499 | (string-append "LDFLAGS=-Wl,-rpath=" | |
500 | (assoc-ref %outputs "out") "/lib") | |
501 | ||
862e38d5 | 502 | (string-append "PREFIX=" (assoc-ref %outputs "out")) |
12c613b5 | 503 | (string-append "SETUP_PREFIX=" (assoc-ref %outputs "out")) |
862e38d5 DC |
504 | "INSTALL=install") |
505 | #:phases | |
506 | (modify-phases %standard-phases | |
6cc86492 EF |
507 | (add-after 'unpack 'patch-pkg-config |
508 | (lambda _ | |
509 | (substitute* '("Makefile" | |
510 | "tests/run_tests.sh") | |
511 | (("pkg-config") | |
027ce789 | 512 | ,(pkg-config-for-target))))) |
d95bb295 | 513 | (delete 'configure)))) ; no configure script |
862e38d5 DC |
514 | (home-page "https://www.devicetree.org") |
515 | (synopsis "Compiles device tree source files") | |
516 | (description "@command{dtc} compiles | |
517 | @uref{http://elinux.org/Device_Tree_Usage, device tree source files} to device | |
518 | tree binary files. These are board description files used by Linux and BSD.") | |
519 | (license license:gpl2+))) | |
520 | ||
3a851d45 VC |
521 | (define %u-boot-rockchip-inno-usb-patch |
522 | ;; Fix regression in 2020.10 causing freezes on boot with USB boot enabled. | |
523 | ;; See https://gitlab.manjaro.org/manjaro-arm/packages/core/uboot-rockpro64/-/issues/4 | |
524 | ;; and https://patchwork.ozlabs.org/project/uboot/patch/20210406151059.1187379-1-icenowy@aosc.io | |
525 | (search-patch "u-boot-rockchip-inno-usb.patch")) | |
526 | ||
eb46c6c5 PL |
527 | (define %u-boot-sifive-prevent-relocating-initrd-fdt |
528 | ;; Fix boot in 2021.07 on Hifive unmatched, see | |
529 | ;; https://bugs.launchpad.net/ubuntu/+source/u-boot/+bug/1937246 | |
530 | (search-patch "u-boot-sifive-prevent-reloc-initrd-fdt.patch")) | |
531 | ||
65be27dc VC |
532 | (define %u-boot-allow-disabling-openssl-patch |
533 | ;; Fixes build of u-boot 2021.10 without openssl | |
534 | ;; https://lists.denx.de/pipermail/u-boot/2021-October/462728.html | |
535 | (search-patch "u-boot-allow-disabling-openssl.patch")) | |
536 | ||
bf1e46e9 PL |
537 | (define %u-boot-rk3399-enable-emmc-phy-patch |
538 | ;; Fix emmc boot on rockpro64 and pinebook-pro, this was a regression | |
539 | ;; therefore should hopefully be fixed when updating u-boot. | |
540 | ;; https://lists.denx.de/pipermail/u-boot/2021-November/466329.html | |
541 | (search-patch "u-boot-rk3399-enable-emmc-phy.patch")) | |
542 | ||
862e38d5 DC |
543 | (define u-boot |
544 | (package | |
545 | (name "u-boot") | |
4a0d0459 | 546 | (version "2022.04") |
862e38d5 | 547 | (source (origin |
3a851d45 | 548 | (patches |
eb46c6c5 | 549 | (list %u-boot-rockchip-inno-usb-patch |
65be27dc | 550 | %u-boot-allow-disabling-openssl-patch |
bf1e46e9 PL |
551 | %u-boot-sifive-prevent-relocating-initrd-fdt |
552 | %u-boot-rk3399-enable-emmc-phy-patch)) | |
862e38d5 DC |
553 | (method url-fetch) |
554 | (uri (string-append | |
98067662 | 555 | "https://ftp.denx.de/pub/u-boot/" |
862e38d5 DC |
556 | "u-boot-" version ".tar.bz2")) |
557 | (sha256 | |
558 | (base32 | |
4a0d0459 | 559 | "1l5w13dznj0z1ibqv2d6ljx2ma1gnf5x5ay3dqkqwxr6750nbq38")))) |
862e38d5 DC |
560 | (native-inputs |
561 | `(("bc" ,bc) | |
336c4a4b | 562 | ("bison" ,bison) |
53e290df | 563 | ("dtc" ,dtc) |
4a0d0459 | 564 | ("gnutls" ,gnutls) |
336c4a4b | 565 | ("flex" ,flex) |
0c7707d5 | 566 | ("lz4" ,lz4) |
4a0d0459 | 567 | ("tinfo" ,ncurses/tinfo) |
634b0e28 VC |
568 | ("perl" ,perl) |
569 | ("python" ,python) | |
570 | ("python-coverage" ,python-coverage) | |
eb46c6c5 | 571 | ("python-pycryptodomex" ,python-pycryptodomex) |
634b0e28 | 572 | ("python-pytest" ,python-pytest) |
4a0d0459 VC |
573 | ("swig" ,swig) |
574 | ("libuuid" ,util-linux "lib"))) | |
862e38d5 | 575 | (build-system gnu-build-system) |
3e63a83c | 576 | (home-page "https://www.denx.de/wiki/U-Boot/") |
862e38d5 | 577 | (synopsis "ARM bootloader") |
2ebcc538 | 578 | (description "U-Boot is a bootloader used mostly for ARM boards. It |
862e38d5 DC |
579 | also initializes the boards (RAM etc).") |
580 | (license license:gpl2+))) | |
581 | ||
2676628f DM |
582 | (define-public u-boot-tools |
583 | (package | |
584 | (inherit u-boot) | |
585 | (name "u-boot-tools") | |
6b125371 | 586 | (native-inputs |
8394619b LC |
587 | (modify-inputs (package-native-inputs u-boot) |
588 | (prepend sdl2))) | |
2676628f | 589 | (arguments |
65212c42 | 590 | `(#:make-flags '("HOSTCC=gcc") |
e9545e6d | 591 | #:test-target "tcheck" |
2676628f DM |
592 | #:phases |
593 | (modify-phases %standard-phases | |
65212c42 DM |
594 | (add-after 'unpack 'patch |
595 | (lambda* (#:key inputs #:allow-other-keys) | |
596 | (substitute* "Makefile" | |
597 | (("/bin/pwd") (which "pwd")) | |
598 | (("/bin/false") (which "false"))) | |
599 | (substitute* "tools/dtoc/fdt_util.py" | |
600 | (("'cc'") "'gcc'")) | |
e1d1ec14 | 601 | (substitute* "tools/patman/test_util.py" |
e9545e6d | 602 | ;; python3-coverage is simply called coverage in guix. |
b0bd3ef9 MB |
603 | (("python3-coverage") "coverage") |
604 | ||
605 | ;; Don't require 100% coverage since it's brittle and can | |
606 | ;; fail with newer versions of coverage or dependencies. | |
607 | (("raise ValueError\\('Test coverage failure'\\)") | |
608 | "print('Continuing anyway since Guix does not care :O')")) | |
65212c42 DM |
609 | (substitute* "test/run" |
610 | ;; Make it easier to find test failures. | |
611 | (("#!/bin/bash") "#!/bin/bash -x") | |
65212c42 DM |
612 | ;; This test would require git. |
613 | (("\\./tools/patman/patman") (which "true")) | |
634b0e28 | 614 | ;; FIXME: test fails, needs further investiation |
eb46c6c5 PL |
615 | (("run_test \"binman\"") "# run_test \"binman\"") |
616 | ;; FIXME: test_spl fails, needs further investiation | |
617 | (("test_ofplatdata or test_handoff or test_spl") | |
618 | "test_ofplatdata or test_handoff") | |
634b0e28 | 619 | ;; FIXME: code coverage not working |
eb46c6c5 PL |
620 | (("run_test \"binman code coverage\"") |
621 | "# run_test \"binman code coverage\"") | |
65212c42 DM |
622 | ;; This test would require internet access. |
623 | (("\\./tools/buildman/buildman") (which "true"))) | |
624 | (substitute* "test/py/tests/test_sandbox_exit.py" | |
625 | (("def test_ctrl_c") | |
626 | "@pytest.mark.skip(reason='Guix has problems with SIGINT') | |
627 | def test_ctrl_c")) | |
6f5be83c VC |
628 | ;; Test against the tools being installed rather than tools built |
629 | ;; for "sandbox" target. | |
630 | (substitute* "test/image/test-imagetools.sh" | |
631 | (("BASEDIR=sandbox") "BASEDIR=.")) | |
4da4e952 VC |
632 | (for-each (lambda (file) |
633 | (substitute* file | |
e9545e6d VC |
634 | ;; Disable features that require OpenSSL due |
635 | ;; to GPL/Openssl license incompatibilities. | |
636 | ;; See https://bugs.gnu.org/34717 for | |
637 | ;; details. | |
638 | (("CONFIG_FIT_SIGNATURE=y") | |
65be27dc | 639 | "CONFIG_FIT_SIGNATURE=n\nCONFIG_UT_LIB_ASN1=n\nCONFIG_TOOLS_LIBCRYPTO=n") |
fb0aeaac VC |
640 | ;; This test requires a sound system, which is un-used |
641 | ;; in u-boot-tools. | |
4da4e952 | 642 | (("CONFIG_SOUND=y") "CONFIG_SOUND=n"))) |
634b0e28 | 643 | (find-files "configs" "sandbox_.*defconfig$|tools-only_defconfig")) |
65212c42 | 644 | #t)) |
2676628f DM |
645 | (replace 'configure |
646 | (lambda* (#:key make-flags #:allow-other-keys) | |
634b0e28 | 647 | (apply invoke "make" "tools-only_defconfig" make-flags))) |
2676628f DM |
648 | (replace 'build |
649 | (lambda* (#:key inputs make-flags #:allow-other-keys) | |
9e84a4d6 | 650 | (apply invoke "make" "tools-all" make-flags))) |
2676628f DM |
651 | (replace 'install |
652 | (lambda* (#:key outputs #:allow-other-keys) | |
653 | (let* ((out (assoc-ref outputs "out")) | |
654 | (bin (string-append out "/bin"))) | |
655 | (for-each (lambda (name) | |
656 | (install-file name bin)) | |
657 | '("tools/netconsole" | |
658 | "tools/jtagconsole" | |
659 | "tools/gen_eth_addr" | |
660 | "tools/gen_ethaddr_crc" | |
661 | "tools/img2srec" | |
662 | "tools/mkenvimage" | |
663 | "tools/dumpimage" | |
664 | "tools/mkimage" | |
06f47e02 | 665 | "tools/kwboot" |
2676628f DM |
666 | "tools/proftool" |
667 | "tools/fdtgrep" | |
10186ee2 DM |
668 | "tools/env/fw_printenv" |
669 | "tools/sunxi-spl-image-builder")) | |
65212c42 DM |
670 | #t))) |
671 | (delete 'check) | |
672 | (add-after 'install 'check | |
673 | (lambda* (#:key make-flags test-target #:allow-other-keys) | |
6f5be83c VC |
674 | (invoke "test/image/test-imagetools.sh"))) |
675 | ;; Only run full test suite on x86_64 systems, as many tests | |
676 | ;; assume x86_64. | |
677 | ,@(if (string-match "^x86_64-linux" | |
678 | (or (%current-target-system) | |
679 | (%current-system))) | |
680 | '((add-after 'check 'check-x86 | |
681 | (lambda* (#:key make-flags test-target #:allow-other-keys) | |
682 | (apply invoke "make" "mrproper" make-flags) | |
683 | (setenv "SDL_VIDEODRIVER" "dummy") | |
684 | (setenv "PAGER" "cat") | |
685 | (apply invoke "make" test-target make-flags)))) | |
686 | '())))) | |
2676628f DM |
687 | (description "U-Boot is a bootloader used mostly for ARM boards. It |
688 | also initializes the boards (RAM etc). This package provides its | |
689 | board-independent tools."))) | |
690 | ||
4ce4fc50 | 691 | (define-public (make-u-boot-package board triplet) |
862e38d5 | 692 | "Returns a u-boot package for BOARD cross-compiled for TRIPLET." |
6bfcb729 LC |
693 | (let ((same-arch? (lambda () |
694 | (string=? (%current-system) | |
695 | (gnu-triplet->nix-system triplet))))) | |
3bfee8ff EF |
696 | (package |
697 | (inherit u-boot) | |
df8a9096 DM |
698 | (name (string-append "u-boot-" |
699 | (string-replace-substring (string-downcase board) | |
700 | "_" "-"))) | |
3bfee8ff | 701 | (native-inputs |
6bfcb729 | 702 | `(,@(if (not (same-arch?)) |
b8806e13 | 703 | `(("cross-gcc" ,(cross-gcc triplet)) |
3bfee8ff | 704 | ("cross-binutils" ,(cross-binutils triplet))) |
b8806e13 | 705 | `()) |
3bfee8ff EF |
706 | ,@(package-native-inputs u-boot))) |
707 | (arguments | |
37297674 EF |
708 | `(#:modules ((ice-9 ftw) |
709 | (srfi srfi-1) | |
710 | (guix build utils) | |
711 | (guix build gnu-build-system)) | |
3bfee8ff EF |
712 | #:test-target "test" |
713 | #:make-flags | |
714 | (list "HOSTCC=gcc" | |
6bfcb729 | 715 | ,@(if (not (same-arch?)) |
3bfee8ff EF |
716 | `((string-append "CROSS_COMPILE=" ,triplet "-")) |
717 | '())) | |
718 | #:phases | |
719 | (modify-phases %standard-phases | |
720 | (replace 'configure | |
721 | (lambda* (#:key outputs make-flags #:allow-other-keys) | |
722 | (let ((config-name (string-append ,board "_defconfig"))) | |
723 | (if (file-exists? (string-append "configs/" config-name)) | |
8f43bdd9 | 724 | (apply invoke "make" `(,@make-flags ,config-name)) |
3bfee8ff | 725 | (begin |
ac30d18c DM |
726 | (display "Invalid board name. Valid board names are:" |
727 | (current-error-port)) | |
30ef146c DM |
728 | (let ((suffix-len (string-length "_defconfig")) |
729 | (entries (scandir "configs"))) | |
730 | (for-each (lambda (file-name) | |
731 | (when (string-suffix? "_defconfig" file-name) | |
ac30d18c | 732 | (format (current-error-port) |
30ef146c DM |
733 | "- ~A\n" |
734 | (string-drop-right file-name | |
735 | suffix-len)))) | |
ee3c8fbe | 736 | (sort entries string-ci<))) |
bdd235b3 | 737 | (error "Invalid boardname ~s." ,board)))))) |
65be27dc VC |
738 | (add-after 'configure 'disable-tools-libcrypto |
739 | ;; Disable libcrypto due to GPL and OpenSSL license | |
740 | ;; incompatibilities | |
741 | (lambda _ | |
742 | (substitute* ".config" | |
743 | (("CONFIG_TOOLS_LIBCRYPTO=.*$") "CONFIG_TOOLS_LIBCRYPTO=n")))) | |
3bfee8ff | 744 | (replace 'install |
9b94ced4 | 745 | (lambda* (#:key outputs #:allow-other-keys) |
3bfee8ff EF |
746 | (let* ((out (assoc-ref outputs "out")) |
747 | (libexec (string-append out "/libexec")) | |
dd208b93 | 748 | (uboot-files (append |
a9446dde DM |
749 | (remove |
750 | ;; Those would not be reproducible | |
751 | ;; because of the randomness used | |
752 | ;; to produce them. | |
753 | ;; It's expected that the user will | |
754 | ;; use u-boot-tools to generate them | |
755 | ;; instead. | |
756 | (lambda (name) | |
757 | (string-suffix? | |
758 | "sunxi-spl-with-ecc.bin" | |
759 | name)) | |
760 | (find-files "." ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$")) | |
fd0b21d5 | 761 | (find-files "." "^(MLO|SPL)$")))) |
3bfee8ff | 762 | (mkdir-p libexec) |
a32f9b59 | 763 | (install-file ".config" libexec) |
0fcfed39 DM |
764 | ;; Useful for "qemu -kernel". |
765 | (install-file "u-boot" libexec) | |
3bfee8ff EF |
766 | (for-each |
767 | (lambda (file) | |
768 | (let ((target-file (string-append libexec "/" file))) | |
769 | (mkdir-p (dirname target-file)) | |
770 | (copy-file file target-file))) | |
d1af9a8c DM |
771 | uboot-files) |
772 | #t))))))))) | |
862e38d5 | 773 | |
862e38d5 DC |
774 | (define-public u-boot-malta |
775 | (make-u-boot-package "malta" "mips64el-linux-gnuabi64")) | |
776 | ||
6b99afee VC |
777 | (define-public u-boot-am335x-boneblack |
778 | (let ((base (make-u-boot-package "am335x_evm" "arm-linux-gnueabihf"))) | |
779 | (package | |
780 | (inherit base) | |
781 | (name "u-boot-am335x-boneblack") | |
2ebcc538 | 782 | (description "U-Boot is a bootloader used mostly for ARM boards. It |
6b99afee VC |
783 | also initializes the boards (RAM etc). |
784 | ||
785 | This U-Boot is built for the BeagleBone Black, which was removed upstream, | |
786 | adjusted from the am335x_evm build with several device trees removed so that | |
787 | it fits within common partitioning schemes.") | |
788 | (arguments | |
789 | (substitute-keyword-arguments (package-arguments base) | |
790 | ((#:phases phases) | |
791 | `(modify-phases ,phases | |
792 | (add-after 'unpack 'patch-defconfig | |
793 | ;; Patch out other devicetrees to build image small enough to | |
794 | ;; fit within typical partitioning schemes where the first | |
795 | ;; partition begins at sector 2048. | |
796 | (lambda _ | |
797 | (substitute* "configs/am335x_evm_defconfig" | |
798 | (("CONFIG_OF_LIST=.*$") "CONFIG_OF_LIST=\"am335x-evm am335x-boneblack\"\n")) | |
799 | #t))))))))) | |
800 | ||
801 | (define-public u-boot-am335x-evm | |
802 | (make-u-boot-package "am335x_evm" "arm-linux-gnueabihf")) | |
4adeb3f6 | 803 | |
0da3526d VC |
804 | (define-public (make-u-boot-sunxi64-package board triplet) |
805 | (let ((base (make-u-boot-package board triplet))) | |
29be6cfb EF |
806 | (package |
807 | (inherit base) | |
808 | (arguments | |
809 | (substitute-keyword-arguments (package-arguments base) | |
810 | ((#:phases phases) | |
811 | `(modify-phases ,phases | |
812 | (add-after 'unpack 'set-environment | |
db78fc06 MO |
813 | (lambda* (#:key native-inputs inputs #:allow-other-keys) |
814 | (let ((bl31 | |
815 | (string-append | |
816 | (assoc-ref (or native-inputs inputs) "firmware") | |
817 | "/bl31.bin"))) | |
29be6cfb | 818 | (setenv "BL31" bl31) |
35e427d1 DM |
819 | ;; This is necessary when we're using the bundled dtc. |
820 | ;(setenv "PATH" (string-append (getenv "PATH") ":" | |
821 | ; "scripts/dtc")) | |
822 | ) | |
29be6cfb EF |
823 | #t)))))) |
824 | (native-inputs | |
95d91986 | 825 | `(("firmware" ,arm-trusted-firmware-sun50i-a64) |
29be6cfb EF |
826 | ,@(package-native-inputs base)))))) |
827 | ||
0da3526d VC |
828 | (define-public u-boot-pine64-plus |
829 | (make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu")) | |
830 | ||
af58b275 MO |
831 | (define-public u-boot-pine64-lts |
832 | (make-u-boot-sunxi64-package "pine64-lts" "aarch64-linux-gnu")) | |
833 | ||
74e35e8c | 834 | (define-public u-boot-pinebook |
760dfc67 VC |
835 | (let ((base (make-u-boot-sunxi64-package "pinebook" "aarch64-linux-gnu"))) |
836 | (package | |
837 | (inherit base) | |
838 | (arguments | |
839 | (substitute-keyword-arguments (package-arguments base) | |
840 | ((#:phases phases) | |
841 | `(modify-phases ,phases | |
842 | (add-after 'unpack 'patch-pinebook-config | |
843 | ;; Fix regression with LCD video output introduced in 2020.01 | |
844 | ;; https://patchwork.ozlabs.org/patch/1225130/ | |
845 | (lambda _ | |
846 | (substitute* "configs/pinebook_defconfig" | |
847 | (("CONFIG_VIDEO_BRIDGE_ANALOGIX_ANX6345=y") "CONFIG_VIDEO_BRIDGE_ANALOGIX_ANX6345=y\nCONFIG_VIDEO_BPP32=y")) | |
848 | #t))))))))) | |
74e35e8c | 849 | |
e830c9d0 | 850 | (define-public u-boot-bananapi-m2-ultra |
30aeb846 DM |
851 | (make-u-boot-package "Bananapi_M2_Ultra" "arm-linux-gnueabihf")) |
852 | ||
c55c6985 DM |
853 | (define-public u-boot-a20-olinuxino-lime |
854 | (make-u-boot-package "A20-OLinuXino-Lime" "arm-linux-gnueabihf")) | |
855 | ||
4b9e9abb DM |
856 | (define-public u-boot-a20-olinuxino-lime2 |
857 | (make-u-boot-package "A20-OLinuXino-Lime2" "arm-linux-gnueabihf")) | |
858 | ||
a7bb327e DM |
859 | (define-public u-boot-a20-olinuxino-micro |
860 | (make-u-boot-package "A20-OLinuXino_MICRO" "arm-linux-gnueabihf")) | |
861 | ||
84ee3378 | 862 | (define-public u-boot-nintendo-nes-classic-edition |
dd7df191 DM |
863 | (let ((base (make-u-boot-package "Nintendo_NES_Classic_Edition" |
864 | "arm-linux-gnueabihf"))) | |
865 | (package | |
866 | (inherit base) | |
867 | ;; Starting with 2019.01, FEL doesn't work anymore on A33. | |
868 | (version "2018.11") | |
869 | (source (origin | |
870 | (method url-fetch) | |
871 | (uri (string-append | |
872 | "https://ftp.denx.de/pub/u-boot/" | |
873 | "u-boot-" version ".tar.bz2")) | |
874 | (sha256 | |
875 | (base32 | |
876 | "0znkwljfwwn4y7j20pzz4ilqw8znphrfxns0x1lwdzh3xbr96z3k")) | |
877 | (patches (search-patches | |
878 | "u-boot-nintendo-nes-serial.patch")))) | |
879 | (description "U-Boot is a bootloader used mostly for ARM boards. It | |
880 | also initializes the boards (RAM etc). | |
881 | ||
882 | This version is for the Nintendo NES Classic Edition. It is assumed that | |
883 | you have added a serial port to pins PB0 and PB1 as described on | |
884 | @url{https://linux-sunxi.org/Nintendo_NES_Classic_Edition}. | |
885 | ||
886 | In order to use FEL mode on the device, hold the Reset button on the | |
887 | device while it's being turned on (and a while longer).") | |
888 | (native-inputs | |
889 | `(("python" ,python-2) | |
890 | ,@(package-native-inputs base)))))) | |
84ee3378 | 891 | |
95a3422e VC |
892 | (define-public u-boot-wandboard |
893 | (make-u-boot-package "wandboard" "arm-linux-gnueabihf")) | |
894 | ||
adc61d72 VC |
895 | (define-public u-boot-mx6cuboxi |
896 | (make-u-boot-package "mx6cuboxi" "arm-linux-gnueabihf")) | |
897 | ||
1b960787 | 898 | (define-public u-boot-novena |
6e2bad00 VC |
899 | (let ((base (make-u-boot-package "novena" "arm-linux-gnueabihf"))) |
900 | (package | |
901 | (inherit base) | |
2ebcc538 | 902 | (description "U-Boot is a bootloader used mostly for ARM boards. It |
6e2bad00 VC |
903 | also initializes the boards (RAM etc). |
904 | ||
905 | This U-Boot is built for Novena. Be advised that this version, contrary | |
6b99afee | 906 | to Novena upstream, does not load u-boot.img from the first partition.") |
6e2bad00 VC |
907 | (arguments |
908 | (substitute-keyword-arguments (package-arguments base) | |
909 | ((#:phases phases) | |
910 | `(modify-phases ,phases | |
911 | (add-after 'unpack 'patch-novena-defconfig | |
912 | ;; Patch configuration to disable loading u-boot.img from FAT partition, | |
913 | ;; allowing it to be installed at a device offset. | |
914 | (lambda _ | |
915 | (substitute* "configs/novena_defconfig" | |
6b99afee | 916 | (("CONFIG_SPL_FS_FAT=y") "# CONFIG_SPL_FS_FAT is not set")) |
6e2bad00 | 917 | #t))))))))) |
1b960787 | 918 | |
dd4fe0c2 DM |
919 | (define-public u-boot-cubieboard |
920 | (make-u-boot-package "Cubieboard" "arm-linux-gnueabihf")) | |
921 | ||
a7d5ce94 JL |
922 | (define-public u-boot-cubietruck |
923 | (make-u-boot-package "Cubietruck" "arm-linux-gnueabihf")) | |
924 | ||
6fe16577 VC |
925 | (define-public u-boot-puma-rk3399 |
926 | (let ((base (make-u-boot-package "puma-rk3399" "aarch64-linux-gnu"))) | |
927 | (package | |
928 | (inherit base) | |
929 | (arguments | |
15990546 VC |
930 | (substitute-keyword-arguments (package-arguments base) |
931 | ((#:phases phases) | |
932 | `(modify-phases ,phases | |
933 | (add-after 'unpack 'set-environment | |
934 | (lambda* (#:key inputs #:allow-other-keys) | |
d468a03a LC |
935 | (setenv "BL31" |
936 | (search-input-file inputs "/bl31.elf")))) | |
15990546 VC |
937 | ;; Phases do not succeed on the bl31 ELF. |
938 | (delete 'strip) | |
939 | (delete 'validate-runpath))))) | |
6fe16577 | 940 | (native-inputs |
15990546 | 941 | `(("firmware" ,arm-trusted-firmware-rk3399) |
6fe16577 VC |
942 | ,@(package-native-inputs base)))))) |
943 | ||
10f31af9 VC |
944 | (define-public u-boot-qemu-riscv64 |
945 | (make-u-boot-package "qemu-riscv64" "riscv64-linux-gnu")) | |
946 | ||
7e954f67 | 947 | (define-public u-boot-qemu-riscv64-smode |
4a0d0459 | 948 | (make-u-boot-package "qemu-riscv64_smode" "riscv64-linux-gnu")) |
7e954f67 | 949 | |
e914fc59 PL |
950 | (define-public u-boot-sifive-unleashed |
951 | (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu")) | |
7d063645 | 952 | |
df3a60d1 | 953 | (define-public u-boot-sifive-unmatched |
1acd0bf8 EF |
954 | (let ((base (make-u-boot-package "sifive_unmatched" "riscv64-linux-gnu"))) |
955 | (package | |
956 | (inherit base) | |
957 | (arguments | |
958 | (substitute-keyword-arguments (package-arguments base) | |
959 | ((#:phases phases) | |
960 | `(modify-phases ,phases | |
961 | (add-after 'unpack 'set-environment | |
962 | (lambda* (#:key inputs #:allow-other-keys) | |
963 | (let ((opensbi (string-append (assoc-ref inputs "firmware") | |
964 | "/fw_dynamic.bin"))) | |
965 | (setenv "OPENSBI" opensbi)))))))) | |
966 | (inputs | |
967 | `(("firmware" ,opensbi-generic) | |
968 | ,@(package-inputs base)))))) | |
df3a60d1 | 969 | |
2fce14af VC |
970 | (define-public u-boot-rock64-rk3328 |
971 | (let ((base (make-u-boot-package "rock64-rk3328" "aarch64-linux-gnu"))) | |
972 | (package | |
973 | (inherit base) | |
2fce14af VC |
974 | (arguments |
975 | (substitute-keyword-arguments (package-arguments base) | |
976 | ((#:phases phases) | |
977 | `(modify-phases ,phases | |
978 | (add-after 'unpack 'set-environment | |
979 | (lambda* (#:key inputs #:allow-other-keys) | |
d468a03a LC |
980 | (let ((bl31 (search-input-file inputs "/bl31.elf"))) |
981 | (setenv "BL31" bl31)))))))) | |
2fce14af VC |
982 | (native-inputs |
983 | `(("firmware" ,arm-trusted-firmware-rk3328) | |
984 | ,@(package-native-inputs base)))))) | |
985 | ||
545ff7b7 VC |
986 | (define-public u-boot-firefly-rk3399 |
987 | (let ((base (make-u-boot-package "firefly-rk3399" "aarch64-linux-gnu"))) | |
988 | (package | |
989 | (inherit base) | |
545ff7b7 VC |
990 | (arguments |
991 | (substitute-keyword-arguments (package-arguments base) | |
992 | ((#:phases phases) | |
993 | `(modify-phases ,phases | |
7d440cdb | 994 | (add-after 'unpack 'set-environment |
545ff7b7 | 995 | (lambda* (#:key inputs #:allow-other-keys) |
d468a03a | 996 | (setenv "BL31" (search-input-file inputs "/bl31.elf")))) |
545ff7b7 VC |
997 | ;; Phases do not succeed on the bl31 ELF. |
998 | (delete 'strip) | |
999 | (delete 'validate-runpath))))) | |
1000 | (native-inputs | |
1001 | `(("firmware" ,arm-trusted-firmware-rk3399) | |
1002 | ,@(package-native-inputs base)))))) | |
1003 | ||
fa747018 CN |
1004 | (define-public u-boot-rockpro64-rk3399 |
1005 | (let ((base (make-u-boot-package "rockpro64-rk3399" "aarch64-linux-gnu"))) | |
1006 | (package | |
1007 | (inherit base) | |
5327b399 VC |
1008 | (arguments |
1009 | (substitute-keyword-arguments (package-arguments base) | |
1010 | ((#:phases phases) | |
1011 | `(modify-phases ,phases | |
adb84ae8 | 1012 | (add-after 'unpack 'set-environment |
5327b399 | 1013 | (lambda* (#:key inputs #:allow-other-keys) |
d468a03a LC |
1014 | (setenv "BL31" |
1015 | (search-input-file inputs "/bl31.elf")))) | |
d643ef38 RW |
1016 | (add-after 'unpack 'patch-config |
1017 | (lambda _ | |
1018 | (substitute* "configs/rockpro64-rk3399_defconfig" | |
1019 | (("CONFIG_USB=y") "\ | |
1020 | CONFIG_USB=y | |
1021 | CONFIG_AHCI=y | |
1022 | CONFIG_AHCI_PCI=y | |
1023 | CONFIG_SATA=y | |
1024 | CONFIG_SATA_SIL=y | |
1025 | CONFIG_SCSI=y | |
1026 | CONFIG_SCSI_AHCI=y | |
1027 | CONFIG_DM_SCSI=y | |
1028 | ")) | |
1029 | (substitute* "include/config_distro_bootcmd.h" | |
1030 | (("\"scsi_need_init=false") | |
1031 | "\"setenv scsi_need_init false") | |
1032 | (("#define BOOTENV_SET_SCSI_NEED_INIT \"scsi_need_init=;") | |
1033 | "#define BOOTENV_SET_SCSI_NEED_INIT \"setenv scsi_need_init;")) | |
1034 | (substitute* "include/configs/rockchip-common.h" | |
1035 | (("#define BOOT_TARGET_DEVICES\\(func\\)") | |
1036 | " | |
1037 | #if CONFIG_IS_ENABLED(CMD_SCSI) | |
1038 | #define BOOT_TARGET_SCSI(func) func(SCSI, scsi, 0) | |
1039 | #else | |
1040 | #define BOOT_TARGET_SCSI(func) | |
1041 | #endif | |
1042 | #define BOOT_TARGET_DEVICES(func)") | |
1043 | (("BOOT_TARGET_NVME\\(func\\) \\\\") | |
1044 | "\ | |
1045 | BOOT_TARGET_NVME(func) \\ | |
1046 | BOOT_TARGET_SCSI(func) \\")))) | |
5327b399 VC |
1047 | ;; Phases do not succeed on the bl31 ELF. |
1048 | (delete 'strip) | |
1049 | (delete 'validate-runpath))))) | |
1050 | (native-inputs | |
1051 | `(("firmware" ,arm-trusted-firmware-rk3399) | |
1052 | ,@(package-native-inputs base)))))) | |
1053 | ||
1054 | (define-public u-boot-pinebook-pro-rk3399 | |
1055 | (let ((base (make-u-boot-package "pinebook-pro-rk3399" "aarch64-linux-gnu"))) | |
1056 | (package | |
eb46c6c5 | 1057 | (inherit base) |
fa747018 CN |
1058 | (arguments |
1059 | (substitute-keyword-arguments (package-arguments base) | |
1060 | ((#:phases phases) | |
1061 | `(modify-phases ,phases | |
1062 | (add-after 'unpack 'set-environment | |
1063 | (lambda* (#:key inputs #:allow-other-keys) | |
d468a03a LC |
1064 | (setenv "BL31" |
1065 | (search-input-file inputs "/bl31.elf")))) | |
fa747018 CN |
1066 | ;; Phases do not succeed on the bl31 ELF. |
1067 | (delete 'strip) | |
1068 | (delete 'validate-runpath))))) | |
1069 | (native-inputs | |
1070 | `(("firmware" ,arm-trusted-firmware-rk3399) | |
1071 | ,@(package-native-inputs base)))))) | |
1072 | ||
a60f1319 MB |
1073 | (define-public vboot-utils |
1074 | (package | |
1075 | (name "vboot-utils") | |
1076 | (version "R63-10032.B") | |
1077 | (source (origin | |
1078 | ;; XXX: Snapshots are available but changes timestamps every download. | |
1079 | (method git-fetch) | |
1080 | (uri (git-reference | |
1081 | (url (string-append "https://chromium.googlesource.com" | |
1082 | "/chromiumos/platform/vboot_reference")) | |
1083 | (commit (string-append "release-" version)))) | |
1084 | (file-name (string-append name "-" version "-checkout")) | |
1085 | (sha256 | |
1086 | (base32 | |
b634b5c2 KK |
1087 | "0h0m3l69vp9dr6xrs1p6y7ilkq3jq8jraw2z20kqfv7lvc9l1lxj")) |
1088 | (patches | |
1089 | (search-patches "vboot-utils-skip-test-workbuf.patch" | |
1090 | "vboot-utils-fix-tests-show-contents.patch" | |
1091 | "vboot-utils-fix-format-load-address.patch")))) | |
a60f1319 MB |
1092 | (build-system gnu-build-system) |
1093 | (arguments | |
1094 | `(#:make-flags (list "CC=gcc" | |
b634b5c2 KK |
1095 | ;; On ARM, we must pass "HOST_ARCH=arm" so that the |
1096 | ;; ${HOST_ARCH} and ${ARCH} variables in the makefile | |
1097 | ;; match. Otherwise, ${HOST_ARCH} will be assigned | |
1098 | ;; "armv7l", the value of `uname -m`, and will not | |
1099 | ;; match ${ARCH}, which will make the tests require | |
1100 | ;; QEMU for testing. | |
1101 | ,@(if (string-prefix? "arm" | |
1102 | (or (%current-target-system) | |
1103 | (%current-system))) | |
1104 | '("HOST_ARCH=arm") | |
1105 | '()) | |
a60f1319 MB |
1106 | (string-append "DESTDIR=" (assoc-ref %outputs "out"))) |
1107 | #:phases (modify-phases %standard-phases | |
1108 | (add-after 'unpack 'patch-hard-coded-paths | |
1109 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
1110 | (let ((coreutils (assoc-ref inputs "coreutils")) | |
1111 | (diffutils (assoc-ref inputs "diffutils"))) | |
1112 | (substitute* "futility/misc.c" | |
1113 | (("/bin/cp") (string-append coreutils "/bin/cp"))) | |
1114 | (substitute* "tests/bitmaps/TestBmpBlock.py" | |
1115 | (("/usr/bin/cmp") (string-append diffutils "/bin/cmp"))) | |
1116 | (substitute* "vboot_host.pc.in" | |
1117 | (("prefix=/usr") | |
1118 | (string-append "prefix=" (assoc-ref outputs "out")))) | |
1119 | #t))) | |
1120 | (delete 'configure) | |
1121 | (add-before 'check 'patch-tests | |
1122 | (lambda _ | |
1123 | ;; These tests compare diffs against known-good values. | |
1124 | ;; Patch the paths to match those in the build container. | |
1125 | (substitute* (find-files "tests/futility/expect_output") | |
1126 | (("/mnt/host/source/src/platform/vboot_reference") | |
1127 | (string-append "/tmp/guix-build-" ,name "-" ,version | |
1128 | ".drv-0/source"))) | |
1129 | ;; Tests require write permissions to many of these files. | |
1130 | (for-each make-file-writable (find-files "tests/futility")) | |
71f2b4b8 KK |
1131 | #t)) |
1132 | (add-after 'install 'install-devkeys | |
1133 | (lambda* (#:key outputs #:allow-other-keys) | |
1134 | (let* ((out (assoc-ref outputs "out")) | |
1135 | (share (string-append out "/share/vboot-utils"))) | |
1136 | (copy-recursively "tests/devkeys" | |
1137 | (string-append share "/devkeys")) | |
1138 | #t)))) | |
a60f1319 MB |
1139 | #:test-target "runtests")) |
1140 | (native-inputs | |
1141 | `(("pkg-config" ,pkg-config) | |
1142 | ||
1143 | ;; For tests. | |
1144 | ("diffutils" ,diffutils) | |
1145 | ("python@2" ,python-2))) | |
1146 | (inputs | |
1147 | `(("coreutils" ,coreutils) | |
1148 | ("libyaml" ,libyaml) | |
1149 | ("openssl" ,openssl) | |
1150 | ("openssl:static" ,openssl "static") | |
bb93042c | 1151 | ("util-linux" ,util-linux "lib"))) |
a60f1319 MB |
1152 | (home-page |
1153 | "https://dev.chromium.org/chromium-os/chromiumos-design-docs/verified-boot") | |
1154 | (synopsis "ChromiumOS verified boot utilities") | |
1155 | (description | |
1156 | "vboot-utils is a collection of tools to facilitate booting of | |
1157 | Chrome-branded devices. This includes the @command{cgpt} partitioning | |
1158 | program, the @command{futility} and @command{crossystem} firmware management | |
1159 | tools, and more.") | |
1160 | (license license:bsd-3))) | |
1161 | ||
aa90375a AI |
1162 | (define-public os-prober |
1163 | (package | |
1164 | (name "os-prober") | |
25e9bb05 | 1165 | (version "1.81") |
aa90375a AI |
1166 | (source |
1167 | (origin | |
1168 | (method url-fetch) | |
1169 | (uri (string-append "mirror://debian/pool/main/o/os-prober/os-prober_" | |
1170 | version ".tar.xz")) | |
1171 | (sha256 | |
25e9bb05 | 1172 | (base32 "10w8jz6mqhp0skdcam9mpgv79vx1sv7lkpra3rqjg0jkhvn2in9g")))) |
aa90375a AI |
1173 | (build-system gnu-build-system) |
1174 | (arguments | |
1175 | `(#:modules ((guix build gnu-build-system) | |
1176 | (guix build utils) | |
e9bdef5f TGR |
1177 | (ice-9 regex) ; for string-match |
1178 | (srfi srfi-26)) ; for cut | |
33430a45 TGR |
1179 | #:make-flags |
1180 | (list ,(string-append "CC=" (cc-for-target))) | |
e9bdef5f | 1181 | #:tests? #f ; no tests |
aa90375a AI |
1182 | #:phases |
1183 | (modify-phases %standard-phases | |
1184 | (replace 'configure | |
1185 | (lambda* (#:key outputs #:allow-other-keys) | |
1186 | (substitute* (find-files ".") | |
1187 | (("/usr") (assoc-ref outputs "out"))) | |
1188 | (substitute* (find-files "." "50mounted-tests$") | |
3666e5e4 | 1189 | (("mkdir") "mkdir -p")))) |
aa90375a AI |
1190 | (replace 'install |
1191 | (lambda* (#:key outputs #:allow-other-keys) | |
1192 | (define (find-files-non-recursive directory) | |
1193 | (find-files directory | |
1194 | (lambda (file stat) | |
1195 | (string-match (string-append "^" directory "/[^/]*$") | |
1196 | file)) | |
1197 | #:directories? #t)) | |
1198 | ||
1199 | (let* ((out (assoc-ref outputs "out")) | |
1200 | (bin (string-append out "/bin")) | |
1201 | (lib (string-append out "/lib")) | |
1202 | (share (string-append out "/share"))) | |
1203 | (for-each (cut install-file <> bin) | |
1204 | (list "linux-boot-prober" "os-prober")) | |
1205 | (install-file "newns" (string-append lib "/os-prober")) | |
1206 | (install-file "common.sh" (string-append share "/os-prober")) | |
1207 | (install-file "os-probes/mounted/powerpc/20macosx" | |
1208 | (string-append lib "/os-probes/mounted")) | |
1209 | (for-each | |
1210 | (lambda (directory) | |
1211 | (for-each | |
1212 | (lambda (file) | |
1213 | (let ((destination (string-append lib "/" directory | |
1214 | "/" (basename file)))) | |
1215 | (mkdir-p (dirname destination)) | |
1216 | (copy-recursively file destination))) | |
1217 | (append (find-files-non-recursive (string-append directory "/common")) | |
1218 | (find-files-non-recursive (string-append directory "/x86"))))) | |
1219 | (list "os-probes" "os-probes/mounted" "os-probes/init" | |
3666e5e4 | 1220 | "linux-boot-probes" "linux-boot-probes/mounted")))))))) |
aa90375a AI |
1221 | (home-page "https://joeyh.name/code/os-prober") |
1222 | (synopsis "Detect other operating systems") | |
1223 | (description "os-prober probes disks on the system for other operating | |
1224 | systems so that they can be added to the bootloader. It also works out how to | |
1225 | boot existing GNU/Linux systems and detects what distribution is installed in | |
1226 | order to add a suitable bootloader menu entry.") | |
1227 | (license license:gpl2+))) | |
aeed7218 VL |
1228 | |
1229 | (define-public ipxe | |
1230 | ;; XXX: 'BUILD_TIMESTAMP' is used to automatically select the newest version | |
1231 | ;; of iPXE if multiple iPXE drivers are loaded concurrently in a UEFI system. | |
1232 | ;; | |
1233 | ;; TODO: Bump this timestamp at each modifications of the package (not only | |
1234 | ;; for updates) by running: date +%s. | |
1235 | (let ((timestamp "1591706427")) | |
1236 | (package | |
1237 | (name "ipxe") | |
ca34b6f0 | 1238 | (version "1.21.1") |
aeed7218 VL |
1239 | (source (origin |
1240 | (method git-fetch) | |
1241 | (uri (git-reference | |
1242 | (url "https://github.com/ipxe/ipxe") | |
1243 | (commit (string-append "v" version)))) | |
1244 | (file-name (git-file-name name version)) | |
1245 | (patches (search-patches "ipxe-reproducible-geniso.patch")) | |
1246 | (sha256 | |
1247 | (base32 | |
ca34b6f0 | 1248 | "1pkf1n1c0rdlzfls8fvjvi1sd9xjd9ijqlyz3wigr70ijcv6x8i9")))) |
aeed7218 VL |
1249 | (build-system gnu-build-system) |
1250 | (arguments | |
1251 | `(#:modules ((guix build utils) | |
1252 | (guix build gnu-build-system) | |
1253 | (guix base32) | |
1254 | (ice-9 string-fun) | |
1255 | (ice-9 regex) | |
1256 | (rnrs bytevectors)) | |
1257 | #:imported-modules ((guix base32) | |
1258 | ,@%gnu-build-system-modules) | |
1259 | #:make-flags | |
1260 | ;; XXX: 'BUILD_ID' is used to determine when another ROM in the | |
1261 | ;; system contains identical code in order to save space within the | |
1262 | ;; legacy BIOS option ROM area, which is extremely limited in size. | |
1263 | ;; It is supposed to be collision-free across all ROMs, to do so we | |
1264 | ;; use the truncated output hash of the package. | |
1265 | (let ((build-id | |
1266 | (lambda (out) | |
1267 | (let* ((nix-store (string-append | |
1268 | (or (getenv "NIX_STORE") "/gnu/store") | |
1269 | "/")) | |
1270 | (filename | |
1271 | (string-replace-substring out nix-store "")) | |
1272 | (hash (match:substring (string-match "[0-9a-z]{32}" | |
1273 | filename))) | |
1274 | (bv (nix-base32-string->bytevector hash))) | |
1275 | (format #f "0x~x" | |
1276 | (bytevector-u32-ref bv 0 (endianness big)))))) | |
1277 | (out (assoc-ref %outputs "out")) | |
1278 | (syslinux (assoc-ref %build-inputs "syslinux"))) | |
1279 | (list "ECHO_E_BIN_ECHO=echo" | |
1280 | "ECHO_E_BIN_ECHO_E=echo -e" | |
1281 | ||
1282 | ;; cdrtools' mkisofs will silently ignore a missing isolinux.bin! | |
1283 | ;; Luckily xorriso is more strict. | |
1284 | (string-append "ISOLINUX_BIN=" syslinux | |
1285 | "/share/syslinux/isolinux.bin") | |
1286 | (string-append "SYSLINUX_MBR_DISK_PATH=" syslinux | |
1287 | "/share/syslinux/isohdpfx.bin") | |
1288 | ||
1289 | ;; Build reproducibly. | |
1290 | (string-append "BUILD_ID_CMD=echo -n " (build-id out)) | |
1291 | (string-append "BUILD_TIMESTAMP=" ,timestamp) | |
1292 | "everything")) | |
1293 | #:phases | |
1294 | (modify-phases %standard-phases | |
1295 | (add-after 'unpack 'enter-source-directory | |
1296 | (lambda _ (chdir "src") #t)) | |
1297 | (add-after 'enter-source-directory 'set-options | |
1298 | (lambda _ | |
1299 | (substitute* "config/general.h" | |
1300 | (("^//(#define PING_CMD.*)" _ uncommented) uncommented) | |
1301 | (("^//(#define IMAGE_TRUST_CMD.*)" _ uncommented) | |
1302 | uncommented) | |
1303 | (("^#undef.*(DOWNLOAD_PROTO_HTTPS.*)" _ option) | |
1304 | (string-append "#define " option)) | |
1305 | (("^#undef.*(DOWNLOAD_PROTO_NFS.*)" _ option) | |
1306 | (string-append "#define " option))) | |
1307 | #t)) | |
1308 | (delete 'configure) ; no configure script | |
1309 | (replace 'install | |
1310 | (lambda* (#:key outputs #:allow-other-keys) | |
1311 | (let* ((out (assoc-ref outputs "out")) | |
1312 | (ipxe (string-append out "/lib/ipxe")) | |
1313 | (exts-re | |
1314 | "\\.(efi|efirom|iso|kkpxe|kpxe|lkrn|mrom|pxe|rom|usb)$") | |
1315 | (dirs '("bin" "bin-i386-linux" "bin-x86_64-pcbios" | |
1316 | "bin-x86_64-efi" "bin-x86_64-linux" "bin-i386-efi")) | |
1317 | (files (apply append | |
1318 | (map (lambda (dir) | |
1319 | (find-files dir exts-re)) dirs)))) | |
1320 | (for-each (lambda (file) | |
1321 | (let* ((subdir (dirname file)) | |
1322 | (fn (basename file)) | |
1323 | (tgtsubdir (cond | |
1324 | ((string=? "bin" subdir) "") | |
1325 | ((string-prefix? "bin-" subdir) | |
1326 | (string-drop subdir 4))))) | |
1327 | (install-file file | |
1328 | (string-append ipxe "/" tgtsubdir)))) | |
1329 | files)) | |
1330 | #t)) | |
1331 | (add-after 'install 'leave-source-directory | |
1332 | (lambda _ (chdir "..") #t))) | |
1333 | #:tests? #f)) ; no test suite | |
1334 | (native-inputs | |
8394619b | 1335 | (list perl syslinux xorriso)) |
aeed7218 VL |
1336 | (home-page "https://ipxe.org") |
1337 | (synopsis "PXE-compliant network boot firmware") | |
1338 | (description "iPXE is a network boot firmware. It provides a full PXE | |
1339 | implementation enhanced with additional features such as booting from: a web | |
1340 | server via HTTP, an iSCSI SAN, a Fibre Channel SAN via FCoE, an AoE SAN, a | |
084d3cac VC |
1341 | wireless network, a wide-area network, an Infiniband network. It |
1342 | controls the boot process with a script. You can use iPXE to replace the | |
aeed7218 VL |
1343 | existing PXE ROM on your network card, or you can chainload into iPXE to obtain |
1344 | the features of iPXE without the hassle of reflashing.") | |
1345 | (license license:gpl2+)))) | |
1346 |