efibootmgr: update to 0.6.0.
This commit is contained in:
parent
ade634f4ac
commit
2307327695
3 changed files with 8 additions and 187 deletions
|
@ -1,159 +0,0 @@
|
||||||
diff --git a/src/efibootmgr/efibootmgr.c b/src/efibootmgr/efibootmgr.c
|
|
||||||
index 5db0d9e..199af39 100644
|
|
||||||
--- src/efibootmgr/efibootmgr.c
|
|
||||||
+++ src/efibootmgr/efibootmgr.c
|
|
||||||
@@ -328,6 +328,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);
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/include/disk.h b/src/include/disk.h
|
|
||||||
index eb93d10..8aa37d7 100644
|
|
||||||
--- src/include/disk.h
|
|
||||||
+++ src/include/disk.h
|
|
||||||
@@ -65,6 +65,9 @@ enum _interface_type {interface_type_unknown,
|
|
||||||
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,
|
|
||||||
diff --git a/src/lib/disk.c b/src/lib/disk.c
|
|
||||||
index 883864f..8ad590b 100644
|
|
||||||
--- src/lib/disk.c
|
|
||||||
+++ 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.
|
|
||||||
@@ -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,27 @@ 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 +501,8 @@ disk_get_partition_info (int fd,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
error_free_mbr:
|
|
||||||
- free(mbr_unaligned);
|
|
||||||
+ free(mbr_sector);
|
|
||||||
+ error:
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/lib/gpt.c b/src/lib/gpt.c
|
|
||||||
index d90ddaf..83e7a94 100644
|
|
||||||
--- src/lib/gpt.c
|
|
||||||
+++ src/lib/gpt.c
|
|
||||||
@@ -215,26 +215,24 @@ read_lastoddsector(int fd, uint64_t lba, void *buffer, size_t count)
|
|
||||||
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 *aligned;
|
|
||||||
- void *unaligned;
|
|
||||||
-
|
|
||||||
- if (bytes % sector_size)
|
|
||||||
- return EINVAL;
|
|
||||||
+ void *iobuf;
|
|
||||||
+ size_t iobuf_size;
|
|
||||||
+ int rc;
|
|
||||||
|
|
||||||
- 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);
|
|
||||||
+ lseek(fd, offset, SEEK_SET);
|
|
||||||
+ 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,41 +1,21 @@
|
||||||
diff --git a/src/efibootmgr/efibootmgr.c b/src/efibootmgr/efibootmgr.c
|
--- src/efibootmgr/efibootmgr.c.orig 2013-05-01 08:47:28.191213068 +0200
|
||||||
index 199af39..3826e03 100644
|
+++ src/efibootmgr/efibootmgr.c 2013-05-01 08:49:21.578759005 +0200
|
||||||
--- src/efibootmgr/efibootmgr.c
|
@@ -786,8 +786,8 @@ usage()
|
||||||
+++ src/efibootmgr/efibootmgr.c
|
|
||||||
@@ -18,7 +18,7 @@
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
|
|
||||||
- This must tie the EFI_DEVICE_PATH to /boot/efi/elilo.efi
|
|
||||||
+ This must tie the EFI_DEVICE_PATH to /boot/efi/EFI/void_grub/grubx64.efi
|
|
||||||
The EFI_DEVICE_PATH will look something like:
|
|
||||||
ACPI device path, length 12 bytes
|
|
||||||
Hardware Device Path, PCI, length 6 bytes
|
|
||||||
@@ -26,7 +26,7 @@
|
|
||||||
Media Device Path, Hard Drive, partition XX, length 30 bytes
|
|
||||||
Media Device Path, File Path, length ??
|
|
||||||
End of Hardware Device Path, length 4
|
|
||||||
- Arguments passed to elilo, as UCS-2 characters, length ??
|
|
||||||
+ Arguments passed to grub2, as UCS-2 characters, length ??
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
@@ -780,8 +780,8 @@ usage()
|
|
||||||
printf("\t-g | --gpt force disk with invalid PMBR to be treated as GPT\n");
|
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-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-i | --iface name create a netboot entry for the named interface\n");
|
||||||
- printf("\t-l | --loader name (defaults to \\elilo.efi)\n");
|
- printf("\t-l | --loader name (defaults to \\EFI\\redhat\\grub.efi)\n");
|
||||||
- printf("\t-L | --label label Boot manager display label (defaults to \"Linux\")\n");
|
- printf("\t-L | --label label Boot manager display label (defaults to \"Linux\")\n");
|
||||||
+ printf("\t-l | --loader name (defaults to \\EFI\\void_grub\\grubx64.efi)\n");
|
+ printf("\t-l | --loader name (defaults to \\EFI\\void_grub\\grubx64.efi)\n");
|
||||||
+ printf("\t-L | --label label Boot manager display label (defaults to \"Void Linux (GRUB2)\")\n");
|
+ printf("\t-L | --label label Boot manager display label (defaults to \"Void Linux (GRUB2)\")\n");
|
||||||
printf("\t-n | --bootnext XXXX set BootNext to XXXX (hex)\n");
|
printf("\t-n | --bootnext XXXX set BootNext to XXXX (hex)\n");
|
||||||
printf("\t-N | --delete-bootnext delete BootNext\n");
|
printf("\t-N | --delete-bootnext delete BootNext\n");
|
||||||
printf("\t-o | --bootorder XXXX,YYYY,ZZZZ,... explicitly set BootOrder (hex)\n");
|
printf("\t-o | --bootorder XXXX,YYYY,ZZZZ,... explicitly set BootOrder (hex)\n");
|
||||||
@@ -808,8 +808,8 @@ set_default_opts()
|
@@ -814,8 +814,8 @@ set_default_opts()
|
||||||
opts.active = -1; /* Don't set it */
|
opts.active = -1; /* Don't set it */
|
||||||
opts.timeout = -1; /* Don't set it */
|
opts.timeout = -1; /* Don't set it */
|
||||||
opts.edd10_devicenum = 0x80;
|
opts.edd10_devicenum = 0x80;
|
||||||
- opts.loader = "\\elilo.efi";
|
- opts.loader = "\\EFI\\redhat\\grub.efi";
|
||||||
- opts.label = "Linux";
|
- opts.label = "Linux";
|
||||||
+ opts.loader = "\\EFI\\void_grub\\grubx64.efi";
|
+ opts.loader = "\\EFI\\void_grub\\grubx64.efi";
|
||||||
+ opts.label = "Void Linux (GRUB2)";
|
+ opts.label = "Void Linux (GRUB2)";
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Template file for 'efibootmgr'
|
# Template file for 'efibootmgr'
|
||||||
pkgname=efibootmgr
|
pkgname=efibootmgr
|
||||||
version=0.5.4
|
version=0.6.0
|
||||||
revision=1
|
revision=1
|
||||||
makedepends="zlib-devel pciutils-devel"
|
makedepends="zlib-devel pciutils-devel"
|
||||||
short_desc="Tool to modify UEFI Firmware Boot Manager Variables"
|
short_desc="Tool to modify UEFI Firmware Boot Manager Variables"
|
||||||
|
@ -8,7 +8,7 @@ maintainer="Juan RP <xtraeme@gmail.com>"
|
||||||
license="GPL-2"
|
license="GPL-2"
|
||||||
homepage="http://linux.dell.com/efibootmgr/"
|
homepage="http://linux.dell.com/efibootmgr/"
|
||||||
distfiles="http://linux.dell.com/efibootmgr/permalink/${pkgname}-${version}.tar.gz"
|
distfiles="http://linux.dell.com/efibootmgr/permalink/${pkgname}-${version}.tar.gz"
|
||||||
checksum=b562a47a4f5327494992f2ee6ae14a75c5aeb9b4a3a78a06749d5cd2917b8e71
|
checksum=5167488b92950e60028d1025942ce6bda04638c6fb5e110abb8c8f687844d155
|
||||||
long_desc="
|
long_desc="
|
||||||
This is efibootmgr, a Linux user-space application to modify the Intel
|
This is efibootmgr, a Linux user-space application to modify the Intel
|
||||||
Extensible Firmware Interface (EFI) Boot Manager. This application
|
Extensible Firmware Interface (EFI) Boot Manager. This application
|
||||||
|
|
Loading…
Reference in a new issue