Commit | Line | Data |
---|---|---|
f8ff37d6 DM |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2019 Danny Milosavljevic <dannym@scratchpost.org> | |
b856a78c | 3 | ;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il> |
373f808d | 4 | ;;; Copyright © 2019–2021 Tobias Geerinckx-Rice <me@tobias.gr> |
4de576e9 | 5 | ;;; Copyright © 2021 Vincent Legoll <vincent.legoll@gmail.com> |
f8ff37d6 DM |
6 | ;;; |
7 | ;;; This file is part of GNU Guix. | |
8 | ;;; | |
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. | |
13 | ;;; | |
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. | |
18 | ;;; | |
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/>. | |
21 | ||
22 | (define-module (gnu packages efi) | |
3da49652 DM |
23 | #:use-module (gnu packages autotools) |
24 | #:use-module (gnu packages bash) | |
25 | #:use-module (gnu packages linux) | |
26 | #:use-module (gnu packages man) | |
527aab6f | 27 | #:use-module (gnu packages perl) |
3da49652 DM |
28 | #:use-module (gnu packages pkg-config) |
29 | #:use-module (gnu packages tls) | |
f8ff37d6 DM |
30 | #:use-module ((guix licenses) #:prefix license:) |
31 | #:use-module (guix build-system gnu) | |
32 | #:use-module (guix download) | |
3da49652 | 33 | #:use-module (guix git-download) |
f8ff37d6 | 34 | #:use-module (guix packages) |
b856a78c EF |
35 | #:use-module (guix utils) |
36 | #:use-module (ice-9 match)) | |
f8ff37d6 DM |
37 | |
38 | (define-public gnu-efi | |
39 | (package | |
40 | (name "gnu-efi") | |
02a2c7e5 | 41 | (version "3.0.13") |
f8ff37d6 DM |
42 | (source |
43 | (origin | |
44 | (method url-fetch) | |
45 | (uri (string-append "mirror://sourceforge/gnu-efi/" | |
93882a9c | 46 | "gnu-efi-" version ".tar.bz2")) |
f8ff37d6 | 47 | (sha256 |
02a2c7e5 | 48 | (base32 "0z9v5pl5pmlw8pjpd66iyh9pml2hh6pqd4c5qilywilw4wazgk1g")))) |
f8ff37d6 DM |
49 | (build-system gnu-build-system) |
50 | (arguments | |
93882a9c | 51 | `(#:tests? #f ; none exist |
f8ff37d6 DM |
52 | #:make-flags |
53 | (list (string-append "PREFIX=" (assoc-ref %outputs "out"))) | |
54 | #:phases | |
55 | (modify-phases %standard-phases | |
56 | (delete 'configure)))) | |
57 | (synopsis "EFI toolchain") | |
84c983f1 TGR |
58 | (description "This package provides an @acronym{EFI, Extensible Firmware |
59 | Interface} toolchain for building programs that can run in the | |
f8ff37d6 DM |
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)))) | |
3da49652 | 64 | |
f79f41e2 | 65 | (define-public efi-analyzer |
373f808d VL |
66 | (let ((commit "77c9e3a67cd7c2fca48a4292dad25a5429872f95") |
67 | (revision "0")) | |
68 | (package | |
f79f41e2 | 69 | (name "efi-analyzer") |
373f808d VL |
70 | (version (git-version "0.0.0" revision commit)) |
71 | (source | |
72 | (origin | |
73 | (method git-fetch) | |
74 | (uri (git-reference | |
75 | (url "https://github.com/xypron/efi_analyzer") | |
76 | (commit commit))) | |
77 | (file-name (git-file-name name version)) | |
78 | (sha256 | |
79 | (base32 "1izdkzybqyvzpzqz6kx4j7y47j6aa2dsdrychzgs65466x1a4br1")))) | |
80 | (build-system gnu-build-system) | |
81 | (arguments | |
82 | `(#:make-flags | |
83 | (list (string-append "prefix=" (assoc-ref %outputs "out"))) | |
84 | #:phases | |
85 | (modify-phases %standard-phases | |
86 | (add-after 'unpack 'support-cross-compilation | |
87 | (lambda _ | |
88 | (substitute* "Makefile" | |
89 | (("gcc") ,(cc-for-target))) | |
90 | #t)) | |
91 | (delete 'configure)))) ; no configure script | |
92 | (home-page "https://github.com/xypron/efi_analyzer") | |
93 | (synopsis "Analyze EFI binaries") | |
94 | (description | |
95 | "The EFI Analyzer checks EFI binaries and prints out header and section | |
96 | information.") | |
97 | (license license:bsd-2)))) | |
98 | ||
f79f41e2 LC |
99 | (define-public efi_analyzer |
100 | ;; For a short while the package name contained an underscore. | |
101 | (deprecated-package "efi_analyzer" efi-analyzer)) | |
102 | ||
3da49652 DM |
103 | (define-public sbsigntools |
104 | (package | |
105 | (name "sbsigntools") | |
6d164aec | 106 | (version "0.9.4") |
3da49652 DM |
107 | (source |
108 | (origin | |
109 | (method git-fetch) | |
110 | (uri | |
111 | (git-reference | |
112 | (url "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git") | |
113 | (commit (string-append "v" version)) | |
114 | (recursive? #t))) | |
115 | (file-name (git-file-name name version)) | |
116 | (sha256 | |
6d164aec | 117 | (base32 "1y76wy65y6k10mjl2dm5hb5ms475alr4s080xzj8y833x01xvf3m")))) |
3da49652 DM |
118 | (build-system gnu-build-system) |
119 | (arguments | |
120 | `(#:phases | |
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" | |
125 | (("#!/bin/bash") | |
126 | (string-append "#!" | |
127 | (assoc-ref inputs "bash") | |
128 | "/bin/bash"))) | |
129 | #t)) | |
130 | (add-after 'unpack 'patch | |
131 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
132 | (substitute* '("configure.ac" | |
133 | "tests/Makefile.am") | |
134 | (("/usr/include/efi") | |
135 | (string-append (assoc-ref inputs "gnu-efi") | |
136 | "/include/efi")) | |
137 | (("/usr/lib/gnuefi") | |
138 | (string-append (assoc-ref inputs "gnu-efi") | |
139 | "/lib"))) | |
140 | #t)) | |
141 | (add-after 'unpack 'setenv | |
142 | (lambda _ | |
143 | (setenv "CC" "gcc") | |
144 | #t))))) | |
145 | (native-inputs | |
146 | `(("autoconf" ,autoconf) | |
147 | ("automake" ,automake) | |
148 | ("bash" ,bash) | |
149 | ("help2man" ,help2man) | |
150 | ("pkg-config" ,pkg-config) | |
151 | ("util-linux" ,util-linux))) ; getopt | |
152 | (inputs | |
153 | `(("gnu-efi" ,gnu-efi) | |
bb93042c | 154 | ("libuuid" ,util-linux "lib") |
3da49652 DM |
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+))) | |
527aab6f DM |
160 | |
161 | (define-public efitools | |
162 | (package | |
163 | (name "efitools") | |
164 | (version "1.9.2") | |
165 | (source | |
166 | (origin | |
167 | (method git-fetch) | |
168 | (uri | |
169 | (git-reference | |
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)) | |
173 | (sha256 | |
174 | (base32 | |
175 | "0jabgl2pxvfl780yvghq131ylpf82k7banjz0ksjhlm66ik8gb1i")))) | |
176 | (build-system gnu-build-system) | |
177 | (arguments | |
178 | `(#:tests? #f ; No tests exist. | |
179 | #:make-flags | |
180 | '("CC=gcc") | |
181 | #:phases | |
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") | |
188 | "/include/efi")) | |
189 | (("\\$\\(DESTDIR\\)/usr") | |
190 | (string-append (assoc-ref outputs "out"))) | |
191 | (("/usr/lib/gnuefi") | |
192 | (string-append (assoc-ref inputs "gnu-efi") | |
193 | "/lib"))) | |
194 | #t)) | |
195 | (add-after 'unpack 'patch-more-shebangs | |
196 | (lambda* (#:key inputs #:allow-other-keys) | |
197 | (substitute* "xxdi.pl" | |
198 | (("#!.*") | |
199 | (string-append "#!" | |
200 | (assoc-ref inputs "perl") | |
201 | "/bin/perl\n"))) | |
202 | #t)) | |
203 | (delete 'configure)))) | |
204 | (native-inputs | |
205 | `(("help2man" ,help2man) | |
206 | ("perl" ,perl) | |
207 | ("perl-file-slurp" ,perl-file-slurp) | |
208 | ("sbsigntools" ,sbsigntools))) | |
209 | (inputs | |
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 | |
220 | license:lgpl2.1)))) | |
bb4a8f48 DM |
221 | |
222 | (define-public efilinux | |
223 | (package | |
224 | (name "efilinux") | |
225 | (version "1.1") | |
226 | (source (origin | |
227 | (method git-fetch) | |
228 | (uri (git-reference | |
b0e7b699 | 229 | (url "https://github.com/mfleming/efilinux") |
bb4a8f48 DM |
230 | (commit (string-append "efilinux-" version)))) |
231 | (file-name (git-file-name name version)) | |
232 | (sha256 | |
233 | (base32 | |
234 | "0b4nxzr3wl5v4b52r79iw1arfgasz26xb38r2blw9v2qz2s1q9w2")))) | |
235 | (build-system gnu-build-system) | |
236 | (arguments | |
237 | `(#:make-flags | |
238 | (list "CC=gcc" | |
b856a78c EF |
239 | ,@(match (%current-system) |
240 | ("aarch64-linux" | |
241 | '("ARCH=aarch64")) | |
242 | ("armhf-linux" | |
243 | '("ARCH=arm")) | |
244 | (_ '())) | |
bb4a8f48 DM |
245 | (string-append "INCDIR=" (assoc-ref %build-inputs "gnu-efi") |
246 | "/include") | |
247 | (string-append "LIBDIR=" (assoc-ref %build-inputs "gnu-efi") | |
248 | "/lib")) | |
249 | #:tests? #f ; No tests exist. | |
250 | #:phases | |
251 | (modify-phases %standard-phases | |
252 | (delete 'configure) | |
253 | (replace 'install | |
254 | (lambda* (#:key outputs #:allow-other-keys) | |
255 | (install-file "efilinux.efi" | |
256 | (string-append (assoc-ref outputs "out") | |
c7797b75 | 257 | "/libexec")) |
bb4a8f48 DM |
258 | #t))))) |
259 | (inputs | |
260 | `(("gnu-efi" ,gnu-efi))) | |
261 | (synopsis "Minimal Linux loader for UEFI") | |
262 | (description "This package provides a minimal Linux loader as an UEFI | |
263 | program.") | |
264 | (home-page "https://github.com/mfleming/efilinux") | |
265 | (license license:bsd-2))) |