Accepting request 909947 from home:polslinux:branches:Base:System
- Update to v17: * use efivar's logging facility more (more info in -v2 , -v3, etc) * Various bug fixes * Better -e parsing * fix pkg-config invocation for ldflags * Make efibootmgr use EFIDIR / efibootmgr.efidir like fwupdate does * make --loader default build-time configurable * sanitize set_mirror()/get_mirror() * Add support for parsing loader options as UCS2 * GCC 7 fixes * Don't use -fshort-wchar since we don't run on EFI machines. - Drop 0001-Don-t-use-fshort-wchar-when-building-63.patch (upstreamed) - Drop 0002-Remove-extra-const-keywords-gcc-7-gripes-about.patch (upstreamed) - Drop 0003-Add-support-for-parsing-optional-data-as-ucs2.patch (upstreamed) - Drop MARM-sanitize-set_mirror.diff (upstreamed) - Drop efibootmgr-derhat.diff (upstreamed) - Rebase efibootmgr-delete-multiple.diff OBS-URL: https://build.opensuse.org/request/show/909947 OBS-URL: https://build.opensuse.org/package/show/Base:System/efibootmgr?expand=0&rev=44
This commit is contained in:
parent
e26f183263
commit
18a994ad57
@ -1,29 +0,0 @@
|
||||
From 3466fd05c8c6f1052e0426d64eed40f8a88fd78f Mon Sep 17 00:00:00 2001
|
||||
From: steve-mcintyre <steve-github@einval.com>
|
||||
Date: Fri, 6 Jan 2017 18:18:47 +0000
|
||||
Subject: [PATCH 1/4] Don't use -fshort-wchar when building (#63)
|
||||
|
||||
It's not needed and is causing build failures with gcc 6. Closes
|
||||
Debian bug #849651
|
||||
|
||||
Signed-off-by: Steve McIntyre <steve@einval.com>
|
||||
---
|
||||
Make.defaults | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Make.defaults b/Make.defaults
|
||||
index 50f1f4d..0ac50ef 100644
|
||||
--- a/Make.defaults
|
||||
+++ b/Make.defaults
|
||||
@@ -26,7 +26,7 @@ clang_cflags =
|
||||
gcc_cflags =
|
||||
cflags = $(CFLAGS) $(SUBDIR_CFLAGS) \
|
||||
-Werror -Wall -Wextra -Wsign-compare -Wstrict-aliasing \
|
||||
- -std=gnu11 -fshort-wchar -fPIC \
|
||||
+ -std=gnu11 -fPIC \
|
||||
-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DLOCALEDIR=\"$(localedir)\" \
|
||||
-DEFIBOOTMGR_VERSION="\"$(VERSION)\"" \
|
||||
$(if $(findstring clang,$(CC)),$(clang_cflags),) \
|
||||
--
|
||||
2.6.6
|
||||
|
@ -1,49 +0,0 @@
|
||||
From 3217ab97776a6493099014f9a4820cbd39f1393a Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 6 Feb 2017 16:34:54 -0500
|
||||
Subject: [PATCH 2/4] Remove extra const keywords gcc 7 gripes about.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
src/efibootdump.c | 2 +-
|
||||
src/efibootmgr.c | 4 ++--
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/efibootdump.c b/src/efibootdump.c
|
||||
index 6ff8360..30a1943 100644
|
||||
--- a/src/efibootdump.c
|
||||
+++ b/src/efibootdump.c
|
||||
@@ -39,7 +39,7 @@ print_boot_entry(efi_load_option *loadopt, size_t data_size)
|
||||
uint8_t *optional_data = NULL;
|
||||
size_t optional_data_len = 0;
|
||||
uint16_t pathlen;
|
||||
- const unsigned char const *desc;
|
||||
+ const unsigned char *desc;
|
||||
char *raw;
|
||||
size_t raw_len;
|
||||
|
||||
diff --git a/src/efibootmgr.c b/src/efibootmgr.c
|
||||
index 493f2cf..90a0998 100644
|
||||
--- a/src/efibootmgr.c
|
||||
+++ b/src/efibootmgr.c
|
||||
@@ -221,7 +221,7 @@ warn_duplicate_name(list_t *var_list)
|
||||
list_t *pos;
|
||||
var_entry_t *entry;
|
||||
efi_load_option *load_option;
|
||||
- const unsigned char const *desc;
|
||||
+ const unsigned char *desc;
|
||||
|
||||
list_for_each(pos, var_list) {
|
||||
entry = list_entry(pos, var_entry_t, list);
|
||||
@@ -873,7 +873,7 @@ show_vars(const char *prefix)
|
||||
{
|
||||
list_t *pos;
|
||||
var_entry_t *boot;
|
||||
- const unsigned char const *description;
|
||||
+ const unsigned char *description;
|
||||
efi_load_option *load_option;
|
||||
efidp dp = NULL;
|
||||
unsigned char *optional_data = NULL;
|
||||
--
|
||||
2.6.6
|
||||
|
@ -1,113 +0,0 @@
|
||||
From c444d8c19de7ea28a0eb4ac4639d6d99d982ca31 Mon Sep 17 00:00:00 2001
|
||||
From: "Martin T. H. Sandsmark" <martin.sandsmark@kde.org>
|
||||
Date: Fri, 30 Dec 2016 14:33:27 +0100
|
||||
Subject: [PATCH 3/4] Add support for parsing optional data as ucs2
|
||||
|
||||
---
|
||||
src/efibootmgr.8 | 2 +-
|
||||
src/efibootmgr.c | 62 +++++++++++++++++++++++++++++++++++++++++++-------------
|
||||
2 files changed, 49 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/efibootmgr.8 b/src/efibootmgr.8
|
||||
index 9208608..20a20b8 100644
|
||||
--- a/src/efibootmgr.8
|
||||
+++ b/src/efibootmgr.8
|
||||
@@ -106,7 +106,7 @@ Boot Manager timeout, in \fIseconds\fR\&.
|
||||
Delete Timeout variable.
|
||||
.TP
|
||||
\fB-u | --unicode | --UCS-2 \fR
|
||||
-pass extra command line arguments as UCS-2 (default is
|
||||
+Handle extra command line arguments as UCS-2 (default is
|
||||
ASCII)
|
||||
.TP
|
||||
\fB-v | --verbose\fR
|
||||
diff --git a/src/efibootmgr.c b/src/efibootmgr.c
|
||||
index 90a0998..20d71e2 100644
|
||||
--- a/src/efibootmgr.c
|
||||
+++ b/src/efibootmgr.c
|
||||
@@ -868,6 +868,36 @@ err:
|
||||
return rc;
|
||||
}
|
||||
|
||||
+#define ev_bits(val, mask, shift) \
|
||||
+ (((val) & ((mask) << (shift))) >> (shift))
|
||||
+
|
||||
+static inline char *
|
||||
+ucs2_to_utf8(const uint16_t * const chars, ssize_t limit)
|
||||
+{
|
||||
+ ssize_t i, j;
|
||||
+ char *ret;
|
||||
+
|
||||
+ ret = alloca(limit * 6 + 1);
|
||||
+ if (!ret)
|
||||
+ return NULL;
|
||||
+ memset(ret, 0, limit * 6 +1);
|
||||
+
|
||||
+ for (i=0, j=0; chars[i] && i < (limit >= 0 ? limit : i+1); i++,j++) {
|
||||
+ if (chars[i] <= 0x7f) {
|
||||
+ ret[j] = chars[i];
|
||||
+ } else if (chars[i] > 0x7f && chars[i] <= 0x7ff) {
|
||||
+ ret[j++] = 0xc0 | ev_bits(chars[i], 0x1f, 6);
|
||||
+ ret[j] = 0x80 | ev_bits(chars[i], 0x3f, 0);
|
||||
+ } else if (chars[i] > 0x7ff) {
|
||||
+ ret[j++] = 0xe0 | ev_bits(chars[i], 0xf, 12);
|
||||
+ ret[j++] = 0x80 | ev_bits(chars[i], 0x3f, 6);
|
||||
+ ret[j] = 0x80| ev_bits(chars[i], 0x3f, 0);
|
||||
+ }
|
||||
+ }
|
||||
+ ret[j] = '\0';
|
||||
+ return strdup(ret);
|
||||
+}
|
||||
+
|
||||
static void
|
||||
show_vars(const char *prefix)
|
||||
{
|
||||
@@ -928,19 +958,23 @@ show_vars(const char *prefix)
|
||||
if (rc < 0)
|
||||
error(21, "Could not parse optional data");
|
||||
|
||||
- rc = unparse_raw_text(NULL, 0, optional_data,
|
||||
- optional_data_len);
|
||||
- if (rc < 0)
|
||||
- error(22, "Could not parse optional data");
|
||||
- rc += 1;
|
||||
- text_path_len = rc;
|
||||
- text_path = calloc(1, rc);
|
||||
- if (!text_path)
|
||||
- error(23, "Could not parse optional data");
|
||||
- rc = unparse_raw_text(text_path, text_path_len,
|
||||
- optional_data, optional_data_len);
|
||||
- if (rc < 0)
|
||||
- error(24, "Could not parse device path");
|
||||
+ if (opts.unicode) {
|
||||
+ text_path = ucs2_to_utf8((uint16_t*)optional_data, optional_data_len/2);
|
||||
+ } else {
|
||||
+ rc = unparse_raw_text(NULL, 0, optional_data,
|
||||
+ optional_data_len);
|
||||
+ if (rc < 0)
|
||||
+ error(22, "Could not parse optional data");
|
||||
+ rc += 1;
|
||||
+ text_path_len = rc;
|
||||
+ text_path = calloc(1, rc);
|
||||
+ if (!text_path)
|
||||
+ error(23, "Could not parse optional data");
|
||||
+ rc = unparse_raw_text(text_path, text_path_len,
|
||||
+ optional_data, optional_data_len);
|
||||
+ if (rc < 0)
|
||||
+ error(24, "Could not parse device path");
|
||||
+ }
|
||||
printf("%s", text_path);
|
||||
free(text_path);
|
||||
}
|
||||
@@ -1211,7 +1245,7 @@ usage()
|
||||
printf("\t-q | --quiet be quiet\n");
|
||||
printf("\t-t | --timeout seconds set boot manager timeout waiting for user input.\n");
|
||||
printf("\t-T | --delete-timeout delete Timeout.\n");
|
||||
- printf("\t-u | --unicode | --UCS-2 pass extra args as UCS-2 (default is ASCII)\n");
|
||||
+ printf("\t-u | --unicode | --UCS-2 handle extra args as UCS-2 (default is ASCII)\n");
|
||||
printf("\t-v | --verbose print additional information\n");
|
||||
printf("\t-V | --version return version and exit\n");
|
||||
printf("\t-w | --write-signature write unique sig to MBR if needed\n");
|
||||
--
|
||||
2.6.6
|
||||
|
@ -1,84 +0,0 @@
|
||||
From d89633f608177283e9ae0f16c7065768e64da0ca Mon Sep 17 00:00:00 2001
|
||||
From: Raymund Will <rw@suse.com>
|
||||
Date: Mon, 13 Feb 2017 15:33:52 +0100
|
||||
Subject: [PATCH] efibootmgr: sanitize `set/get_mirror()`
|
||||
References: bsc#987599
|
||||
|
||||
get_mirror()
|
||||
- don't short-circuit the assignment of values in case of version mismatch
|
||||
as `show_mirror()` happily tries to use them nevertheless
|
||||
- move redundant warning (from `show_mirror()`s PoV) to `set_mirror()`
|
||||
- add missing `free(data)`
|
||||
|
||||
set_mirror()
|
||||
- skip obsolete second assignment of `data`
|
||||
- avoid potentially "uninitialized" access to `above/below4g` by protecting
|
||||
it with `opts.set_mirror_hi/_lo` respectively, thus simplifying the code
|
||||
down the line
|
||||
Note: this will prevent unnecessary write-operations!
|
||||
|
||||
Signed-off-by: Raymund Will <rw@suse.com>
|
||||
---
|
||||
src/efibootmgr.c | 25 +++++++++++++++----------
|
||||
1 file changed, 15 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/efibootmgr.c b/src/efibootmgr.c
|
||||
index 20d71e2..15659c6 100644
|
||||
--- a/src/efibootmgr.c
|
||||
+++ b/src/efibootmgr.c
|
||||
@@ -1106,12 +1106,12 @@ get_mirror(int which, int *below4g, int *above4g, int *mirrorstatus)
|
||||
if (rc == 0) {
|
||||
abm = (ADDRESS_RANGE_MIRROR_VARIABLE_DATA *)data;
|
||||
if (!which && abm->mirror_version != MIRROR_VERSION) {
|
||||
- warningx("** Warning ** : unrecognised version for memory mirror i/f");
|
||||
- return 2;
|
||||
+ rc = 2;
|
||||
}
|
||||
*below4g = abm->mirror_memory_below_4gb;
|
||||
*above4g = abm->mirror_amount_above_4gb;
|
||||
*mirrorstatus = abm->mirror_status;
|
||||
+ free(data);
|
||||
} else {
|
||||
cond_warning(opts.verbose >= 2,
|
||||
"Could not read variable '%s'", name);
|
||||
@@ -1130,14 +1130,19 @@ set_mirror(int below4g, int above4g)
|
||||
uint32_t attributes;
|
||||
int oldbelow4g, oldabove4g;
|
||||
|
||||
- if ((s = get_mirror(0, &oldbelow4g, &oldabove4g, &status)) == 0) {
|
||||
- if (oldbelow4g == below4g && oldabove4g == above4g)
|
||||
- return 0;
|
||||
- } else {
|
||||
- warningx("** Warning ** : platform does not support memory mirror");
|
||||
+ if ((s = get_mirror(0, &oldbelow4g, &oldabove4g, &status)) != 0) {
|
||||
+ if (s == 2)
|
||||
+ warningx("** Warning ** : unrecognised version for memory mirror i/f");
|
||||
+ else
|
||||
+ warningx("** Warning ** : platform does not support memory mirror");
|
||||
return s;
|
||||
}
|
||||
|
||||
+ below4g = opts.set_mirror_lo ? below4g : oldbelow4g;
|
||||
+ above4g = opts.set_mirror_hi ? above4g : oldabove4g;
|
||||
+ if (oldbelow4g == below4g && oldabove4g == above4g)
|
||||
+ return 0;
|
||||
+
|
||||
data = (uint8_t *)&abm;
|
||||
data_size = sizeof (abm);
|
||||
attributes = EFI_VARIABLE_NON_VOLATILE
|
||||
@@ -1145,10 +1151,9 @@ set_mirror(int below4g, int above4g)
|
||||
| EFI_VARIABLE_RUNTIME_ACCESS;
|
||||
|
||||
abm.mirror_version = MIRROR_VERSION;
|
||||
- abm.mirror_amount_above_4gb = opts.set_mirror_hi ? above4g : oldabove4g;
|
||||
- abm.mirror_memory_below_4gb = opts.set_mirror_lo ? below4g : oldbelow4g;
|
||||
+ abm.mirror_amount_above_4gb = above4g;
|
||||
+ abm.mirror_memory_below_4gb = below4g;
|
||||
abm.mirror_status = 0;
|
||||
- data = (uint8_t *)&abm;
|
||||
rc = efi_set_variable(ADDRESS_RANGE_MIRROR_VARIABLE_GUID,
|
||||
ADDRESS_RANGE_MIRROR_VARIABLE_REQUEST, data,
|
||||
data_size, attributes, 0644);
|
||||
--
|
||||
2.6.6
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:377ec16484414b80afd1b8a586153d7ef55ccf048638080101d49b7c77f37ad8
|
||||
size 34972
|
3
efibootmgr-17.tar.gz
Normal file
3
efibootmgr-17.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:22a95ebe0d5c9fb2915b3a100450f8f37484d1dbb8b296f55b343cc84f10397d
|
||||
size 41643
|
@ -13,15 +13,10 @@ This does unfortunately require an API-change of efivar!
|
||||
|
||||
Signed-off-by: Raymund Will <rw@suse.com>
|
||||
---
|
||||
src/efibootmgr.c | 187 ++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
src/include/efibootmgr.h | 3 +-
|
||||
2 files changed, 185 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/efibootmgr.c b/src/efibootmgr.c
|
||||
index 20d71e2..93663cb 100644
|
||||
--- a/src/efibootmgr.c
|
||||
+++ b/src/efibootmgr.c
|
||||
@@ -608,6 +608,146 @@ delete_var(const char *prefix, uint16_t num)
|
||||
diff -ru old/src/efibootmgr.c new/src/efibootmgr.c
|
||||
--- old/src/efibootmgr.c 2018-06-10 22:12:10.000000000 +0200
|
||||
+++ new/src/efibootmgr.c 2021-08-03 11:57:25.435196489 +0200
|
||||
@@ -617,6 +617,146 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -168,7 +163,7 @@ index 20d71e2..93663cb 100644
|
||||
static void
|
||||
set_var_nums(const char *prefix, list_t *list)
|
||||
{
|
||||
@@ -1215,7 +1355,9 @@ usage()
|
||||
@@ -1236,7 +1376,9 @@
|
||||
printf("\t-a | --active sets bootnum active\n");
|
||||
printf("\t-A | --inactive sets bootnum inactive\n");
|
||||
printf("\t-b | --bootnum XXXX modify BootXXXX (hex)\n");
|
||||
@ -179,23 +174,23 @@ index 20d71e2..93663cb 100644
|
||||
printf("\t-c | --create create new variable bootnum and add to bootorder\n");
|
||||
printf("\t-C | --create-only create new variable bootnum and do not add to bootorder\n");
|
||||
printf("\t-D | --remove-dups remove duplicate values from BootOrder\n");
|
||||
@@ -1242,6 +1384,7 @@ usage()
|
||||
@@ -1263,6 +1405,7 @@
|
||||
printf("\t-o | --bootorder XXXX,YYYY,ZZZZ,... explicitly set BootOrder (hex)\n");
|
||||
printf("\t-O | --delete-bootorder delete BootOrder\n");
|
||||
printf("\t-p | --part part (defaults to 1) containing loader\n");
|
||||
+ printf("\t-P | --part-uuid UUID select all variables for given partition UUID\n");
|
||||
printf("\t-p | --part part partition containing loader (defaults to 1 on partitioned devices)\n");
|
||||
+ printf("\t-P | --part-uuid UUID select all variables for given partition UUID\n");
|
||||
printf("\t-q | --quiet be quiet\n");
|
||||
printf("\t-t | --timeout seconds set boot manager timeout waiting for user input.\n");
|
||||
printf("\t-T | --delete-timeout delete Timeout.\n");
|
||||
@@ -1267,6 +1410,7 @@ set_default_opts()
|
||||
@@ -1288,6 +1431,7 @@
|
||||
opts.label = (unsigned char *)"Linux";
|
||||
opts.disk = "/dev/sda";
|
||||
opts.part = 1;
|
||||
+ opts.part_uuid = NULL;
|
||||
opts.part = -1;
|
||||
+ opts.part_uuid = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1288,6 +1432,7 @@ parse_opts(int argc, char **argv)
|
||||
@@ -1310,6 +1454,7 @@
|
||||
{"delete-bootnum", no_argument, 0, 'B'},
|
||||
{"create", no_argument, 0, 'c'},
|
||||
{"create-only", no_argument, 0, 'C'},
|
||||
@ -203,7 +198,7 @@ index 20d71e2..93663cb 100644
|
||||
{"remove-dups", no_argument, 0, 'D'},
|
||||
{"disk", required_argument, 0, 'd'},
|
||||
{"iface", required_argument, 0, 'i'},
|
||||
@@ -1320,7 +1465,7 @@ parse_opts(int argc, char **argv)
|
||||
@@ -1342,7 +1487,7 @@
|
||||
};
|
||||
|
||||
c = getopt_long (argc, argv,
|
||||
@ -212,7 +207,7 @@ index 20d71e2..93663cb 100644
|
||||
"@:hry",
|
||||
long_options, &option_index);
|
||||
if (c == -1)
|
||||
@@ -1368,11 +1513,16 @@ parse_opts(int argc, char **argv)
|
||||
@@ -1390,11 +1535,16 @@
|
||||
opts.create = 1;
|
||||
opts.no_order = 1;
|
||||
break;
|
||||
@ -228,8 +223,8 @@ index 20d71e2..93663cb 100644
|
||||
+ opts.delete |= 2;
|
||||
break;
|
||||
case 'e':
|
||||
rc = sscanf(optarg, "%u", &num);
|
||||
@@ -1410,6 +1560,9 @@ parse_opts(int argc, char **argv)
|
||||
rc = sscanf(optarg, "%d", &snum);
|
||||
@@ -1434,6 +1584,9 @@
|
||||
break;
|
||||
case 'l':
|
||||
opts.loader = optarg;
|
||||
@ -239,7 +234,7 @@ index 20d71e2..93663cb 100644
|
||||
break;
|
||||
case 'L':
|
||||
opts.label = (unsigned char *)optarg;
|
||||
@@ -1474,6 +1627,17 @@ parse_opts(int argc, char **argv)
|
||||
@@ -1498,6 +1651,17 @@
|
||||
else
|
||||
errorx(37, "invalid numeric value %s\n",
|
||||
optarg);
|
||||
@ -257,7 +252,7 @@ index 20d71e2..93663cb 100644
|
||||
break;
|
||||
case 'q':
|
||||
opts.quiet = 1;
|
||||
@@ -1595,9 +1759,24 @@ main(int argc, char **argv)
|
||||
@@ -1622,9 +1786,24 @@
|
||||
set_var_nums(prefices[mode], &entry_list);
|
||||
|
||||
if (opts.delete) {
|
||||
@ -284,11 +279,12 @@ index 20d71e2..93663cb 100644
|
||||
else {
|
||||
ret = delete_var(prefices[mode], opts.num);
|
||||
if (ret < 0)
|
||||
diff --git a/src/include/efibootmgr.h b/src/include/efibootmgr.h
|
||||
index d692d0c..d2d90dc 100644
|
||||
--- a/src/include/efibootmgr.h
|
||||
+++ b/src/include/efibootmgr.h
|
||||
@@ -60,6 +60,7 @@ typedef struct {
|
||||
Only in new/src: efibootmgr.c.orig
|
||||
Only in new/src: efibootmgr.c.rej
|
||||
diff -ru old/src/include/efibootmgr.h new/src/include/efibootmgr.h
|
||||
--- old/src/include/efibootmgr.h 2018-06-10 22:12:10.000000000 +0200
|
||||
+++ new/src/include/efibootmgr.h 2021-08-03 11:56:14.638896535 +0200
|
||||
@@ -60,6 +60,7 @@
|
||||
int keep_old_entries;
|
||||
char *testfile;
|
||||
char *extra_opts_file;
|
||||
@ -296,7 +292,7 @@ index d692d0c..d2d90dc 100644
|
||||
uint32_t part;
|
||||
int edd_version;
|
||||
uint32_t edd10_devicenum;
|
||||
@@ -70,7 +71,7 @@ typedef struct {
|
||||
@@ -70,7 +71,7 @@
|
||||
int below4g;
|
||||
int above4g;
|
||||
int deduplicate;
|
||||
@ -305,6 +301,3 @@ index d692d0c..d2d90dc 100644
|
||||
unsigned int delete_order:1;
|
||||
unsigned int delete_bootnext:1;
|
||||
unsigned int quiet:1;
|
||||
--
|
||||
2.6.6
|
||||
|
||||
|
@ -1,83 +0,0 @@
|
||||
From: Raymund Will <rw@suse.com>
|
||||
Subject: Make default '--loader' build-time configurable.
|
||||
|
||||
Each distribution uses a specific 'vendor'-directory in the
|
||||
'efi' directory on the EFI System Partition to store their
|
||||
EFI loader. There's little use in hardcoding the value
|
||||
for just one in 'efibootmgr', which is displayed in '--help'
|
||||
and used as default without '--loader'.
|
||||
|
||||
Simply use
|
||||
make OS_VENDOR=<vendor> EFI_LOADER=<loader>.efi
|
||||
to get the desired value. :)
|
||||
|
||||
Signed-off-by: Raymund Will <rw@suse.com>
|
||||
---
|
||||
Make.defaults | 4 ++++
|
||||
src/efibootmgr.c | 9 +++++----
|
||||
2 files changed, 9 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/Make.defaults b/Make.defaults
|
||||
index 0ac50ef..7ca17e3 100644
|
||||
--- a/Make.defaults
|
||||
+++ b/Make.defaults
|
||||
@@ -9,6 +9,9 @@ localedir ?= $(datadir)/locale/
|
||||
PCDIR ?= $(libdir)/pkgconfig
|
||||
DESTDIR ?=
|
||||
|
||||
+OS_VENDOR := redhat
|
||||
+EFI_LOADER := grub.efi
|
||||
+
|
||||
INSTALL ?= install
|
||||
CROSS_COMPILE ?=
|
||||
PKG_CONFIG = $(CROSS_COMPILE)pkg-config
|
||||
@@ -29,6 +32,7 @@ cflags = $(CFLAGS) $(SUBDIR_CFLAGS) \
|
||||
-std=gnu11 -fPIC \
|
||||
-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DLOCALEDIR=\"$(localedir)\" \
|
||||
-DEFIBOOTMGR_VERSION="\"$(VERSION)\"" \
|
||||
+ -DDEFAULT_LOADER=\"\\\\efi\\\\$(OS_VENDOR)\\\\$(EFI_LOADER)\" \
|
||||
$(if $(findstring clang,$(CC)),$(clang_cflags),) \
|
||||
$(if $(findstring gcc,$(CC)),$(gcc_cflags),) \
|
||||
$(call pkg-config-cflags)
|
||||
diff --git a/src/efibootmgr.c b/src/efibootmgr.c
|
||||
index 20d71e2..825435e 100644
|
||||
--- a/src/efibootmgr.c
|
||||
+++ b/src/efibootmgr.c
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
- efibootmgr.c - Manipulates EFI variables as exported in /proc/efi/vars
|
||||
+ efibootmgr.c - Manipulates EFI variables as exported in /sys/firmware/efi/
|
||||
+ efivars or vars (previously /proc/efi/vars)
|
||||
|
||||
Copyright (C) 2001-2004 Dell, Inc. <Matt_Domsch@dell.com>
|
||||
|
||||
@@ -18,7 +19,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
- This must tie the EFI_DEVICE_PATH to /boot/efi/EFI/redhat/grub.efi
|
||||
+ This must tie the EFI_DEVICE_PATH to /boot/efi/EFI/<vendor>/<loader>.efi
|
||||
The EFI_DEVICE_PATH will look something like:
|
||||
ACPI device path, length 12 bytes
|
||||
Hardware Device Path, PCI, length 6 bytes
|
||||
@@ -1233,7 +1234,7 @@ usage()
|
||||
printf("\t --ip-port <local>,<remote> set local and remote IP ports\n");
|
||||
printf("\t --ip-origin { {dhcp|static} | { static|stateless|stateful} }\n");
|
||||
#endif
|
||||
- printf("\t-l | --loader name (defaults to \\EFI\\redhat\\grub.efi)\n");
|
||||
+ printf("\t-l | --loader name (defaults to \""DEFAULT_LOADER"\")\n");
|
||||
printf("\t-L | --label label Boot manager display label (defaults to \"Linux\")\n");
|
||||
printf("\t-m | --mirror-below-4G t|f mirror memory below 4GB\n");
|
||||
printf("\t-M | --mirror-above-4G X percentage memory to mirror above 4GB\n");
|
||||
@@ -1263,7 +1264,7 @@ set_default_opts()
|
||||
opts.active = -1; /* Don't set it */
|
||||
opts.timeout = -1; /* Don't set it */
|
||||
opts.edd10_devicenum = 0x80;
|
||||
- opts.loader = "\\EFI\\redhat\\grub.efi";
|
||||
+ opts.loader = DEFAULT_LOADER;
|
||||
opts.label = (unsigned char *)"Linux";
|
||||
opts.disk = "/dev/sda";
|
||||
opts.part = 1;
|
||||
--
|
||||
2.6.6
|
||||
|
@ -1,3 +1,26 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Aug 3 10:03:52 UTC 2021 - Paolo Stivanin <info@paolostivanin.com>
|
||||
|
||||
- Update to v17:
|
||||
* use efivar's logging facility more (more info in -v2 , -v3, etc)
|
||||
* Various bug fixes
|
||||
* Better -e parsing
|
||||
* fix pkg-config invocation for ldflags
|
||||
* Make efibootmgr use EFIDIR / efibootmgr.efidir like fwupdate does
|
||||
* make --loader default build-time configurable
|
||||
* sanitize set_mirror()/get_mirror()
|
||||
* Add support for parsing loader options as UCS2
|
||||
* GCC 7 fixes
|
||||
* Don't use -fshort-wchar since we don't run on EFI machines.
|
||||
- Drop 0001-Don-t-use-fshort-wchar-when-building-63.patch (upstreamed)
|
||||
- Drop 0002-Remove-extra-const-keywords-gcc-7-gripes-about.patch
|
||||
(upstreamed)
|
||||
- Drop 0003-Add-support-for-parsing-optional-data-as-ucs2.patch
|
||||
(upstreamed)
|
||||
- Drop MARM-sanitize-set_mirror.diff (upstreamed)
|
||||
- Drop efibootmgr-derhat.diff (upstreamed)
|
||||
- Rebase efibootmgr-delete-multiple.diff
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Apr 3 13:50:11 CEST 2018 - kukuk@suse.de
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package efibootmgr
|
||||
#
|
||||
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2021 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -12,30 +12,25 @@
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
Name: efibootmgr
|
||||
Version: 14
|
||||
Version: 17
|
||||
Release: 0
|
||||
Summary: EFI Boot Manager
|
||||
License: GPL-2.0-or-later
|
||||
Group: System/Boot
|
||||
Url: https://github.com/rhinstaller/efibootmgr
|
||||
Source: https://github.com/rhinstaller/efibootmgr/releases/download/14/efibootmgr-14.tar.bz2
|
||||
Patch1: 0001-Don-t-use-fshort-wchar-when-building-63.patch
|
||||
Patch2: 0002-Remove-extra-const-keywords-gcc-7-gripes-about.patch
|
||||
Patch3: 0003-Add-support-for-parsing-optional-data-as-ucs2.patch
|
||||
Patch4: %{name}-derhat.diff
|
||||
Patch5: MARM-sanitize-set_mirror.diff
|
||||
Patch6: %{name}-delete-multiple.diff
|
||||
BuildRequires: efivar-devel >= 31
|
||||
BuildRequires: pciutils-devel
|
||||
BuildRequires: pkg-config
|
||||
BuildRequires: popt-devel
|
||||
BuildRequires: zlib-devel
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
URL: https://github.com/rhinstaller/efibootmgr
|
||||
Source: https://github.com/rhboot/efibootmgr/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||
Patch0: %{name}-delete-multiple.diff
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: pkgconfig(efiboot) >= 31
|
||||
BuildRequires: pkgconfig(efivar) >= 31
|
||||
BuildRequires: pkgconfig(libpci)
|
||||
BuildRequires: pkgconfig(popt)
|
||||
BuildRequires: pkgconfig(zlib)
|
||||
|
||||
%description
|
||||
The EFI Boot Manager allows the user to edit the Intel Extensible
|
||||
@ -44,15 +39,13 @@ information about the EFI can be found at
|
||||
<http://developer.intel.com/technology/efi/efi.htm>.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%autosetup -p1
|
||||
|
||||
%build
|
||||
# removing hotfix function declaration:
|
||||
# https://github.com/rhboot/efibootmgr/issues/128
|
||||
sed -e '/extern int efi_set_verbose/d' -i "src/efibootmgr.c"
|
||||
|
||||
LOADER="grub.efi" # default loader
|
||||
[ "$RPM_ARCH" != ia64 ] || LOADER="elilo.efi" # except Itanium
|
||||
|
||||
@ -62,14 +55,19 @@ case "%{_repository}" in
|
||||
(SUSE*|SLE*) VENDOR="SUSE";;
|
||||
(*) VENDOR="linux";;
|
||||
esac
|
||||
make %{?_smp_mflags} CFLAGS="%{optflags} -flto -fPIE -pie" \
|
||||
OS_VENDOR="$VENDOR" EFI_LOADER="$LOADER"
|
||||
%make_build CFLAGS="%{optflags} -flto -fPIE -pie" \
|
||||
OS_VENDOR="$VENDOR" EFI_LOADER="$LOADER" EFIDIR="$VENDOR"
|
||||
|
||||
%install
|
||||
make DESTDIR=%{buildroot} sbindir=%{_sbindir} install
|
||||
case "%{_repository}" in
|
||||
(openSUSE*) VENDOR="openSUSE";;
|
||||
(SLE_11_SP*) VENDOR="SuSE" LOADER="elilo.efi";;
|
||||
(SUSE*|SLE*) VENDOR="SUSE";;
|
||||
(*) VENDOR="linux";;
|
||||
esac
|
||||
make DESTDIR=%{buildroot} sbindir=%{_sbindir} EFIDIR="$VENDOR" install
|
||||
|
||||
%files
|
||||
%defattr(-, root, root)
|
||||
%license COPYING
|
||||
%doc README
|
||||
%{_sbindir}/efiboot*
|
||||
|
Loading…
Reference in New Issue
Block a user