aboutsummaryrefslogtreecommitdiffstats
path: root/main/efitools
diff options
context:
space:
mode:
authorLeo <thinkabit.ukim@gmail.com>2020-02-02 06:30:43 +0100
committerLeo <thinkabit.ukim@gmail.com>2020-02-02 06:30:50 +0100
commit3d5d80aa474a576b202a1c6dd9fe72f351c9d3f2 (patch)
tree6eaf90f2201c1f85d08f3b0eeb5abeb9f7ff951b /main/efitools
parent28ed176db4d4c0413c9285c2849d8f84a8a94b09 (diff)
downloadaports-3d5d80aa474a576b202a1c6dd9fe72f351c9d3f2.tar.bz2
aports-3d5d80aa474a576b202a1c6dd9fe72f351c9d3f2.tar.xz
main/efitools: move from testing
I used in creating my keys for Secure Boot without any problems.
Diffstat (limited to 'main/efitools')
-rw-r--r--main/efitools/001-datatypes.patch11
-rw-r--r--main/efitools/002-fix-parallel-make.patch11
-rw-r--r--main/efitools/003-fix-wchar_t.patch96
-rw-r--r--main/efitools/APKBUILD36
4 files changed, 154 insertions, 0 deletions
diff --git a/main/efitools/001-datatypes.patch b/main/efitools/001-datatypes.patch
new file mode 100644
index 0000000000..a55da69169
--- /dev/null
+++ b/main/efitools/001-datatypes.patch
@@ -0,0 +1,11 @@
+--- a/lib/asn1/oid.h 2017-03-24 16:04:44.603350102 +0200
++++ b/lib/asn1/oid.h 2017-03-24 19:58:30.876866547 +0200
+@@ -8,6 +8,8 @@
+ #ifndef OID_H_
+ #define OID_H_
+
++#include <sys/types.h>
++
+ typedef struct {
+ u_char octet;
+ u_int next;
diff --git a/main/efitools/002-fix-parallel-make.patch b/main/efitools/002-fix-parallel-make.patch
new file mode 100644
index 0000000000..4c405a3804
--- /dev/null
+++ b/main/efitools/002-fix-parallel-make.patch
@@ -0,0 +1,11 @@
+--- efitools-1.7.0/Make.rules.orig 2017-10-17 12:44:32.760969391 +0000
++++ efitools-1.7.0/Make.rules 2017-10-17 12:45:05.148245509 +0000
+@@ -71,7 +71,7 @@
+ %.hash: %.efi hash-to-efi-sig-list
+ ./hash-to-efi-sig-list $< $@
+
+-%-blacklist.esl: %.crt cert-to-efi-hash-list
++%-blacklist.esl: %.crt cert-to-efi-sig-list
+ ./cert-to-efi-sig-list $< $@
+
+ %-hash-blacklist.esl: %.crt cert-to-efi-hash-list
diff --git a/main/efitools/003-fix-wchar_t.patch b/main/efitools/003-fix-wchar_t.patch
new file mode 100644
index 0000000000..049d52fd7a
--- /dev/null
+++ b/main/efitools/003-fix-wchar_t.patch
@@ -0,0 +1,96 @@
+diff --git a/Make.rules b/Make.rules
+index 903a5a4..3de81c7 100644
+--- a/Make.rules
++++ b/Make.rules
+@@ -15,7 +15,7 @@ $(error unknown architecture $(ARCH))
+ endif
+ INCDIR = -I$(TOPDIR)include/ -I/usr/include/efi -I/usr/include/efi/$(ARCH) -I/usr/include/efi/protocol
+ CPPFLAGS = -DCONFIG_$(ARCH)
+-CFLAGS = -O2 -g $(ARCH3264) -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -fno-stack-protector -ffreestanding -fno-stack-check
++CFLAGS = -O2 -g $(ARCH3264) -fpic -Wall -fno-strict-aliasing -fno-merge-constants -fno-stack-protector -ffreestanding -fno-stack-check
+ LDFLAGS = -nostdlib
+ CRTOBJ = crt0-efi-$(ARCH).o
+ CRTPATHS = /lib /lib64 /lib/efi /lib64/efi /usr/lib /usr/lib64 /usr/lib/efi /usr/lib64/efi /usr/lib/gnuefi /usr/lib64/gnuefi
+diff --git a/cert-to-efi-hash-list.c b/cert-to-efi-hash-list.c
+index 8a5468a..c6b1e8e 100644
+--- a/cert-to-efi-hash-list.c
++++ b/cert-to-efi-hash-list.c
+@@ -23,7 +23,6 @@
+ #include <fcntl.h>
+ #include <time.h>
+ #include <unistd.h>
+-#include <wchar.h>
+
+ #include <openssl/pem.h>
+ #include <openssl/err.h>
+diff --git a/flash-var.c b/flash-var.c
+index aa10ae6..3ff6c7e 100644
+--- a/flash-var.c
++++ b/flash-var.c
+@@ -46,7 +46,7 @@ main(int argc, char *argv[])
+ | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS;
+ int flashfile, varfile, i, offset, varlen, varfilesize, listvars = 0;
+ const int chunk = 8;
+- wchar_t var[128];
++ uint16_t var[128];
+ struct stat st;
+ EFI_GUID *owner = NULL, guid;
+ EFI_TIME timestamp;
+@@ -88,7 +88,7 @@ main(int argc, char *argv[])
+ /* copy to wchar16_t including trailing zero */
+ for (i = 0; i < strlen(argv[2]) + 1; i++)
+ var[i] = argv[2][i];
+- varlen = i*2; /* size of storage including zero */
++ varlen = i*sizeof(var[0]); /* size of storage including zero */
+
+ if (!owner)
+ owner = get_owner_guid(argv[2]);
+diff --git a/hash-to-efi-sig-list.c b/hash-to-efi-sig-list.c
+index 4b69026..dbbc4f1 100644
+--- a/hash-to-efi-sig-list.c
++++ b/hash-to-efi-sig-list.c
+@@ -21,7 +21,6 @@
+ #include <fcntl.h>
+ #include <time.h>
+ #include <unistd.h>
+-#include <wchar.h>
+
+ #include <PeImage.h> /* for ALIGN_VALUE */
+ #include <sha256.h>
+diff --git a/sign-efi-sig-list.c b/sign-efi-sig-list.c
+index 94bd7d4..27abc17 100644
+--- a/sign-efi-sig-list.c
++++ b/sign-efi-sig-list.c
+@@ -21,7 +21,6 @@
+ #include <fcntl.h>
+ #include <time.h>
+ #include <unistd.h>
+-#include <wchar.h>
+
+ #include <variables.h>
+ #include <guid.h>
+@@ -73,7 +72,7 @@ main(int argc, char *argv[])
+ sigsize;
+ EFI_GUID vendor_guid;
+ struct stat st;
+- wchar_t var[256];
++ uint16_t var[256];
+ UINT32 attributes = EFI_VARIABLE_NON_VOLATILE
+ | EFI_VARIABLE_RUNTIME_ACCESS
+ | EFI_VARIABLE_BOOTSERVICE_ACCESS
+@@ -191,14 +190,11 @@ main(int argc, char *argv[])
+ timestamp.Month, timestamp.Day, timestamp.Hour, timestamp.Minute,
+ timestamp.Second);
+
+- /* Warning: don't use any glibc wchar functions. We're building
+- * with -fshort-wchar which breaks the glibc ABI */
+ i = 0;
+ do {
+ var[i] = str[i];
+ } while (str[i++] != '\0');
+-
+- varlen = (i - 1)*sizeof(wchar_t);
++ varlen = (i - 1)*sizeof(var[0]);
+
+ int fdefifile = open(efifile, O_RDONLY);
+ if (fdefifile == -1) {
diff --git a/main/efitools/APKBUILD b/main/efitools/APKBUILD
new file mode 100644
index 0000000000..3563e3a31c
--- /dev/null
+++ b/main/efitools/APKBUILD
@@ -0,0 +1,36 @@
+# Contributor: Tero Hilpinen <tero.hilpinen@symbio.com>
+# Contributor: Timo Teräs <timo.teras@iki.fi>
+# Maintainer: Timo Teräs <timo.teras@iki.fi>
+pkgname=efitools
+pkgver=1.9.2
+pkgrel=1
+pkgdesc="EFI tools"
+url="https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git"
+arch="x86_64"
+license="GPL-2.0-only and LGPL-2.1-or-later"
+makedepends="gnu-efi-dev openssl-dev perl-file-slurp help2man sbsigntool"
+subpackages="$pkgname-doc"
+source="https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git/snapshot/efitools-$pkgver.tar.gz
+ 001-datatypes.patch
+ 002-fix-parallel-make.patch
+ 003-fix-wchar_t.patch
+ "
+
+prepare() {
+ default_prepare
+ sed -i "s/-O2/${CFLAGS} -Wno-pointer-sign -O2/" Make.rules
+}
+
+build() {
+ export ARCH="$CARCH"
+ make
+}
+
+package() {
+ make DESTDIR="$pkgdir" install
+}
+
+sha512sums="77e0ad7e865814ed388ff6daabe0f4b49ba51672bf2cbb98b7905e209cbd28f9ede2f73213ce45af8a978c1e67dba24ec88a1188661317cc22317b47e575cde8 efitools-1.9.2.tar.gz
+cd72161a99b26472909a8da834c08a1f88b54d35291a6646562b03a6616fa5fb61e49d4fb3c780861689d23823c101709890dd245dd8aa9f51dca40ac1b2d369 001-datatypes.patch
+7afe87e9b44ed3e10200770d3079e4e14b6d39c54c05538031e93d021631427fed47781b016b46f58b8fe6d21f1f3c78667b2b502aa20b99516aa980303aa2ad 002-fix-parallel-make.patch
+bd31e51c6d80ab3fdfe0e7abea1cd6f982d63a96a345c0e75f438f6a219bf64b1510f0dabdcc49d24cc788c06ff4ccfbccde0c1aead9c00b65eaf2977e87e742 003-fix-wchar_t.patch"