Sync from SUSE:SLFO:Main efivar revision 3f74ce7127c82830edd45538fc7949a5

This commit is contained in:
Adrian Schröter 2024-05-03 12:17:12 +02:00
commit 4951bfc643
9 changed files with 946 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

BIN
efivar-38.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,36 @@
From 26ad6858b7ca2093677a8a13d367436f5c1a22fe Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Mon, 17 Jan 2022 11:42:53 -0500
Subject: [PATCH] Adjust dependency for libefivar and libefiboot objects
Depending on 'prep' causes all objects to be rebuilt every time 'make'
is invoked.
Depending on '$(GENERATED_SOURCES)' causes a build failure because
guid-symbols.c gets passed to the compiler due to a rule in rules.mk.
Depend on 'include/efivar/efivar-guids.h' directly to avoid these
issues.
Fixes: https://github.com/rhboot/efivar/issues/199
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
src/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Makefile b/src/Makefile
index a86abdc..e04357a 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -88,7 +88,7 @@ $(MAKEGUIDS_OUTPUT) : guids.txt
prep : makeguids $(GENERATED_SOURCES)
-$(LIBEFIVAR_OBJECTS) $(LIBEFIBOOT_OBJECTS) : prep
+$(LIBEFIVAR_OBJECTS) $(LIBEFIBOOT_OBJECTS) : include/efivar/efivar-guids.h
libefivar.a : | $(GENERATED_SOURCES)
libefivar.a : $(patsubst %.o,%.static.o,$(LIBEFIVAR_OBJECTS))
--
2.35.3

View File

@ -0,0 +1,58 @@
From bc65d63ebf8fe6ac8a099ff15ca200986dba1565 Mon Sep 17 00:00:00 2001
From: Robbie Harwood <rharwood@redhat.com>
Date: Thu, 28 Jul 2022 16:11:24 -0400
Subject: [PATCH] Fix glibc 2.36 build (mount.h conflicts)
glibc has decided that sys/mount.h and linux/mount.h are no longer
usable at the same time. This broke the build, since linux/fs.h itself
includes linux/mount.h. For now, fix the build by only including
sys/mount.h where we need it.
See-also: https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E
Resolves: #227
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
---
src/gpt.c | 1 +
src/linux.c | 1 +
src/util.h | 1 -
3 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/gpt.c b/src/gpt.c
index 1eda049..21413c3 100644
--- a/src/gpt.c
+++ b/src/gpt.c
@@ -17,6 +17,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/mount.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/utsname.h>
diff --git a/src/linux.c b/src/linux.c
index 47e45ae..1780816 100644
--- a/src/linux.c
+++ b/src/linux.c
@@ -20,6 +20,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <sys/ioctl.h>
+#include <sys/mount.h>
#include <sys/socket.h>
#include <sys/sysmacros.h>
#include <sys/types.h>
diff --git a/src/util.h b/src/util.h
index 3300666..1e67e44 100644
--- a/src/util.h
+++ b/src/util.h
@@ -23,7 +23,6 @@
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
-#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <tgmath.h>
--
2.35.3

View File

@ -0,0 +1,262 @@
From 06a27de4468c879494db0e34d37b4ad2e5788af4 Mon Sep 17 00:00:00 2001
From: Nicholas Vinson <nvinson234@gmail.com>
Date: Mon, 10 Oct 2022 14:22:36 -0400
Subject: [PATCH] Revamp efi_well_known_* variable handling
The current implementation attempts to use the linker to create aliases
for efi_well_known_guids and efi_well_known_names. It also tries to use
the linker to generate the variables efi_well_known_guids_end and
efi_well_known_names_end.
When building with clang, the generated linker result results in a
broken libefivar.so that causes programs to segfault when linked against
it. This change does away with linker script hacker and instead
introduces pointers to store the locations of efi_well_known_guids_end
and efi_well_known_names_end.
Additionally, efi_well_known_guids and efi_well_known_names are now
created as pointers that point to the beginning of their respective
arrays.
Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Fixes: #234
---
src/Makefile | 7 ++--
src/include/rules.mk | 5 +--
src/include/workarounds.mk | 24 -------------
src/makeguids.c | 72 +++++++++++++-------------------------
4 files changed, 27 insertions(+), 81 deletions(-)
delete mode 100644 src/include/workarounds.mk
diff --git a/src/Makefile b/src/Makefile
index 0e423c4..a655a56 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -4,7 +4,6 @@ include $(TOPDIR)/src/include/deprecated.mk
include $(TOPDIR)/src/include/version.mk
include $(TOPDIR)/src/include/rules.mk
include $(TOPDIR)/src/include/defaults.mk
-include $(TOPDIR)/src/include/workarounds.mk
LIBTARGETS=libefivar.so libefiboot.so libefisec.so
STATICLIBTARGETS=libefivar.a libefiboot.a libefisec.a
@@ -30,7 +29,7 @@ EFISECDB_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(EFISECDB_SOURCES)))
GENERATED_SOURCES = include/efivar/efivar-guids.h guid-symbols.c
MAKEGUIDS_SOURCES = makeguids.c util.c
MAKEGUIDS_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(MAKEGUIDS_SOURCES)))
-MAKEGUIDS_OUTPUT = $(GENERATED_SOURCES) guids.lds
+MAKEGUIDS_OUTPUT = $(GENERATED_SOURCES)
ALL_SOURCES=$(LIBEFISEC_SOURCES) $(LIBEFIBOOT_SOURCES) $(LIBEFIVAR_SOURCES) \
$(MAKEGUIDS_SOURCES) $(GENERATED_SOURCES) $(EFIVAR_SOURCES) \
@@ -81,7 +80,7 @@ $(MAKEGUIDS_OUTPUT) : guids.txt
if [ "$${missing}" != "no" ]; then \
exit 1 ; \
fi
- ./makeguids $(LD_DASH_T) guids.txt guid-symbols.c include/efivar/efivar-guids.h guids.lds
+ ./makeguids guids.txt guid-symbols.c include/efivar/efivar-guids.h
prep : makeguids $(GENERATED_SOURCES)
@@ -93,7 +92,6 @@ libefivar.a : $(patsubst %.o,%.static.o,$(LIBEFIVAR_OBJECTS))
libefivar.so : $(LIBEFIVAR_OBJECTS)
libefivar.so : | $(GENERATED_SOURCES) libefivar.map
libefivar.so : LIBS=dl
-libefivar.so : LDSCRIPTS=guids.lds
libefivar.so : MAP=libefivar.map
efivar : $(EFIVAR_OBJECTS) | libefivar.so
@@ -134,7 +132,6 @@ deps : $(ALL_SOURCES)
clean :
@rm -rfv *~ *.o *.a *.E *.so *.so.* *.pc *.bin .*.d *.map \
makeguids guid-symbols.c include/efivar/efivar-guids.h \
- guids.lds \
$(TARGETS) $(STATICTARGETS)
@# remove the deps files we used to create, as well.
@rm -rfv .*.P .*.h.P *.S.P include/efivar/.*.h.P
diff --git a/src/include/rules.mk b/src/include/rules.mk
index f309f86..8d0b68a 100644
--- a/src/include/rules.mk
+++ b/src/include/rules.mk
@@ -3,7 +3,6 @@ default : all
.PHONY: default all clean install test
include $(TOPDIR)/src/include/version.mk
-include $(TOPDIR)/src/include/workarounds.mk
comma:= ,
empty:=
@@ -36,9 +35,7 @@ family = $(foreach FAMILY_SUFFIX,$(FAMILY_SUFFIXES),$($(1)_$(FAMILY_SUFFIX)))
$(CCLD) $(CCLDFLAGS) $(CPPFLAGS) -o $@ $(sort $^) $(LDLIBS)
%.so :
- $(CCLD) $(CCLDFLAGS) $(CPPFLAGS) $(SOFLAGS) \
- $(foreach LDS,$(LDSCRIPTS),$(LD_DASH_T) $(LDS)) \
- -o $@ $^ $(LDLIBS)
+ $(CCLD) $(CCLDFLAGS) $(CPPFLAGS) $(SOFLAGS) -o $@ $^ $(LDLIBS)
ln -vfs $@ $@.1
%.abixml : %.so
diff --git a/src/include/workarounds.mk b/src/include/workarounds.mk
deleted file mode 100644
index 3118834..0000000
--- a/src/include/workarounds.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# SPDX-License-Identifier: SPDX-License-Identifier: LGPL-2.1-or-later
-#
-# workarounds.mk - workarounds for weird stuff behavior
-
-LD_FLAVOR := $(shell $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/ .*//g')
-LD_VERSION := $(shell $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/.* //')
-# I haven't tested 2.36 here; 2.35 is definitely broken and 2.37 seems to work
-LD_DASH_T := $(shell \
- if [ "x${LD_FLAVOR}" = xLLD ] ; then \
- echo '-T' ; \
- elif [ "x${LD_FLAVOR}" = xGNU ] ; then \
- if echo "${LD_VERSION}" | grep -q -E '^2\.3[789]|^2\.[456789]|^[3456789]|^[[:digit:]][[:digit:]]' ; then \
- echo '-T' ; \
- else \
- echo "" ; \
- fi ; \
- else \
- echo "Your linker is not supported" ; \
- exit 1 ; \
- fi)
-
-export LD_DASH_T
-
-# vim:ft=make
diff --git a/src/makeguids.c b/src/makeguids.c
index e4ff411..b9e9312 100644
--- a/src/makeguids.c
+++ b/src/makeguids.c
@@ -107,51 +107,46 @@ write_guidnames(FILE *out, const char *listname,
gn->symbol, gn->name, gn->description);
}
fprintf(out, "};\n");
+ fprintf(out, "const struct efivar_guidname\n"
+ "\t__attribute__((__visibility__ (\"default\")))\n"
+ "\t* const %s = %s_;\n", listname, listname);
+ fprintf(out, "const struct efivar_guidname\n"
+ "\t__attribute__((__visibility__ (\"default\")))\n"
+ "\t* const %s_end = %s_\n\t+ %zd;\n",
+ listname, listname, n - 1);
}
int
main(int argc, char *argv[])
{
int rc;
- int argstart = 0;
- FILE *symout, *header, *ldsout;
- int dash_t = 0;
+ FILE *symout, *header;
- if (argc < 5) {
+ if (argc < 4) {
errx(1, "Not enough arguments.\n");
- } else if (argc > 5 && !strcmp(argv[1],"-T")) {
- argstart = 1;
- dash_t = 1;
- } else if (argc > 5) {
+ } else if (argc > 4) {
errx(1, "Too many arguments.\n");
}
- symout = fopen(argv[argstart + 2], "w");
+ symout = fopen(argv[2], "w");
if (symout == NULL)
- err(1, "could not open \"%s\"", argv[argstart + 2]);
- rc = chmod(argv[argstart + 2], 0644);
+ err(1, "could not open \"%s\"", argv[2]);
+ rc = chmod(argv[2], 0644);
if (rc < 0)
- warn("chmod(%s, 0644)", argv[argstart + 2]);
+ warn("chmod(%s, 0644)", argv[2]);
- header = fopen(argv[argstart + 3], "w");
+ header = fopen(argv[3], "w");
if (header == NULL)
- err(1, "could not open \"%s\"", argv[argstart + 3]);
- rc = chmod(argv[argstart + 3], 0644);
- if (rc < 0)
- warn("chmod(%s, 0644)", argv[argstart + 3]);
-
- ldsout = fopen(argv[argstart + 4], "w");
- if (ldsout == NULL)
- err(1, "could not open \"%s\"", argv[argstart + 4]);
- rc = chmod(argv[argstart + 4], 0644);
+ err(1, "could not open \"%s\"", argv[3]);
+ rc = chmod(argv[3], 0644);
if (rc < 0)
- warn("chmod(%s, 0644)", argv[argstart + 4]);
+ warn("chmod(%s, 0644)", argv[3]);
struct guidname_index *guidnames = NULL;
- rc = read_guids_at(AT_FDCWD, argv[argstart + 1], &guidnames);
+ rc = read_guids_at(AT_FDCWD, argv[1], &guidnames);
if (rc < 0)
- err(1, "could not read \"%s\"", argv[argstart + 1]);
+ err(1, "could not read \"%s\"", argv[1]);
struct efivar_guidname *outbuf;
@@ -239,12 +234,11 @@ struct efivar_guidname {\n\
fprintf(header,
"extern const struct efivar_guidname\n"
"\t__attribute__((__visibility__ (\"default\")))\n"
- "\tefi_well_known_guids[%d];\n",
- i);
+ "\t* const efi_well_known_guids;\n");
fprintf(header,
"extern const struct efivar_guidname\n"
"\t__attribute__((__visibility__ (\"default\")))\n"
- "\tefi_well_known_guids_end;\n");
+ "\t* const efi_well_known_guids_end;\n");
fprintf(header,
"extern const uint64_t\n"
"\t__attribute__((__visibility__ (\"default\")))\n"
@@ -252,12 +246,11 @@ struct efivar_guidname {\n\
fprintf(header,
"extern const struct efivar_guidname\n"
"\t__attribute__((__visibility__ (\"default\")))\n"
- "\tefi_well_known_names[%d];\n",
- i);
+ "\t* const efi_well_known_names;\n");
fprintf(header,
"extern const struct efivar_guidname\n"
"\t__attribute__((__visibility__ (\"default\")))\n"
- "\tefi_well_known_names_end;\n");
+ "\t* const efi_well_known_names_end;\n");
fprintf(header,
"extern const uint64_t\n"
"\t__attribute__((__visibility__ (\"default\")))\n"
@@ -302,23 +295,6 @@ struct efivar_guidname {\n\
fclose(symout);
- fprintf(ldsout,
- "SECTIONS\n"
- "{\n"
- " .data :\n"
- " {\n"
- " efi_well_known_guids = efi_well_known_guids_;\n"
- " efi_well_known_guids_end = efi_well_known_guids_ + %zd;\n"
- " efi_well_known_names = efi_well_known_names_;\n"
- " efi_well_known_names_end = efi_well_known_names_ + %zd;\n"
- " }\n"
- "}%s;\n",
- (line - 1) * sizeof(struct efivar_guidname),
- (line - 1) * sizeof(struct efivar_guidname),
- dash_t ? " INSERT AFTER .data" : "");
-
- fclose(ldsout);
-
free(guidnames->strtab);
free(guidnames);
--
2.35.3

View File

@ -0,0 +1,29 @@
From 85419ca09d225630cd1740e554bfb65c560e3904 Mon Sep 17 00:00:00 2001
From: Gary Lin <glin@suse.com>
Date: Wed, 21 Dec 2022 14:49:34 +0800
Subject: [PATCH] Exclude '-march=native' from ppc64le and riscv64
Since gcc of ppc64le and riscv64 doesn't support '-march=native', remove
it from HOST_CPPFLAGS.
Signed-off-by: Gary Lin <glin@suse.com>
---
src/include/defaults.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/include/defaults.mk b/src/include/defaults.mk
index 9da5182..94502ed 100644
--- a/src/include/defaults.mk
+++ b/src/include/defaults.mk
@@ -70,7 +70,7 @@ override SOFLAGS = $(_SOFLAGS) \
$(call family,SOFLAGS)
HOST_ARCH=$(shell uname -m)
-ifneq ($(HOST_ARCH),ia64)
+ifeq (, $(filter ia64 riscv64 ppc64le, $(HOST_ARCH)))
HOST_MARCH=-march=native
else
HOST_MARCH=
--
2.35.3

340
efivar.changes Normal file
View File

@ -0,0 +1,340 @@
-------------------------------------------------------------------
Fri Feb 10 07:21:31 UTC 2023 - Gary Ching-Pang Lin <glin@suse.com>
- Update to 38
+ Rework some makefile bits to make overriding some options
simpler
+ Handle /sys/devices/virtual/{nvme-fabrics,nvme-subsystem}
devices
+ guids.S: Include <cet.h> when CET is enabled
+ Fix /sys/block sysfs parsing for eMMC-s
+ Properly check mmap return error
+ Fix s{yt,ty}le typo in efi_get_variable(3)
+ Handle NULL set_variable()
+ Fix parsing for nvme-subsystem devices
+ Attempt to fix the identified thread safety bugs
+ Make thread-test depend on libefivar.so
+ Upstream a local patch from rawhide
+ Fix conversion from UTF8 to UCS2
+ efivar: make docs match current code for 'efivar -A'
+ Add code of conduct
+ Misc minor fixes
+ Add efi_time_t declarations and helper functions
+ More misc fixes
+ Coverity fixes 20211208
+ Fix linux virtual root device parsing
+ efivar.spec.in: fix license to be valid SPDX
+ Add efisecdb tooling
+ Fix linker string comparison for dash
- Add efivar-bsc1206388-revamp-efi_well_known-variable-handling.patch
to remove the ld script hack for efi_well_known_* variables
that caused build failure with LTO (bsc#1206388)
- Add mandoc to BuildRequires to build efisecdb man page
- Add efivar-adjust-dependency.patch to avoid 'make install' from
building the binaries again
- Add efivar-filter-gcc-march.patch to drop '-march=native' from
HOST_CPPFLAGS for ppc64le and riscv64 due to the absence of the
gcc parameter
- Refresh libefiboot-export-disk_get_partition_info.patch
+ Cast (uint8_t *) signature to (partition_signature_t *)
+ Update src/libefiboot.map.in
- Remove upstreamed patches
+ efivar-Fix-all-the-places-Werror-address-of-packed-member-c.patch
+ efivar-bsc1127544-fix-ucs2len.patch
+ efivar-bsc1175989-handle-NULL-set-variable.patch
+ efivar-bsc1181967-fix-nvme-parsing.patch
+ efivar-bsc1187386-fix-emmc-parsing.patch
+ efivar-fix-efidp_ipv4_addr-fields-assignment.patch
+ efivar-make-format_guid-handle-misaligned-guid-pointer.patch
-------------------------------------------------------------------
Wed Dec 21 18:58:32 UTC 2022 - Callum Farmer <gmbr3@opensuse.org>
- Update spec file to current standards
-------------------------------------------------------------------
Wed Aug 10 01:54:21 UTC 2022 - Gary Ching-Pang Lin <glin@suse.com>
- Add efivar-bsc1202209-fix-glibc-2.36-build.patch to fix the build
error against glibc 2.36 (bsc#1202209)
-------------------------------------------------------------------
Wed Jun 16 06:45:21 UTC 2021 - Gary Ching-Pang Lin <glin@suse.com>
- Add efivar-bsc1187386-fix-emmc-parsing.patch to fix the eMMC
sysfs parsing (bsc#1187386)
- Add efivar-bsc1181967-fix-nvme-parsing.patch to fix the NVME
path parsing (bsc#1181967)
-------------------------------------------------------------------
Tue Sep 8 09:31:54 UTC 2020 - Gary Ching-Pang Lin <glin@suse.com>
- Add efivar-bsc1175989-handle-NULL-set-variable.patch to fix
segfault in non-EFI systems (bsc#1175989)
-------------------------------------------------------------------
Fri Aug 14 08:20:09 UTC 2020 - Martin Liška <mliska@suse.cz>
- Do not partition LTO as we may reach new GAS error:
Error: invalid attempt to declare external version
name as default in symbol `efi_set_variable@@LIBEFIVAR_0.24'
-------------------------------------------------------------------
Fri Mar 8 03:16:22 UTC 2019 - Gary Ching-Pang Lin <glin@suse.com>
- Add efivar-bsc1127544-fix-ucs2len.patch to fix logic that checks
for UCS-2 string termination (boo#1127544)
- Add efivar-fix-efidp_ipv4_addr-fields-assignment.patch to fix the
casting of IPv4 address.
-------------------------------------------------------------------
Fri Feb 22 08:24:56 UTC 2019 - Gary Ching-Pang Lin <glin@suse.com>
- Update to 37
+ Improve ACPI device path formatting
+ Add support for SOC devices that use FDT as their PCI root node
+ Make devices we can't parse the "device" sysfs link for use
DEV_ABBREV_ONLY
+ Handle SCSI port numbers better
+ Don't require an EUI for NVMe (boo#1100077)
+ Fix the accidental requirement on ACPI UID nodes existing
+ Add support for EMMC devices
+ Add support for PCI root nodes without a device link in sysfs
+ Add support for partitioned MD devices
+ Fix partition number detection when the number isn't provided
+ Add support for ACPI Generic Container and Embedded Controller
root nodes (boo#1101023)
+ Add limited support for SAS/SATA port expanders
- Add upstream patches to fix boo#1120862
+ efivar-make-format_guid-handle-misaligned-guid-pointer.patch
+ efivar-Fix-all-the-places-Werror-address-of-packed-member-c.patch
- Drop upstreamed reproducible.patch
- Refresh libefiboot-export-disk_get_partition_info.patch
- Use %license for COPYING
-------------------------------------------------------------------
Tue Jul 24 07:45:35 UTC 2018 - bwiedemann@suse.com
- Add reproducible.patch to initialize memory (boo#1061219)
-------------------------------------------------------------------
Mon Jul 16 07:45:14 UTC 2018 - glin@suse.com
- Downgrade to 35 (fate#326702)
+ 36 rewrote the linux interface parsers and caused several
problems in efibootmgr. Downgrade the version before the change
to avoid the failure of boot variable creation
(boo#1100077, boo#1101023)
- Refresh libefiboot-export-disk_get_partition_info.patch
-------------------------------------------------------------------
Wed Jun 20 15:03:30 UTC 2018 - oliver@getspam.de
- Update to version 36
- adjust libefiboot-export-disk_get_partition_info.patch to fit
new version
-------------------------------------------------------------------
Thu Mar 23 15:32:57 UTC 2017 - jengelh@inai.de
- RPM group fix
-------------------------------------------------------------------
Fri Mar 3 18:09:42 UTC 2017 - rw@suse.com
- libefiboot-export-disk_get_partition_info.patch:
(bsc#870211, bsc#945705)
-------------------------------------------------------------------
Tue Feb 10 10:40:18 UTC 2017 - rw@suse.com
- Update to 31 (fate#322108)
- Drop upstreamed patches
+ efivar-no-static.patch
+ deprecated-readdir_r.patch
+ efivar-use-sysmacros.patch
-------------------------------------------------------------------
Thu Feb 9 06:32:10 UTC 2017 - glin@suse.com
- Add efivar-use-sysmacros.patch to fix the Factory/Tumbleweed
build correctly.
- Amend the spec file to specify the gcc version for SLE11SP4
-------------------------------------------------------------------
Mon Feb 6 14:40:25 UTC 2017 - rw@suse.com
- Fix building for SLE11SP4, SLE12SP2, and Tumbleweed
(fate#322108, bnc#1012765)
- Drop obsolete patch
efivar-bsc988000-remove-versioning-efi_set_variable.patch
-------------------------------------------------------------------
Wed Jul 13 03:54:20 UTC 2016 - glin@suse.com
- Update to 0.24
- Drop upstreamed patches
+ efivar-0.21-gcc6.diff
+ efivar-nvme-rename.patch
+ efivar-nvme-no-kernel-header.patch
+ efivar-relicensing.patch
+ efivar-bsc988000-fix-mode-efi_set_variable.patch
-------------------------------------------------------------------
Tue Jul 12 09:00:02 UTC 2016 - schwab@suse.de
- deprecated-readdir_r.patch: Remove use of deprecated readdir_r
-------------------------------------------------------------------
Mon Jul 11 06:44:37 UTC 2016 - glin@suse.com
- Add efivar-bsc988000-fix-mode-efi_set_variable.patch and
efivar-bsc988000-remove-versioning-efi_set_variable.patch to set
the default file mode rather than fetching a value randomly
(bsc#988000)
-------------------------------------------------------------------
Wed Apr 13 02:08:09 UTC 2016 - glin@suse.com
- Add efivar-relicensing.patch to update the license in some files
-------------------------------------------------------------------
Tue Apr 12 02:05:47 UTC 2016 - glin@suse.com
- Add the missing COPYING
-------------------------------------------------------------------
Wed Mar 9 04:23:29 UTC 2016 - glin@suse.com
- Update to 0.23 for fwupdate (FATE#319345)
- Add efivar-nvme-rename.patch and efivar-nvme-no-kernel-header.patch
to work around the missing kernel header.
- Add efivar-no-static.patch to remove efivar-static since it
causes build failure and we don't really need it.
- Remove efivar-fix-initializer.patch since it's already in 0.23.
- Remove _smp_mflags since the Makefile doesn't work well with
the flag.
-------------------------------------------------------------------
Wed Feb 10 15:31:35 UTC 2016 - rguenther@suse.com
- Add efivar-0.21-gcc6.diff to fix strict-aliasing issue.
- Build with -Wno-nonnull as efivar tests nonnull args for zero
and that breaks with its use of -Werror.
-------------------------------------------------------------------
Tue Dec 1 09:08:28 UTC 2015 - glin@suse.com
- Update the source link
-------------------------------------------------------------------
Fri Nov 27 10:23:58 UTC 2015 - glin@suse.com
- Update to 0.21
- Add efivar-fix-initializer.patch to initialize ifreq properly
- Drop patches
+ efivar-fix-vars_del_variable.patch: upstreamed
+ efivar-revert-linker-order.patch: not necessary
-------------------------------------------------------------------
Wed Jun 24 09:58:16 UTC 2015 - glin@suse.com
- Add efivar-fix-vars_del_variable.patch to fix the deletion of
the variable with the old efivar kernel modules
-------------------------------------------------------------------
Tue Jun 16 07:30:20 UTC 2015 - glin@suse.com
- Add efivar-revert-linker-order.patch to adjust the linker order
which caused the compilation error in pesign
-------------------------------------------------------------------
Thu Jun 11 06:59:41 UTC 2015 - mpluskal@suse.com
- Use default CFLAGS
-------------------------------------------------------------------
Wed Jun 3 07:46:58 UTC 2015 - mpluskal@suse.com
- Update to 0.20
* Make sure tester is build with the right link order for
libraries.
* Adjust linker order for pkg-config
* Work around LocateDevicePath() not grokking PcieRoot() devices
properly.
* Rectify some missing changelog entries
- Changes for 0.19
* Lots of debugging in this release, as well as some of the
documentation that's planned. There's more of that to come.
- Changes for 0.18
* This release is mostly about adding the efidp and libefiboot
APIs available.Next release will feature documentation for
them, verification that various different device path types
work, etc. Right now efi device path generation is basically
limited to:
+ full file paths on sata devices
+ full file paths on sas devices
+ HD() paths for SATA and SAS devices
+ ipv4 dhcp device paths that don't specify their own
filenames
- Drop upstreamed patche
* efivar-correct-license-header.patch
- Drop as Makefiles have been restructured, CFLAGS no longer
defined in them
* efivar-suse-build.patch
- Use fdupes to reduce amount of duplicate files
-------------------------------------------------------------------
Fri Nov 7 02:20:06 UTC 2014 - glin@suse.com
- Add efivar-correct-license-header.patch to correct the license of
util.h
- Amend the spec file with spec-cleaner
-------------------------------------------------------------------
Wed Oct 29 04:00:49 UTC 2014 - glin@suse.com
- Update to 0.15
+ Make FSF addresses in COPYING be URLS
+ Fix variables' DataSize field on 32-bit machines.
+ Add some vendor specific guids to our guid list
+ Add efi_id_guid_to_name() and efi_name_to_id_guid(), which
support {ID GUID} as a concept a la
http://technet.microsoft.com/en-us/library/cc766223%28v=ws.10%29.aspx
+ Call "empty" "zero" now, as many other places do. (empty
references still exist for ABI compatibility)
+ add "efivar -L" to the man page
+ efi_symbol_to_guid()
+ efi_name_to_guid() will fall back on efi_symbol_to_guid()
+ "efivar -L" to list all the guids we know about
+ better namespacing on libefivar.so
(rename well_known_* -> efi_well_known_*)
- Refresh efivar-suse-build.patch
-------------------------------------------------------------------
Fri Sep 26 04:06:57 UTC 2014 - glin@suse.com
- Update to 0.12
+ Make efi_guid_to_str() only optionally allocate.
+ Add ", mode" optionally to efi_set_variable()
+ Fix some return values that don't properly set errno.
+ Make "wrong size" test more verbose
+ Excise read_fd() since we've got read_file(), plus cleanups.
+ Remove variables we've failed to create.
+ Only open with O_CREAT if we're not using
EFI_VARIABLE_APPEND_WRITE
+ Fix poptReadDefaultConfig() error checking
+ Get rid of ftruncate() call in efivarfs writes.
+ If the real file size of an efivarfs file is smaller than stat,
get it right.
+ Fix uninitialized variables
+ Remove effectively dead code from text_to_guid()
+ Remove unnecessary explicit definitions or overrides of make
variables
- refresh efivar-suse-build.patch
-------------------------------------------------------------------
Mon Nov 4 08:05:05 UTC 2013 - glin@suse.com
- Initial import 0.7

97
efivar.spec Normal file
View File

@ -0,0 +1,97 @@
#
# spec file for package efivar
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define major 1
Name: efivar
Version: 38
Release: 0
Summary: Tools to manage UEFI variables
License: LGPL-2.1-only
Group: Development/Libraries/C and C++
URL: https://github.com/rhinstaller/efivar
Source: https://github.com/rhinstaller/%{name}/releases/download/%{version}/%{name}-%{version}.tar.bz2
Patch0: libefiboot-export-disk_get_partition_info.patch
Patch1: efivar-bsc1202209-fix-glibc-2.36-build.patch
Patch2: efivar-adjust-dependency.patch
Patch3: efivar-filter-gcc-march.patch
Patch4: efivar-bsc1206388-revamp-efi_well_known-variable-handling.patch
BuildRequires: fdupes
BuildRequires: mandoc
BuildRequires: pkgconfig
BuildRequires: pkgconfig(popt)
Requires: libefivar%{major} = %{version}-%{release}
%description
efivar provides a simple command line interface to the UEFI variable facility.
%package -n libefivar%{major}
Summary: Library to manage UEFI variables
Group: System/Libraries
%description -n libefivar%{major}
Library to allow for the simple manipulation of UEFI variables.
%package devel
Summary: Development headers for libefivar
Group: Development/Libraries/C and C++
Requires: libefivar%{major} = %{version}-%{release}
%description devel
Development headers required to use libefivar.
%prep
%autosetup -p1
%build
CFLAGS="%{optflags} -Wno-nonnull -flto"
%ifarch ia64
CFLAGS="${CFLAGS//-fstack-protector/}"
%endif
export CFLAGS
export LDFLAGS="-flto-partition=one"
%make_build
%install
%make_install \
libdir=%{_libdir} \
bindir=%{_bindir}
%fdupes -s %{buildroot}
# fail on undercover ABI changes
file %{buildroot}/%{_libdir}/lib%{name}.so.%{major}*
%ldconfig_scriptlets -n libefivar%{major}
%files
%license COPYING
%{_bindir}/efivar
%{_bindir}/efisecdb
%{_mandir}/man1/*
%files devel
%{_mandir}/man3/*
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%files -n libefivar%{major}
%{_libdir}/*.so.*
%changelog

View File

@ -0,0 +1,98 @@
Index: efivar-38/src/disk.c
===================================================================
--- efivar-38.orig/src/disk.c
+++ efivar-38/src/disk.c
@@ -239,6 +239,34 @@ is_partitioned(int fd)
return true;
}
+/*
+ * efi_disk_get_partition_info()
+ * @fd - open file descriptor to disk
+ * @part - partition number (1 is first partition on the disk)
+ * @start - partition starting sector returned
+ * @size - partition size (in sectors) returned
+ * @signature - partition signature returned
+ * @mbr_type - partition type returned
+ * @signature_type - signature type returned
+ *
+ * Description: Finds partition table info for given partition on given disk.
+ * Both GPT and MSDOS partition tables are tested for.
+ * Returns 0 on success, non-zero on failure
+ */
+int
+__attribute__((__nonnull__ (3,4,5,6,7)))
+__attribute__((__visibility__ ("default")))
+efi_disk_get_partition_info (int fd,
+ uint32_t part,
+ uint64_t *start, uint64_t *size,
+ uint8_t *signature,
+ uint8_t *mbr_type, uint8_t *signature_type)
+{
+ return get_partition_info(fd, EFIBOOT_OPTIONS_IGNORE_PMBR_ERR, part,
+ start, size, (partition_signature_t *)signature, mbr_type,
+ signature_type);
+}
+
ssize_t HIDDEN
make_hd_dn(uint8_t *buf, ssize_t size, int fd, int32_t partition,
uint32_t options)
Index: efivar-38/src/include/efivar/efiboot-disk.h
===================================================================
--- /dev/null
+++ efivar-38/src/include/efivar/efiboot-disk.h
@@ -0,0 +1,32 @@
+/*
+ * libefiboot - library for the manipulation of EFI boot variables
+ * Copyright 2012-2015 Red Hat, Inc.
+ * Copyright (C) 2001 Dell Computer Corporation <Matt_Domsch@dell.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+#ifndef _EFIBOOT_BOOT_H
+#define _EFIBOOT_BOOT_H 1
+
+extern int efi_disk_get_partition_info (int fd,
+ uint32_t part,
+ uint64_t *start, uint64_t *size,
+ uint8_t *signature,
+ uint8_t *mbr_type, uint8_t *signature_type)
+ __attribute__((__nonnull__ (3,4,5,6,7)))
+ __attribute__((__visibility__ ("default")));
+
+#endif /* _EFIBOOT_BOOT_H */
Index: efivar-38/src/include/efivar/efiboot.h
===================================================================
--- efivar-38.orig/src/include/efivar/efiboot.h
+++ efivar-38/src/include/efivar/efiboot.h
@@ -20,6 +20,7 @@
#include <efivar/efiboot-creator.h>
#include <efivar/efiboot-loadopt.h>
+#include <efivar/efiboot-disk.h>
extern uint32_t efi_get_libefiboot_version(void)
__attribute__((__visibility__("default")));
Index: efivar-38/src/libefiboot.map.in
===================================================================
--- efivar-38.orig/src/libefiboot.map.in
+++ efivar-38/src/libefiboot.map.in
@@ -36,4 +36,5 @@ LIBEFIBOOT_1.30 {
LIBEFIBOOT_1.31 {
global: efi_get_libefiboot_version;
+ efi_disk_get_partition_info;
} LIBEFIBOOT_1.30;