Skip to content

Commit

Permalink
[sys-boot/efibootmgr sys-libs/efivar] copy versions from portage
Browse files Browse the repository at this point in the history
  • Loading branch information
mudler committed Sep 17, 2016
1 parent 2681c06 commit 192769c
Show file tree
Hide file tree
Showing 9 changed files with 265 additions and 0 deletions.
1 change: 1 addition & 0 deletions sys-boot/efibootmgr/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DIST efibootmgr-0.12.tar.bz2 35816 SHA256 a66f5850677e86255d93cb1cead04c3c48a823a2b864c579321f2a07f00256e6 SHA512 ca3d4a582a95465c73ca01faa004f300d92e5fae3251eeda8c50017532ddfb7034721ef161563350dd9af1259d4536b03269b58ffcd2ae2258c90edb72f83ec6 WHIRLPOOL 83b6f5a790638ffc6998e7db3bf9d3f78799ee566a9e4776e962edeab9faa60b154136aaf7e93fa3bb140ddb35ed006303c6cf5c59ebeb3a7d8357c567311e5f
36 changes: 36 additions & 0 deletions sys-boot/efibootmgr/efibootmgr-0.12.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5

inherit toolchain-funcs

DESCRIPTION="User-space application to modify the EFI boot manager"
HOMEPAGE="https://github.com/rhinstaller/efibootmgr"
SRC_URI="https://github.com/rhinstaller/${PN}/releases/download/${P}/${P}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 ia64 x86"
IUSE=""

RDEPEND="sys-apps/pciutils
>=sys-libs/efivar-0.19"
DEPEND="${RDEPEND}"

src_prepare() {
sed -i -e s/-Werror// Makefile || die
}

src_configure() {
tc-export CC
export EXTRA_CFLAGS=${CFLAGS}
}

src_install() {
# build system uses perl, so just do it ourselves
dosbin src/efibootmgr/efibootmgr
doman src/man/man8/efibootmgr.8
dodoc AUTHORS README doc/ChangeLog doc/TODO
}
40 changes: 40 additions & 0 deletions sys-boot/efibootmgr/files/efibootmgr-error-reporting.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@@ -, +, @@
---
src/lib/efivars_sysfs.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
--- a/src/lib/efivars_sysfs.c
+++ a/src/lib/efivars_sysfs.c
@@ -66,6 +66,7 @@ static efi_status_t
sysfs_write_variable(const char *filename, efi_variable_t *var)
{
int fd;
+ int rc = EFI_SUCCESS;
size_t writesize;
char buffer[PATH_MAX+40];

@@ -77,12 +78,21 @@ sysfs_write_variable(const char *filename, efi_variable_t *var)
return EFI_INVALID_PARAMETER;
}
writesize = write(fd, var, sizeof(*var));
+ if (writesize == -1) {
+ if (errno == -ENOSPC)
+ rc = EFI_OUT_OF_RESOURCES;
+ else
+ rc = EFI_INVALID_PARAMETER;
+ goto out;
+ }
if (writesize != sizeof(*var)) {
- close(fd);
- return EFI_INVALID_PARAMETER;
+ rc = EFI_INVALID_PARAMETER;
}
+out:
+ if (rc != EFI_SUCCESS)
+ fprintf(stderr, "Failed to write variable: %s\n", strerror(errno));
close(fd);
- return EFI_SUCCESS;
+ return rc;
}


--
1 change: 1 addition & 0 deletions sys-libs/efivar/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DIST efivar-0.23.tar.bz2 67558 SHA256 9ca81f56b0c9177b6536c8187c9cf5974723abcaf57cd34173500c80bff3caa4 SHA512 ff95c735425708cef0f85f1e9f8909e64651d10c303927d9e77d44fcb0a02ec90e4a364b0315cc3f5e30d77059ed2d8f43cc1efbed2db09a695ef7a6f1bb58f4 WHIRLPOOL 35207e4040041c03d105bbf7b2f7f103f1415dbc51dce9614ddba99786b6cacdf88136ab3a888551cf494c3d55685c7991c72fac1c6223255128c7c191e0318c
45 changes: 45 additions & 0 deletions sys-libs/efivar/efivar-0.23.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5

inherit eutils multilib toolchain-funcs

DESCRIPTION="Tools and library to manipulate EFI variables"
HOMEPAGE="https://github.com/rhinstaller/efivar"
SRC_URI="https://github.com/rhinstaller/${PN}/releases/download/${PV}/${P}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ia64 ~x86"

RDEPEND="dev-libs/popt"
DEPEND="${RDEPEND}
>=sys-kernel/linux-headers-3.18"

src_prepare() {
epatch "${FILESDIR}/0.21-nvme_ioctl.h.patch"
epatch "${FILESDIR}/0.23-sysmacros.patch"
epatch_user
}

src_configure() {
tc-export CC
tc-ld-disable-gold
export libdir="/usr/$(get_libdir)"
unset LIBS # Bug 562004
}

src_compile() {
# Avoid building static binary/libs
opts=(
BINTARGETS=efivar
STATICLIBTARGETS=
)
emake "${opts[@]}"
}

