diff --git a/0026-Use-EFI-canonical-names-everywhere-the-compiler-does.patch b/0026-Use-EFI-canonical-names-everywhere-the-compiler-does.patch new file mode 100644 index 0000000..b1a8732 --- /dev/null +++ b/0026-Use-EFI-canonical-names-everywhere-the-compiler-does.patch @@ -0,0 +1,481 @@ +From a92a9ed2db67c415c7bad5a9b041aca4efc33cf2 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 1 May 2018 14:12:01 -0400 +Subject: [PATCH] Use EFI canonical names everywhere the compiler doesn't care. + +Always use x64/X64 and aa64/AA64 unless the toolchain cares about +"x86_64" or whatnot. + +Signed-off-by: Peter Jones +--- + gnuefi/{reloc_aarch64.c => reloc_aa64.c} | 2 +- + gnuefi/{reloc_x86_64.c => reloc_x64.c} | 2 +- + lib/{aarch64 => aa64}/initplat.c | 0 + lib/{aarch64 => aa64}/math.c | 0 + lib/{x86_64 => x64}/callwrap.c | 0 + lib/{x86_64 => x64}/initplat.c | 0 + lib/{x86_64 => x64}/math.c | 0 + inc/{aarch64 => aa64}/efibind.h | 4 ++- + inc/{aarch64 => aa64}/efilibplat.h | 0 + inc/{aarch64 => aa64}/efisetjmp_arch.h | 6 ++-- + inc/efiapi.h | 5 ++- + inc/efidebug.h | 2 +- + inc/{x86_64 => x64}/efibind.h | 4 +-- + inc/{x86_64 => x64}/efilibplat.h | 0 + inc/{x86_64 => x64}/efisetjmp_arch.h | 6 ++-- + inc/{x86_64 => x64}/pe.h | 0 + gnuefi/{crt0-efi-aarch64.S => crt0-efi-aa64.S} | 2 +- + gnuefi/{crt0-efi-x86_64.S => crt0-efi-x64.S} | 2 +- + lib/{aarch64 => aa64}/efi_stub.S | 0 + lib/{aarch64 => aa64}/setjmp.S | 0 + lib/{x86_64 => x64}/efi_stub.S | 0 + lib/{x86_64 => x64}/setjmp.S | 0 + Make.defaults | 39 +++++++++++++++------- + README.gnuefi | 6 ++-- + apps/Makefile | 2 +- + gnuefi/Makefile | 6 ++-- + gnuefi/{elf_aarch64_efi.lds => elf_aa64_efi.lds} | 0 + gnuefi/{elf_x86_64_efi.lds => elf_x64_efi.lds} | 2 +- + ...lf_x86_64_fbsd_efi.lds => elf_x64_fbsd_efi.lds} | 2 +- + lib/Makefile | 4 +-- + 30 files changed, 58 insertions(+), 38 deletions(-) + rename gnuefi/{reloc_aarch64.c => reloc_aa64.c} (97%) + rename gnuefi/{reloc_x86_64.c => reloc_x64.c} (97%) + rename lib/{aarch64 => aa64}/initplat.c (100%) + rename lib/{aarch64 => aa64}/math.c (100%) + rename lib/{x86_64 => x64}/callwrap.c (100%) + rename lib/{x86_64 => x64}/initplat.c (100%) + rename lib/{x86_64 => x64}/math.c (100%) + rename inc/{aarch64 => aa64}/efibind.h (98%) + rename inc/{aarch64 => aa64}/efilibplat.h (100%) + rename inc/{aarch64 => aa64}/efisetjmp_arch.h (78%) + rename inc/{x86_64 => x64}/efibind.h (99%) + rename inc/{x86_64 => x64}/efilibplat.h (100%) + rename inc/{x86_64 => x64}/efisetjmp_arch.h (71%) + rename inc/{x86_64 => x64}/pe.h (100%) + rename gnuefi/{crt0-efi-aarch64.S => crt0-efi-aa64.S} (98%) + rename gnuefi/{crt0-efi-x86_64.S => crt0-efi-x64.S} (97%) + rename lib/{aarch64 => aa64}/efi_stub.S (100%) + rename lib/{aarch64 => aa64}/setjmp.S (100%) + rename lib/{x86_64 => x64}/efi_stub.S (100%) + rename lib/{x86_64 => x64}/setjmp.S (100%) + rename gnuefi/{elf_aarch64_efi.lds => elf_aa64_efi.lds} (100%) + rename gnuefi/{elf_x86_64_efi.lds => elf_x64_efi.lds} (93%) + rename gnuefi/{elf_x86_64_fbsd_efi.lds => elf_x64_fbsd_efi.lds} (93%) + +diff --git a/gnuefi/reloc_aarch64.c b/gnuefi/reloc_aa64.c +similarity index 97% +rename from gnuefi/reloc_aarch64.c +rename to gnuefi/reloc_aa64.c +index 086727961c2..f2ac52b1269 100644 +--- a/gnuefi/reloc_aarch64.c ++++ b/gnuefi/reloc_aa64.c +@@ -1,4 +1,4 @@ +-/* reloc_aarch64.c - position independent x86 ELF shared object relocator ++/* reloc_aa64.c - position independent ARM Aarch64 ELF shared object relocator + Copyright (C) 2014 Linaro Ltd. + Copyright (C) 1999 Hewlett-Packard Co. + Contributed by David Mosberger . +diff --git a/gnuefi/reloc_x86_64.c b/gnuefi/reloc_x64.c +similarity index 97% +rename from gnuefi/reloc_x86_64.c +rename to gnuefi/reloc_x64.c +index 04b75b29fda..09493227a7b 100644 +--- a/gnuefi/reloc_x86_64.c ++++ b/gnuefi/reloc_x64.c +@@ -1,4 +1,4 @@ +-/* reloc_x86_64.c - position independent x86_64 ELF shared object relocator ++/* reloc_x64.c - position independent x86_64 ELF shared object relocator + Copyright (C) 1999 Hewlett-Packard Co. + Contributed by David Mosberger . + Copyright (C) 2005 Intel Co. +diff --git a/lib/aarch64/initplat.c b/lib/aa64/initplat.c +similarity index 100% +rename from lib/aarch64/initplat.c +rename to lib/aa64/initplat.c +diff --git a/lib/aarch64/math.c b/lib/aa64/math.c +similarity index 100% +rename from lib/aarch64/math.c +rename to lib/aa64/math.c +diff --git a/lib/x86_64/callwrap.c b/lib/x64/callwrap.c +similarity index 100% +rename from lib/x86_64/callwrap.c +rename to lib/x64/callwrap.c +diff --git a/lib/x86_64/initplat.c b/lib/x64/initplat.c +similarity index 100% +rename from lib/x86_64/initplat.c +rename to lib/x64/initplat.c +diff --git a/lib/x86_64/math.c b/lib/x64/math.c +similarity index 100% +rename from lib/x86_64/math.c +rename to lib/x64/math.c +diff --git a/inc/aarch64/efibind.h b/inc/aa64/efibind.h +similarity index 98% +rename from inc/aarch64/efibind.h +rename to inc/aa64/efibind.h +index bdaa5238e84..8a35a25e3a7 100644 +--- a/inc/aarch64/efibind.h ++++ b/inc/aa64/efibind.h +@@ -14,7 +14,8 @@ + * GNU General Public License as published by the Free Software Foundation; + * either version 2 of the License, or (at your option) any later version. + */ +- ++#ifndef GNU_EFI_AA64_EFI_BIND_H ++#define GNU_EFI_AA64_EFI_BIND_H + #if !defined(_MSC_VER) && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )) + + // ANSI C 1999/2000 stdint.h integer width declarations +@@ -154,3 +155,4 @@ typedef uint64_t UINTN; + + #define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__) + #define EFI_FUNCTION ++#endif /* GNU_EFI_AA64_EFI_BIND_H */ +diff --git a/inc/aarch64/efilibplat.h b/inc/aa64/efilibplat.h +similarity index 100% +rename from inc/aarch64/efilibplat.h +rename to inc/aa64/efilibplat.h +diff --git a/inc/aarch64/efisetjmp_arch.h b/inc/aa64/efisetjmp_arch.h +similarity index 78% +rename from inc/aarch64/efisetjmp_arch.h +rename to inc/aa64/efisetjmp_arch.h +index abd7a0e9ad9..d4c17578dd2 100644 +--- a/inc/aarch64/efisetjmp_arch.h ++++ b/inc/aa64/efisetjmp_arch.h +@@ -1,5 +1,5 @@ +-#ifndef GNU_EFI_AARCH64_SETJMP_H +-#define GNU_EFI_AARCH64_SETJMP_H ++#ifndef GNU_EFI_AA64_SETJMP_H ++#define GNU_EFI_AA64_SETJMP_H + + #define JMPBUF_ALIGN 8 + +@@ -30,4 +30,4 @@ typedef struct { + UINT64 D15; + } ALIGN(JMPBUF_ALIGN) jmp_buf; + +-#endif /* GNU_EFI_AARCH64_SETJMP_H */ ++#endif /* GNU_EFI_AA64_SETJMP_H */ +diff --git a/inc/efiapi.h b/inc/efiapi.h +index e7d2abd79de..6355a2ff899 100644 +--- a/inc/efiapi.h ++++ b/inc/efiapi.h +@@ -338,8 +338,11 @@ EFI_STATUS + #define EFI_IMAGE_MACHINE_ARMTHUMB_MIXED 0x01C2 + #endif + ++#if !defined(EFI_IMAGE_MACHINE_AA64) ++#define EFI_IMAGE_MACHINE_AA64 0xAA64 ++#endif + #if !defined(EFI_IMAGE_MACHINE_AARCH64) +-#define EFI_IMAGE_MACHINE_AARCH64 0xAA64 ++#define EFI_IMAGE_MACHINE_AARCH64 EFI_IMAGE_MACHINE_AA64 + #endif + + // Image Entry prototype +diff --git a/inc/efidebug.h b/inc/efidebug.h +index 8e54dcda842..3649edf26d1 100644 +--- a/inc/efidebug.h ++++ b/inc/efidebug.h +@@ -533,7 +533,7 @@ typedef enum { + IsaIpf = EFI_IMAGE_MACHINE_IA64, + IsaEbc = EFI_IMAGE_MACHINE_EBC, + IsaArm = EFI_IMAGE_MACHINE_ARMTHUMB_MIXED, +-// IsaArm64 = EFI_IMAGE_MACHINE_AARCH64 ++// IsaArm64 = EFI_IMAGE_MACHINE_AA64 + } EFI_INSTRUCTION_SET_ARCHITECTURE; + + // +diff --git a/inc/x86_64/efibind.h b/inc/x64/efibind.h +similarity index 99% +rename from inc/x86_64/efibind.h +rename to inc/x64/efibind.h +index 4309f9f0e17..75e0dde35b6 100644 +--- a/inc/x86_64/efibind.h ++++ b/inc/x64/efibind.h +@@ -16,8 +16,8 @@ Abstract: + Revision History + + --*/ +-#ifndef X86_64_EFI_BIND +-#define X86_64_EFI_BIND ++#ifndef X64_EFI_BIND ++#define X64_EFI_BIND + #ifndef __GNUC__ + #pragma pack() + #endif +diff --git a/inc/x86_64/efilibplat.h b/inc/x64/efilibplat.h +similarity index 100% +rename from inc/x86_64/efilibplat.h +rename to inc/x64/efilibplat.h +diff --git a/inc/x86_64/efisetjmp_arch.h b/inc/x64/efisetjmp_arch.h +similarity index 71% +rename from inc/x86_64/efisetjmp_arch.h +rename to inc/x64/efisetjmp_arch.h +index a489993c174..6f774f9cb33 100644 +--- a/inc/x86_64/efisetjmp_arch.h ++++ b/inc/x64/efisetjmp_arch.h +@@ -1,5 +1,5 @@ +-#ifndef GNU_EFI_X86_64_SETJMP_H +-#define GNU_EFI_X86_64_SETJMP_H ++#ifndef GNU_EFI_X64_SETJMP_H ++#define GNU_EFI_X64_SETJMP_H + + #define JMPBUF_ALIGN 8 + +@@ -19,4 +19,4 @@ typedef struct { + UINT8 XmmBuffer[160]; // XMM6 - XMM15 + } ALIGN(JMPBUF_ALIGN) jmp_buf; + +-#endif /* GNU_EFI_X86_64_SETJMP_H */ ++#endif /* GNU_EFI_X64_SETJMP_H */ +diff --git a/inc/x86_64/pe.h b/inc/x64/pe.h +similarity index 100% +rename from inc/x86_64/pe.h +rename to inc/x64/pe.h +diff --git a/gnuefi/crt0-efi-aarch64.S b/gnuefi/crt0-efi-aa64.S +similarity index 98% +rename from gnuefi/crt0-efi-aarch64.S +rename to gnuefi/crt0-efi-aa64.S +index c300d89bdfd..d6e610b8c79 100644 +--- a/gnuefi/crt0-efi-aarch64.S ++++ b/gnuefi/crt0-efi-aa64.S +@@ -1,5 +1,5 @@ + /* +- * crt0-efi-aarch64.S - PE/COFF header for AArch64 EFI applications ++ * crt0-efi-aa64.S - PE/COFF header for AArch64 EFI applications + * + * Copright (C) 2014 Linaro Ltd. + * +diff --git a/gnuefi/crt0-efi-x86_64.S b/gnuefi/crt0-efi-x64.S +similarity index 97% +rename from gnuefi/crt0-efi-x86_64.S +rename to gnuefi/crt0-efi-x64.S +index 6839150a72e..6533af7461f 100644 +--- a/gnuefi/crt0-efi-x86_64.S ++++ b/gnuefi/crt0-efi-x64.S +@@ -1,4 +1,4 @@ +-/* crt0-efi-x86_64.S - x86_64 EFI startup code. ++/* crt0-efi-x64.S - x86_64 EFI startup code. + Copyright (C) 1999 Hewlett-Packard Co. + Contributed by David Mosberger . + Copyright (C) 2005 Intel Co. +diff --git a/lib/aarch64/efi_stub.S b/lib/aa64/efi_stub.S +similarity index 100% +rename from lib/aarch64/efi_stub.S +rename to lib/aa64/efi_stub.S +diff --git a/lib/aarch64/setjmp.S b/lib/aa64/setjmp.S +similarity index 100% +rename from lib/aarch64/setjmp.S +rename to lib/aa64/setjmp.S +diff --git a/lib/x86_64/efi_stub.S b/lib/x64/efi_stub.S +similarity index 100% +rename from lib/x86_64/efi_stub.S +rename to lib/x64/efi_stub.S +diff --git a/lib/x86_64/setjmp.S b/lib/x64/setjmp.S +similarity index 100% +rename from lib/x86_64/setjmp.S +rename to lib/x64/setjmp.S +diff --git a/Make.defaults b/Make.defaults +index ba743f17893..7a8a95c5704 100755 +--- a/Make.defaults ++++ b/Make.defaults +@@ -62,17 +62,32 @@ OBJCOPY := $(prefix)$(CROSS_COMPILE)objcopy + + # Host/target identification + OS := $(shell uname -s) +-HOSTARCH ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed -e s,i[3456789]86,ia32, -e 's,armv7.*,arm,' ) +-ARCH ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed -e s,i[3456789]86,ia32, -e 's,armv7.*,arm,' ) ++HOSTARCH ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed \ ++ -e s,i[3456789]86,ia32, \ ++ -e s,amd64,x64, -e s,x86_64,x64, \ ++ -e s,aarch64,aa64, \ ++ -e 's,armv7.*,arm,' \ ++ ) ++ARCH ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed \ ++ -e s,i[3456789]86,ia32, \ ++ -e s,amd64,x64, -e s,x86_64,x64, \ ++ -e s,aarch64,aa64, \ ++ -e 's,armv7.*,arm,' \ ++ ) ++BFD_ARCH ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed \ ++ -e s,i[3456789]86,ia32, \ ++ -e s,amd64,x86_64, \ ++ -e 's,armv7.*,arm,' \ ++ ) + + # Get ARCH from the compiler if cross compiling + ifneq ($(CROSS_COMPILE),) +- override ARCH := $(shell $(CC) -dumpmachine | cut -f1 -d-| sed -e s,i[3456789]86,ia32, -e 's,armv7.*,arm,' ) +-endif +- +-# FreeBSD (and possibly others) reports amd64 instead of x86_64 +-ifeq ($(ARCH),amd64) +- override ARCH := x86_64 ++ override ARCH := $(shell $(CC) -dumpmachine | cut -f1 -d- | sed \ ++ -e s,i[3456789]86,ia32, \ ++ -e s,amd64,x64, -e s,x86_64,x64, \ ++ -e s,aarch64,aa64, \ ++ -e 's,armv7.*,arm,' \ ++ ) + endif + + # +@@ -95,12 +110,12 @@ endif + + ifeq ($(ARCH),ia32) + CFLAGS += -mno-mmx -mno-sse +- ifeq ($(HOSTARCH),x86_64) ++ ifeq ($(HOSTARCH),x64) + ARCH3264 = -m32 + endif + endif + +-ifeq ($(ARCH),x86_64) ++ifeq ($(ARCH),x64) + GCCVERSION := $(shell $(CC) -dumpversion | cut -f1 -d.) + GCCMINOR := $(shell $(CC) -dumpversion | cut -f2 -d.) + USING_CLANG := $(shell $(CC) -v 2>&1 | grep -q 'clang version' && echo clang) +@@ -122,7 +137,7 @@ ifeq ($(ARCH),x86_64) + endif + endif + +-ifneq (,$(filter $(ARCH),ia32 x86_64)) ++ifneq (,$(filter $(ARCH),ia32 x64)) + # Disable AVX, if the compiler supports that. + CC_CAN_DISABLE_AVX=$(shell $(CC) -Werror -c -o /dev/null -xc -mno-avx - /dev/null 2>&1 && echo 1) + ifeq ($(CC_CAN_DISABLE_AVX), 1) +@@ -139,7 +154,7 @@ endif + # Set HAVE_EFI_OBJCOPY if objcopy understands --target efi-[app|bsdrv|rtdrv], + # otherwise we need to compose the PE/COFF header using the assembler + # +-ifneq ($(ARCH),aarch64) ++ifneq ($(ARCH),aa64) + ifneq ($(ARCH),arm) + ifneq ($(ARCH),mips64el) + export HAVE_EFI_OBJCOPY=y +diff --git a/README.gnuefi b/README.gnuefi +index 512698c28b4..ac3f0aa6b04 100644 +--- a/README.gnuefi ++++ b/README.gnuefi +@@ -100,7 +100,7 @@ the appropriate compiler, assembler, linker, ar, and ranlib binaries, + respectively. + + If you're working in a cross-development environment, be sure to set +-macro ARCH to the desired target architecture ("ia32" for x86, "x86_64" for ++macro ARCH to the desired target architecture ("ia32" for x86, "x64" for + x86_64 and "ia64" for IA-64). For convenience, this can also be done from + the make command line (e.g., "make ARCH=ia64"). + +@@ -225,7 +225,7 @@ environment addresses each of these issues. + In order to satisfy the COFF constraint of page-sized and page-aligned + sections, the GNU EFI build environment uses the special linker script + in gnuefi/elf_$(ARCH)_efi.lds where $(ARCH) is the target architecture +-("ia32" for x86, "x86_64" for x86_64 and "ia64" for IA-64). ++("ia32" for x86, "x64" for x86_64 and "ia64" for IA-64). + This script is set up to create only eight COFF section, each page aligned + and page sized.These eight sections are used to group together the much + greater number of sections that are typically present in ELF object files. +@@ -319,7 +319,7 @@ environment is to: + + The self-relocator is of course architecture dependent. The x86 + version can be found in gnuefi/reloc_ia32.c, the x86_64 version +-can be found in gnuefi/reloc_x86_64.c and the IA-64 version can be ++can be found in gnuefi/reloc_x64.c and the IA-64 version can be + found in gnuefi/reloc_ia64.S. + + The self-relocator operates as follows: the startup code invokes it +diff --git a/apps/Makefile b/apps/Makefile +index 4e1b69a38c8..51b66a2a78f 100644 +--- a/apps/Makefile ++++ b/apps/Makefile +@@ -68,7 +68,7 @@ TARGET_RTDRIVERS = + + ifneq ($(HAVE_EFI_OBJCOPY),) + +-FORMAT := --target efi-app-$(ARCH) +-$(TARGET_BSDRIVERS): FORMAT=--target efi-bsdrv-$(ARCH) +-$(TARGET_RTDRIVERS): FORMAT=--target efi-rtdrv-$(ARCH) ++FORMAT := --target efi-app-$(BFD_ARCH) ++$(TARGET_BSDRIVERS): FORMAT=--target efi-bsdrv-$(BFD_ARCH) ++$(TARGET_RTDRIVERS): FORMAT=--target efi-rtdrv-$(BFD_ARCH) + +diff --git a/gnuefi/Makefile b/gnuefi/Makefile +index 2a61699ac25..2dc98d3ab3f 100644 +--- a/gnuefi/Makefile ++++ b/gnuefi/Makefile +@@ -47,8 +47,8 @@ FILES = reloc_$(ARCH) + + OBJS = $(FILES:%=%.o) + +-# on aarch64, avoid jump tables before all relocations have been processed +-reloc_aarch64.o: CFLAGS += -fno-jump-tables ++# on aa64, avoid jump tables before all relocations have been processed ++reloc_aa64.o: CFLAGS += -fno-jump-tables + + TARGETS = crt0-efi-$(ARCH).o libgnuefi.a + +@@ -63,7 +63,7 @@ install: + mkdir -p $(INSTALLROOT)$(LIBDIR) + $(INSTALL) -m 644 $(TARGETS) $(INSTALLROOT)$(LIBDIR) + ifneq (,$(findstring FreeBSD,$(OS))) +- ifeq ($(ARCH),x86_64) ++ ifeq ($(ARCH),x64) + $(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_fbsd_efi.lds $(INSTALLROOT)$(LIBDIR) + else + $(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR) +diff --git a/gnuefi/elf_aarch64_efi.lds b/gnuefi/elf_aa64_efi.lds +similarity index 100% +rename from gnuefi/elf_aarch64_efi.lds +rename to gnuefi/elf_aa64_efi.lds +diff --git a/gnuefi/elf_x86_64_efi.lds b/gnuefi/elf_x64_efi.lds +similarity index 93% +rename from gnuefi/elf_x86_64_efi.lds +rename to gnuefi/elf_x64_efi.lds +index 7be59023510..c7a105898c8 100644 +--- a/gnuefi/elf_x86_64_efi.lds ++++ b/gnuefi/elf_x64_efi.lds +@@ -1,4 +1,4 @@ +-/* Same as elf_x86_64_fbsd_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */ ++/* Same as elf_x64_fbsd_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */ + OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") + OUTPUT_ARCH(i386:x86-64) + ENTRY(_start) +diff --git a/gnuefi/elf_x86_64_fbsd_efi.lds b/gnuefi/elf_x64_fbsd_efi.lds +similarity index 93% +rename from gnuefi/elf_x86_64_fbsd_efi.lds +rename to gnuefi/elf_x64_fbsd_efi.lds +index fe1f3342cae..705719bf68b 100644 +--- a/gnuefi/elf_x86_64_fbsd_efi.lds ++++ b/gnuefi/elf_x64_fbsd_efi.lds +@@ -1,4 +1,4 @@ +-/* Same as elf_x86_64_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */ ++/* Same as elf_x64_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */ + OUTPUT_FORMAT("elf64-x86-64-freebsd", "elf64-x86-64-freebsd", "elf64-x86-64-freebsd") + OUTPUT_ARCH(i386:x86-64) + ENTRY(_start) +diff --git a/lib/Makefile b/lib/Makefile +index 0e6410dac55..8bf94000e33 100644 +--- a/lib/Makefile ++++ b/lib/Makefile +@@ -53,7 +53,7 @@ ifeq ($(ARCH),ia64) + FILES += $(ARCH)/salpal $(ARCH)/palproc + endif + +-ifeq ($(ARCH),x86_64) ++ifeq ($(ARCH),x64) + FILES += $(ARCH)/callwrap $(ARCH)/efi_stub + endif + +@@ -64,7 +64,7 @@ endif + + OBJS = $(FILES:%=%.o) + +-SUBDIRS = ia32 x86_64 ia64 aarch64 arm mips64el runtime ++SUBDIRS = ia32 x64 ia64 aa64 arm mips64el runtime + + LIBDIRINSTALL = $(INSTALLROOT)$(LIBDIR) + +-- +2.14.3 + diff --git a/gnu-efi.spec b/gnu-efi.spec index c78aadc..2474b57 100644 --- a/gnu-efi.spec +++ b/gnu-efi.spec @@ -2,12 +2,13 @@ Summary: Development Libraries and headers for EFI Name: gnu-efi Version: 3.0.8 %global tarball_version 3.0.6 -Release: 2%{?dist}%{?buildid} +Release: 3%{?dist}%{?buildid} Epoch: 1 Group: Development/System License: BSD URL: ftp://ftp.hpl.hp.com/pub/linux-ia64 -ExclusiveArch: x86_64 aarch64 %{arm} %{ix86} +ExclusiveArch: %{efi} +BuildRequires: efi-rpm-macros BuildRequires: git %ifarch x86_64 # So... in some build environments, glibc32 provides some headers. In @@ -46,6 +47,7 @@ Patch0022: 0022-Nerf-Werror-pragma-away.patch Patch0023: 0023-Call-ar-in-deterministic-mode.patch Patch0024: 0024-Add-debug-helper-applications.patch Patch0025: 0025-Bump-revision-from-VERSION-3.0.7-to-VERSION-3.0.8.patch +Patch0026: 0026-Use-EFI-canonical-names-everywhere-the-compiler-does.patch %define debug_package %{nil} @@ -62,23 +64,6 @@ Patch0025: 0025-Bump-revision-from-VERSION-3.0.7-to-VERSION-3.0.8.patch # %global __strip "%{__strip} -p" -# Figure out the right file path to use -%global efidir %(eval echo $(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/')) - -%ifarch x86_64 -%global efiarch x86_64 -%endif -%ifarch aarch64 -%global efiarch aarch64 -%endif -%ifarch %{arm} -%global efiarch arm -%endif - -%ifarch %{ix86} -%global efiarch ia32 -%endif - %description This package contains development headers and libraries for developing applications that run under EFI (Extensible Firmware Interface). @@ -116,28 +101,28 @@ git config --unset user.name # Package cannot build with %{?_smp_mflags}. make make apps -%ifarch x86_64 -setarch linux32 -B make ARCH=ia32 PREFIX=%{_prefix} LIBDIR=%{_prefix}/%{lib} -setarch linux32 -B make ARCH=ia32 PREFIX=%{_prefix} LIBDIR=%{_prefix}/%{lib} apps -%endif +if [[ -n "%{efi_alt_arch}" ]] ; then + setarch linux32 -B make ARCH=%{efi_alt_arch} PREFIX=%{_prefix} LIBDIR=%{_prefix}/%{lib} + setarch linux32 -B make ARCH=%{efi_alt_arch} PREFIX=%{_prefix} LIBDIR=%{_prefix}/%{lib} apps +fi %install rm -rf %{buildroot} mkdir -p %{buildroot}/%{_libdir}/gnuefi -mkdir -p %{buildroot}/boot/efi/EFI/%{efidir}/%{efiarch} +mkdir -p %{buildroot}/%{efi_esp_dir}/%{efi_arch} make PREFIX=%{_prefix} LIBDIR=%{_libdir} INSTALLROOT=%{buildroot} install mv %{buildroot}/%{_libdir}/*.lds %{buildroot}/%{_libdir}/*.o %{buildroot}/%{_libdir}/gnuefi -mv %{efiarch}/apps/{route80h.efi,modelist.efi} %{buildroot}/boot/efi/EFI/%{efidir}/%{efiarch}/ +mv %{efi_arch}/apps/{route80h.efi,modelist.efi} %{buildroot}%{efi_esp_dir}/%{efi_arch}/ -%ifarch x86_64 -mkdir -p %{buildroot}/%{_prefix}/%{lib}/gnuefi -mkdir -p %{buildroot}/boot/efi/EFI/%{efidir}/ia32 +if [[ -n "%{efi_alt_arch}" ]] ; then + mkdir -p %{buildroot}/%{_prefix}/%{lib}/gnuefi + mkdir -p %{buildroot}%{efi_esp_dir}/%{efi_alt_arch} -setarch linux32 -B make PREFIX=%{_prefix} LIBDIR=%{_prefix}/%{lib} INSTALLROOT=%{buildroot} ARCH=ia32 install -mv %{buildroot}/%{_prefix}/%{lib}/*.{lds,o} %{buildroot}/%{_prefix}/%{lib}/gnuefi/ -mv ia32/apps/{route80h.efi,modelist.efi} %{buildroot}/boot/efi/EFI/%{efidir}/ia32/ -%endif + setarch linux32 -B make PREFIX=%{_prefix} LIBDIR=%{_prefix}/%{lib} INSTALLROOT=%{buildroot} ARCH=%{efi_alt_arch} install + mv %{buildroot}/%{_prefix}/%{lib}/*.{lds,o} %{buildroot}/%{_prefix}/%{lib}/gnuefi/ + mv %{efi_alt_arch}/apps/{route80h.efi,modelist.efi} %{buildroot}%{efi_esp_dir}/%{efi_alt_arch}/ +fi %files %{_prefix}/%{lib}*/* @@ -148,11 +133,15 @@ mv ia32/apps/{route80h.efi,modelist.efi} %{buildroot}/boot/efi/EFI/%{efidir}/ia3 %{_includedir}/efi %files utils -%dir %attr(0700,root,root) /boot/efi/EFI/%{efidir}/ -%dir %attr(0700,root,root) /boot/efi/EFI/%{efidir}/*/ -%attr(0700,root,root) /boot/efi/EFI/%{efidir}/*/*.efi +%dir %attr(0700,root,root) %{efi_esp_dir}/ +%dir %attr(0700,root,root) %{efi_esp_dir}/*/ +%attr(0700,root,root) %{efi_esp_dir}/*/*.efi %changelog +* Tue May 01 2018 Peter Jones - 3.0.8-3 +- Use efi-rpm-macros instead of defining all the efi directory and arch + stuff ourselves. + * Mon Apr 30 2018 Peter Jones - 3.0.8-2 - Fix permissions on /boot/efi/...