1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015 Leo Famulari <leo@famulari.name>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu packages grub)
22 #:use-module (guix download)
23 #:use-module (guix packages)
24 #:use-module ((guix licenses) #:select (gpl3+))
25 #:use-module (guix build-system gnu)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages flex)
28 #:use-module (gnu packages bison)
29 #:use-module (gnu packages gettext)
30 #:use-module (gnu packages fontutils)
31 #:use-module (gnu packages linux)
32 #:use-module (gnu packages qemu)
33 #:use-module (gnu packages man)
34 #:use-module (gnu packages texinfo)
35 #:use-module (gnu packages ncurses)
36 #:use-module (gnu packages cdrom)
37 #:use-module (srfi srfi-1))
39 (define qemu-for-tests
40 ;; Newer QEMU versions, such as 1.5.1, no longer support the 'shutdown'
41 ;; instruction. This leads to test hangs, as reported at
42 ;; <https://bugs.launchpad.net/bugs/947597> and fixed at
43 ;; <http://bzr.savannah.gnu.org/lh/grub/trunk/grub/revision/4828>.
44 ;; Work around it by using an older QEMU.
45 (package (inherit qemu-minimal)
49 (uri (string-append "http://wiki.qemu-project.org/download/qemu-"
53 "1bqfrb5dlsxm8gxhkksz8qzi5fhj3xqhxyfwbqcphhcv1kpyfwip"))))
55 ;; With recent GLib versions, we get a test failure:
56 ;; ERROR:tests/rtc-test.c:176:check_time: assertion failed (ABS(t - s) <= wiggle): (382597824 <= 2)
57 ;; Simply disable the tests.
58 (arguments `(#:tests? #f
59 ,@(package-arguments qemu-minimal)))
61 ;; The manual fails to build with Texinfo 5.x.
62 (native-inputs (alist-delete "texinfo" (package-native-inputs qemu)))))
65 ;; GNU Unifont, <http://gnu.org/s/unifont>.
66 ;; GRUB needs it for its graphical terminal, gfxterm.
70 "http://unifoundry.com/pub/unifont-7.0.06/font-builds/unifont-7.0.06.bdf.gz")
73 "0p2vhnc18cnbmb39vq4m7hzv4mhnm2l0a2s7gx3ar277fwng3hys"))))
81 (uri (string-append "mirror://gnu/grub/grub-"
85 "0n64hpmsccvicagvr0c6v0kgp2yw0kgnd3jvsyd26cnwgs7c6kkq"))
86 (patches (search-patches "grub-gets-undeclared.patch"
88 "grub-CVE-2015-8370.patch"))))
89 (build-system gnu-build-system)
91 '(#:configure-flags '("--disable-werror")
92 #:phases (modify-phases %standard-phases
95 (lambda* (#:key inputs #:allow-other-keys)
96 (substitute* "grub-core/Makefile.in"
97 (("/bin/sh") (which "sh")))
99 ;; Make the font visible.
100 (copy-file (assoc-ref inputs "unifont") "unifont.bdf.gz")
101 (system* "gunzip" "unifont.bdf.gz")
103 ;; TODO: Re-enable this test when we have Parted.
104 (substitute* "tests/partmap_test.in"
105 (("set -e") "exit 77"))
110 ("gettext" ,gnu-gettext)
111 ("freetype" ,freetype)
112 ;; ("libusb" ,libusb)
114 ("ncurses" ,ncurses)))
116 `(("unifont" ,unifont)
120 ("help2man" ,help2man)
122 ;; Dependencies for the test suite. The "real" QEMU is needed here,
123 ;; because several targets are used.
124 ("qemu" ,qemu-for-tests)
125 ("xorriso" ,xorriso)))
126 (home-page "http://www.gnu.org/software/grub/")
127 (synopsis "GRand Unified Boot loader")
129 "GRUB is a multiboot bootloader. It is used for initially loading the
130 kernel of an operating system and then transferring control to it. The kernel
131 then goes on to load the rest of the operating system. As a multiboot
132 bootloader, GRUB handles the presence of multiple operating systems installed
133 on the same computer; upon booting the computer, the user is presented with a
134 menu to select one of the installed operating systems.")