1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2019 Danny Milosavljevic <dannym@scratchpost.org>
3 ;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2019–2021 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; Copyright © 2021 Vincent Legoll <vincent.legoll@gmail.com>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages efi)
23 #:use-module (gnu packages autotools)
24 #:use-module (gnu packages bash)
25 #:use-module (gnu packages linux)
26 #:use-module (gnu packages man)
27 #:use-module (gnu packages perl)
28 #:use-module (gnu packages pkg-config)
29 #:use-module (gnu packages tls)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix download)
33 #:use-module (guix git-download)
34 #:use-module (guix packages)
35 #:use-module (guix utils)
36 #:use-module (ice-9 match))
38 (define-public gnu-efi
45 (uri (string-append "mirror://sourceforge/gnu-efi/"
46 "gnu-efi-" version ".tar.bz2"))
48 (base32 "0z9v5pl5pmlw8pjpd66iyh9pml2hh6pqd4c5qilywilw4wazgk1g"))))
49 (build-system gnu-build-system)
51 `(#:tests? #f ; none exist
53 (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
55 (modify-phases %standard-phases
56 (delete 'configure))))
57 (synopsis "EFI toolchain")
58 (description "This package provides an @acronym{EFI, Extensible Firmware
59 Interface} toolchain for building programs that can run in the
60 environment presented by Intel's EFI.")
61 (home-page "https://directory.fsf.org/wiki/GNU_EFI")
62 ;; Distribution is allowed only when accepting all those licenses.
63 (license (list license:bsd-2 license:bsd-3 license:bsd-4 license:expat))))
65 (define-public efi-analyzer
66 (let ((commit "77c9e3a67cd7c2fca48a4292dad25a5429872f95")
70 (version (git-version "0.0.0" revision commit))
75 (url "https://github.com/xypron/efi_analyzer")
77 (file-name (git-file-name name version))
79 (base32 "1izdkzybqyvzpzqz6kx4j7y47j6aa2dsdrychzgs65466x1a4br1"))))
80 (build-system gnu-build-system)
83 (list (string-append "prefix=" (assoc-ref %outputs "out")))
85 (modify-phases %standard-phases
86 (add-after 'unpack 'support-cross-compilation
88 (substitute* "Makefile"
89 (("gcc") ,(cc-for-target)))
91 (delete 'configure)))) ; no configure script
92 (home-page "https://github.com/xypron/efi_analyzer")
93 (synopsis "Analyze EFI binaries")
95 "The EFI Analyzer checks EFI binaries and prints out header and section
97 (license license:bsd-2))))
99 (define-public efi_analyzer
100 ;; For a short while the package name contained an underscore.
101 (deprecated-package "efi_analyzer" efi-analyzer))
103 (define-public sbsigntools
112 (url "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git")
113 (commit (string-append "v" version))
115 (file-name (git-file-name name version))
117 (base32 "1y76wy65y6k10mjl2dm5hb5ms475alr4s080xzj8y833x01xvf3m"))))
118 (build-system gnu-build-system)
121 (modify-phases %standard-phases
122 (add-after 'unpack 'patch-more-shebangs
123 (lambda* (#:key inputs #:allow-other-keys)
124 (substitute* "lib/ccan.git/tools/create-ccan-tree"
127 (assoc-ref inputs "bash")
130 (add-after 'unpack 'patch
131 (lambda* (#:key inputs outputs #:allow-other-keys)
132 (substitute* '("configure.ac"
134 (("/usr/include/efi")
135 (string-append (assoc-ref inputs "gnu-efi")
138 (string-append (assoc-ref inputs "gnu-efi")
141 (add-after 'unpack 'setenv
146 `(("autoconf" ,autoconf)
147 ("automake" ,automake)
149 ("help2man" ,help2man)
150 ("pkg-config" ,pkg-config)
151 ("util-linux" ,util-linux))) ; getopt
153 `(("gnu-efi" ,gnu-efi)
154 ("libuuid" ,util-linux "lib")
155 ("openssl" ,openssl)))
156 (synopsis "EFI signing tools")
157 (description "This package provides tools for signing EFI binaries.")
158 (home-page "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git/")
159 (license license:gpl3+)))
161 (define-public efitools
170 (url "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git")
171 (commit (string-append "v" version))))
172 (file-name (git-file-name name version))
175 "0jabgl2pxvfl780yvghq131ylpf82k7banjz0ksjhlm66ik8gb1i"))))
176 (build-system gnu-build-system)
178 `(#:tests? #f ; No tests exist.
182 (modify-phases %standard-phases
183 (add-after 'unpack 'patch
184 (lambda* (#:key inputs outputs #:allow-other-keys)
185 (substitute* "Make.rules"
186 (("/usr/include/efi")
187 (string-append (assoc-ref inputs "gnu-efi")
189 (("\\$\\(DESTDIR\\)/usr")
190 (string-append (assoc-ref outputs "out")))
192 (string-append (assoc-ref inputs "gnu-efi")
195 (add-after 'unpack 'patch-more-shebangs
196 (lambda* (#:key inputs #:allow-other-keys)
197 (substitute* "xxdi.pl"
200 (assoc-ref inputs "perl")
203 (delete 'configure))))
205 `(("help2man" ,help2man)
207 ("perl-file-slurp" ,perl-file-slurp)
208 ("sbsigntools" ,sbsigntools)))
210 `(("gnu-efi" ,gnu-efi)
211 ("openssl" ,openssl)))
212 (synopsis "EFI tools (key management, variable management)")
213 (description "This package provides EFI tools for EFI key management
214 and EFI variable management.")
215 (home-page "https://blog.hansenpartnership.com/efitools-1-4-with-linux-key-manipulation-utilities-released/")
216 ;; Programs are under GPL 2.
217 ;; Library routines (in lib/) are under LGPL 2.1.
218 ;; Compiling/linking/using OpenSSL is permitted.
219 (license (list license:gpl2
222 (define-public efilinux
229 (url "https://github.com/mfleming/efilinux")
230 (commit (string-append "efilinux-" version))))
231 (file-name (git-file-name name version))
234 "0b4nxzr3wl5v4b52r79iw1arfgasz26xb38r2blw9v2qz2s1q9w2"))))
235 (build-system gnu-build-system)
239 ,@(match (%current-system)
245 (string-append "INCDIR=" (assoc-ref %build-inputs "gnu-efi")
247 (string-append "LIBDIR=" (assoc-ref %build-inputs "gnu-efi")
249 #:tests? #f ; No tests exist.
251 (modify-phases %standard-phases
254 (lambda* (#:key outputs #:allow-other-keys)
255 (install-file "efilinux.efi"
256 (string-append (assoc-ref outputs "out")
260 `(("gnu-efi" ,gnu-efi)))
261 (synopsis "Minimal Linux loader for UEFI")
262 (description "This package provides a minimal Linux loader as an UEFI
264 (home-page "https://github.com/mfleming/efilinux")
265 (license license:bsd-2)))