summaryrefslogtreecommitdiff
path: root/source/a/efibootmgr
diff options
context:
space:
mode:
authorPatrick J Volkerding <volkerdi@slackware.com>2013-11-04 17:08:47 +0000
committerEric Hameleers <alien@slackware.com>2018-05-31 22:57:36 +0200
commit76fc4757ac91ac7947a01fb7b53dddf9a78a01d1 (patch)
tree9b98e6e193c7870cb27ac861394c1c4592850922 /source/a/efibootmgr
parent9664bee729d487bcc0a0bc35859f8e13d5421c75 (diff)
downloadcurrent-76fc4757ac91ac7947a01fb7b53dddf9a78a01d1.tar.gz
Slackware 14.1slackware-14.1
Mon Nov 4 17:08:47 UTC 2013 Slackware 14.1 x86_64 stable is released! It's been another interesting release cycle here at Slackware bringing new features like support for UEFI machines, updated compilers and development tools, the switch from MySQL to MariaDB, and many more improvements throughout the system. Thanks to the team, the upstream developers, the dedicated Slackware community, and everyone else who pitched in to help make this release a reality. The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a dual-sided 32-bit/64-bit x86/x86_64 DVD. Please consider supporting the Slackware project by picking up a copy from store.slackware.com. We're taking pre-orders now, and offer a discount if you sign up for a subscription. Have fun! :-)
Diffstat (limited to 'source/a/efibootmgr')
-rw-r--r--source/a/efibootmgr/efibootmgr-0.5.4-Remove-device-path-padding-on-non-Itanium.patch28
-rw-r--r--source/a/efibootmgr/efibootmgr-0.5.4-Work-around-broken-Apple-firmware.patch30
-rw-r--r--source/a/efibootmgr/efibootmgr-0.5.4-fix-disk-minor-number-discovery.patch29
-rw-r--r--source/a/efibootmgr/efibootmgr-0.5.4-support-4k-sectors.patch176
-rwxr-xr-xsource/a/efibootmgr/efibootmgr.SlackBuild117
-rw-r--r--source/a/efibootmgr/slack-desc19
6 files changed, 399 insertions, 0 deletions
diff --git a/source/a/efibootmgr/efibootmgr-0.5.4-Remove-device-path-padding-on-non-Itanium.patch b/source/a/efibootmgr/efibootmgr-0.5.4-Remove-device-path-padding-on-non-Itanium.patch
new file mode 100644
index 00000000..240aa696
--- /dev/null
+++ b/source/a/efibootmgr/efibootmgr-0.5.4-Remove-device-path-padding-on-non-Itanium.patch
@@ -0,0 +1,28 @@
+From 2d8f962284f40b918c0fc8385e58fcba219ddc12 Mon Sep 17 00:00:00 2001
+From: Fedora Ninjas <pjones@fedoraproject.org>
+Date: Wed, 28 Nov 2012 17:13:24 -0500
+Subject: [PATCH 2/5] Remove device path padding on non-Itanium
+
+This code predates EFI support on any x86 hardware, and it's a strict
+violation of the specification. Windows doesn't do it either.
+---
+ src/include/efi.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/include/efi.h b/src/include/efi.h
+index be667ae..c2ac853 100644
+--- 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 {
+--
+1.8.0
+
diff --git a/source/a/efibootmgr/efibootmgr-0.5.4-Work-around-broken-Apple-firmware.patch b/source/a/efibootmgr/efibootmgr-0.5.4-Work-around-broken-Apple-firmware.patch
new file mode 100644
index 00000000..a1d9831d
--- /dev/null
+++ b/source/a/efibootmgr/efibootmgr-0.5.4-Work-around-broken-Apple-firmware.patch
@@ -0,0 +1,30 @@
+From 6edc3ed5479b575f87eb51e335957b05fdd04fe8 Mon Sep 17 00:00:00 2001
+From: Fedora Ninjas <pjones@fedoraproject.org>
+Date: Wed, 28 Nov 2012 16:49:18 -0500
+Subject: [PATCH 1/5] Work around broken Apple firmware
+
+Alex Murray found that Apple's firmware sets an invalid EFI attribute on
+BootCurrent, which newer versions of the kernel then reject. This patch
+from him simply masks off the extraneous bit.
+---
+ src/lib/efivars_sysfs.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/lib/efivars_sysfs.c b/src/lib/efivars_sysfs.c
+index 182c70f..ea87325 100644
+--- a/src/lib/efivars_sysfs.c
++++ b/src/lib/efivars_sysfs.c
+@@ -55,6 +55,10 @@ sysfs_read_variable(const char *name, efi_variable_t *var)
+ 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;
+ }
+
+--
+1.8.0
+
diff --git a/source/a/efibootmgr/efibootmgr-0.5.4-fix-disk-minor-number-discovery.patch b/source/a/efibootmgr/efibootmgr-0.5.4-fix-disk-minor-number-discovery.patch
new file mode 100644
index 00000000..e9b53583
--- /dev/null
+++ b/source/a/efibootmgr/efibootmgr-0.5.4-fix-disk-minor-number-discovery.patch
@@ -0,0 +1,29 @@
+From f9f4ee75ad745637a47bf17ed968101b1ffbcc1d Mon Sep 17 00:00:00 2001
+From: Matt Domsch <Matt_Domsch@dell.com>
+Date: Thu, 23 Jul 2009 14:20:19 -0500
+Subject: [PATCH 4/5] 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
+---
+ src/lib/disk.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/lib/disk.c b/src/lib/disk.c
+index ebfe619..8ad590b 100644
+--- 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.8.0
+
diff --git a/source/a/efibootmgr/efibootmgr-0.5.4-support-4k-sectors.patch b/source/a/efibootmgr/efibootmgr-0.5.4-support-4k-sectors.patch
new file mode 100644
index 00000000..c380c610
--- /dev/null
+++ b/source/a/efibootmgr/efibootmgr-0.5.4-support-4k-sectors.patch
@@ -0,0 +1,176 @@
+Return-Path: pjones@redhat.com
+Received: from zmta02.collab.prod.int.phx2.redhat.com (LHLO
+ zmta02.collab.prod.int.phx2.redhat.com) (10.5.5.32) by
+ mail04.corp.redhat.com with LMTP; Wed, 14 Jul 2010 14:25:52 -0400 (EDT)
+Received: from localhost (localhost.localdomain [127.0.0.1])
+ by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id B69C19F152
+ for <pjones@redhat.com>; Wed, 14 Jul 2010 14:25:52 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+ by localhost (zmta02.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+ with ESMTP id jCHcGZehMQ5J for <pjones@redhat.com>;
+ Wed, 14 Jul 2010 14:25:52 -0400 (EDT)
+Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21])
+ by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id A601C9F14C
+ for <pjones@mail.corp.redhat.com>; Wed, 14 Jul 2010 14:25:52 -0400 (EDT)
+Received: from pjones4.install.bos.redhat.com (pjones4.install.bos.redhat.com [10.16.52.154])
+ by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6EIPpGh017771;
+ Wed, 14 Jul 2010 14:25:52 -0400
+From: Peter Jones <pjones@redhat.com>
+To: Matt Domsch <Matt_Domsch@dell.com>
+Cc: Peter Jones <pjones@redhat.com>, Stuart Hayes <stuart_hayes@dell.com>
+Subject: [efibootmgr patch] Handle sector_size != 512.
+Date: Wed, 14 Jul 2010 14:26:49 -0400
+Message-Id: <1279132009-26635-1-git-send-email-pjones@redhat.com>
+In-Reply-To: <1279121617-17961-1-git-send-email-pjones@redhat.com>
+References: <1279121617-17961-1-git-send-email-pjones@redhat.com>
+X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21
+
+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 | 43 +++++++++++++++++++++++++++++++++----------
+ src/lib/gpt.c | 30 ++++++++++++++----------------
+ 3 files changed, 50 insertions(+), 26 deletions(-)
+
+diff --git a/src/include/disk.h b/src/include/disk.h
+index eb93d10..8aa37d7 100644
+--- a/src/include/disk.h
++++ b/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..9c3a878 100644
+--- 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,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
+--- a/src/lib/gpt.c
++++ b/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.7.1.1
+
diff --git a/source/a/efibootmgr/efibootmgr.SlackBuild b/source/a/efibootmgr/efibootmgr.SlackBuild
new file mode 100755
index 00000000..1e411677
--- /dev/null
+++ b/source/a/efibootmgr/efibootmgr.SlackBuild
@@ -0,0 +1,117 @@
+#!/bin/sh
+
+# Copyright 2013 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+PKGNAM=efibootmgr
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-1}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$(uname -m)" in
+ i?86) ARCH=i486 ;;
+ arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7lh ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) ARCH=$(uname -m) ;;
+ esac
+ export ARCH
+fi
+
+if [ "$ARCH" = "i386" ]; then
+ SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "s390" ]; then
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+elif [ "$ARCH" = "armv7hl" ]; then
+ SLKCFLAGS="-O3 -march=armv7-a -mfpu=vfpv3-d16"
+ LIBDIRSUFFIX=""
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-$PKGNAM
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+
+cd $TMP
+rm -rf $PKGNAM-$VERSION
+tar xvf $CWD/$PKGNAM-$VERSION.tar.?z* || exit 1
+cd $PKGNAM-$VERSION
+
+zcat $CWD/efibootmgr-0.5.4-Remove-device-path-padding-on-non-Itanium.patch.gz | patch -p1 --verbose || exit 1
+zcat $CWD/efibootmgr-0.5.4-Work-around-broken-Apple-firmware.patch.gz | patch -p1 --verbose || exit 1
+zcat $CWD/efibootmgr-0.5.4-fix-disk-minor-number-discovery.patch.gz | patch -p1 --verbose || exit 1
+zcat $CWD/efibootmgr-0.5.4-support-4k-sectors.patch.gz | patch -p1 --verbose || exit 1
+
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+# Build:
+CFLAGS="$SLKCFLAGS" make || exit 1
+
+# Install:
+mkdir -p $PKG/usr/sbin
+cp src/efibootmgr/efibootmgr $PKG/usr/sbin
+chown root:root $PKG/usr/sbin/efibootmgr
+chmod 755 $PKG/usr/sbin/efibootmgr
+mkdir -p $PKG/usr/man/man8
+cat src/man/man8/efibootmgr.8 | gzip -9c > $PKG/usr/man/man8/efibootmgr.8.gz
+
+# Strip binaries:
+( cd $PKG
+ find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+ find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+)
+
+# Add a documentation directory:
+mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
+cp -a \
+ AUTHORS COPYING* INSTALL README* doc/* \
+ $PKG/usr/doc/${PKGNAM}-$VERSION
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/source/a/efibootmgr/slack-desc b/source/a/efibootmgr/slack-desc
new file mode 100644
index 00000000..953b4b2a
--- /dev/null
+++ b/source/a/efibootmgr/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+efibootmgr: efibootmgr (tool to modify UEFI boot entries)
+efibootmgr:
+efibootmgr: efibootmgr is a Linux userspace application to modify the Intel
+efibootmgr: Extensible Firmware Interface (EFI) Boot Manager. This application
+efibootmgr: can create and destroy boot entries, change the boot order, change
+efibootmgr: the next running boot option, and more.
+efibootmgr:
+efibootmgr: Homepage: http://linux.dell.com/efibootmgr
+efibootmgr:
+efibootmgr:
+efibootmgr: