Accepting request 258751 from home:gary_lin:branches:Base:System

- Update version number to 0.11.0
- Rebase patches
  (efibootmgr-0.11.0-derhat.diff,
   efibootmgr-0.11.0-check-boot-order.diff)
- Drop efibootmgr-0.6.0-set_boot_order.diff since the data size of
  the variable is handled properly now
- Drop efibootmgr-0.6.0-fail-visibly.diff since err() and warn()
  are introduced to show more meaningful messages
- Drop upstreamed patch
  (efibootmgr-0.6.0-gcc-Wall.diff,
   efibootmgr-0.6.0-write-unique-id-once.diff)

OBS-URL: https://build.opensuse.org/request/show/258751
OBS-URL: https://build.opensuse.org/package/show/Base:System/efibootmgr?expand=0&rev=21
This commit is contained in:
Dirk Mueller 2014-10-31 09:41:17 +00:00 committed by Git OBS Bridge
parent 734e247dc4
commit 7de38aff65
11 changed files with 52 additions and 287 deletions

View File

@ -0,0 +1,16 @@
---
src/efibootmgr/efibootmgr.c | 3 +++
1 file changed, 3 insertions(+)
--- a/src/efibootmgr/efibootmgr.c
+++ b/src/efibootmgr/efibootmgr.c
@@ -467,6 +467,9 @@ remove_from_boot_order(uint16_t num)
}
}
+ if (new_i == 0)
+ return efi_del_variable(EFI_GLOBAL_GUID, "BootOrder");
+
/* Now new_data has what we need */
free(boot_order->data);
boot_order->data = (uint8_t *)new_data;

View File

@ -1,7 +1,7 @@
From: Raymund Will <rw@suse.com>
Subject: Make default '--loader' build-time configurable.
Each distribution uses a specific 'vendor'-directory in the
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'
@ -13,8 +13,8 @@ to get the previous value. :)
Signed-off-by: Raymund Will <rw@suse.com>
---
Makefile | 4 ++++
src/efibootmgr/efibootmgr.c | 12 ++++++++----
Makefile | 4 ++++
src/efibootmgr/efibootmgr.c | 12 ++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
--- a/Makefile
@ -25,15 +25,15 @@ Signed-off-by: Raymund Will <rw@suse.com>
+ OS_VENDOR := vendor
+ EFI_LOADER := boot.efi
+
SIGNING_KEY := jordan_hargrave
RELEASE_DATE := "23-Jan-2013"
SIGNING_KEY := pjones
RELEASE_MAJOR := 0
@@ -10,6 +13,7 @@
RELEASE_STRING := $(RELEASE_NAME)-$(RELEASE_MAJOR).$(RELEASE_MINOR).$(RELEASE_SUBLEVEL)$(RELEASE_EXTRALEVEL)
RELEASE_MINOR := 11
@@ -8,6 +11,7 @@
RELEASE_STRING := $(RELEASE_NAME)-$(RELEASE_MAJOR).$(RELEASE_MINOR).$(RELEASE_SUBLEVEL)
CFLAGS = $(EXTRA_CFLAGS) -DEFIBOOTMGR_VERSION=\"$(RELEASE_MAJOR).$(RELEASE_MINOR).$(RELEASE_SUBLEVEL)$(RELEASE_EXTRALEVEL)\" \
CFLAGS = $(EXTRA_CFLAGS) -DEFIBOOTMGR_VERSION=\"$(RELEASE_MAJOR).$(RELEASE_MINOR).$(RELEASE_SUBLEVEL)\" \
+ -DDEFAULT_LOADER=\"\\\\efi\\\\$(OS_VENDOR)\\\\$(EFI_LOADER)\" \
-Wall -g -D_FILE_OFFSET_BITS=64
-Wsign-compare -Wall -Werror -g -D_FILE_OFFSET_BITS=64
MODULES := src
--- a/src/efibootmgr/efibootmgr.c
@ -55,7 +55,7 @@ Signed-off-by: Raymund Will <rw@suse.com>
The EFI_DEVICE_PATH will look something like:
ACPI device path, length 12 bytes
Hardware Device Path, PCI, length 6 bytes
@@ -55,6 +56,9 @@
@@ -59,6 +60,9 @@
#define EFIBOOTMGR_VERSION "unknown (fix Makefile!)"
#endif
@ -64,8 +64,8 @@ Signed-off-by: Raymund Will <rw@suse.com>
+#endif
typedef struct _var_entry {
struct dirent *name;
@@ -786,7 +790,7 @@ usage()
char *name;
@@ -965,7 +969,7 @@ usage()
printf("\t-g | --gpt force disk with invalid PMBR to be treated as GPT\n");
printf("\t-H | --acpi_hid XXXX set the ACPI HID (used with -i)\n");
printf("\t-i | --iface name create a netboot entry for the named interface\n");
@ -74,7 +74,7 @@ Signed-off-by: Raymund Will <rw@suse.com>
printf("\t-L | --label label Boot manager display label (defaults to \"Linux\")\n");
printf("\t-n | --bootnext XXXX set BootNext to XXXX (hex)\n");
printf("\t-N | --delete-bootnext delete BootNext\n");
@@ -814,7 +818,7 @@ set_default_opts()
@@ -993,7 +997,7 @@ set_default_opts()
opts.active = -1; /* Don't set it */
opts.timeout = -1; /* Don't set it */
opts.edd10_devicenum = 0x80;

3
efibootmgr-0.11.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c569f654d22788881a2b76f84eb9d708de2d91664689a5cfe8bed61ad134be42
size 62328

View File

@ -1,14 +0,0 @@
diff --git a/src/efibootmgr/efibootmgr.c b/src/efibootmgr/efibootmgr.c
index 7ea1887..b01a05a 100644
--- a/src/efibootmgr/efibootmgr.c
+++ b/src/efibootmgr/efibootmgr.c
@@ -380,6 +380,9 @@ remove_from_boot_order(uint16_t num)
}
}
+ if (new_i == 0)
+ return delete_variable(&boot_order);
+
/* Now new_data has what we need */
new_data_size = new_i * sizeof(uint16_t);
memset(&(boot_order.Data), 0, boot_order.DataSize);

