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> |
bc6c06b0 | 4 | ;;; Copyright © 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr> |
f8ff37d6 DM |
5 | ;;; |
6 | ;;; This file is part of GNU Guix. | |
7 | ;;; | |
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. | |
12 | ;;; | |
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. | |
17 | ;;; | |
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/>. | |
20 | ||
21 | (define-module (gnu packages efi) | |
3da49652 DM |
22 | #:use-module (gnu packages autotools) |
23 | #:use-module (gnu packages bash) | |
24 | #:use-module (gnu packages linux) | |
25 | #:use-module (gnu packages man) | |
527aab6f | 26 | #:use-module (gnu packages perl) |
3da49652 DM |
27 | #:use-module (gnu packages pkg-config) |
28 | #:use-module (gnu packages tls) | |
f8ff37d6 DM |
29 | #:use-module ((guix licenses) #:prefix license:) |
30 | #:use-module (guix build-system gnu) | |
31 | #:use-module (guix download) | |
3da49652 | 32 | #:use-module (guix git-download) |
f8ff37d6 | 33 | #:use-module (guix packages) |
b856a78c EF |
34 | #:use-module (guix utils) |
35 | #:use-module (ice-9 match)) | |
f8ff37d6 DM |
36 | |
37 | (define-public gnu-efi | |
38 | (package | |
39 | (name "gnu-efi") | |
fa876b2c | 40 | (version "3.0.12") |
f8ff37d6 DM |
41 | (source |
42 | (origin | |
43 | (method url-fetch) | |
44 | (uri (string-append "mirror://sourceforge/gnu-efi/" | |
93882a9c | 45 | "gnu-efi-" version ".tar.bz2")) |
f8ff37d6 | 46 | (sha256 |
fa876b2c | 47 | (base32 "0sbn6am3k5lqafycggh1g964fcwjwnh0i9hhwrk4ncrwzphz55h1")))) |
f8ff37d6 DM |
48 | (build-system gnu-build-system) |
49 | (arguments | |
93882a9c | 50 | `(#:tests? #f ; none exist |
f8ff37d6 DM |
51 | #:make-flags |
52 | (list (string-append "PREFIX=" (assoc-ref %outputs "out"))) | |
53 | #:phases | |
54 | (modify-phases %standard-phases | |
55 | (delete 'configure)))) | |
56 | (synopsis "EFI toolchain") | |
84c983f1 TGR |
57 | (description "This package provides an @acronym{EFI, Extensible Firmware |
58 | Interface} toolchain for building programs that can run in the | |
f8ff37d6 DM |
59 | environment presented by Intel's EFI.") |
60 | (home-page "https://directory.fsf.org/wiki/GNU_EFI") | |
61 | ;; Distribution is allowed only when accepting all those licenses. | |
62 | (license (list license:bsd-2 license:bsd-3 license:bsd-4 license:expat)))) | |
3da49652 DM |
63 | |
64 | (define-public sbsigntools | |
65 | (package | |
66 | (name "sbsigntools") | |
6d164aec | 67 | (version "0.9.4") |
3da49652 DM |
68 | (source |
69 | (origin | |
70 | (method git-fetch) | |
71 | (uri | |
72 | (git-reference | |
73 | (url "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git") | |
74 | (commit (string-append "v" version)) | |
75 | (recursive? #t))) | |
76 | (file-name (git-file-name name version)) | |
77 | (sha256 | |
6d164aec | 78 | (base32 "1y76wy65y6k10mjl2dm5hb5ms475alr4s080xzj8y833x01xvf3m")))) |
3da49652 DM |
79 | (build-system gnu-build-system) |
80 | (arguments | |
81 | `(#:phases | |
82 | (modify-phases %standard-phases | |
83 | (add-after 'unpack 'patch-more-shebangs | |
84 | (lambda* (#:key inputs #:allow-other-keys) | |
85 | (substitute* "lib/ccan.git/tools/create-ccan-tree" | |
86 | (("#!/bin/bash") | |
87 | (string-append "#!" | |
88 | (assoc-ref inputs "bash") | |
89 | "/bin/bash"))) | |
90 | #t)) | |
91 | (add-after 'unpack 'patch | |
92 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
93 | (substitute* '("configure.ac" | |
94 | "tests/Makefile.am") | |
95 | (("/usr/include/efi") | |
96 | (string-append (assoc-ref inputs "gnu-efi") | |
97 | "/include/efi")) | |
98 | (("/usr/lib/gnuefi") | |
99 | (string-append (assoc-ref inputs "gnu-efi") | |
100 | "/lib"))) | |
101 | #t)) | |
102 | (add-after 'unpack 'setenv | |
103 | (lambda _ | |
104 | (setenv "CC" "gcc") | |
105 | #t))))) | |
106 | (native-inputs | |
107 | `(("autoconf" ,autoconf) | |
108 | ("automake" ,automake) | |
109 | ("bash" ,bash) | |
110 | ("help2man" ,help2man) | |
111 | ("pkg-config" ,pkg-config) | |
112 | ("util-linux" ,util-linux))) ; getopt | |
113 | (inputs | |
114 | `(("gnu-efi" ,gnu-efi) | |
bb93042c | 115 | ("libuuid" ,util-linux "lib") |
3da49652 DM |
116 | ("openssl" ,openssl))) |
117 | (synopsis "EFI signing tools") | |
118 | (description "This package provides tools for signing EFI binaries.") | |
119 | (home-page "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git/") | |
120 | (license license:gpl3+))) | |
527aab6f DM |
121 | |
122 | (define-public efitools | |
123 | (package | |
124 | (name "efitools") | |
125 | (version "1.9.2") | |
126 | (source | |
127 | (origin | |
128 | (method git-fetch) | |
129 | (uri | |
130 | (git-reference | |
131 | (url "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git") | |
132 | (commit (string-append "v" version)))) | |
133 | (file-name (git-file-name name version)) | |
134 | (sha256 | |
135 | (base32 | |
136 | "0jabgl2pxvfl780yvghq131ylpf82k7banjz0ksjhlm66ik8gb1i")))) | |
137 | (build-system gnu-build-system) | |
138 | (arguments | |
139 | `(#:tests? #f ; No tests exist. | |
140 | #:make-flags | |
141 | '("CC=gcc") | |
142 | #:phases | |
143 | (modify-phases %standard-phases | |
144 | (add-after 'unpack 'patch | |
145 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
146 | (substitute* "Make.rules" | |
147 | (("/usr/include/efi") | |
148 | (string-append (assoc-ref inputs "gnu-efi") | |
149 | "/include/efi")) | |
150 | (("\\$\\(DESTDIR\\)/usr") | |
151 | (string-append (assoc-ref outputs "out"))) | |
152 | (("/usr/lib/gnuefi") | |
153 | (string-append (assoc-ref inputs "gnu-efi") | |
154 | "/lib"))) | |
155 | #t)) | |
156 | (add-after 'unpack 'patch-more-shebangs | |
157 | (lambda* (#:key inputs #:allow-other-keys) | |
158 | (substitute* "xxdi.pl" | |
159 | (("#!.*") | |
160 | (string-append "#!" | |
161 | (assoc-ref inputs "perl") | |
162 | "/bin/perl\n"))) | |
163 | #t)) | |
164 | (delete 'configure)))) | |
165 | (native-inputs | |
166 | `(("help2man" ,help2man) | |
167 | ("perl" ,perl) | |
168 | ("perl-file-slurp" ,perl-file-slurp) | |
169 | ("sbsigntools" ,sbsigntools))) | |
170 | (inputs | |
171 | `(("gnu-efi" ,gnu-efi) | |
172 | ("openssl" ,openssl))) | |
173 | (synopsis "EFI tools (key management, variable management)") | |
174 | (description "This package provides EFI tools for EFI key management | |
175 | and EFI variable management.") | |
176 | (home-page "https://blog.hansenpartnership.com/efitools-1-4-with-linux-key-manipulation-utilities-released/") | |
177 | ;; Programs are under GPL 2. | |
178 | ;; Library routines (in lib/) are under LGPL 2.1. | |
179 | ;; Compiling/linking/using OpenSSL is permitted. | |
180 | (license (list license:gpl2 | |
181 | license:lgpl2.1)))) | |
bb4a8f48 DM |
182 | |
183 | (define-public efilinux | |
184 | (package | |
185 | (name "efilinux") | |
186 | (version "1.1") | |
187 | (source (origin | |
188 | (method git-fetch) | |
189 | (uri (git-reference | |
b0e7b699 | 190 | (url "https://github.com/mfleming/efilinux") |
bb4a8f48 DM |
191 | (commit (string-append "efilinux-" version)))) |
192 | (file-name (git-file-name name version)) | |
193 | (sha256 | |
194 | (base32 | |
195 | "0b4nxzr3wl5v4b52r79iw1arfgasz26xb38r2blw9v2qz2s1q9w2")))) | |
196 | (build-system gnu-build-system) | |
197 | (arguments | |
198 | `(#:make-flags | |
199 | (list "CC=gcc" | |
b856a78c EF |
200 | ,@(match (%current-system) |
201 | ("aarch64-linux" | |
202 | '("ARCH=aarch64")) | |
203 | ("armhf-linux" | |
204 | '("ARCH=arm")) | |
205 | (_ '())) | |
bb4a8f48 DM |
206 | (string-append "INCDIR=" (assoc-ref %build-inputs "gnu-efi") |
207 | "/include") | |
208 | (string-append "LIBDIR=" (assoc-ref %build-inputs "gnu-efi") | |
209 | "/lib")) | |
210 | #:tests? #f ; No tests exist. | |
211 | #:phases | |
212 | (modify-phases %standard-phases | |
213 | (delete 'configure) | |
214 | (replace 'install | |
215 | (lambda* (#:key outputs #:allow-other-keys) | |
216 | (install-file "efilinux.efi" | |
217 | (string-append (assoc-ref outputs "out") | |
c7797b75 | 218 | "/libexec")) |
bb4a8f48 DM |
219 | #t))))) |
220 | (inputs | |
221 | `(("gnu-efi" ,gnu-efi))) | |
222 | (synopsis "Minimal Linux loader for UEFI") | |
223 | (description "This package provides a minimal Linux loader as an UEFI | |
224 | program.") | |
225 | (home-page "https://github.com/mfleming/efilinux") | |
226 | (license license:bsd-2))) |