pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

efivar: import efivar-38 as wip/efivar



Module Name:	pkgsrc-wip
Committed By:	Sergii Dmytruk <sergii.dmytruk%3mdeb.com@localhost>
Pushed By:	sergiidmytruk
Date:		Thu Oct 13 20:04:25 2022 +0300
Changeset:	2456880fdb325a6bdb665a818feae17668ab3b5e

Modified Files:
	Makefile
Added Files:
	efivar/COMMIT_MSG
	efivar/DESCR
	efivar/Makefile
	efivar/PLIST
	efivar/TODO
	efivar/distinfo
	efivar/patches/patch-src_include_defaults.mk
	efivar/patches/patch-src_include_efivar_efivar-dp.h
	efivar/patches/patch-src_include_gcc.specs

Log Message:
efivar: import efivar-38 as wip/efivar

This package provides user-space tools and libraries for EFI.
It includes libraries for managing EFI variables (libefivar), device
paths, load options (both by libefiboot), security certificates
(libefisec) as well as binaries for accessing EFI variables (efivar)
and manipulating certificates (efisecdb).

Signed-off-by: Sergii Dmytruk <sergii.dmytruk%3mdeb.com@localhost>

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=2456880fdb325a6bdb665a818feae17668ab3b5e

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                                           |  1 +
 efivar/COMMIT_MSG                                  | 13 +++++
 efivar/DESCR                                       |  5 ++
 efivar/Makefile                                    | 28 +++++++++++
 efivar/PLIST                                       | 57 ++++++++++++++++++++++
 efivar/TODO                                        | 11 +++++
 efivar/distinfo                                    |  8 +++
 efivar/patches/patch-src_include_defaults.mk       | 20 ++++++++
 .../patches/patch-src_include_efivar_efivar-dp.h   | 19 ++++++++
 efivar/patches/patch-src_include_gcc.specs         | 18 +++++++
 10 files changed, 180 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index 78bd3f619b..201351873d 100644
--- a/Makefile
+++ b/Makefile
@@ -748,6 +748,7 @@ SUBDIR+=	edid-decode
 SUBDIR+=	eduke32
 SUBDIR+=	ee
 SUBDIR+=	efgallery
+SUBDIR+=	efivar
 SUBDIR+=	efl
 SUBDIR+=	efltk
 SUBDIR+=	eic
diff --git a/efivar/COMMIT_MSG b/efivar/COMMIT_MSG
new file mode 100644
index 0000000000..b43d663aaf
--- /dev/null
+++ b/efivar/COMMIT_MSG
@@ -0,0 +1,13 @@
+devel/efivar: Add efivar 38
+
+This is an adaptation of https://github.com/rhboot/efivar to make it
+work on BSD systems.  Amount of changes is quite substantial and is
+very similar across *BSD systems, so a fork is used instead of a set of
+patches (there are still small patches in the port related to building
+on NetBSD).
+
+Fully implementing libefiboot for a system will take a lot of work, so
+it has limitations [1].  Generating abbreviated device paths works and
+that's enough to boot an EFI payload, making it useful for fwupd.
+
+[1]: https://github.com/3mdeb/efivar/blob/bsd/BSD_PORTING.md
diff --git a/efivar/DESCR b/efivar/DESCR
new file mode 100644
index 0000000000..66e5b34655
--- /dev/null
+++ b/efivar/DESCR
@@ -0,0 +1,5 @@
+This package provides user-space tools and libraries for EFI.
+It includes libraries for managing EFI variables (libefivar), device paths,
+load options (both by libefiboot), security certificates (libefisec) as well
+as binaries for accessing EFI variables (efivar) and manipulating
+certificates (efisecdb).
diff --git a/efivar/Makefile b/efivar/Makefile
new file mode 100644
index 0000000000..1da9a57566
--- /dev/null
+++ b/efivar/Makefile
@@ -0,0 +1,28 @@
+# $NetBSD$
+
+DISTNAME=		efivar-38
+CATEGORIES=		devel
+# The project is Linux-oriented, using fork with BSD-specific changes so that
+# patches are manageable and can be potentially sent upstream.
+#
+# The fork also uses unreleased changes as some of them fix build on systems
+# that don't use glibc.
+MASTER_SITES=		${MASTER_SITE_GITHUB:=3mdeb/}
+GITHUB_PROJECT=		efivar
+GITHUB_TAG=		bsd-v1
+
+MAINTAINER=		sergii.dmytruk%3mdeb.com@localhost
+HOMEPAGE=		https://github.com/rhboot/efivar
+COMMENT=		Tools and libraries to work with EFI
+LICENSE=		gnu-lgpl-v2.1 # or later
+
+USE_TOOLS+=		gmake
+
+# Specify lib directory name.
+MAKE_FLAGS=		LIBDIR=${PREFIX}/lib
+# Override man directory default of prefix/share/man.
+MAKE_FLAGS+=		MANDIR=${PREFIX}/${PKGMANDIR}
+# Instruct dynamic linker to give preference to /usr/pkg/lib.
+MAKE_FLAGS+=		SOFLAGS=${COMPILER_RPATH_FLAG}${PREFIX}/lib
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/efivar/PLIST b/efivar/PLIST
new file mode 100644
index 0000000000..f515762b17
--- /dev/null
+++ b/efivar/PLIST
@@ -0,0 +1,57 @@
+@comment $NetBSD$
+bin/efisecdb
+bin/efivar
+include/efivar/efiboot-creator.h
+include/efivar/efiboot-loadopt.h
+include/efivar/efiboot.h
+include/efivar/efisec-secdb.h
+include/efivar/efisec-types.h
+include/efivar/efisec.h
+include/efivar/efivar-dp.h
+include/efivar/efivar-guids.h
+include/efivar/efivar-time.h
+include/efivar/efivar-types.h
+include/efivar/efivar.h
+lib/libefiboot.so
+lib/libefiboot.so.1
+lib/libefiboot.so.1.${PKGVERSION}
+lib/libefisec.so
+lib/libefisec.so.1
+lib/libefisec.so.1.${PKGVERSION}
+lib/libefivar.so
+lib/libefivar.so.1
+lib/libefivar.so.1.${PKGVERSION}
+lib/pkgconfig/efiboot.pc
+lib/pkgconfig/efisec.pc
+lib/pkgconfig/efivar.pc
+man/man1/efisecdb.1
+man/man1/efivar.1
+man/man3/efi_append_variable.3
+man/man3/efi_del_variable.3
+man/man3/efi_get_next_variable_name.3
+man/man3/efi_get_variable.3
+man/man3/efi_get_variable_attributes.3
+man/man3/efi_get_variable_size.3
+man/man3/efi_guid_to_id_guid.3
+man/man3/efi_guid_to_name.3
+man/man3/efi_guid_to_str.3
+man/man3/efi_guid_to_symbol.3
+man/man3/efi_name_to_guid.3
+man/man3/efi_set_variable.3
+man/man3/efi_str_to_guid.3
+man/man3/efi_symbol_to_guid.3
+man/man3/efi_variable_alloc.3
+man/man3/efi_variable_export.3
+man/man3/efi_variable_free.3
+man/man3/efi_variable_get_attributes.3
+man/man3/efi_variable_get_data.3
+man/man3/efi_variable_get_guid.3
+man/man3/efi_variable_get_name.3
+man/man3/efi_variable_import.3
+man/man3/efi_variable_realize.3
+man/man3/efi_variable_set_attributes.3
+man/man3/efi_variable_set_data.3
+man/man3/efi_variable_set_guid.3
+man/man3/efi_variable_set_name.3
+man/man3/efi_variable_t.3
+man/man3/efi_variables_supported.3
diff --git a/efivar/TODO b/efivar/TODO
new file mode 100644
index 0000000000..c75b0829d2
--- /dev/null
+++ b/efivar/TODO
@@ -0,0 +1,11 @@
+Can generally be used, but see [1] for limitations.
+
+[1]: https://github.com/3mdeb/efivar/blob/bsd/BSD_PORTING.md
+
+This uses EFI driver which seem to NOT be included into releases?
+
+The are warnings during build like (not sure if needs to be fixed):
+
+    In file included from ioctl.c:25:0:
+    /usr/include/sys/efiio.h:46:0: note: this is the location of the previous definition
+     #define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS   0x00000010
diff --git a/efivar/distinfo b/efivar/distinfo
new file mode 100644
index 0000000000..e1b292b463
--- /dev/null
+++ b/efivar/distinfo
@@ -0,0 +1,8 @@
+$NetBSD$
+
+BLAKE2s (efivar-38.tar.gz) = 2e0821f4373bf99ee6e59ddf98fafb6e9341dc2f7f5f6ba072c9ba5c95b25435
+SHA512 (efivar-38.tar.gz) = 5ac146227e20c845d0cd39d7cb9b8a109a3ddb8f2e3c78a9fdf480c5ac37417360bce815c7d359354a9aa07bfb30be1d6d318a2ffa250e2904f629df6113a430
+Size (efivar-38.tar.gz) = 470176 bytes
+SHA1 (patch-src_include_defaults.mk) = e79446000ba43eb82ecd6a141de593d9d768d27f
+SHA1 (patch-src_include_efivar_efivar-dp.h) = 8eaeb0a3657a6263e2b19da77c14b29bd7b6f411
+SHA1 (patch-src_include_gcc.specs) = b63825b96dcedc44404de730683a09f421a07eea
diff --git a/efivar/patches/patch-src_include_defaults.mk b/efivar/patches/patch-src_include_defaults.mk
new file mode 100644
index 0000000000..87073c2a6e
--- /dev/null
+++ b/efivar/patches/patch-src_include_defaults.mk
@@ -0,0 +1,20 @@
+$NetBSD$
+
+ld produces this warning:
+
+    warning: guids.lds contains output sections; did you forget -T?
+
+It's harmless and is meant to make user notice lack of -T, but it's not needed
+here. Not clear how to suppress the warning, so removing --fatal-warnings as it
+causes the build to fail.
+
+--- src/include/defaults.mk.orig	2022-09-30 15:17:36.405877661 +0000
++++ src/include/defaults.mk
+@@ -56,7 +56,6 @@ override LDFLAGS = $(CFLAGS) -L. $(_LDFL
+ 		   -Wl,-z,now \
+ 		   -Wl,-z,muldefs \
+ 		   -Wl,-z,relro \
+-		   -Wl,--fatal-warnings \
+ 		   $(call family,LDFLAGS) $(call family,CCLDFLAGS) \
+ 		   $(call pkg-config-ccldflags)
+ override CCLDFLAGS = $(LDFLAGS)
diff --git a/efivar/patches/patch-src_include_efivar_efivar-dp.h b/efivar/patches/patch-src_include_efivar_efivar-dp.h
new file mode 100644
index 0000000000..147b36cfbf
--- /dev/null
+++ b/efivar/patches/patch-src_include_efivar_efivar-dp.h
@@ -0,0 +1,19 @@
+$NetBSD$
+
+/usr/include/net/if.h contains:
+
+    #define   if_type         if_data.ifi_type
+
+--- src/include/efivar/efivar-dp.h.orig	2022-09-30 16:35:57.395069283 +0000
++++ src/include/efivar/efivar-dp.h
+@@ -425,6 +425,10 @@ typedef struct {
+ 	uint32_t	target;
+ } EFIVAR_PACKED efidp_i2o;
+ 
++#ifdef if_type
++# undef if_type
++#endif
++
+ #define EFIDP_MSG_MAC_ADDR	0x0b
+ typedef struct {
+ 	efidp_header	header;
diff --git a/efivar/patches/patch-src_include_gcc.specs b/efivar/patches/patch-src_include_gcc.specs
new file mode 100644
index 0000000000..5a4255f542
--- /dev/null
+++ b/efivar/patches/patch-src_include_gcc.specs
@@ -0,0 +1,18 @@
+$NetBSD$
+
+ld produces this warning:
+
+    warning: guids.lds contains output sections; did you forget -T?
+
+It's harmless and is meant to make user notice lack of -T, but it's not needed
+here. Not clear how to suppress the warning, so removing --fatal-warnings as it
+causes the build to fail.
+
+--- src/include/gcc.specs.orig	2022-09-30 15:19:39.356337220 +0000
++++ src/include/gcc.specs
+@@ -5,4 +5,4 @@
+ + %{!shared:%{!static:%{!r:-pie}}} %{static:-Wl,-no-fatal-warnings -Wl,-static -static -Wl,-z,relro,-z,now} -grecord-gcc-switches
+ 
+ *link:
+-+ %{!static:--fatal-warnings} --no-undefined-version -z now --build-id %{!static:%{!shared:-pie}} %{shared:-z relro} %{static:%<pie}
+++ --no-undefined-version -z now --build-id %{!static:%{!shared:-pie}} %{shared:-z relro} %{static:%<pie}


Home | Main Index | Thread Index | Old Index