View File

@ -1,34 +0,0 @@
From: Raymund Will <rw@suse.com>
Subject: Print EFI status on failed operations.
References: bnc#811767
Otherwise it's probably noticed only much too late.
V2: Produce failure output for '--create' as well.
Reported-by: Frederic Crozat <fcrozat@suse.com>
Signed-off-by: Raymund Will <rw@suse.com>
---
src/efibootmgr/efibootmgr.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/src/efibootmgr/efibootmgr.c
+++ b/src/efibootmgr/efibootmgr.c
@@ -279,6 +279,7 @@ make_boot_var(list_t *boot_list)
status = create_variable(&boot->var_data);
if (status != EFI_SUCCESS) {
+ fprintf (stderr,"\n\nrequested operation failed: status=%lx\n\n", status);
free(boot);
return NULL;
}
@@ -1137,6 +1138,9 @@ main(int argc, char **argv)
}
show_boot_order();
show_boot_vars();
+ } else if (ret > 1) {
+ /* only print efi_status_t values as others already have a message! */
+ fprintf (stderr,"\n\nrequested operation failed: status=%lx\n\n", ret);
}
}
free_dirents(boot_names, num_boot_names);

View File

@ -1,124 +0,0 @@
From: Raymund Will <rw@suse.com>
Subject: Fix all gcc warnings.
+ cc -Wall -g -D_FILE_OFFSET_BITS=64 -Isrc/lib -Isrc/include \
-c -o src/lib/disk.o src/lib/disk.c
src/lib/disk.c: In function 'disk_get_ide_pci':
src/lib/disk.c:195:9: warning: variable 'read_count' set but not used
[-Wunused-but-set-variable]
src/lib/disk.c: In function 'disk_get_partition_info':
src/lib/disk.c:468:8: warning: variable 'offset' set but not used
[-Wunused-but-set-variable]
+ cc -Wall -g -D_FILE_OFFSET_BITS=64 -Isrc/lib -Isrc/include \
-c -o src/lib/efi.o src/lib/efi.c
src/lib/efi.c: In function 'is_parent_bridge':
src/lib/efi.c:311:16: warning: variable 'primary' set but not used
[-Wunused-but-set-variable]
src/lib/efi.c: In function 'make_disk_load_option':
src/lib/efi.c:536:10: warning: pointer targets in passing argument 5 of
'make_harddrive_device_path' differ in signedness [-Wpointer-sign]
src/lib/efi.c:418:1: note: expected 'uint8_t *' but argument is of
type 'char *'
+ cc -Wall -g -D_FILE_OFFSET_BITS=64 -Isrc/lib -Isrc/include \
-c -o src/lib/gpt.o src/lib/gpt.c
src/lib/gpt.c: In function 'compare_gpts':
src/lib/gpt.c:401:24: warning: format '%lx' expects argument of type 'long
unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat]
src/lib/gpt.c:401:24: warning: format '%lx' expects argument of type 'long
unsigned int', but argument 4 has type 'long long unsigned int' [-Wformat]
src/lib/gpt.c:409:24: warning: format '%lx' expects argument of type 'long
unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat]
src/lib/gpt.c:409:24: warning: format '%lx' expects argument of type 'long
unsigned int', but argument 4 has type 'long long unsigned int' [-Wformat]
src/lib/gpt.c:417:24: warning: format '%lx' expects argument of type 'long
unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat]
src/lib/gpt.c:417:24: warning: format '%lx' expects argument of type 'long
unsigned int', but argument 4 has type 'long long unsigned int' [-Wformat]
src/lib/gpt.c:425:24: warning: format '%lx' expects argument of type 'long
unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat]
src/lib/gpt.c:425:24: warning: format '%lx' expects argument of type 'long
unsigned int', but argument 4 has type 'long long unsigned int' [-Wformat]
src/lib/gpt.c:462:10: warning: format '%lx' expects argument of type 'long
unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat]
src/lib/gpt.c:470:10: warning: format '%lx' expects argument of type 'long
unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat]
Signed-off-by: Raymund Will <rw@suse.com>
---
src/lib/disk.c | 10 +++++++++-
src/lib/efi.c | 4 +++-
src/lib/gpt.c | 9 +++++++++
3 files changed, 21 insertions(+), 2 deletions(-)
--- a/src/lib/disk.c
+++ b/src/lib/disk.c
@@ -211,6 +211,7 @@ disk_get_ide_pci(int fd,
read_count = read(procfd, infoline, sizeof(infoline)-1);
close(procfd);
+ infoline[(read_count < 0) ? 0 : read_count] = 0;
num_scanned = sscanf(infoline,
"pci bus %x device %x vid %*x did %*x channel %*x",
&b, &d);
@@ -375,7 +376,10 @@ msdos_disk_get_partition_info (int fd, l
/* Write it to the disk */
lseek(fd, 0, SEEK_SET);
- write(fd, mbr, sizeof(*mbr));
+ rc = write(fd, mbr, sizeof(*mbr));
+ if (rc == -1) {
+ perror("write unique MBR signature");
+ }
}
*(uint32_t *)signature = mbr->unique_mbr_signature;
@@ -478,6 +482,10 @@ disk_get_partition_info (int fd,
memset(mbr_sector, '\0', mbr_size);
offset = lseek(fd, 0, SEEK_SET);
+ if (offset) {
+ rc=1;
+ goto error_free_mbr;
+ }
this_bytes_read = read(fd, mbr_sector, mbr_size);
if (this_bytes_read < sizeof(*mbr)) {
rc=1;
--- a/src/lib/efi.c
+++ b/src/lib/efi.c
@@ -316,6 +316,8 @@ is_parent_bridge(struct pci_dev *p, unsi
primary=pci_read_byte(p, PCI_PRIMARY_BUS);
secondary=pci_read_byte(p, PCI_SECONDARY_BUS);
+ if (primary == 0xFF)
+ /* return NULL*/; /* don't care!? */
if (secondary != target_bus)
return NULL;
@@ -416,7 +418,7 @@ make_scsi_device_path(void *dest, uint16
static uint16_t
make_harddrive_device_path(void *dest, uint32_t num, uint64_t start, uint64_t size,
- uint8_t *signature,
+ char *signature,
uint8_t mbr_type, uint8_t signature_type)
{
HARDDRIVE_DEVICE_PATH p;
--- a/src/lib/gpt.c
+++ b/src/lib/gpt.c
@@ -32,7 +32,16 @@
#include <unistd.h>
#include <errno.h>
#include <sys/utsname.h>
+#if 0
+/* don't use kernel headers! */
#include <asm/byteorder.h>
+#else
+#include <endian.h>
+#define __le16_to_cpu le16toh
+#define __le32_to_cpu le32toh
+#define __le64_to_cpu le64toh
+#define __cpu_to_le32 htole32
+#endif
#include "crc32.h"
#include "disk.h"
#include "gpt.h"

View File

@ -1,60 +0,0 @@
From: Raymund Will <rw@suse.com>
Subject: Fix '--bootorder' handling.
References: bnc#810899
Elisa Mitchell wrote:
> If efibootmgr -o is called with a boot order number that does not exist
> in the list you get when you execute efibootmgr, it is supposed to test
> for an invalid DataSize parameter and exit. In fact, the test conducted
> will never fail, even on invalid data, and the command will always take
> the path to make the firmware call, passing FW an invalid DataSize value,
> which can lead to panics, hangs, uninterruptible command hangs.
Even if not every firmware panics over such an "invalid DataSize value",
it's still a bug, which should be addressed.
Reported-by: Elisa Mitchell <lisa.mitchell@hp.com>
Signed-off-by: Raymund Will <rw@suse.com>
---
src/efibootmgr/efibootmgr.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/src/efibootmgr/efibootmgr.c
+++ b/src/efibootmgr/efibootmgr.c
@@ -612,10 +612,10 @@ is_current_boot_entry(int b)
}
-static int
+static unsigned long
parse_boot_order(char *buffer, uint16_t *order, int length)
{
- int i;
+ unsigned long i;
int num, rc;
for (i=0; i<length && *buffer; i++) {
@@ -623,12 +623,12 @@ parse_boot_order(char *buffer, uint16_t
if (rc == 1) order[i] = num & 0xFFFF;
else {
fprintf(stderr,"\nInvalid hex characters in boot order: %s\n\n",buffer);
- return -1;
+ return 0UL;
}
/* make sure this is an existing boot entry */
if (!is_current_boot_entry(order[i])) {
fprintf (stderr,"\nboot entry %X does not exist\n\n",order[i]);
- return -1;
+ return 0UL;
}
/* Advance to the comma */
@@ -651,7 +651,7 @@ set_boot_order()
fill_var(&boot_order, "BootOrder");
boot_order.DataSize = parse_boot_order(opts.bootorder, n, 1024/sizeof(uint16_t)) * sizeof(uint16_t);
- if (boot_order.DataSize < 0)
+ if (boot_order.DataSize == 0UL)
return 1;
else
return create_or_edit_variable(&boot_order);

View File

@ -1,27 +0,0 @@
From: Raymund Will <rw@suse.com>
Subject: Don't let '--write-signature' overwrite unique signatures.
References: bnc#
Using '--write-signature' on an MBR-partitioned disk always overwrites
the previous signature, even if it was already unique.
While not using GPT is against the spec, it still works most of the time.
The issue is, that excessively writing new entries to NVRAM (and incidentally
breaking all old references to the partition in question) was found to
bring trouble to certain systems.
Signed-off-by: Raymund Will <rw@suse.com>
---
src/lib/disk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/src/lib/disk.c
+++ b/src/lib/disk.c
@@ -353,7 +353,7 @@ msdos_disk_get_partition_info (int fd, l
printf("******************************************************\n\n");
}
- else if (opts.write_signature) {
+ else if (!mbr->unique_mbr_signature && opts.write_signature) {
/* MBR Signatures must be unique for the
EFI Boot Manager

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1c9b0852df7932c410865e296a38fe66e39a26e10c9c1a7ff34fca87f3e25f53
size 64995

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Wed Oct 29 03:51:49 UTC 2014 - glin@suse.com
- Update version number to 0.11.0
- Rebase patches
(efibootmgr-0.11.0-derhat.diff,
efibootmgr-0.11.0-check-boot-order.diff)
- Drop efibootmgr-0.6.0-set_boot_order.diff since the data size of
the variable is handled properly now
- Drop efibootmgr-0.6.0-fail-visibly.diff since err() and warn()
are introduced to show more meaningful messages
- Drop upstreamed patch
(efibootmgr-0.6.0-gcc-Wall.diff,
efibootmgr-0.6.0-write-unique-id-once.diff)
-------------------------------------------------------------------
Tue Sep 9 13:24:25 UTC 2014 - schwab@suse.de

View File

@ -20,18 +20,15 @@ Name: efibootmgr
Summary: EFI Boot Manager
License: GPL-2.0+
Group: System/Boot
Version: 0.6.0
Version: 0.11.0
Release: 0
Url: http://linux.dell.com/efibootmgr/
Source: http://linux.dell.com/%{name}/%{name}-%{version}/%{name}-%{version}.tar.gz
Patch0: %{name}-0.6.0-gcc-Wall.diff
Patch1: %{name}-0.6.0-derhat.diff
Patch2: %{name}-0.6.0-set_boot_order.diff
Patch3: %{name}-0.6.0-fail-visibly.diff
Patch4: %{name}-0.6.0-write-unique-id-once.diff
Patch5: %{name}-0.6.0-check-boot-order.diff
Patch1: %{name}-0.11.0-derhat.diff
Patch2: %{name}-0.11.0-check-boot-order.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: efivar-devel
BuildRequires: pciutils-devel
BuildRequires: zlib-devel
ExclusiveArch: ia64 x86_64 aarch64
@ -44,12 +41,8 @@ information about the EFI can be found at
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
LOADER="grub.efi" # default loader