forked from pool/efibootmgr
- Integrate SLE11 patches. [bnc#830784]
o Print EFI status for failed '--create' as well. [bnc#811767] o Fix '--bootorder' handling. [bnc#810899] o Print EFI status in case of failure. [bnc#811767] - Update version number to 0.6.0. - Stop '--write-signature' overwriting unique signature. - Fix gcc warnings. OBS-URL: https://build.opensuse.org/package/show/Base:System/efibootmgr?expand=0&rev=11
This commit is contained in:
parent
92b00c0ba2
commit
005b0540c9
@ -1,223 +0,0 @@
|
||||
---
|
||||
Makefile | 2 -
|
||||
doc/ChangeLog | 66 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
src/efibootmgr/efibootmgr.c | 9 +++++-
|
||||
src/include/efi.h | 2 +
|
||||
src/lib/disk.c | 1
|
||||
src/lib/efivars_sysfs.c | 4 ++
|
||||
src/lib/gpt.c | 6 ++--
|
||||
src/man/man8/efibootmgr.8 | 10 ++++--
|
||||
8 files changed, 92 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/doc/ChangeLog
|
||||
+++ b/doc/ChangeLog
|
||||
@@ -1,3 +1,69 @@
|
||||
+commit de0ca446e7e5439306f7f54806d1a15310588426
|
||||
+Author: Jordan Hargrave <Jordan_Hargrave@dell.com>
|
||||
+Date: Thu Nov 29 10:11:43 2012 -0600
|
||||
+
|
||||
+ Add patches from fedora release
|
||||
+ * Wed Nov 28 2012 Matthew Garrett <mjg59@srcf.ucam.org> - 0.5.4-14
|
||||
+ - efibootmgr-0.5.4-Work-around-broken-Apple-firmware.patch
|
||||
+ Resolves: #873629
|
||||
+ - efibootmgr-0.5.4-Remove-device-path-padding-on-non-Itanium.patch - improve
|
||||
+ spec conformance
|
||||
+
|
||||
+commit 9392250bd8668ef7544530d17800dc0271cd8bf3
|
||||
+Author: Jordan Hargrave <Jordan_Hargrave@dell.com>
|
||||
+Date: Tue Apr 24 12:58:57 2012 -0500
|
||||
+
|
||||
+ From: Lane Winner<lane.winner@oracle.com>
|
||||
+
|
||||
+ make_boot_var does not check for failed status with create_variable.
|
||||
+ This can result in a memory leak.
|
||||
+ Additionally the user should be notified of the problem.
|
||||
+
|
||||
+ We encounter this issue on one system after filling up the UEFI boot list
|
||||
+ with dummy devices.
|
||||
+
|
||||
+ The patch fix the problem. It was verified on a Mensa system using RHEL 6.0
|
||||
+
|
||||
+ Signed-off-by: Yinghai Lu<yinghai@kernel.org>
|
||||
+
|
||||
+commit 8602b3c41701572669b1f8b9c45409d98405eca2
|
||||
+Author: Peter Jones <pjones@redhat.com>
|
||||
+Date: Wed Jul 14 11:26:49 2010 -0700
|
||||
+
|
||||
+ Handle sector_size != 512.
|
||||
+
|
||||
+ Disks can have 4kB sectors now, so don't just bail out when that's the
|
||||
+ case.
|
||||
+
|
||||
+commit fb3d9a8d9bfd580d23b14b384a393510e0a749ac
|
||||
+Author: Matt Domsch <Matt_Domsch@dell.com>
|
||||
+Date: Thu Jul 23 14:20:19 2009 -0500
|
||||
+
|
||||
+ fix disk minor number discovery
|
||||
+
|
||||
+ Raymund Will noted disk_info_from_fd() incorrectly used logical &&
|
||||
+ instead of bitwise & when obtaining the minor number.
|
||||
+
|
||||
+ Reported in https://bugzilla.novell.com/show_bug.cgi?id=524529#c1
|
||||
+
|
||||
+commit acac7412e8e0819fc66cdadc06ad4ca535f29b35
|
||||
+Author: Matt Domsch <Matt_Domsch@dell.com>
|
||||
+Date: Thu Jul 23 14:18:11 2009 -0500
|
||||
+
|
||||
+ fix minor memory leak
|
||||
+
|
||||
+ David Binderman noted new_data was being allocated but not freed. Not
|
||||
+ a big deal as the program exits soon thereafter (and is thus freed),
|
||||
+ but worth fixing anyhow.
|
||||
+
|
||||
+ Fixes https://bugzilla.novell.com/show_bug.cgi?id=524529#c1
|
||||
+
|
||||
+commit c8d6ceaa7b33f952bcf32bc017ce8b5d7d659267
|
||||
+Author: Matt Domsch <Matt_Domsch@dell.com>
|
||||
+Date: Fri Jan 11 15:09:12 2008 -0600
|
||||
+
|
||||
+ update ChangeLog
|
||||
+
|
||||
commit 6e6bf6fc7665851798a6c2c92893ebb629e42aff
|
||||
Author: Matt Domsch <Matt_Domsch@dell.com>
|
||||
Date: Fri Jan 11 15:08:12 2008 -0600
|
||||
--- a/src/efibootmgr/efibootmgr.c
|
||||
+++ b/src/efibootmgr/efibootmgr.c
|
||||
@@ -239,6 +239,7 @@ warn_duplicate_name(list_t *boot_list)
|
||||
static var_entry_t *
|
||||
make_boot_var(list_t *boot_list)
|
||||
{
|
||||
+ efi_status_t status;
|
||||
var_entry_t *boot;
|
||||
int free_number;
|
||||
list_t *pos;
|
||||
@@ -271,7 +272,12 @@ make_boot_var(list_t *boot_list)
|
||||
free(boot);
|
||||
return NULL;
|
||||
}
|
||||
- create_variable(&boot->var_data);
|
||||
+
|
||||
+ status = create_variable(&boot->var_data);
|
||||
+ if (status != EFI_SUCCESS) {
|
||||
+ free(boot);
|
||||
+ return NULL;
|
||||
+ }
|
||||
list_add_tail(&boot->list, boot_list);
|
||||
return boot;
|
||||
}
|
||||
@@ -328,6 +334,7 @@ add_to_boot_order(uint16_t num)
|
||||
/* Now new_data has what we need */
|
||||
memcpy(&(boot_order.Data), new_data, new_data_size);
|
||||
boot_order.DataSize = new_data_size;
|
||||
+ free(new_data);
|
||||
return create_or_edit_variable(&boot_order);
|
||||
}
|
||||
|
||||
--- a/src/include/efi.h
|
||||
+++ b/src/include/efi.h
|
||||
@@ -294,7 +294,9 @@ typedef struct {
|
||||
uint8_t signature[16];
|
||||
uint8_t mbr_type;
|
||||
uint8_t signature_type;
|
||||
+#ifdef __ia64
|
||||
uint8_t padding[6]; /* Emperically needed */
|
||||
+#endif
|
||||
} __attribute__((packed)) HARDDRIVE_DEVICE_PATH;
|
||||
|
||||
typedef struct {
|
||||
--- a/src/lib/efivars_sysfs.c
|
||||
+++ b/src/lib/efivars_sysfs.c
|
||||
@@ -55,6 +55,10 @@ sysfs_read_variable(const char *name, ef
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
close(fd);
|
||||
+ /* latest apple firmware sets high bit which appears invalid
|
||||
+ to the linux kernel if we write it back so lets zero it out
|
||||
+ if it is set since it would be invalid to set it anyway */
|
||||
+ var->Attributes = var->Attributes & ~(1 << 31);
|
||||
return var->Status;
|
||||
}
|
||||
|
||||
--- a/src/man/man8/efibootmgr.8
|
||||
+++ b/src/man/man8/efibootmgr.8
|
||||
@@ -3,7 +3,7 @@
|
||||
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
|
||||
.\" Please send any bug reports, improvements, comments, patches,
|
||||
.\" etc. to Steve Cheng <steve@ggi-project.org>.
|
||||
-.TH "EFIBOOTMGR" "8" "11 August 2005" "" ""
|
||||
+.TH "EFIBOOTMGR" "8" "11 January 2012" "" ""
|
||||
|
||||
.SH NAME
|
||||
efibootmgr \- manipulate the EFI Boot Manager
|
||||
@@ -127,6 +127,9 @@ the data, so you can pass any binary or
|
||||
1.
|
||||
.SS "DISPLAYING THE CURRENT SETTINGS (MUST BE ROOT)."
|
||||
.PP
|
||||
+.PP
|
||||
+.nf
|
||||
+.B
|
||||
[root@localhost ~]# efibootmgr
|
||||
BootCurrent: 0004
|
||||
BootNext: 0003
|
||||
@@ -137,6 +140,7 @@ Boot0001* CD-ROM Drive(device:FF)
|
||||
Boot0002* Hard Drive(Device:80)/HD(Part1,Sig00112233)
|
||||
Boot0003* PXE Boot: MAC(00D0B7C15D91)
|
||||
Boot0004* Linux
|
||||
+.fi
|
||||
.PP
|
||||
This shows:
|
||||
.RS
|
||||
@@ -217,8 +221,8 @@ You create the boot entry with:
|
||||
\fBefibootmgr -c -i eth0 -H 222F -U 500 -L netboot\fR
|
||||
.SH "BUGS"
|
||||
.PP
|
||||
-Please direct any bugs, features, patches, etc. to Matt Domsch
|
||||
-<Matt_Domsch@dell.com>\&.
|
||||
+Please direct any bugs, features, patches, etc. to Jordan Hargrave
|
||||
+<jordan_hargrave@dell.com>\&.
|
||||
.SH "AUTHOR"
|
||||
.PP
|
||||
This man page was generated by dann frazier <dannf@debian.org> for the
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -4,7 +4,7 @@
|
||||
RELEASE_MAJOR := 0
|
||||
RELEASE_MINOR := 5
|
||||
RELEASE_SUBLEVEL := 4
|
||||
- RELEASE_EXTRALEVEL :=
|
||||
+ RELEASE_EXTRALEVEL := .suse2
|
||||
RELEASE_NAME := efibootmgr
|
||||
RELEASE_STRING := $(RELEASE_NAME)-$(RELEASE_MAJOR).$(RELEASE_MINOR).$(RELEASE_SUBLEVEL)$(RELEASE_EXTRALEVEL)
|
||||
|
||||
--- a/src/lib/disk.c
|
||||
+++ b/src/lib/disk.c
|
||||
@@ -471,6 +471,7 @@ disk_get_partition_info (int fd,
|
||||
int rc=0;
|
||||
int sector_size = get_sector_size(fd);
|
||||
|
||||
+
|
||||
mbr_size = lcm(sizeof(*mbr), sector_size);
|
||||
if ((rc = posix_memalign(&mbr_sector, sector_size, mbr_size)) != 0)
|
||||
goto error;
|
||||
--- a/src/lib/gpt.c
|
||||
+++ b/src/lib/gpt.c
|
||||
@@ -215,8 +215,8 @@ read_lastoddsector(int fd, uint64_t lba,
|
||||
static ssize_t
|
||||
read_lba(int fd, uint64_t lba, void *buffer, size_t bytes)
|
||||
{
|
||||
- int sector_size = get_sector_size(fd);
|
||||
- off_t offset = lba * sector_size;
|
||||
+ int sector_size = get_sector_size(fd);
|
||||
+ off_t offset = lba * sector_size;
|
||||
ssize_t bytesread;
|
||||
void *iobuf;
|
||||
size_t iobuf_size;
|
||||
@@ -229,7 +229,7 @@ read_lba(int fd, uint64_t lba, void *buf
|
||||
memset(iobuf, 0, bytes);
|
||||
|
||||
|
||||
- lseek(fd, offset, SEEK_SET);
|
||||
+ lseek(fd, offset, SEEK_SET);
|
||||
bytesread = read(fd, iobuf, iobuf_size);
|
||||
memcpy(buffer, iobuf, bytes);
|
||||
free(iobuf);
|
@ -1,140 +0,0 @@
|
||||
From b8af2c229031e274a2c61293a1a634e515a56d27 Mon Sep 17 00:00:00 2001
|
||||
In-Reply-To: <1279121617-17961-1-git-send-email-pjones@redhat.com>
|
||||
References: <1279121617-17961-1-git-send-email-pjones@redhat.com>
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Wed, 14 Jul 2010 14:55:17 -0400
|
||||
Subject: [efibootmgr patch] Handle sector_size != 512.
|
||||
|
||||
Disks can have 4kB sectors now, so don't just bail out when that's the
|
||||
case.
|
||||
---
|
||||
src/include/disk.h | 3 +++
|
||||
src/lib/disk.c | 42 ++++++++++++++++++++++++++++++++----------
|
||||
src/lib/gpt.c | 24 +++++++++++-------------
|
||||
3 files changed, 46 insertions(+), 23 deletions(-)
|
||||
|
||||
--- a/src/include/disk.h
|
||||
+++ b/src/include/disk.h
|
||||
@@ -65,6 +65,9 @@ enum _interface_type {interface_type_unk
|
||||
ata, atapi, scsi, usb,
|
||||
i1394, fibre, i2o, md};
|
||||
|
||||
+
|
||||
+unsigned int lcm(unsigned int x, unsigned int y);
|
||||
+
|
||||
int disk_get_pci(int fd,
|
||||
unsigned char *bus,
|
||||
unsigned char *device,
|
||||
--- a/src/lib/disk.c
|
||||
+++ b/src/lib/disk.c
|
||||
@@ -420,6 +420,27 @@ get_sector_size(int filedes)
|
||||
return sector_size;
|
||||
}
|
||||
|
||||
+/************************************************************
|
||||
+ * lcm
|
||||
+ * Requires:
|
||||
+ * - numbers of which to find the lowest common multiple
|
||||
+ * Modifies: nothing
|
||||
+ * Returns:
|
||||
+ * lowest common multiple of x and y
|
||||
+ ************************************************************/
|
||||
+unsigned int
|
||||
+lcm(unsigned int x, unsigned int y)
|
||||
+{
|
||||
+ unsigned int m = x, n = y, o;
|
||||
+
|
||||
+ while ((o = m % n)) {
|
||||
+ m = n;
|
||||
+ n = o;
|
||||
+ }
|
||||
+
|
||||
+ return (x / n) * y;
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* disk_get_partition_info()
|
||||
* @fd - open file descriptor to disk
|
||||
@@ -442,26 +463,26 @@ disk_get_partition_info (int fd,
|
||||
uint8_t *mbr_type, uint8_t *signature_type)
|
||||
{
|
||||
legacy_mbr *mbr;
|
||||
- void *mbr_unaligned;
|
||||
+ void *mbr_sector;
|
||||
+ size_t mbr_size;
|
||||
off_t offset;
|
||||
int this_bytes_read = 0;
|
||||
int gpt_invalid=0, mbr_invalid=0;
|
||||
int rc=0;
|
||||
int sector_size = get_sector_size(fd);
|
||||
|
||||
- if (sizeof(*mbr) != sector_size)
|
||||
- return 1;
|
||||
- mbr_unaligned = malloc(sizeof(*mbr)+sector_size-1);
|
||||
- mbr = (legacy_mbr *)
|
||||
- (((unsigned long)mbr_unaligned + sector_size - 1) &
|
||||
- ~(unsigned long)(sector_size-1));
|
||||
- memset(mbr, 0, sizeof(*mbr));
|
||||
+ mbr_size = lcm(sizeof(*mbr), sector_size);
|
||||
+ if ((rc = posix_memalign(&mbr_sector, sector_size, mbr_size)) != 0)
|
||||
+ goto error;
|
||||
+ memset(mbr_sector, '\0', mbr_size);
|
||||
+
|
||||
offset = lseek(fd, 0, SEEK_SET);
|
||||
- this_bytes_read = read(fd, mbr, sizeof(*mbr));
|
||||
+ this_bytes_read = read(fd, mbr_sector, mbr_size);
|
||||
if (this_bytes_read < sizeof(*mbr)) {
|
||||
rc=1;
|
||||
goto error_free_mbr;
|
||||
}
|
||||
+ mbr = (legacy_mbr *)mbr_sector;
|
||||
gpt_invalid = gpt_disk_get_partition_info(fd, num,
|
||||
start, size,
|
||||
signature,
|
||||
@@ -479,7 +500,8 @@ disk_get_partition_info (int fd,
|
||||
}
|
||||
}
|
||||
error_free_mbr:
|
||||
- free(mbr_unaligned);
|
||||
+ free(mbr_sector);
|
||||
+ error:
|
||||
return rc;
|
||||
}
|
||||
|
||||
--- a/src/lib/gpt.c
|
||||
+++ b/src/lib/gpt.c
|
||||
@@ -218,23 +218,21 @@ read_lba(int fd, uint64_t lba, void *buf
|
||||
int sector_size = get_sector_size(fd);
|
||||
off_t offset = lba * sector_size;
|
||||
ssize_t bytesread;
|
||||
- void *aligned;
|
||||
- void *unaligned;
|
||||
+ void *iobuf;
|
||||
+ size_t iobuf_size;
|
||||
+ int rc;
|
||||
|
||||
- if (bytes % sector_size)
|
||||
- return EINVAL;
|
||||
-
|
||||
- unaligned = malloc(bytes+sector_size-1);
|
||||
- aligned = (void *)
|
||||
- (((unsigned long)unaligned + sector_size - 1) &
|
||||
- ~(unsigned long)(sector_size-1));
|
||||
- memset(aligned, 0, bytes);
|
||||
+ iobuf_size = lcm(bytes, sector_size);
|
||||
+ rc = posix_memalign(&iobuf, sector_size, iobuf_size);
|
||||
+ if (rc)
|
||||
+ return rc;
|
||||
+ memset(iobuf, 0, bytes);
|
||||
|
||||
|
||||
lseek(fd, offset, SEEK_SET);
|
||||
- bytesread = read(fd, aligned, bytes);
|
||||
- memcpy(buffer, aligned, bytesread);
|
||||
- free(unaligned);
|
||||
+ bytesread = read(fd, iobuf, iobuf_size);
|
||||
+ memcpy(buffer, iobuf, bytes);
|
||||
+ free(iobuf);
|
||||
|
||||
/* Kludge. This is necessary to read/write the last
|
||||
block of an odd-sized disk, until Linux 2.5.x kernel fixes.
|
@ -1,11 +0,0 @@
|
||||
--- a/src/lib/disk.c
|
||||
+++ b/src/lib/disk.c
|
||||
@@ -55,7 +55,7 @@ disk_info_from_fd(int fd,
|
||||
return 1;
|
||||
}
|
||||
major = buf.st_dev >> 8;
|
||||
- minor = buf.st_dev && 0xFF;
|
||||
+ minor = buf.st_dev & 0xFF;
|
||||
|
||||
/* IDE disks can have up to 64 partitions, or 6 bits worth,
|
||||
* and have one bit for the disk number.
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b562a47a4f5327494992f2ee6ae14a75c5aeb9b4a3a78a06749d5cd2917b8e71
|
||||
size 59121
|
71
efibootmgr-0.6.0-derhat.diff
Normal file
71
efibootmgr-0.6.0-derhat.diff
Normal file
@ -0,0 +1,71 @@
|
||||
---
|
||||
Makefile | 4 ++++
|
||||
src/efibootmgr/efibootmgr.c | 12 ++++++++----
|
||||
2 files changed, 12 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -1,5 +1,8 @@
|
||||
default: all
|
||||
|
||||
+ OS_VENDOR := vendor
|
||||
+ EFI_LOADER := boot.efi
|
||||
+
|
||||
SIGNING_KEY := jordan_hargrave
|
||||
RELEASE_DATE := "23-Jan-2013"
|
||||
RELEASE_MAJOR := 0
|
||||
@@ -10,6 +13,7 @@
|
||||
RELEASE_STRING := $(RELEASE_NAME)-$(RELEASE_MAJOR).$(RELEASE_MINOR).$(RELEASE_SUBLEVEL)$(RELEASE_EXTRALEVEL)
|
||||
|
||||
CFLAGS = $(EXTRA_CFLAGS) -DEFIBOOTMGR_VERSION=\"$(RELEASE_MAJOR).$(RELEASE_MINOR).$(RELEASE_SUBLEVEL)$(RELEASE_EXTRALEVEL)\" \
|
||||
+ -DDEFAULT_LOADER=\"\\\\efi\\\\$(OS_VENDOR)\\\\$(EFI_LOADER)\" \
|
||||
-Wall -g -D_FILE_OFFSET_BITS=64
|
||||
|
||||
MODULES := src
|
||||
--- a/src/efibootmgr/efibootmgr.c
|
||||
+++ b/src/efibootmgr/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/vars (previously as /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
|
||||
@@ -55,6 +56,9 @@
|
||||
#define EFIBOOTMGR_VERSION "unknown (fix Makefile!)"
|
||||
#endif
|
||||
|
||||
+#ifndef DEFAULT_LOADER
|
||||
+#define DEFAULT_LOADER "\\EFI\\redhat\\grub.efi"
|
||||
+#endif
|
||||
|
||||
typedef struct _var_entry {
|
||||
struct dirent *name;
|
||||
@@ -787,7 +791,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");
|
||||
- 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-n | --bootnext XXXX set BootNext to XXXX (hex)\n");
|
||||
printf("\t-N | --delete-bootnext delete BootNext\n");
|
||||
@@ -815,7 +819,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 = "Linux";
|
||||
opts.disk = "/dev/sda";
|
||||
opts.iface = NULL;
|
24
efibootmgr-0.6.0-fail-visibly.diff
Normal file
24
efibootmgr-0.6.0-fail-visibly.diff
Normal file
@ -0,0 +1,24 @@
|
||||
---
|
||||
src/efibootmgr/efibootmgr.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/src/efibootmgr/efibootmgr.c
|
||||
+++ b/src/efibootmgr/efibootmgr.c
|
||||
@@ -275,6 +275,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;
|
||||
}
|
||||
@@ -1133,6 +1134,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);
|
78
efibootmgr-0.6.0-gcc-Wall.diff
Normal file
78
efibootmgr-0.6.0-gcc-Wall.diff
Normal file
@ -0,0 +1,78 @@
|
||||
---
|
||||
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"
|
43
efibootmgr-0.6.0-set_boot_order.diff
Normal file
43
efibootmgr-0.6.0-set_boot_order.diff
Normal file
@ -0,0 +1,43 @@
|
||||
---
|
||||
src/efibootmgr/efibootmgr.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/src/efibootmgr/efibootmgr.c
|
||||
+++ b/src/efibootmgr/efibootmgr.c
|
||||
@@ -608,10 +608,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++) {
|
||||
@@ -619,12 +619,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 */
|
||||
@@ -647,7 +647,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);
|
17
efibootmgr-0.6.0-write-unique-id-once.diff
Normal file
17
efibootmgr-0.6.0-write-unique-id-once.diff
Normal file
@ -0,0 +1,17 @@
|
||||
Write "unique_mbr_signature" only once to MBR!
|
||||
|
||||
---
|
||||
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) {
|
||||
|
||||
/* MBR Signatures must be unique for the
|
||||
EFI Boot Manager
|
3
efibootmgr-0.6.0.tar.gz
Normal file
3
efibootmgr-0.6.0.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1c9b0852df7932c410865e296a38fe66e39a26e10c9c1a7ff34fca87f3e25f53
|
||||
size 64995
|
@ -1,3 +1,22 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Dec 19 15:59:44 UTC 2013 - rw@suse.de
|
||||
|
||||
- Integrate SLE11 patches. [bnc#830784]
|
||||
- Update version number to 0.6.0.
|
||||
- Stop '--write-signature' overwriting unique signature.
|
||||
- Fix gcc warnings.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 27 21:05:20 UTC 2013 - rw@suse.com
|
||||
|
||||
- Print EFI status for failed '--create' as well. [bnc#811767]
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 27 16:00:41 UTC 2013 - rw@suse.com
|
||||
|
||||
- Fix '--bootorder' handling. [bnc#810899]
|
||||
- Print EFI status in case of failure. [bnc#811767]
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 12 16:38:47 UTC 2013 - rw@suse.com
|
||||
|
||||
@ -5,8 +24,6 @@ Tue Feb 12 16:38:47 UTC 2013 - rw@suse.com
|
||||
o for memory leaking variable creation. [bnc#746324]
|
||||
o to improve spec conformance by removing device path padding.
|
||||
o to work around broken Apple firmware.
|
||||
efibootmgr-0.5.4-sector-size.diff
|
||||
efibootmgr-0.5.4-catchup.diff
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jun 12 16:51:40 UTC 2012 - mgorse@suse.com
|
||||
|
@ -20,13 +20,16 @@ Name: efibootmgr
|
||||
Summary: EFI Boot Manager
|
||||
License: GPL-2.0+
|
||||
Group: System/Boot
|
||||
Version: 0.5.4
|
||||
Version: 0.6.0
|
||||
Release: 0
|
||||
Url: http://linux.dell.com/efibootmgr/
|
||||
Source: http://linux.dell.com/efibootmgr/efibootmgr-%{version}.tar.gz
|
||||
Patch0: %{name}-%{version}.diff
|
||||
Patch1: %{name}-%{version}-sector-size.diff
|
||||
Patch2: %{name}-%{version}-catchup.diff
|
||||
Source: http://linux.dell.com/%{name}/%{name}-%{version}/%{name}-%{version}.tar.gz
|
||||
Patch0: %{name}-0.6.0-derhat.diff
|
||||
Patch1: %{name}-0.6.0-set_boot_order.diff
|
||||
Patch2: %{name}-0.6.0-fail-visibly.diff
|
||||
Patch3: %{name}-0.6.0-gcc-Wall.diff
|
||||
Patch4: %{name}-0.6.0-write-unique-id-once.diff
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildRequires: pciutils-devel
|
||||
BuildRequires: zlib-devel
|
||||
@ -43,10 +46,21 @@ information about the EFI can be found at
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
chmod +x tools/install.pl
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
|
||||
%build
|
||||
make %{?_smp_mflags} EXTRA_CFLAGS="$RPM_OPT_FLAGS"
|
||||
LOADER="grub.efi" # default loader
|
||||
[ "$RPM_ARCH" != ia64 ] || LOADER="elilo.efi" # except Itanium
|
||||
|
||||
case "%{_repository}" in
|
||||
(openSUSE*) VENDOR="openSUSE";;
|
||||
(SLE_11_SP*) VENDOR="SuSE" LOADER="elilo.efi";;
|
||||
(SUSE*|SLE*) VENDOR="SUSE";;
|
||||
(*) VENDOR="linux";;
|
||||
esac
|
||||
make %{?_smp_mflags} EXTRA_CFLAGS="$RPM_OPT_FLAGS" \
|
||||
OS_VENDOR="$VENDOR" EFI_LOADER="$LOADER"
|
||||
|
||||
%install
|
||||
install -d $RPM_BUILD_ROOT%{_sbindir}
|
||||
|
Loading…
x
Reference in New Issue
Block a user