Commit | Line | Data |
---|---|---|
f8ff37d6 DM |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2019 Danny Milosavljevic <dannym@scratchpost.org> | |
3 | ;;; | |
4 | ;;; This file is part of GNU Guix. | |
5 | ;;; | |
6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
7 | ;;; under the terms of the GNU General Public License as published by | |
8 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
9 | ;;; your option) any later version. | |
10 | ;;; | |
11 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | ;;; GNU General Public License for more details. | |
15 | ;;; | |
16 | ;;; You should have received a copy of the GNU General Public License | |
17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
18 | ||
19 | (define-module (gnu packages efi) | |
3da49652 DM |
20 | #:use-module (gnu packages autotools) |
21 | #:use-module (gnu packages bash) | |
22 | #:use-module (gnu packages linux) | |
23 | #:use-module (gnu packages man) | |
527aab6f | 24 | #:use-module (gnu packages perl) |
3da49652 DM |
25 | #:use-module (gnu packages pkg-config) |
26 | #:use-module (gnu packages tls) | |
f8ff37d6 DM |
27 | #:use-module ((guix licenses) #:prefix license:) |
28 | #:use-module (guix build-system gnu) | |
29 | #:use-module (guix download) | |
3da49652 | 30 | #:use-module (guix git-download) |
f8ff37d6 DM |
31 | #:use-module (guix packages) |
32 | #:use-module (guix utils)) | |
33 | ||
34 | (define-public gnu-efi | |
35 | (package | |
36 | (name "gnu-efi") | |
37 | (version "3.0.9") | |
38 | (source | |
39 | (origin | |
40 | (method url-fetch) | |
41 | (uri (string-append "mirror://sourceforge/gnu-efi/" | |
42 | name "-" version ".tar.bz2")) | |
43 | (sha256 | |
44 | (base32 | |
45 | "1w3p4aqlc5j93q44la7dc8cr3hky20zvsd0h0k2lyzhwmrzfl5b7")))) | |
46 | (build-system gnu-build-system) | |
47 | (arguments | |
48 | `(#:tests? #f ; None exist. | |
49 | #:make-flags | |
50 | (list (string-append "PREFIX=" (assoc-ref %outputs "out"))) | |
51 | #:phases | |
52 | (modify-phases %standard-phases | |
53 | (delete 'configure)))) | |
54 | (synopsis "EFI toolchain") | |
55 | (description "This package provides an EFI (Extensible Firmware | |
56 | Interface) toolchain for building programs that can run in the | |
57 | environment presented by Intel's EFI.") | |
58 | (home-page "https://directory.fsf.org/wiki/GNU_EFI") | |
59 | ;; Distribution is allowed only when accepting all those licenses. | |
60 | (license (list license:bsd-2 license:bsd-3 license:bsd-4 license:expat)))) | |
3da49652 DM |
61 | |
62 | (define-public sbsigntools | |
63 | (package | |
64 | (name "sbsigntools") | |
65 | (version "0.9.2") | |
66 | (source | |
67 | (origin | |
68 | (method git-fetch) | |
69 | (uri | |
70 | (git-reference | |
71 | (url "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git") | |
72 | (commit (string-append "v" version)) | |
73 | (recursive? #t))) | |
74 | (file-name (git-file-name name version)) | |
75 | (sha256 | |
76 | (base32 | |
77 | "116649ixr6gvw9fqiljfflxsv4293hgm73bmba5ilxrzn4kpbzvb")))) | |
78 | (build-system gnu-build-system) | |
79 | (arguments | |
80 | `(#:phases | |
81 | (modify-phases %standard-phases | |
82 | (add-after 'unpack 'patch-more-shebangs | |
83 | (lambda* (#:key inputs #:allow-other-keys) | |
84 | (substitute* "lib/ccan.git/tools/create-ccan-tree" | |
85 | (("#!/bin/bash") | |
86 | (string-append "#!" | |
87 | (assoc-ref inputs "bash") | |
88 | "/bin/bash"))) | |
89 | #t)) | |
90 | (add-after 'unpack 'patch | |
91 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
92 | (substitute* '("configure.ac" | |
93 | "tests/Makefile.am") | |
94 | (("/usr/include/efi") | |
95 | (string-append (assoc-ref inputs "gnu-efi") | |
96 | "/include/efi")) | |
97 | (("/usr/lib/gnuefi") | |
98 | (string-append (assoc-ref inputs "gnu-efi") | |
99 | "/lib"))) | |
100 | #t)) | |
101 | (add-after 'unpack 'setenv | |
102 | (lambda _ | |
103 | (setenv "CC" "gcc") | |
104 | #t))))) | |
105 | (native-inputs | |
106 | `(("autoconf" ,autoconf) | |
107 | ("automake" ,automake) | |
108 | ("bash" ,bash) | |
109 | ("help2man" ,help2man) | |
110 | ("pkg-config" ,pkg-config) | |
111 | ("util-linux" ,util-linux))) ; getopt | |
112 | (inputs | |
113 | `(("gnu-efi" ,gnu-efi) | |
114 | ("openssl" ,openssl))) | |
115 | (synopsis "EFI signing tools") | |
116 | (description "This package provides tools for signing EFI binaries.") | |
117 | (home-page "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git/") | |
118 | (license license:gpl3+))) | |
527aab6f DM |
119 | |
120 | (define-public efitools | |
121 | (package | |
122 | (name "efitools") | |
123 | (version "1.9.2") | |
124 | (source | |
125 | (origin | |
126 | (method git-fetch) | |
127 | (uri | |
128 | (git-reference | |
129 | (url "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git") | |
130 | (commit (string-append "v" version)))) | |
131 | (file-name (git-file-name name version)) | |
132 | (sha256 | |
133 | (base32 | |
134 | "0jabgl2pxvfl780yvghq131ylpf82k7banjz0ksjhlm66ik8gb1i")))) | |
135 | (build-system gnu-build-system) | |
136 | (arguments | |
137 | `(#:tests? #f ; No tests exist. | |
138 | #:make-flags | |
139 | '("CC=gcc") | |
140 | #:phases | |
141 | (modify-phases %standard-phases | |
142 | (add-after 'unpack 'patch | |
143 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
144 | (substitute* "Make.rules" | |
145 | (("/usr/include/efi") | |
146 | (string-append (assoc-ref inputs "gnu-efi") | |
147 | "/include/efi")) | |
148 | (("\\$\\(DESTDIR\\)/usr") | |
149 | (string-append (assoc-ref outputs "out"))) | |
150 | (("/usr/lib/gnuefi") | |
151 | (string-append (assoc-ref inputs "gnu-efi") | |
152 | "/lib"))) | |
153 | #t)) | |
154 | (add-after 'unpack 'patch-more-shebangs | |
155 | (lambda* (#:key inputs #:allow-other-keys) | |
156 | (substitute* "xxdi.pl" | |
157 | (("#!.*") | |
158 | (string-append "#!" | |
159 | (assoc-ref inputs "perl") | |
160 | "/bin/perl\n"))) | |
161 | #t)) | |
162 | (delete 'configure)))) | |
163 | (native-inputs | |
164 | `(("help2man" ,help2man) | |
165 | ("perl" ,perl) | |
166 | ("perl-file-slurp" ,perl-file-slurp) | |
167 | ("sbsigntools" ,sbsigntools))) | |
168 | (inputs | |
169 | `(("gnu-efi" ,gnu-efi) | |
170 | ("openssl" ,openssl))) | |
171 | (synopsis "EFI tools (key management, variable management)") | |
172 | (description "This package provides EFI tools for EFI key management | |
173 | and EFI variable management.") | |
174 | (home-page "https://blog.hansenpartnership.com/efitools-1-4-with-linux-key-manipulation-utilities-released/") | |
175 | ;; Programs are under GPL 2. | |
176 | ;; Library routines (in lib/) are under LGPL 2.1. | |
177 | ;; Compiling/linking/using OpenSSL is permitted. | |
178 | (license (list license:gpl2 | |
179 | license:lgpl2.1)))) | |
bb4a8f48 DM |
180 | |
181 | (define-public efilinux | |
182 | (package | |
183 | (name "efilinux") | |
184 | (version "1.1") | |
185 | (source (origin | |
186 | (method git-fetch) | |
187 | (uri (git-reference | |
188 | (url "https://github.com/mfleming/efilinux.git") | |
189 | (commit (string-append "efilinux-" version)))) | |
190 | (file-name (git-file-name name version)) | |
191 | (sha256 | |
192 | (base32 | |
193 | "0b4nxzr3wl5v4b52r79iw1arfgasz26xb38r2blw9v2qz2s1q9w2")))) | |
194 | (build-system gnu-build-system) | |
195 | (arguments | |
196 | `(#:make-flags | |
197 | (list "CC=gcc" | |
198 | (string-append "INCDIR=" (assoc-ref %build-inputs "gnu-efi") | |
199 | "/include") | |
200 | (string-append "LIBDIR=" (assoc-ref %build-inputs "gnu-efi") | |
201 | "/lib")) | |
202 | #:tests? #f ; No tests exist. | |
203 | #:phases | |
204 | (modify-phases %standard-phases | |
205 | (delete 'configure) | |
206 | (replace 'install | |
207 | (lambda* (#:key outputs #:allow-other-keys) | |
208 | (install-file "efilinux.efi" | |
209 | (string-append (assoc-ref outputs "out") | |
c7797b75 | 210 | "/libexec")) |
bb4a8f48 DM |
211 | #t))))) |
212 | (inputs | |
213 | `(("gnu-efi" ,gnu-efi))) | |
214 | (synopsis "Minimal Linux loader for UEFI") | |
215 | (description "This package provides a minimal Linux loader as an UEFI | |
216 | program.") | |
217 | (home-page "https://github.com/mfleming/efilinux") | |
218 | (license license:bsd-2))) |