New port: devel/efivar
Tools and library to manipulate EFI variables. Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
166833e55d
commit
04b9b64e7a
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=377450
14 changed files with 340 additions and 0 deletions
|
@ -387,6 +387,7 @@
|
|||
SUBDIR += ebnf2yacc
|
||||
SUBDIR += ecgi
|
||||
SUBDIR += edb
|
||||
SUBDIR += efivar
|
||||
SUBDIR += efl
|
||||
SUBDIR += eggdbus
|
||||
SUBDIR += egypt
|
||||
|
|
51
devel/efivar/Makefile
Normal file
51
devel/efivar/Makefile
Normal file
|
@ -0,0 +1,51 @@
|
|||
# Created by: Edward Tomasz Napierala <trasz@FreeBSD.org>
|
||||
# $FreeBSD$
|
||||
|
||||
PORTNAME= efivar
|
||||
PORTVERSION= 0.15
|
||||
CATEGORIES= devel
|
||||
|
||||
MAINTAINER= trasz@FreeBSD.org
|
||||
COMMENT= Tools and library to manipulate EFI variables
|
||||
|
||||
LICENSE= LGPL21
|
||||
|
||||
LIB_DEPENDS= libpopt.so:${PORTSDIR}/devel/popt
|
||||
|
||||
USE_GCC= 4.8+
|
||||
USE_GITHUB= yes
|
||||
GH_ACCOUNT= vathpela
|
||||
GH_COMMIT= 5776088
|
||||
|
||||
USES= gmake pkgconfig
|
||||
USE_LDCONFIG= yes
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
post-patch:
|
||||
@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/src/efivar.pc.in
|
||||
|
||||
do-install:
|
||||
${INSTALL_PROGRAM} ${WRKSRC}/src/efivar ${STAGEDIR}${PREFIX}/bin
|
||||
${INSTALL_LIB} ${WRKSRC}/src/libefivar.so ${STAGEDIR}${PREFIX}/lib
|
||||
${INSTALL_LIB} ${WRKSRC}/src/libefivar.so.0 ${STAGEDIR}${PREFIX}/lib
|
||||
${INSTALL_DATA} ${WRKSRC}/src/efivar.h ${STAGEDIR}${PREFIX}/include
|
||||
${INSTALL_DATA} ${WRKSRC}/src/efivar-guids.h ${STAGEDIR}${PREFIX}/include
|
||||
${INSTALL_DATA} ${WRKSRC}/src/efivar.pc ${STAGEDIR}${PREFIX}/libdata/pkgconfig
|
||||
${INSTALL_MAN} ${WRKSRC}/docs/efivar.1 ${STAGEDIR}${MAN1PREFIX}/man/man1
|
||||
${INSTALL_MAN} ${WRKSRC}/docs/efi_append_variable.3 ${STAGEDIR}${MAN1PREFIX}/man/man3
|
||||
${INSTALL_MAN} ${WRKSRC}/docs/efi_del_variable.3 ${STAGEDIR}${MAN1PREFIX}/man/man3
|
||||
${INSTALL_MAN} ${WRKSRC}/docs/efi_get_next_variable_name.3 ${STAGEDIR}${MAN1PREFIX}/man/man3
|
||||
${INSTALL_MAN} ${WRKSRC}/docs/efi_get_variable.3 ${STAGEDIR}${MAN1PREFIX}/man/man3
|
||||
${INSTALL_MAN} ${WRKSRC}/docs/efi_get_variable_attributes.3 ${STAGEDIR}${MAN1PREFIX}/man/man3
|
||||
${INSTALL_MAN} ${WRKSRC}/docs/efi_get_variable_size.3 ${STAGEDIR}${MAN1PREFIX}/man/man3
|
||||
${INSTALL_MAN} ${WRKSRC}/docs/efi_guid_to_name.3 ${STAGEDIR}${MAN1PREFIX}/man/man3
|
||||
${INSTALL_MAN} ${WRKSRC}/docs/efi_guid_to_str.3 ${STAGEDIR}${MAN1PREFIX}/man/man3
|
||||
${INSTALL_MAN} ${WRKSRC}/docs/efi_guid_to_symbol.3 ${STAGEDIR}${MAN1PREFIX}/man/man3
|
||||
${INSTALL_MAN} ${WRKSRC}/docs/efi_name_to_guid.3 ${STAGEDIR}${MAN1PREFIX}/man/man3
|
||||
${INSTALL_MAN} ${WRKSRC}/docs/efi_set_variable.3 ${STAGEDIR}${MAN1PREFIX}/man/man3
|
||||
${INSTALL_MAN} ${WRKSRC}/docs/efi_str_to_guid.3 ${STAGEDIR}${MAN1PREFIX}/man/man3
|
||||
${INSTALL_MAN} ${WRKSRC}/docs/efi_symbol_to_guid.3 ${STAGEDIR}${MAN1PREFIX}/man/man3
|
||||
${INSTALL_MAN} ${WRKSRC}/docs/efi_variables_supported.3 ${STAGEDIR}${MAN1PREFIX}/man/man3
|
||||
|
||||
.include <bsd.port.post.mk>
|
2
devel/efivar/distinfo
Normal file
2
devel/efivar/distinfo
Normal file
|
@ -0,0 +1,2 @@
|
|||
SHA256 (efivar-0.15.tar.gz) = 1ca09c58b4071f96783f53aa14d123489d910f6f3a9a12996ea57d0ea5b9f8dc
|
||||
SIZE (efivar-0.15.tar.gz) = 30079
|
10
devel/efivar/files/patch-src-Makefile
Normal file
10
devel/efivar/files/patch-src-Makefile
Normal file
|
@ -0,0 +1,10 @@
|
|||
--- src/Makefile.orig 2015-01-19 15:35:31.000000000 +0100
|
||||
+++ src/Makefile 2015-01-19 15:35:42.000000000 +0100
|
||||
@@ -15,7 +15,6 @@ all : $(LIBTARGETS) $(PCTARGETS) $(BINTA
|
||||
OBJECTS = lib.o vars.o efivarfs.o guid.o guidlist.o guid-symbols.o
|
||||
DEPS = .lib.c.P .efivar.c.P .efivar.h.P .vars.c.P .lib.h.P \
|
||||
.generics.h.P .guid.h.P .guid.c.P
|
||||
-LIBS = dl
|
||||
|
||||
libefivar.a :: $(OBJECTS)
|
||||
|
51
devel/efivar/files/patch-src-efivar.c
Normal file
51
devel/efivar/files/patch-src-efivar.c
Normal file
|
@ -0,0 +1,51 @@
|
|||
--- src/efivar.c.orig 2014-10-15 15:48:49.000000000 +0200
|
||||
+++ src/efivar.c 2015-01-19 15:41:34.000000000 +0100
|
||||
@@ -16,11 +16,11 @@
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
-#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <popt.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
+#include <sys/endian.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -53,7 +53,7 @@ list_all_variables(void)
|
||||
int rc;
|
||||
while ((rc = efi_get_next_variable_name(&guid, &name)) > 0)
|
||||
printf(GUID_FORMAT "-%s\n",
|
||||
- guid->a, guid->b, guid->c, bswap_16(guid->d),
|
||||
+ guid->a, guid->b, guid->c, bswap16(guid->d),
|
||||
guid->e[0], guid->e[1], guid->e[2], guid->e[3],
|
||||
guid->e[4], guid->e[5], name);
|
||||
|
||||
@@ -142,7 +142,7 @@ show_variable(char *guid_name)
|
||||
}
|
||||
|
||||
printf("GUID: "GUID_FORMAT "\n",
|
||||
- guid.a, guid.b, guid.c, bswap_16(guid.d),
|
||||
+ guid.a, guid.b, guid.c, bswap16(guid.d),
|
||||
guid.e[0], guid.e[1], guid.e[2], guid.e[3],
|
||||
guid.e[4], guid.e[5]);
|
||||
printf("Name: \"%s\"\n", name);
|
||||
@@ -240,7 +240,7 @@ prepare_data(const char *filename, void
|
||||
goto err;
|
||||
|
||||
buflen = statbuf.st_size;
|
||||
- buf = mmap(NULL, buflen, PROT_READ, MAP_PRIVATE|MAP_POPULATE, fd, 0);
|
||||
+ buf = mmap(NULL, buflen, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
if (!buf)
|
||||
goto err;
|
||||
|
||||
@@ -338,7 +338,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
printf("{"GUID_FORMAT"} {%s} %s %s\n",
|
||||
guid->guid.a, guid->guid.b,
|
||||
- guid->guid.c, bswap_16(guid->guid.d),
|
||||
+ guid->guid.c, bswap16(guid->guid.d),
|
||||
guid->guid.e[0], guid->guid.e[1],
|
||||
guid->guid.e[2], guid->guid.e[3],
|
||||
guid->guid.e[4], guid->guid.e[5],
|
28
devel/efivar/files/patch-src-efivar.h
Normal file
28
devel/efivar/files/patch-src-efivar.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
--- src/efivar.h.orig 2014-10-15 15:48:49.000000000 +0200
|
||||
+++ src/efivar.h 2015-01-19 15:32:22.000000000 +0100
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
-#include <byteswap.h>
|
||||
|
||||
typedef struct {
|
||||
uint32_t a;
|
||||
@@ -40,7 +39,7 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
#define EFI_GUID(a,b,c,d,e0,e1,e2,e3,e4,e5) \
|
||||
-((efi_guid_t) {(a), (b), (c), bswap_16(d), { (e0), (e1), (e2), (e3), (e4), (e5) }})
|
||||
+((efi_guid_t) {(a), (b), (c), bswap16(d), { (e0), (e1), (e2), (e3), (e4), (e5) }})
|
||||
|
||||
#define EFI_GLOBAL_GUID EFI_GUID(0x8be4df61,0x93ca,0x11d2,0xaa0d,0x00,0xe0,0x98,0x03,0x2b,0x8c)
|
||||
|
||||
@@ -85,7 +84,7 @@ efi_set_variable(efi_guid_t guid, const
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (__va_arg_pack_len() == 0)
|
||||
+ if (__builtin_va_arg_pack_len() == 0)
|
||||
return _efi_set_variable(guid, name, data, data_size,
|
||||
attributes, 0644);
|
||||
|
19
devel/efivar/files/patch-src-efivar.pc.in
Normal file
19
devel/efivar/files/patch-src-efivar.pc.in
Normal file
|
@ -0,0 +1,19 @@
|
|||
--- src/efivar.pc.in.orig 2014-10-15 15:48:49.000000000 +0200
|
||||
+++ src/efivar.pc.in 2015-01-19 16:23:12.000000000 +0100
|
||||
@@ -1,10 +1,11 @@
|
||||
-prefix=/usr
|
||||
-exec_prefix=/usr
|
||||
-libdir=@@LIBDIR@@
|
||||
-includedir=/usr/include
|
||||
+prefix=%%PREFIX%%
|
||||
+exec_prefix=${prefix}
|
||||
+libdir=${exec_prefix}/lib
|
||||
+includedir=${prefix}/include
|
||||
|
||||
Name: efivar
|
||||
Description: UEFI Variable Management
|
||||
Version: @@VERSION@@
|
||||
Requires:
|
||||
-Libs: -L${libdir} -lefivar -ldl
|
||||
+Libs: -L${libdir} -lefivar
|
||||
+Cflags: -I${includedir}
|
29
devel/efivar/files/patch-src-efivarfs.c
Normal file
29
devel/efivar/files/patch-src-efivarfs.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
--- src/efivarfs.c.orig 2015-01-19 15:38:34.000000000 +0100
|
||||
+++ src/efivarfs.c 2015-01-19 15:40:15.000000000 +0100
|
||||
@@ -18,15 +18,15 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
-#include <linux/magic.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
+#include <sys/mount.h>
|
||||
#include <sys/types.h>
|
||||
+#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/uio.h>
|
||||
-#include <sys/vfs.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "lib.h"
|
||||
@@ -66,7 +66,7 @@ efivarfs_probe(void)
|
||||
#define make_efivarfs_path(str, guid, name) ({ \
|
||||
asprintf(str, EFIVARS_PATH "%s-" GUID_FORMAT, \
|
||||
name, (guid).a, (guid).b, (guid).c, \
|
||||
- bswap_16((guid).d), \
|
||||
+ bswap16((guid).d), \
|
||||
(guid).e[0], (guid).e[1], (guid).e[2], \
|
||||
(guid).e[3], (guid).e[4], (guid).e[5]); \
|
||||
})
|
44
devel/efivar/files/patch-src-guid.c
Normal file
44
devel/efivar/files/patch-src-guid.c
Normal file
|
@ -0,0 +1,44 @@
|
|||
--- src/guid.c.orig 2015-01-19 15:37:01.000000000 +0100
|
||||
+++ src/guid.c 2015-01-19 15:37:10.000000000 +0100
|
||||
@@ -41,17 +41,17 @@ efi_guid_to_str(const efi_guid_t *guid,
|
||||
|
||||
if (!sp) {
|
||||
return snprintf(NULL, 0, GUID_FORMAT,
|
||||
- guid->a, guid->b, guid->c, bswap_16(guid->d),
|
||||
+ guid->a, guid->b, guid->c, bswap16(guid->d),
|
||||
guid->e[0], guid->e[1], guid->e[2], guid->e[3],
|
||||
guid->e[4], guid->e[5]);
|
||||
} else if (sp && *sp) {
|
||||
return snprintf(*sp, GUID_LENGTH_WITH_NUL, GUID_FORMAT,
|
||||
- guid->a, guid->b, guid->c, bswap_16(guid->d),
|
||||
+ guid->a, guid->b, guid->c, bswap16(guid->d),
|
||||
guid->e[0], guid->e[1], guid->e[2], guid->e[3],
|
||||
guid->e[4], guid->e[5]);
|
||||
} else {
|
||||
rc = asprintf(&ret, GUID_FORMAT,
|
||||
- guid->a, guid->b, guid->c, bswap_16(guid->d),
|
||||
+ guid->a, guid->b, guid->c, bswap16(guid->d),
|
||||
guid->e[0], guid->e[1], guid->e[2], guid->e[3],
|
||||
guid->e[4], guid->e[5]);
|
||||
if (rc >= 0)
|
||||
@@ -161,17 +161,17 @@ efi_guid_to_id_guid(const efi_guid_t *gu
|
||||
}
|
||||
if (!sp) {
|
||||
return snprintf(NULL, 0, "{"GUID_FORMAT"}",
|
||||
- guid->a, guid->b, guid->c, bswap_16(guid->d),
|
||||
+ guid->a, guid->b, guid->c, bswap16(guid->d),
|
||||
guid->e[0], guid->e[1], guid->e[2], guid->e[3],
|
||||
guid->e[4], guid->e[5]);
|
||||
} else if (sp && *sp) {
|
||||
return snprintf(*sp, GUID_LENGTH_WITH_NUL+2, "{"GUID_FORMAT"}",
|
||||
- guid->a, guid->b, guid->c, bswap_16(guid->d),
|
||||
+ guid->a, guid->b, guid->c, bswap16(guid->d),
|
||||
guid->e[0], guid->e[1], guid->e[2], guid->e[3],
|
||||
guid->e[4], guid->e[5]);
|
||||
}
|
||||
rc = asprintf(&ret, "{"GUID_FORMAT"}",
|
||||
- guid->a, guid->b, guid->c, bswap_16(guid->d),
|
||||
+ guid->a, guid->b, guid->c, bswap16(guid->d),
|
||||
guid->e[0], guid->e[1], guid->e[2], guid->e[3],
|
||||
guid->e[4], guid->e[5]);
|
||||
if (rc >= 0)
|
20
devel/efivar/files/patch-src-guid.h
Normal file
20
devel/efivar/files/patch-src-guid.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
--- src/guid.h.orig 2014-10-15 15:48:49.000000000 +0200
|
||||
+++ src/guid.h 2015-01-19 15:34:12.000000000 +0100
|
||||
@@ -19,7 +19,7 @@
|
||||
#ifndef LIBEFIVAR_GUID_H
|
||||
#define LIBEFIVAR_GUID_H 1
|
||||
|
||||
-#include <endian.h>
|
||||
+#include <sys/endian.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
@@ -111,7 +111,7 @@ text_to_guid(const char *text, efi_guid_
|
||||
strncpy(fourbytes, text+19, 4);
|
||||
if (check_segment_sanity(fourbytes, 4) < 0)
|
||||
return -1;
|
||||
- guid->d = bswap_16((uint16_t)strtoul(fourbytes, NULL, 16));
|
||||
+ guid->d = bswap16((uint16_t)strtoul(fourbytes, NULL, 16));
|
||||
|
||||
/* 84be9c3e-8a32-42c0-891c-4cd3b072becc
|
||||
* ^ */
|
14
devel/efivar/files/patch-src-test-tester.c
Normal file
14
devel/efivar/files/patch-src-test-tester.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
--- src/test/tester.c.orig 2015-01-19 15:43:11.000000000 +0100
|
||||
+++ src/test/tester.c 2015-01-19 15:43:31.000000000 +0100
|
||||
@@ -1,10 +1,10 @@
|
||||
-#include <alloca.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
+#include <sys/endian.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
47
devel/efivar/files/patch-src-vars.c
Normal file
47
devel/efivar/files/patch-src-vars.c
Normal file
|
@ -0,0 +1,47 @@
|
|||
--- src/vars.c.orig 2015-01-19 15:36:23.000000000 +0100
|
||||
+++ src/vars.c 2015-01-19 15:36:36.000000000 +0100
|
||||
@@ -94,7 +94,7 @@ vars_get_variable_size(efi_guid_t guid,
|
||||
|
||||
char *path = NULL;
|
||||
int rc = asprintf(&path, VARS_PATH "%s-"GUID_FORMAT"/size",
|
||||
- name, guid.a, guid.b, guid.c, bswap_16(guid.d),
|
||||
+ name, guid.a, guid.b, guid.c, bswap16(guid.d),
|
||||
guid.e[0], guid.e[1], guid.e[2], guid.e[3],
|
||||
guid.e[4], guid.e[5]);
|
||||
if (rc < 0)
|
||||
@@ -146,7 +146,7 @@ vars_get_variable(efi_guid_t guid, const
|
||||
size_t bufsize = -1;
|
||||
char *path;
|
||||
int rc = asprintf(&path, VARS_PATH "%s-" GUID_FORMAT "/raw_var",
|
||||
- name, guid.a, guid.b, guid.c, bswap_16(guid.d),
|
||||
+ name, guid.a, guid.b, guid.c, bswap16(guid.d),
|
||||
guid.e[0], guid.e[1], guid.e[2],
|
||||
guid.e[3], guid.e[4], guid.e[5]);
|
||||
if (rc < 0)
|
||||
@@ -193,7 +193,7 @@ vars_del_variable(efi_guid_t guid, const
|
||||
int ret = -1;
|
||||
char *path;
|
||||
int rc = asprintf(&path, VARS_PATH "%s-" GUID_FORMAT "/raw_var",
|
||||
- name, guid.a, guid.b, guid.c, bswap_16(guid.d),
|
||||
+ name, guid.a, guid.b, guid.c, bswap16(guid.d),
|
||||
guid.e[0], guid.e[1], guid.e[2],
|
||||
guid.e[3], guid.e[4], guid.e[5]);
|
||||
if (rc < 0)
|
||||
@@ -280,7 +280,7 @@ vars_chmod_variable(efi_guid_t guid, con
|
||||
|
||||
char *path;
|
||||
int rc = asprintf(&path, VARS_PATH "%s-" GUID_FORMAT,
|
||||
- name, guid.a, guid.b, guid.c, bswap_16(guid.d),
|
||||
+ name, guid.a, guid.b, guid.c, bswap16(guid.d),
|
||||
guid.e[0], guid.e[1], guid.e[2], guid.e[3],
|
||||
guid.e[4], guid.e[5]);
|
||||
if (rc < 0)
|
||||
@@ -312,7 +312,7 @@ vars_set_variable(efi_guid_t guid, const
|
||||
|
||||
char *path;
|
||||
int rc = asprintf(&path, VARS_PATH "%s-" GUID_FORMAT "/data",
|
||||
- name, guid.a, guid.b, guid.c, bswap_16(guid.d),
|
||||
+ name, guid.a, guid.b, guid.c, bswap16(guid.d),
|
||||
guid.e[0], guid.e[1], guid.e[2], guid.e[3],
|
||||
guid.e[4], guid.e[5]);
|
||||
if (rc < 0)
|
3
devel/efivar/pkg-descr
Normal file
3
devel/efivar/pkg-descr
Normal file
|
@ -0,0 +1,3 @@
|
|||
Tools and library to manipulate EFI variables.
|
||||
|
||||
WWW: https://github.com/vathpela/efivar
|
21
devel/efivar/pkg-plist
Normal file
21
devel/efivar/pkg-plist
Normal file
|
@ -0,0 +1,21 @@
|
|||
bin/efivar
|
||||
include/efivar-guids.h
|
||||
include/efivar.h
|
||||
lib/libefivar.so
|
||||
lib/libefivar.so.0
|
||||
libdata/pkgconfig/efivar.pc
|
||||
man/man1/efivar.1.gz
|
||||
man/man3/efi_append_variable.3.gz
|
||||
man/man3/efi_del_variable.3.gz
|
||||
man/man3/efi_get_next_variable_name.3.gz
|
||||
man/man3/efi_get_variable.3.gz
|
||||
man/man3/efi_get_variable_attributes.3.gz
|
||||
man/man3/efi_get_variable_size.3.gz
|
||||
man/man3/efi_guid_to_name.3.gz
|
||||
man/man3/efi_guid_to_str.3.gz
|
||||
man/man3/efi_guid_to_symbol.3.gz
|
||||
man/man3/efi_name_to_guid.3.gz
|
||||
man/man3/efi_set_variable.3.gz
|
||||
man/man3/efi_str_to_guid.3.gz
|
||||
man/man3/efi_symbol_to_guid.3.gz
|
||||
man/man3/efi_variables_supported.3.gz
|
Loading…
Reference in a new issue