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> |
f8ff37d6 DM |
4 | ;;; |
5 | ;;; This file is part of GNU Guix. | |
6 | ;;; | |
7 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
8 | ;;; under the terms of the GNU General Public License as published by | |
9 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
10 | ;;; your option) any later version. | |
11 | ;;; | |
12 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
13 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | ;;; GNU General Public License for more details. | |
16 | ;;; | |
17 | ;;; You should have received a copy of the GNU General Public License | |
18 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
19 | ||
20 | (define-module (gnu packages efi) | |
3da49652 DM |
21 | #:use-module (gnu packages autotools) |
22 | #:use-module (gnu packages bash) | |
23 | #:use-module (gnu packages linux) | |
24 | #:use-module (gnu packages man) | |
527aab6f | 25 | #:use-module (gnu packages perl) |
3da49652 DM |
26 | #:use-module (gnu packages pkg-config) |
27 | #:use-module (gnu packages tls) | |
f8ff37d6 DM |
28 | #:use-module ((guix licenses) #:prefix license:) |
29 | #:use-module (guix build-system gnu) | |
30 | #:use-module (guix download) | |
3da49652 | 31 | #:use-module (guix git-download) |
f8ff37d6 | 32 | #:use-module (guix packages) |
b856a78c EF |
33 | #:use-module (guix utils) |
34 | #:use-module (ice-9 match)) | |
f8ff37d6 DM |
35 | |
36 | (define-public gnu-efi | |
37 | (package | |
38 | (name "gnu-efi") | |
39 | (version "3.0.9") | |
40 | (source | |
41 | (origin | |
42 | (method url-fetch) | |
43 | (uri (string-append "mirror://sourceforge/gnu-efi/" | |
44 | name "-" version ".tar.bz2")) | |
45 | (sha256 | |
46 | (base32 | |
47 | "1w3p4aqlc5j93q44la7dc8cr3hky20zvsd0h0k2lyzhwmrzfl5b7")))) | |
48 | (build-system gnu-build-system) | |
49 | (arguments | |
50 | `(#:tests? #f ; None exist. | |
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") | |
57 | (description "This package provides an EFI (Extensible Firmware | |
58 | Interface) toolchain for building programs that can run in the | |
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") | |
67 | (version "0.9.2") | |
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 | |
78 | (base32 | |
79 | "116649ixr6gvw9fqiljfflxsv4293hgm73bmba5ilxrzn4kpbzvb")))) | |
80 | (build-system gnu-build-system) | |
81 | (arguments | |
82 | `(#:phases | |
83 | (modify-phases %standard-phases | |
84 | (add-after 'unpack 'patch-more-shebangs | |
85 | (lambda* (#:key inputs #:allow-other-keys) | |
86 | (substitute* "lib/ccan.git/tools/create-ccan-tree" | |
87 | (("#!/bin/bash") | |
88 | (string-append "#!" | |
89 | (assoc-ref inputs "bash") | |
90 | "/bin/bash"))) | |
91 | #t)) | |
92 | (add-after 'unpack 'patch | |
93 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
94 | (substitute* '("configure.ac" | |
95 | "tests/Makefile.am") | |
96 | (("/usr/include/efi") | |
97 | (string-append (assoc-ref inputs "gnu-efi") | |
98 | "/include/efi")) | |
99 | (("/usr/lib/gnuefi") | |
100 | (string-append (assoc-ref inputs "gnu-efi") | |
101 | "/lib"))) | |
102 | #t)) | |
103 | (add-after 'unpack 'setenv | |
104 | (lambda _ | |
105 | (setenv "CC" "gcc") | |
106 | #t))))) | |
107 | (native-inputs | |
108 | `(("autoconf" ,autoconf) | |
109 | ("automake" ,automake) | |
110 | ("bash" ,bash) | |
111 | ("help2man" ,help2man) | |
112 | ("pkg-config" ,pkg-config) | |
113 | ("util-linux" ,util-linux))) ; getopt | |
114 | (inputs | |
115 | `(("gnu-efi" ,gnu-efi) | |
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 | |
190 | (url "https://github.com/mfleming/efilinux.git") | |
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))) |