1{
2 lib,
3 stdenv,
4 gnu-efi,
5 openssl,
6 sbsigntool,
7 perl,
8 perlPackages,
9 help2man,
10 fetchzip,
11}:
12stdenv.mkDerivation rec {
13 pname = "efitools";
14 version = "1.9.2";
15
16 buildInputs = [
17 gnu-efi
18 openssl
19 sbsigntool
20 ];
21
22 nativeBuildInputs = [
23 perl
24 perlPackages.FileSlurp
25 help2man
26 ];
27
28 src = fetchzip {
29 url = "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git/snapshot/efitools-v${version}.tar.gz";
30 sha256 = "0jabgl2pxvfl780yvghq131ylpf82k7banjz0ksjhlm66ik8gb1i";
31 };
32
33 # https://github.com/ncroxon/gnu-efi/issues/7#issuecomment-2122741592
34 patches = [
35 ./aarch64.patch
36 ];
37
38 postPatch = ''
39 sed -i -e 's#/usr/include/efi#${gnu-efi}/include/efi/#g' Make.rules
40 sed -i -e 's#/usr/lib64/gnuefi#${gnu-efi}/lib/#g' Make.rules
41 sed -i -e 's#$(DESTDIR)/usr#$(out)#g' Make.rules
42 sed -i '$asign-efi-sig-list.o flash-var.o: CFLAGS += -D_GNU_SOURCE' Makefile
43 substituteInPlace lib/console.c --replace "EFI_WARN_UNKOWN_GLYPH" "EFI_WARN_UNKNOWN_GLYPH"
44 patchShebangs .
45 '';
46
47 meta = with lib; {
48 description = "Tools for manipulating UEFI secure boot platforms";
49 homepage = "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git";
50 license = licenses.gpl2Only;
51 maintainers = [ maintainers.grahamc ];
52 platforms = platforms.linux;
53 };
54}