src_install() {
emake "${opts[@]}" DESTDIR="${D}" install
}
42 changes: 42 additions & 0 deletions sys-libs/efivar/files/0.21-initializer.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
From a3606c02fd271d32e364fcc540e34ba1899309f6 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 14 Jul 2015 09:33:54 -0400
Subject: [PATCH] Sometimes the compiler doesn't like { 0, } as an
initializer...

Because it really wants to be { {0, },} or something, and sometimes the
compiler, knowing full well what we're trying to do, likes to complain
about the rigor applied to our technique in doing it.

memset() the struct ifreq to 0 instead so I don't need to figure out its
internal structure just to zero it out.

Resolves #28

Signed-off-by: Peter Jones <pjones@redhat.com>
---
src/linux.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/linux.c b/src/linux.c
index 57f71f3..817b8e6 100644
--- a/src/linux.c
+++ b/src/linux.c
@@ -847,12 +847,13 @@ ssize_t
__attribute__((__visibility__ ("hidden")))
make_mac_path(uint8_t *buf, ssize_t size, const char * const ifname)
{
- struct ifreq ifr = { 0, };
+ struct ifreq ifr;
struct ethtool_drvinfo drvinfo = { 0, };
int fd, rc;
ssize_t ret = -1, sz, off=0;
char busname[PATH_MAX+1] = "";

+ memset(&ifr, 0, sizeof (ifr));
strncpy(ifr.ifr_name, ifname, IF_NAMESIZE);
drvinfo.cmd = ETHTOOL_GDRVINFO;
ifr.ifr_data = (caddr_t)&drvinfo;
--
2.4.6

30 changes: 30 additions & 0 deletions sys-libs/efivar/files/0.21-nvme_ioctl.h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
From ae0869b71a90bc14e67f3c917bd9c96db25c99a6 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Thu, 14 Jan 2016 17:02:31 -0500
Subject: [PATCH] Workaround rename of linux/nvme.h

Bug: https://bugs.gentoo.org/571548
---
src/linux.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/src/linux.c b/src/linux.c
index 5ebc151..e551377 100644
--- a/src/linux.c
+++ b/src/linux.c
@@ -22,7 +22,12 @@
#include <inttypes.h>
#include <limits.h>
#include <linux/ethtool.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)
+#include <linux/nvme_ioctl.h>
+#else
#include <linux/nvme.h>
+#endif
#include <linux/sockios.h>
#include <net/if.h>
#include <scsi/scsi.h>
--
2.7.0

41 changes: 41 additions & 0 deletions sys-libs/efivar/files/0.22-flags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
From 5bc17590cb096340fc695da3020883130437d745 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Fri, 12 Feb 2016 13:22:13 -0500
Subject: [PATCH] Make.defaults: Improve gcc/clang detection

The old filter only matched "gcc" or "clang".

The new findstring call matches any occurance of gcc or clang. This is
useful when CC includes the full host tuple, like x86_64-pc-linux-gnu-gcc.

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
Make.defaults | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Make.defaults b/Make.defaults
index bf814b8..5aed21e 100644
--- a/Make.defaults
+++ b/Make.defaults
@@ -25,14 +25,14 @@ PKGS =
clang_cflags =
gcc_cflags = -specs=$(TOPDIR)/gcc.specs
cflags = $(CFLAGS) -I${TOPDIR}/src/include/efivar/ \
- $(if $(filter $(CC),clang),$(clang_cflags),) \
- $(if $(filter $(CC),gcc),$(gcc_cflags),) \
+ $(if $(findstring clang,$(CC)),$(clang_cflags),) \
+ $(if $(findstring gcc,$(CC)),$(gcc_cflags),) \
$(call pkg-config-cflags)
clang_ccldflags =
gcc_ccldflags =
ccldflags = $(cflags) $(CCLDFLAGS) $(LDFLAGS) \
- $(if $(filter $(CCLD),clang),$(clang_ccldflags),) \
- $(if $(filter $(CCLD),gcc),$(gcc_ccldflags),) \
+ $(if $(findstring clang,$(CCLD)),$(clang_ccldflags),) \
+ $(if $(findstring gcc,$(CCLD)),$(gcc_ccldflags),) \
$(call pkg-config-ccldflags)
SOFLAGS=-shared
LDLIBS=$(foreach lib,$(LIBS),-l$(lib)) $(call pkg-config-ldlibs)
--
2.7.1

29 changes: 29 additions & 0 deletions sys-libs/efivar/files/0.23-sysmacros.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
From 554b0255f9ee265f7d093ac875215207fac8fb1e Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Fri, 15 Apr 2016 17:58:15 -0400
Subject: [PATCH] Include sys/sysmacros.h when sys/types.h does not define
major

glibc is planning to drop this from sys/types.h.
---
src/linux.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/src/linux.c b/src/linux.c
index 866455d..fde6947 100644
--- a/src/linux.c
+++ b/src/linux.c
@@ -36,6 +36,10 @@
#include <sys/stat.h>
#include <unistd.h>

+#ifndef major
+#include <sys/sysmacros.h>
+#endif
+
#include <efivar.h>
#include <efiboot.h>

--
2.8.1

0 comments on commit 192769c

Please sign in to comment.