mirror of
https://git.yoctoproject.org/poky
synced 2026-02-14 20:53:03 +01:00
efivar: Upgrade to tip of trunk
Drop all the patches accepted upstream
Additional important changes it fixes build with lld linker
Following changes are brought over from trunk
* 90e88b2 Allow -a to create a non-existent variable
* 9306e0b Allow passing of hex values to -A
* 328f584 Allow overriding PKG_CONFIG
* cfd686d Revamp efi_well_known_* variable handling
* 914c686 Use off_t instead of off64_t
* dd901c1 Fix IPv4 and IPv6 Device Path printing
* c4138d0 efidp_ipv6_addr: fix gateway size
* bfe9a6b format_ipv6_addr_helper(): fix bad port-printing conditional
* 7c39722 format_ipv6_addr_helper: fix dp_type usage
* 9a5e710 File device paths: don't print "File(" or ")"
* bc65d63 Fix glibc 2.36 build (mount.h conflicts)
* 1f24726 LLD: fix detection and remove not needed workarounds
* 01de743 Set LC_ALL=C to force English output from ld
* 26ad685 Adjust dependency for libefivar and libefiboot objects
* ca48d39 src/Makefile: build util.c separately for makeguids
* b23aba1 Remove deprecated --add-needed linker flag
* 6be2cb1 Fix invalid free in main()
* df09b47 efisecdb: do not free optarg
* cece3ff efisecdb: fix build with musl libc
* aab4e9b Fix the -march issue for riscv64
* 15622b7 Avoid format error on i686
* 28789d1 Add `extern "C"` to headers for easier use by C++
* 197a087 Add -T workaround for GNU ld 2.36
(From OE-Core rev: 4df808c616f847d90203582fd950a49bb8360dd0)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
From 7b0e7ba674321ec1ddd6b9cbb419e5fb44f88bb3 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
|
||||
|
||||
Upstream-Status: Backport [https://github.com/rhboot/efivar/commit/bc65d63ebf8fe6ac8a099ff15ca200986dba1565]
|
||||
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.37.1
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
From 085f027e9e9f1478f68ddda705f83b244ee3bd88 Mon Sep 17 00:00:00 2001
|
||||
From: Robbie Harwood <rharwood@redhat.com>
|
||||
Date: Mon, 18 Apr 2022 13:08:18 -0400
|
||||
Subject: [PATCH] Fix invalid free in main()
|
||||
|
||||
data is allocated by mmap() in prepare_data().
|
||||
|
||||
Resolves: #173
|
||||
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
||||
Upstream-Status: Backport
|
||||
Link: https://github.com/rhboot/efivar/commit/6be2cb1c0139ac177e754b0767abf1ca1533847f
|
||||
Signed-off-by: Grygorii Tertychnyi <grygorii.tertychnyi@leica-geosystems.com>
|
||||
|
||||
---
|
||||
src/efivar.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/efivar.c b/src/efivar.c
|
||||
index 5cd1eb2bc73c..09f85edd0a38 100644
|
||||
--- a/src/efivar.c
|
||||
+++ b/src/efivar.c
|
||||
@@ -633,7 +633,7 @@ int main(int argc, char *argv[])
|
||||
if (sz < 0)
|
||||
err(1, "Could not import data from \"%s\"", infile);
|
||||
|
||||
- free(data);
|
||||
+ munmap(data, data_size);
|
||||
data = NULL;
|
||||
data_size = 0;
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
From 1eb0fa531301a5045af1b020fc093c4fcfd38680 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Wed, 14 Dec 2022 16:55:51 -0800
|
||||
Subject: [PATCH] Use off_t instead of off64_t
|
||||
|
||||
Pass _FILE_OFFSET_BITS=64 to ensure 64bit off_t
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/rhboot/efivar/pull/237]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
src/error.c | 2 +-
|
||||
src/include/defaults.mk | 1 +
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/error.c b/src/error.c
|
||||
index fcbba0d..9530e22 100644
|
||||
--- a/src/error.c
|
||||
+++ b/src/error.c
|
||||
@@ -191,7 +191,7 @@ dbglog_write(void *cookie, const char *buf, size_t size)
|
||||
}
|
||||
|
||||
static int
|
||||
-dbglog_seek(void *cookie UNUSED, off64_t *offset, int whence)
|
||||
+dbglog_seek(void *cookie UNUSED, off_t *offset, int whence)
|
||||
{
|
||||
FILE *log = efi_errlog ? efi_errlog : stderr;
|
||||
int rc;
|
||||
diff --git a/src/include/defaults.mk b/src/include/defaults.mk
|
||||
index 632b155..95be8be 100644
|
||||
--- a/src/include/defaults.mk
|
||||
+++ b/src/include/defaults.mk
|
||||
@@ -34,6 +34,7 @@ CPPFLAGS ?=
|
||||
override _CPPFLAGS := $(CPPFLAGS)
|
||||
override CPPFLAGS = $(_CPPFLAGS) -DLIBEFIVAR_VERSION=$(VERSION) \
|
||||
-D_GNU_SOURCE \
|
||||
+ -D_FILE_OFFSET_BITS=64 \
|
||||
-I$(TOPDIR)/src/include/
|
||||
CFLAGS ?= $(OPTIMIZE) $(DEBUGINFO) $(WARNINGS) $(ERRORS)
|
||||
CFLAGS_GCC ?= -specs=$(TOPDIR)/src/include/gcc.specs \
|
||||
@@ -1,38 +0,0 @@
|
||||
From 80f11fcb46f6b52e13501cb323ca1a849c3f6e88 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Kanavin <alex@linutronix.de>
|
||||
Date: Tue, 18 Jan 2022 11:53:41 +0100
|
||||
Subject: [PATCH] src/Makefile: build util.c separately for makeguids
|
||||
|
||||
util.c needs to be built twice when cross-compiling:
|
||||
for the build machine to be able to link with
|
||||
makeguids which then runs during the same build,
|
||||
and then for the actual target.
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/rhboot/efivar/pull/203]
|
||||
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
|
||||
---
|
||||
src/Makefile | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/Makefile b/src/Makefile
|
||||
index 0e423c4..b10051b 100644
|
||||
--- a/src/Makefile
|
||||
+++ b/src/Makefile
|
||||
@@ -28,10 +28,13 @@ EFIVAR_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(EFIVAR_SOURCES)))
|
||||
EFISECDB_SOURCES = efisecdb.c guid-symbols.c secdb-dump.c util.c
|
||||
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_SOURCES = makeguids.c util-makeguids.c
|
||||
MAKEGUIDS_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(MAKEGUIDS_SOURCES)))
|
||||
MAKEGUIDS_OUTPUT = $(GENERATED_SOURCES) guids.lds
|
||||
|
||||
+util-makeguids.c :
|
||||
+ cp util.c util-makeguids.c
|
||||
+
|
||||
ALL_SOURCES=$(LIBEFISEC_SOURCES) $(LIBEFIBOOT_SOURCES) $(LIBEFIVAR_SOURCES) \
|
||||
$(MAKEGUIDS_SOURCES) $(GENERATED_SOURCES) $(EFIVAR_SOURCES) \
|
||||
$(sort $(wildcard include/efivar/*.h))
|
||||
--
|
||||
2.20.1
|
||||
|
||||
@@ -1,184 +0,0 @@
|
||||
From cece3ffd5be2f8641eb694513f2b73e5eb97ffd3 Mon Sep 17 00:00:00 2001
|
||||
From: Natanael Copa <ncopa@alpinelinux.org>
|
||||
Date: Fri, 28 Jan 2022 12:13:30 +0100
|
||||
Subject: [PATCH] efisecdb: fix build with musl libc
|
||||
|
||||
Refactor code to use POSIX atexit(3) instead of the GNU specific
|
||||
on_exit(3).
|
||||
|
||||
Resolves: #197
|
||||
Resolves: #202
|
||||
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
|
||||
|
||||
Upstream-Status: Backport
|
||||
https://github.com/rhboot/efivar/commit/cece3ffd5be2f8641eb694513f2b73e5eb97ffd3
|
||||
|
||||
Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com>
|
||||
---
|
||||
src/compiler.h | 2 --
|
||||
src/efisecdb.c | 68 +++++++++++++++++++-------------------------------
|
||||
2 files changed, 26 insertions(+), 44 deletions(-)
|
||||
|
||||
diff --git a/src/compiler.h b/src/compiler.h
|
||||
index e2f18f0b..d95fb014 100644
|
||||
--- a/src/compiler.h
|
||||
+++ b/src/compiler.h
|
||||
@@ -7,8 +7,6 @@
|
||||
#ifndef COMPILER_H_
|
||||
#define COMPILER_H_
|
||||
|
||||
-#include <sys/cdefs.h>
|
||||
-
|
||||
/* GCC version checking borrowed from glibc. */
|
||||
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
|
||||
# define GNUC_PREREQ(maj,min) \
|
||||
diff --git a/src/efisecdb.c b/src/efisecdb.c
|
||||
index f8823737..6bd5ad90 100644
|
||||
--- a/src/efisecdb.c
|
||||
+++ b/src/efisecdb.c
|
||||
@@ -25,6 +25,10 @@
|
||||
extern char *optarg;
|
||||
extern int optind, opterr, optopt;
|
||||
|
||||
+static efi_secdb_t *secdb = NULL;
|
||||
+static list_t infiles;
|
||||
+static list_t actions;
|
||||
+
|
||||
struct hash_param {
|
||||
char *name;
|
||||
efi_secdb_type_t algorithm;
|
||||
@@ -187,12 +191,11 @@ add_action(list_t *list, action_type_t action_type, const efi_guid_t *owner,
|
||||
}
|
||||
|
||||
static void
|
||||
-free_actions(int status UNUSED, void *actionsp)
|
||||
+free_actions(void)
|
||||
{
|
||||
- list_t *actions = (list_t *)actionsp;
|
||||
list_t *pos, *tmp;
|
||||
|
||||
- for_each_action_safe(pos, tmp, actions) {
|
||||
+ for_each_action_safe(pos, tmp, &actions) {
|
||||
action_t *action = list_entry(pos, action_t, list);
|
||||
|
||||
list_del(&action->list);
|
||||
@@ -202,12 +205,11 @@ free_actions(int status UNUSED, void *actionsp)
|
||||
}
|
||||
|
||||
static void
|
||||
-free_infiles(int status UNUSED, void *infilesp)
|
||||
+free_infiles(void)
|
||||
{
|
||||
- list_t *infiles = (list_t *)infilesp;
|
||||
list_t *pos, *tmp;
|
||||
|
||||
- for_each_ptr_safe(pos, tmp, infiles) {
|
||||
+ for_each_ptr_safe(pos, tmp, &infiles) {
|
||||
ptrlist_t *entry = list_entry(pos, ptrlist_t, list);
|
||||
|
||||
list_del(&entry->list);
|
||||
@@ -216,27 +218,12 @@ free_infiles(int status UNUSED, void *infilesp)
|
||||
}
|
||||
|
||||
static void
|
||||
-maybe_free_secdb(int status UNUSED, void *voidp)
|
||||
+maybe_free_secdb(void)
|
||||
{
|
||||
- efi_secdb_t **secdbp = (efi_secdb_t **)voidp;
|
||||
-
|
||||
- if (secdbp == NULL || *secdbp == NULL)
|
||||
+ if (secdb == NULL)
|
||||
return;
|
||||
|
||||
- efi_secdb_free(*secdbp);
|
||||
-}
|
||||
-
|
||||
-static void
|
||||
-maybe_do_unlink(int status, void *filep)
|
||||
-{
|
||||
- char **file = (char **)filep;
|
||||
-
|
||||
- if (status == 0)
|
||||
- return;
|
||||
- if (file == NULL || *file == NULL)
|
||||
- return;
|
||||
-
|
||||
- unlink(*file);
|
||||
+ efi_secdb_free(secdb);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -323,15 +310,6 @@ parse_input_files(list_t *infiles, char **outfile, efi_secdb_t **secdb,
|
||||
return status;
|
||||
}
|
||||
|
||||
-/*
|
||||
- * These need to be static globals so that they're not on main's stack when
|
||||
- * on_exit() fires.
|
||||
- */
|
||||
-static efi_secdb_t *secdb = NULL;
|
||||
-static list_t infiles;
|
||||
-static list_t actions;
|
||||
-static char *outfile = NULL;
|
||||
-
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
@@ -351,6 +329,7 @@ main(int argc, char *argv[])
|
||||
bool do_sort_data = false;
|
||||
bool sort_descending = false;
|
||||
int status = 0;
|
||||
+ char *outfile = NULL;
|
||||
|
||||
const char sopts[] = ":aAc:dfg:h:i:Lo:rs:t:v?";
|
||||
const struct option lopts[] = {
|
||||
@@ -376,10 +355,9 @@ main(int argc, char *argv[])
|
||||
INIT_LIST_HEAD(&infiles);
|
||||
INIT_LIST_HEAD(&actions);
|
||||
|
||||
- on_exit(free_actions, &actions);
|
||||
- on_exit(free_infiles, &infiles);
|
||||
- on_exit(maybe_free_secdb, &secdb);
|
||||
- on_exit(maybe_do_unlink, &outfile);
|
||||
+ atexit(free_actions);
|
||||
+ atexit(free_infiles);
|
||||
+ atexit(maybe_free_secdb);
|
||||
|
||||
/*
|
||||
* parse the command line.
|
||||
@@ -587,24 +565,30 @@ main(int argc, char *argv[])
|
||||
outfd = open(outfile, flags, 0600);
|
||||
if (outfd < 0) {
|
||||
char *tmpoutfile = outfile;
|
||||
- if (errno == EEXIST)
|
||||
- outfile = NULL;
|
||||
+ if (errno != EEXIST)
|
||||
+ unlink(outfile);
|
||||
err(1, "could not open \"%s\"", tmpoutfile);
|
||||
}
|
||||
|
||||
rc = ftruncate(outfd, 0);
|
||||
- if (rc < 0)
|
||||
+ if (rc < 0) {
|
||||
+ unlink(outfile);
|
||||
err(1, "could not truncate output file \"%s\"", outfile);
|
||||
+ }
|
||||
|
||||
void *output;
|
||||
size_t size = 0;
|
||||
rc = efi_secdb_realize(secdb, &output, &size);
|
||||
- if (rc < 0)
|
||||
+ if (rc < 0) {
|
||||
+ unlink(outfile);
|
||||
secdb_err(1, "could not realize signature list");
|
||||
+ }
|
||||
|
||||
rc = write(outfd, output, size);
|
||||
- if (rc < 0)
|
||||
+ if (rc < 0) {
|
||||
+ unlink(outfile);
|
||||
err(1, "could not write signature list");
|
||||
+ }
|
||||
|
||||
close(outfd);
|
||||
xfree(output);
|
||||
@@ -9,13 +9,9 @@ COMPATIBLE_HOST = "(i.86|x86_64|arm|aarch64).*-linux"
|
||||
|
||||
SRC_URI = "git://github.com/rhinstaller/efivar.git;branch=main;protocol=https \
|
||||
file://0001-docs-do-not-build-efisecdb-manpage.patch \
|
||||
file://0001-src-Makefile-build-util.c-separately-for-makeguids.patch \
|
||||
file://efisecdb-fix-build-with-musl-libc.patch \
|
||||
file://0001-Fix-invalid-free-in-main.patch \
|
||||
file://0001-Fix-glibc-2.36-build-mount.h-conflicts.patch \
|
||||
file://0001-Use-off_t-instead-of-off64_t.patch \
|
||||
"
|
||||
SRCREV = "1753149d4176ebfb2b135ac0aaf79340bf0e7a93"
|
||||
SRCREV = "90e88b221e8bc60dc50f3246051369b8f580c0d0"
|
||||
PV .= "+39+git${SRCPV}"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user