1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015 Leo Famulari <leo@famulari.name>
5 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
6 ;;; Copyright © 2016, 2017, 2018 Marius Bakke <mbakke@fastmail.com>
7 ;;; Copyright © 2016, 2017 Danny Milosavljevic <dannym@scratchpost.org>
8 ;;; Copyright © 2016, 2017 David Craven <david@craven.ch>
9 ;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
10 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
12 ;;; This file is part of GNU Guix.
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27 (define-module (gnu packages bootloaders)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages admin)
30 #:use-module ((gnu packages algebra) #:select (bc))
31 #:use-module (gnu packages assembly)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages disk)
34 #:use-module (gnu packages bison)
35 #:use-module (gnu packages cdrom)
36 #:use-module (gnu packages check)
37 #:use-module (gnu packages cross-base)
38 #:use-module (gnu packages disk)
39 #:use-module (gnu packages firmware)
40 #:use-module (gnu packages flex)
41 #:use-module (gnu packages fontutils)
42 #:use-module (gnu packages gcc)
43 #:use-module (gnu packages gettext)
44 #:use-module (gnu packages linux)
45 #:use-module (gnu packages man)
46 #:use-module (gnu packages mtools)
47 #:use-module (gnu packages ncurses)
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages texinfo)
52 #:use-module (gnu packages tls)
53 #:use-module (gnu packages sdl)
54 #:use-module (gnu packages swig)
55 #:use-module (gnu packages valgrind)
56 #:use-module (gnu packages virtualization)
57 #:use-module (gnu packages web)
58 #:use-module (guix build-system gnu)
59 #:use-module (guix download)
60 #:use-module (guix git-download)
61 #:use-module ((guix licenses) #:prefix license:)
62 #:use-module (guix packages)
63 #:use-module (guix utils)
64 #:use-module (srfi srfi-1)
65 #:use-module (srfi srfi-26)
66 #:use-module (ice-9 regex))
69 ;; GNU Unifont, <http://gnu.org/s/unifont>.
70 ;; GRUB needs it for its graphical terminal, gfxterm.
74 "http://unifoundry.com/pub/unifont-7.0.06/font-builds/unifont-7.0.06.bdf.gz")
77 "0p2vhnc18cnbmb39vq4m7hzv4mhnm2l0a2s7gx3ar277fwng3hys"))))
85 (uri (string-append "mirror://gnu/grub/grub-" version ".tar.xz"))
88 "03vvdfhdmf16121v7xs8is2krwnv15wpkhkf16a4yf8nsfc3f2w1"))
89 (patches (search-patches "grub-check-error-efibootmgr.patch"
90 "grub-binutils-compat.patch"))))
91 (build-system gnu-build-system)
93 `(#:phases (modify-phases %standard-phases
94 (add-after 'unpack 'patch-stuff
95 (lambda* (#:key inputs #:allow-other-keys)
96 (substitute* "grub-core/Makefile.in"
97 (("/bin/sh") (which "sh")))
99 ;; Give the absolute file name of 'mdadm', used to
100 ;; determine the root file system when it's a RAID
101 ;; device. Failing to do that, 'grub-probe' silently
102 ;; fails if 'mdadm' is not in $PATH.
103 (substitute* "grub-core/osdep/linux/getroot.c"
104 (("argv\\[0\\] = \"mdadm\"")
105 (string-append "argv[0] = \""
106 (assoc-ref inputs "mdadm")
109 ;; Make the font visible.
110 (copy-file (assoc-ref inputs "unifont") "unifont.bdf.gz")
111 (system* "gunzip" "unifont.bdf.gz")
113 (add-before 'check 'disable-flaky-test
115 ;; This test is unreliable. For more information, see:
116 ;; <https://bugs.gnu.org/26936>.
117 (substitute* "Makefile.in"
118 (("grub_cmd_date grub_cmd_set_date grub_cmd_sleep")
119 "grub_cmd_date grub_cmd_sleep"))
121 ;; Disable tests on ARM and AARCH64 platforms.
122 #:tests? ,(not (any (cute string-prefix? <> (or (%current-target-system)
124 '("arm" "aarch64")))))
126 `(("gettext" ,gettext-minimal)
128 ;; Depend on LVM2 for libdevmapper, used by 'grub-probe' and
129 ;; 'grub-install' to recognize mapped devices (LUKS, etc.)
132 ;; Depend on mdadm, which is invoked by 'grub-probe' and 'grub-install'
133 ;; to determine whether the root file system is RAID.
136 ("freetype" ,freetype)
137 ;; ("libusb" ,libusb)
139 ("ncurses" ,ncurses)))
141 `(("pkg-config" ,pkg-config)
144 ;; Due to a bug in flex >= 2.6.2, GRUB must be built with an older flex:
145 ;; <http://lists.gnu.org/archive/html/grub-devel/2017-02/msg00133.html>
146 ;; TODO Try building with flex > 2.6.4.
149 ("help2man" ,help2man)
151 ;; XXX: When building GRUB 2.02 on 32-bit x86, we need a binutils
152 ;; capable of assembling 64-bit instructions. However, our default
153 ;; binutils on 32-bit x86 is not 64-bit capable.
154 ,@(if (string-match "^i[3456]86-" (%current-system))
155 (let ((binutils (package/inherit
157 (name "binutils-i386")
159 (substitute-keyword-arguments (package-arguments binutils)
160 ((#:configure-flags flags ''())
161 `(cons "--enable-64-bit-bfd" ,flags)))))))
162 `(("ld-wrapper" ,(make-ld-wrapper "ld-wrapper-i386"
163 #:binutils binutils))
164 ("binutils" ,binutils)))
167 ;; Dependencies for the test suite. The "real" QEMU is needed here,
168 ;; because several targets are used.
170 ("qemu" ,qemu-minimal-2.10)
171 ("xorriso" ,xorriso)))
172 (home-page "https://www.gnu.org/software/grub/")
173 (synopsis "GRand Unified Boot loader")
175 "GRUB is a multiboot bootloader. It is used for initially loading the
176 kernel of an operating system and then transferring control to it. The kernel
177 then goes on to load the rest of the operating system. As a multiboot
178 bootloader, GRUB handles the presence of multiple operating systems installed
179 on the same computer; upon booting the computer, the user is presented with a
180 menu to select one of the installed operating systems.")
181 (license license:gpl3+)
182 (properties '((cpe-name . "grub2")))))
184 (define-public grub-efi
188 (synopsis "GRand Unified Boot loader (UEFI version)")
190 `(("efibootmgr" ,efibootmgr)
192 ,@(package-inputs grub)))
194 `(;; TODO: Tests need a UEFI firmware for qemu. There is one at
195 ;; https://github.com/tianocore/edk2/tree/master/OvmfPkg .
196 ;; Search for 'OVMF' in "tests/util/grub-shell.in".
197 ,@(substitute-keyword-arguments (package-arguments grub)
199 ((#:configure-flags flags ''())
200 `(cons "--with-platform=efi" ,flags))
202 `(modify-phases ,phases
203 (add-after 'patch-stuff 'use-absolute-efibootmgr-path
204 (lambda* (#:key inputs #:allow-other-keys)
205 (substitute* "grub-core/osdep/unix/platform.c"
207 (string-append (assoc-ref inputs "efibootmgr")
208 "/sbin/efibootmgr")))
210 (add-after 'patch-stuff 'use-absolute-mtools-path
211 (lambda* (#:key inputs #:allow-other-keys)
212 (let ((mtools (assoc-ref inputs "mtools")))
213 (substitute* "util/grub-mkrescue.c"
215 (string-append "\"" mtools
217 (substitute* "util/grub-mkrescue.c"
219 (string-append "\"" mtools
223 ;; Because grub searches hardcoded paths it's easiest to just build grub
224 ;; again to make it find both grub-pc and grub-efi. There is a command
225 ;; line argument which allows you to specify ONE platform - but
226 ;; grub-mkrescue will use multiple platforms if they are available
227 ;; in the installation directory (without command line argument).
228 (define-public grub-hybrid
232 (synopsis "GRand Unified Boot loader (hybrid version)")
235 ,@(package-inputs grub-efi)))
237 (substitute-keyword-arguments (package-arguments grub-efi)
238 ((#:modules modules `((guix build utils) (guix build gnu-build-system)))
239 `((ice-9 ftw) ,@modules))
241 `(modify-phases ,phases
242 (add-after 'install 'install-non-efi
243 (lambda* (#:key inputs outputs #:allow-other-keys)
244 (let ((input-dir (string-append (assoc-ref inputs "grub")
246 (output-dir (string-append (assoc-ref outputs "out")
250 (if (not (or (string-prefix? "." basename)
251 (file-exists? (string-append output-dir "/" basename))))
252 (symlink (string-append input-dir "/" basename)
253 (string-append output-dir "/" basename))))
257 (define-public syslinux
258 (let ((commit "bb41e935cc83c6242de24d2271e067d76af3585c"))
261 (version (git-version "6.04-pre" "1" commit))
265 (url "https://github.com/geneC/syslinux")
267 (file-name (git-file-name name version))
270 "0k8dvafd6410kqxf3kyr4y8jzmpmrih6wbjqg6gklak7945yflrc"))))
271 (build-system gnu-build-system)
275 ("python-2" ,python-2)))
277 `(("libuuid" ,util-linux)
280 `(#:parallel-build? #f
282 (list (string-append "BINDIR=" %output "/bin")
283 (string-append "SBINDIR=" %output "/sbin")
284 (string-append "LIBDIR=" %output "/lib")
285 (string-append "INCDIR=" %output "/include")
286 (string-append "DATADIR=" %output "/share")
287 (string-append "MANDIR=" %output "/share/man")
291 (modify-phases %standard-phases
292 (add-after 'unpack 'patch-files
293 (lambda* (#:key inputs #:allow-other-keys)
294 (substitute* (find-files "." "Makefile.*|ppmtolss16")
295 (("/bin/pwd") (which "pwd"))
296 (("/bin/echo") (which "echo"))
297 (("/usr/bin/perl") (which "perl")))
298 (let ((mtools (assoc-ref inputs "mtools")))
299 (substitute* (find-files "." "\\.c$")
301 (string-append mtools "/bin/mcopy"))
303 (string-append mtools "/bin/mattrib"))))
306 (add-before 'build 'set-permissions
308 (invoke "chmod" "a+w" "utils/isohybrid.in")))
312 (substitute* "tests/unittest/include/unittest/unittest.h"
313 ;; Don't look up headers under /usr.
314 (("/usr/include/") ""))
315 (invoke "make" "unittest"))))))
316 (home-page "https://www.syslinux.org")
317 (synopsis "Lightweight Linux bootloader")
318 (description "Syslinux is a lightweight Linux bootloader.")
319 (license (list license:gpl2+
320 license:bsd-3 ; gnu-efi/*
321 license:bsd-4 ; gnu-efi/inc/* gnu-efi/lib/*
323 license:expat license:isc license:zlib)))))
332 "mirror://kernel.org/software/utils/dtc/"
333 "dtc-" version ".tar.xz"))
336 "1rydi5jvhlhsr110h6n0pavv3daqa0cb4m5vcps50qzq1zqfhhv6"))))
337 (build-system gnu-build-system)
342 ("valgrind" ,valgrind)))
344 `(("python-2" ,python-2)))
348 (string-append "PREFIX=" (assoc-ref %outputs "out"))
349 (string-append "SETUP_PREFIX=" (assoc-ref %outputs "out"))
352 (modify-phases %standard-phases
353 (delete 'configure)))) ; no configure script
354 (home-page "https://www.devicetree.org")
355 (synopsis "Compiles device tree source files")
356 (description "@command{dtc} compiles
357 @uref{http://elinux.org/Device_Tree_Usage, device tree source files} to device
358 tree binary files. These are board description files used by Linux and BSD.")
359 (license license:gpl2+)))
368 "ftp://ftp.denx.de/pub/u-boot/"
369 "u-boot-" version ".tar.bz2"))
372 "1m7nw64mxflpc6sqvnz2kb5fxfkb4mrpy8b1wi15dcwipj4dy44z"))))
379 ("python-2" ,python-2)
380 ("python2-coverage" ,python2-coverage)
381 ("python2-pytest" ,python2-pytest)
384 (build-system gnu-build-system)
385 (home-page "https://www.denx.de/wiki/U-Boot/")
386 (synopsis "ARM bootloader")
387 (description "U-Boot is a bootloader used mostly for ARM boards. It
388 also initializes the boards (RAM etc).")
389 (license license:gpl2+)))
391 (define-public u-boot-tools
394 (name "u-boot-tools")
396 `(#:make-flags '("HOSTCC=gcc")
397 #:test-target "tests"
399 (modify-phases %standard-phases
400 (add-after 'unpack 'patch
401 (lambda* (#:key inputs #:allow-other-keys)
402 (substitute* "Makefile"
403 (("/bin/pwd") (which "pwd"))
404 (("/bin/false") (which "false")))
405 (substitute* "tools/dtoc/fdt_util.py"
407 (substitute* "test/run"
408 ;; Make it easier to find test failures.
409 (("#!/bin/bash") "#!/bin/bash -x")
410 ;; pytest doesn't find it otherwise.
411 (("test/py/tests/test_ofplatdata.py")
412 "tests/test_ofplatdata.py")
413 ;; This test would require git.
414 (("\\./tools/patman/patman") (which "true"))
415 ;; This test would require internet access.
416 (("\\./tools/buildman/buildman") (which "true")))
417 (substitute* "test/py/tests/test_sandbox_exit.py"
419 "@pytest.mark.skip(reason='Guix has problems with SIGINT')
421 (substitute* "tools/binman/binman.py"
422 (("100%") "99%")) ; TODO: Find out why that is needed.
425 (lambda* (#:key make-flags #:allow-other-keys)
426 (call-with-output-file "configs/tools_defconfig"
428 (display "CONFIG_SYS_TEXT_BASE=0\n" port)))
429 (apply invoke "make" "tools_defconfig" make-flags)))
431 (lambda* (#:key inputs make-flags #:allow-other-keys)
432 (apply invoke "make" "tools-all" make-flags)))
434 (lambda* (#:key outputs #:allow-other-keys)
435 (let* ((out (assoc-ref outputs "out"))
436 (bin (string-append out "/bin")))
437 (for-each (lambda (name)
438 (install-file name bin))
442 "tools/gen_ethaddr_crc"
449 "tools/env/fw_printenv"
450 "tools/sunxi-spl-image-builder"))
453 (add-after 'install 'check
454 (lambda* (#:key make-flags test-target #:allow-other-keys)
455 (apply invoke "make" "mrproper" make-flags)
456 (setenv "SDL_VIDEODRIVER" "dummy")
457 (setenv "PAGER" "cat")
458 (apply invoke "make" test-target make-flags)
459 (symlink "build-sandbox_spl" "sandbox")
460 (invoke "test/image/test-imagetools.sh"))))))
461 (description "U-Boot is a bootloader used mostly for ARM boards. It
462 also initializes the boards (RAM etc). This package provides its
463 board-independent tools.")))
465 (define-public (make-u-boot-package board triplet)
466 "Returns a u-boot package for BOARD cross-compiled for TRIPLET."
467 (let ((same-arch? (if (string-prefix? (%current-system)
468 (gnu-triplet->nix-system triplet))
473 (name (string-append "u-boot-"
474 (string-replace-substring (string-downcase board)
477 `(,@(if (not same-arch?)
478 `(("cross-gcc" ,(cross-gcc triplet #:xgcc gcc-7))
479 ("cross-binutils" ,(cross-binutils triplet)))
481 ,@(package-native-inputs u-boot)))
483 `(#:modules ((ice-9 ftw)
486 (guix build gnu-build-system))
490 ,@(if (not same-arch?)
491 `((string-append "CROSS_COMPILE=" ,triplet "-"))
494 (modify-phases %standard-phases
496 (lambda* (#:key outputs make-flags #:allow-other-keys)
497 (let ((config-name (string-append ,board "_defconfig")))
498 (if (file-exists? (string-append "configs/" config-name))
499 (zero? (apply system* "make" `(,@make-flags ,config-name)))
501 (display "Invalid board name. Valid board names are:"
502 (current-error-port))
503 (let ((suffix-len (string-length "_defconfig"))
504 (entries (scandir "configs")))
505 (for-each (lambda (file-name)
506 (when (string-suffix? "_defconfig" file-name)
507 (format (current-error-port)
509 (string-drop-right file-name
511 (sort entries string-ci<)))
512 (error "Invalid boardname ~s." ,board))))))
514 (lambda* (#:key outputs #:allow-other-keys)
515 (let* ((out (assoc-ref outputs "out"))
516 (libexec (string-append out "/libexec"))
519 ;; Those would not be reproducible
520 ;; because of the randomness used
522 ;; It's expected that the user will
523 ;; use u-boot-tools to generate them
527 "sunxi-spl-with-ecc.bin"
529 (find-files "." ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
530 (find-files "." "^(MLO|SPL)$"))))
532 (install-file ".config" libexec)
533 ;; Useful for "qemu -kernel".
534 (install-file "u-boot" libexec)
537 (let ((target-file (string-append libexec "/" file)))
538 (mkdir-p (dirname target-file))
539 (copy-file file target-file)))
543 (define-public u-boot-vexpress
544 (make-u-boot-package "vexpress_ca9x4" "arm-linux-gnueabihf"))
546 (define-public u-boot-malta
547 (make-u-boot-package "malta" "mips64el-linux-gnuabi64"))
549 (define-public u-boot-beagle-bone-black
550 (make-u-boot-package "am335x_boneblack" "arm-linux-gnueabihf"))
552 (define-public u-boot-pine64-plus
553 (let ((base (make-u-boot-package "pine64_plus" "aarch64-linux-gnu")))
557 (substitute-keyword-arguments (package-arguments base)
559 `(modify-phases ,phases
560 (add-after 'unpack 'set-environment
561 (lambda* (#:key inputs #:allow-other-keys)
562 (let ((bl31 (string-append (assoc-ref inputs "firmware")
565 ;; This is necessary when we're using the bundled dtc.
566 ;(setenv "PATH" (string-append (getenv "PATH") ":"
571 `(("firmware" ,arm-trusted-firmware-pine64-plus)
572 ,@(package-native-inputs base))))))
574 (define-public u-boot-bananapi-m2-ultra
575 (make-u-boot-package "Bananapi_M2_Ultra" "arm-linux-gnueabihf"))
577 (define-public u-boot-a20-olinuxino-lime
578 (make-u-boot-package "A20-OLinuXino-Lime" "arm-linux-gnueabihf"))
580 (define-public u-boot-a20-olinuxino-lime2
581 (make-u-boot-package "A20-OLinuXino-Lime2" "arm-linux-gnueabihf"))
583 (define-public u-boot-a20-olinuxino-micro
584 (make-u-boot-package "A20-OLinuXino_MICRO" "arm-linux-gnueabihf"))
586 (define-public u-boot-nintendo-nes-classic-edition
587 (make-u-boot-package "Nintendo_NES_Classic_Edition" "arm-linux-gnueabihf"))
589 (define-public u-boot-wandboard
590 (make-u-boot-package "wandboard" "arm-linux-gnueabihf"))
592 (define-public u-boot-mx6cuboxi
593 (make-u-boot-package "mx6cuboxi" "arm-linux-gnueabihf"))
595 (define-public u-boot-novena
596 (make-u-boot-package "novena" "arm-linux-gnueabihf"))
598 (define-public u-boot-cubieboard
599 (make-u-boot-package "Cubieboard" "arm-linux-gnueabihf"))
601 (define-public u-boot-cubietruck
602 (make-u-boot-package "Cubietruck" "arm-linux-gnueabihf"))
604 (define-public u-boot-puma-rk3399
605 (let ((base (make-u-boot-package "puma-rk3399" "aarch64-linux-gnu")))
609 (substitute-keyword-arguments (package-arguments base)
611 `(modify-phases ,phases
612 (add-after 'unpack 'set-environment
613 (lambda* (#:key inputs #:allow-other-keys)
614 ;; Need to copy the firmware into u-boot build
616 (copy-file (string-append (assoc-ref inputs "firmware")
617 "/bl31.bin") "bl31-rk3399.bin")
618 (copy-file (string-append (assoc-ref inputs "firmware-m0")
619 "/rk3399m0.bin") "rk3399m0.bin")
621 (add-after 'build 'build-itb
622 (lambda* (#:key make-flags #:allow-other-keys)
623 ;; The u-boot.itb is not built by default.
624 (apply invoke "make" `(,@make-flags ,"u-boot.itb"))))
625 (add-after 'build-itb 'build-rksd
626 (lambda* (#:key inputs #:allow-other-keys)
627 ;; Build Rockchip SD card images.
628 (invoke "./tools/mkimage" "-T" "rksd" "-n" "rk3399" "-d"
629 "spl/u-boot-spl.bin" "u-boot-spl.rksd")))))))
631 `(("firmware" ,arm-trusted-firmware-puma-rk3399)
632 ("firmware-m0" ,rk3399-cortex-m0)
633 ,@(package-native-inputs base))))))
635 (define-public vboot-utils
638 (version "R63-10032.B")
640 ;; XXX: Snapshots are available but changes timestamps every download.
643 (url (string-append "https://chromium.googlesource.com"
644 "/chromiumos/platform/vboot_reference"))
645 (commit (string-append "release-" version))))
646 (file-name (string-append name "-" version "-checkout"))
649 "0h0m3l69vp9dr6xrs1p6y7ilkq3jq8jraw2z20kqfv7lvc9l1lxj"))))
650 (build-system gnu-build-system)
652 `(#:make-flags (list "CC=gcc"
653 (string-append "DESTDIR=" (assoc-ref %outputs "out")))
654 #:phases (modify-phases %standard-phases
655 (add-after 'unpack 'patch-hard-coded-paths
656 (lambda* (#:key inputs outputs #:allow-other-keys)
657 (let ((coreutils (assoc-ref inputs "coreutils"))
658 (diffutils (assoc-ref inputs "diffutils")))
659 (substitute* "futility/misc.c"
660 (("/bin/cp") (string-append coreutils "/bin/cp")))
661 (substitute* "tests/bitmaps/TestBmpBlock.py"
662 (("/usr/bin/cmp") (string-append diffutils "/bin/cmp")))
663 (substitute* "vboot_host.pc.in"
665 (string-append "prefix=" (assoc-ref outputs "out"))))
668 (add-before 'check 'patch-tests
670 ;; These tests compare diffs against known-good values.
671 ;; Patch the paths to match those in the build container.
672 (substitute* (find-files "tests/futility/expect_output")
673 (("/mnt/host/source/src/platform/vboot_reference")
674 (string-append "/tmp/guix-build-" ,name "-" ,version
676 ;; Tests require write permissions to many of these files.
677 (for-each make-file-writable (find-files "tests/futility"))
679 #:test-target "runtests"))
681 `(("pkg-config" ,pkg-config)
684 ("diffutils" ,diffutils)
685 ("python@2" ,python-2)))
687 `(("coreutils" ,coreutils)
690 ("openssl:static" ,openssl "static")
691 ("util-linux" ,util-linux)))
693 "https://dev.chromium.org/chromium-os/chromiumos-design-docs/verified-boot")
694 (synopsis "ChromiumOS verified boot utilities")
696 "vboot-utils is a collection of tools to facilitate booting of
697 Chrome-branded devices. This includes the @command{cgpt} partitioning
698 program, the @command{futility} and @command{crossystem} firmware management
700 (license license:bsd-3)))
702 (define-public os-prober
709 (uri (string-append "mirror://debian/pool/main/o/os-prober/os-prober_"
713 "1vb45i76bqivlghrq7m3n07qfmmq4wxrkplqx8gywj011rhq19fk"))))
714 (build-system gnu-build-system)
716 `(#:modules ((guix build gnu-build-system)
718 (ice-9 regex) ; for string-match
719 (srfi srfi-26)) ; for cut
720 #:make-flags (list "CC=gcc")
721 #:tests? #f ; no tests
723 (modify-phases %standard-phases
725 (lambda* (#:key outputs #:allow-other-keys)
726 (substitute* (find-files ".")
727 (("/usr") (assoc-ref outputs "out")))
728 (substitute* (find-files "." "50mounted-tests$")
729 (("mkdir") "mkdir -p"))
732 (lambda* (#:key outputs #:allow-other-keys)
733 (define (find-files-non-recursive directory)
734 (find-files directory
736 (string-match (string-append "^" directory "/[^/]*$")
740 (let* ((out (assoc-ref outputs "out"))
741 (bin (string-append out "/bin"))
742 (lib (string-append out "/lib"))
743 (share (string-append out "/share")))
744 (for-each (cut install-file <> bin)
745 (list "linux-boot-prober" "os-prober"))
746 (install-file "newns" (string-append lib "/os-prober"))
747 (install-file "common.sh" (string-append share "/os-prober"))
748 (install-file "os-probes/mounted/powerpc/20macosx"
749 (string-append lib "/os-probes/mounted"))
754 (let ((destination (string-append lib "/" directory
755 "/" (basename file))))
756 (mkdir-p (dirname destination))
757 (copy-recursively file destination)))
758 (append (find-files-non-recursive (string-append directory "/common"))
759 (find-files-non-recursive (string-append directory "/x86")))))
760 (list "os-probes" "os-probes/mounted" "os-probes/init"
761 "linux-boot-probes" "linux-boot-probes/mounted"))
763 (home-page "https://joeyh.name/code/os-prober")
764 (synopsis "Detect other operating systems")
765 (description "os-prober probes disks on the system for other operating
766 systems so that they can be added to the bootloader. It also works out how to
767 boot existing GNU/Linux systems and detects what distribution is installed in
768 order to add a suitable bootloader menu entry.")
769 (license license:gpl2+)))