Update to 3.0u
Signed-off-by: Peter Jones <pjones@redhat.com> Conflicts: gnu-efi.spec
This commit is contained in:
parent
8330e26b0c
commit
be24ef3065
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
clog
|
||||
gnu-efi?3.0*.tar.*
|
||||
*.rpm
|
||||
|
@ -1,53 +0,0 @@
|
||||
From d703c370c78578b63e7b5e04a3801c7f5fbf0c94 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Fri, 31 May 2013 15:00:11 -0400
|
||||
Subject: [PATCH] Disable MMX and SSE.
|
||||
|
||||
GCC 4.8.0 adds some optimizations that will use movups/movaps (and use
|
||||
%xmm* registers) when they're faster, and of course that won't work at
|
||||
all since UEFI firmwares aren't guaranteed to initialize the mmx/sse
|
||||
instructions.
|
||||
|
||||
This will be even more annoying, since most UEFI firmwares don't
|
||||
initialize the #DE or #UD trap handlers, and your backtrace will be a
|
||||
random path through uninitialized memory, occasionally including
|
||||
whatever address the IDT has for #UD, but also addresses like "0x4" and
|
||||
"0x507" that you don't normally expect to see in your call path.
|
||||
---
|
||||
Make.defaults | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Make.defaults b/Make.defaults
|
||||
index 0585915..ea7513e 100644
|
||||
--- a/Make.defaults
|
||||
+++ b/Make.defaults
|
||||
@@ -60,7 +60,9 @@ CPPFLAGS = -DCONFIG_$(ARCH)
|
||||
ifeq ($(GCCNEWENOUGH),1)
|
||||
CPPFLAGS += -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args --std=c11
|
||||
endif
|
||||
-CFLAGS = $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -ffreestanding -fno-stack-protector -fno-stack-check
|
||||
+CFLAGS = $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing \
|
||||
+ -fno-merge-constants -ffreestanding -fno-stack-protector \
|
||||
+ -fno-stack-check
|
||||
ASFLAGS = $(ARCH3264)
|
||||
LDFLAGS = -nostdlib --no-undefined
|
||||
INSTALL = install
|
||||
@@ -78,13 +80,14 @@ ifeq ($(ARCH),ia64)
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH), ia32)
|
||||
+ CFLAGS += -mno-mmx -mno-sse
|
||||
ifeq ($(HOSTARCH), x86_64)
|
||||
ARCH3264 = -m32
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH), x86_64)
|
||||
- CFLAGS += -mno-red-zone
|
||||
+ CFLAGS += -mno-red-zone -mno-mmx -mno-sse
|
||||
ifeq ($(HOSTARCH), ia32)
|
||||
ARCH3264 = -m64
|
||||
endif
|
||||
--
|
||||
1.8.2.1
|
||||
|
@ -1,448 +0,0 @@
|
||||
From 52dad0ecd12f938e2dcb9f32c910e580cdf57291 Mon Sep 17 00:00:00 2001
|
||||
From: noxorc <nigel.croxon@hp.com>
|
||||
Date: Wed, 15 May 2013 15:26:16 -0400
|
||||
Subject: [PATCH] - Removes the ElfW() macro usage from reloc_ia32.c and
|
||||
reloc_x86_64.c. These macros only exist in link.h on Linux. On FreeBSD, the
|
||||
equivalent macro is __ElfN(). But the macro usage is redundant. You're only
|
||||
going to compile the ia32 file for IA32 binaries and the x86_64 file for X64
|
||||
binaries. If you had just one file built for both cases, then using the macro
|
||||
might make more sense.
|
||||
|
||||
- Removes the "#define foo_t efi_foo_t" macros from reloc_ia32.c and
|
||||
reloc_x86_64.c.
|
||||
|
||||
- Modifies inc/x86_64/efibind.h and inc/ia32/efibind.h to use the new
|
||||
definitions for uint64_t, int64_t and int8_t. The 64-bit types are now defined
|
||||
as:
|
||||
|
||||
typedef int __attribute__((__mode__(__DI__))) int64_t;
|
||||
typedef unsigned int __attribute__((__mode__(__DI__))) uint64_t;
|
||||
|
||||
This removes the conflict between the host types dragged in by elf.h and the
|
||||
type definitions in efibind.h that made the #define foo_t efi_foo_t" hack
|
||||
necessary. Also, int8_t is now defined as signed char instead of just char
|
||||
(assuming char == signed char is apparently not good enough).
|
||||
|
||||
- Also modifies these files to use stdint.h instead of stdint-gcc.h. It's
|
||||
unclear if this is completely correct, but stdint-gcc.h is not present with
|
||||
all GCC installs, and if you use -std=c99 or later you will force this case to
|
||||
be hit. This also can break clang, which doesn't have a stdint-gcc.h at all.
|
||||
|
||||
- Removes the #include of <link.h> from reloc_ia32.c and reloc_x86_64.c (since
|
||||
with the previous changes it's not needed anymore).
|
||||
|
||||
- Places the #include of <elf.h> after #include <efi>/#include <efilib.h> so
|
||||
that we know the types will always be defined properly, in case you build on a
|
||||
system where <elf.h> doesn't automatically pull in the right header files to
|
||||
define all the needed types. (This actually happens on VxWorks. It's harmless
|
||||
elsewhere. If you don't care about VxWorks, you can leave this out.)
|
||||
|
||||
- Modifies setjmp_ia32.S and setjmp_x86_64.S so to change "function" to
|
||||
@function. The clang compiler doesn't like the former. Clang and GCC both like
|
||||
the latter.
|
||||
|
||||
- Modifles Make.defaults so that if ARCH is detected as "amd64," it's changed
|
||||
to "x86_64." It happens that uname -m on 64-bit FreeBSD reports the former
|
||||
rather than the latter, which breaks the build. This may also be the case on
|
||||
some other OSes. There's a way to force uname(1) to return x86_64 as the
|
||||
machine type, but this way is a little friendlier.
|
||||
|
||||
- Creates gnuefi/elf_ia32_fbsd_efi.lds which specifies the object file type as
|
||||
elf-ia32-freebsd. This is required for building on FreeBSD/i386, not just
|
||||
FreeBSD/amd64.
|
||||
|
||||
- Modifies apps/Makefile to always use
|
||||
$(TOPDIR)/gnuefi/elf_$(ARCH)_fbsd_efi.lds when building on either 32-bit or
|
||||
64-bit FreeBSD instead of just for the x86_64 case.
|
||||
|
||||
- Changed LDFLAGS in Make.defaults to include --no-undefined. This will cause
|
||||
linking to fail if there are any unsatisfied symbols when creating foo.so
|
||||
during any of the app builds, as opposed to just silently succeeding and
|
||||
producing an unusable binary.
|
||||
|
||||
- Changed CFLAGS to include -ffreestanding -fno-stack-protector -fno-stack-
|
||||
check. This prevents clang from inserting a call to memset() when compiling
|
||||
the RtZeroMem() and RtSetMem() routines in lib/runtime/efirtlib.c and guards
|
||||
against the native compiler in some Linux distros from adding in stack
|
||||
checking code which relies on libc help that isn't present in the EFI runtime
|
||||
environment.
|
||||
|
||||
This does the following:
|
||||
|
||||
- Cleans up the ia32 and x86-64 relocation code a bit (tries to break the
|
||||
dependency between the host ELF headers and the EFI runtime environment)
|
||||
- Avoids the dependency on stdint-gcc.h which may not always be available
|
||||
- Allows GNU EFI to build out of the box on both FreeBSD/i386 and
|
||||
FreeBSD/amd64
|
||||
- Allows GNU EFI to build out of the box with either GCC or clang on
|
||||
FreeBSD/i386 and FreeBSD/amd64 9.0 and later.
|
||||
- Makes things a little easier to port to VxWorks
|
||||
- Avoids creating un-runable binaries with unresolved symbol definitions
|
||||
(which can be very confusing to debug)
|
||||
---
|
||||
Make.defaults | 8 +++--
|
||||
apps/Makefile | 4 +--
|
||||
gnuefi/elf_ia32_fbsd_efi.lds | 75 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
gnuefi/reloc_ia32.c | 33 ++++---------------
|
||||
gnuefi/reloc_x86_64.c | 34 ++++----------------
|
||||
gnuefi/setjmp_ia32.S | 2 +-
|
||||
gnuefi/setjmp_x86_64.S | 2 +-
|
||||
inc/ia32/efibind.h | 8 ++---
|
||||
inc/ia64/efibind.h | 2 +-
|
||||
inc/x86_64/efibind.h | 8 ++---
|
||||
10 files changed, 105 insertions(+), 71 deletions(-)
|
||||
create mode 100644 gnuefi/elf_ia32_fbsd_efi.lds
|
||||
|
||||
diff --git a/Make.defaults b/Make.defaults
|
||||
index 38da180..0585915 100644
|
||||
--- a/Make.defaults
|
||||
+++ b/Make.defaults
|
||||
@@ -46,6 +46,10 @@ TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
|
||||
|
||||
HOSTARCH = $(shell uname -m | sed s,i[3456789]86,ia32,)
|
||||
ARCH := $(shell uname -m | sed s,i[3456789]86,ia32,)
|
||||
+# FreeBSD (and possibly others) reports amd64 instead of x86_64
|
||||
+ifeq ($(ARCH), amd64)
|
||||
+ARCH = x86_64
|
||||
+endif
|
||||
OS = $(shell uname -s)
|
||||
INCDIR = -I$(SRCDIR) -I$(TOPDIR)/inc -I$(TOPDIR)/inc/$(ARCH) -I$(TOPDIR)/inc/protocol
|
||||
GCCVERSION := $(shell gcc -dumpversion | cut -f1 -d.)
|
||||
@@ -56,9 +60,9 @@ CPPFLAGS = -DCONFIG_$(ARCH)
|
||||
ifeq ($(GCCNEWENOUGH),1)
|
||||
CPPFLAGS += -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args --std=c11
|
||||
endif
|
||||
-CFLAGS = $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants
|
||||
+CFLAGS = $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -ffreestanding -fno-stack-protector -fno-stack-check
|
||||
ASFLAGS = $(ARCH3264)
|
||||
-LDFLAGS = -nostdlib
|
||||
+LDFLAGS = -nostdlib --no-undefined
|
||||
INSTALL = install
|
||||
prefix = /usr/bin/
|
||||
|
||||
diff --git a/apps/Makefile b/apps/Makefile
|
||||
index 43db2f1..773bc08 100644
|
||||
--- a/apps/Makefile
|
||||
+++ b/apps/Makefile
|
||||
@@ -48,10 +48,8 @@ CPPFLAGS += -D__KERNEL__ -I$(LINUX_HEADERS)/include
|
||||
CRTOBJS = ../gnuefi/crt0-efi-$(ARCH).o
|
||||
|
||||
LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_efi.lds
|
||||
-ifeq ($(ARCH),x86_64)
|
||||
- ifneq (,$(findstring FreeBSD,$(OS)))
|
||||
+ifneq (,$(findstring FreeBSD,$(OS)))
|
||||
LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_fbsd_efi.lds
|
||||
- endif
|
||||
endif
|
||||
|
||||
LDFLAGS += -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
|
||||
diff --git a/gnuefi/elf_ia32_fbsd_efi.lds b/gnuefi/elf_ia32_fbsd_efi.lds
|
||||
new file mode 100644
|
||||
index 0000000..bc25b1f
|
||||
--- /dev/null
|
||||
+++ b/gnuefi/elf_ia32_fbsd_efi.lds
|
||||
@@ -0,0 +1,75 @@
|
||||
+OUTPUT_FORMAT("elf32-i386-freebsd", "elf32-i386-freebsd", "elf32-i386-freebsd")
|
||||
+OUTPUT_ARCH(i386)
|
||||
+ENTRY(_start)
|
||||
+SECTIONS
|
||||
+{
|
||||
+ . = 0;
|
||||
+ ImageBase = .;
|
||||
+ .hash : { *(.hash) } /* this MUST come first! */
|
||||
+ . = ALIGN(4096);
|
||||
+ .text :
|
||||
+ {
|
||||
+ *(.text)
|
||||
+ *(.text.*)
|
||||
+ *(.gnu.linkonce.t.*)
|
||||
+ }
|
||||
+ . = ALIGN(4096);
|
||||
+ .sdata :
|
||||
+ {
|
||||
+ *(.got.plt)
|
||||
+ *(.got)
|
||||
+ *(.srodata)
|
||||
+ *(.sdata)
|
||||
+ *(.sbss)
|
||||
+ *(.scommon)
|
||||
+ }
|
||||
+ . = ALIGN(4096);
|
||||
+ .data :
|
||||
+ {
|
||||
+ *(.rodata*)
|
||||
+ *(.data)
|
||||
+ *(.data1)
|
||||
+ *(.data.*)
|
||||
+ *(.sdata)
|
||||
+ *(.got.plt)
|
||||
+ *(.got)
|
||||
+ /* the EFI loader doesn't seem to like a .bss section, so we stick
|
||||
+ it all into .data: */
|
||||
+ *(.sbss)
|
||||
+ *(.scommon)
|
||||
+ *(.dynbss)
|
||||
+ *(.bss)
|
||||
+ *(COMMON)
|
||||
+ }
|
||||
+ . = ALIGN(4096);
|
||||
+ .dynamic : { *(.dynamic) }
|
||||
+ . = ALIGN(4096);
|
||||
+ .rel :
|
||||
+ {
|
||||
+ *(.rel.data)
|
||||
+ *(.rel.data.*)
|
||||
+ *(.rel.got)
|
||||
+ *(.rel.stab)
|
||||
+ *(.data.rel.ro.local)
|
||||
+ *(.data.rel.local)
|
||||
+ *(.data.rel.ro)
|
||||
+ *(.data.rel*)
|
||||
+ }
|
||||
+ . = ALIGN(4096);
|
||||
+ .reloc : /* This is the PECOFF .reloc section! */
|
||||
+ {
|
||||
+ *(.reloc)
|
||||
+ }
|
||||
+ . = ALIGN(4096);
|
||||
+ .dynsym : { *(.dynsym) }
|
||||
+ . = ALIGN(4096);
|
||||
+ .dynstr : { *(.dynstr) }
|
||||
+ . = ALIGN(4096);
|
||||
+ /DISCARD/ :
|
||||
+ {
|
||||
+ *(.rel.reloc)
|
||||
+ *(.eh_frame)
|
||||
+ *(.note.GNU-stack)
|
||||
+ }
|
||||
+ .comment 0 : { *(.comment) }
|
||||
+}
|
||||
diff --git a/gnuefi/reloc_ia32.c b/gnuefi/reloc_ia32.c
|
||||
index be57f4f..8d50a75 100644
|
||||
--- a/gnuefi/reloc_ia32.c
|
||||
+++ b/gnuefi/reloc_ia32.c
|
||||
@@ -33,43 +33,22 @@
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
-#include <elf.h>
|
||||
-#include <link.h> /* get _DYNAMIC decl and ElfW and ELFW macros */
|
||||
-
|
||||
-#undef NULL
|
||||
-#define uint64_t efi_uint64_t
|
||||
-#define int64_t efi_int64_t
|
||||
-#define uint32_t efi_uint32_t
|
||||
-#define int32_t efi_int32_t
|
||||
-#define uint16_t efi_uint16_t
|
||||
-#define int16_t efi_int16_t
|
||||
-#define uint8_t efi_uint8_t
|
||||
-#define int8_t efi_int8_t
|
||||
-
|
||||
-#undef NULL
|
||||
-#define uint64_t efi_uint64_t
|
||||
-#define int64_t efi_int64_t
|
||||
-#define uint32_t efi_uint32_t
|
||||
-#define int32_t efi_int32_t
|
||||
-#define uint16_t efi_uint16_t
|
||||
-#define int16_t efi_int16_t
|
||||
-#define uint8_t efi_uint8_t
|
||||
-#define int8_t efi_int8_t
|
||||
-
|
||||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
-EFI_STATUS _relocate (long ldbase, ElfW(Dyn) *dyn, EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
|
||||
+#include <elf.h>
|
||||
+
|
||||
+EFI_STATUS _relocate (long ldbase, Elf32_Dyn *dyn, EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
|
||||
{
|
||||
long relsz = 0, relent = 0;
|
||||
- ElfW(Rel) *rel = 0;
|
||||
+ Elf32_Rel *rel = 0;
|
||||
unsigned long *addr;
|
||||
int i;
|
||||
|
||||
for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
|
||||
switch (dyn[i].d_tag) {
|
||||
case DT_REL:
|
||||
- rel = (ElfW(Rel)*)
|
||||
+ rel = (Elf32_Rel*)
|
||||
((unsigned long)dyn[i].d_un.d_ptr
|
||||
+ ldbase);
|
||||
break;
|
||||
@@ -111,7 +90,7 @@ EFI_STATUS _relocate (long ldbase, ElfW(Dyn) *dyn, EFI_HANDLE image, EFI_SYSTEM_
|
||||
default:
|
||||
break;
|
||||
}
|
||||
- rel = (ElfW(Rel)*) ((char *) rel + relent);
|
||||
+ rel = (Elf32_Rel*) ((char *) rel + relent);
|
||||
relsz -= relent;
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
diff --git a/gnuefi/reloc_x86_64.c b/gnuefi/reloc_x86_64.c
|
||||
index 4593125..04b4ddb 100644
|
||||
--- a/gnuefi/reloc_x86_64.c
|
||||
+++ b/gnuefi/reloc_x86_64.c
|
||||
@@ -35,44 +35,22 @@
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
-#include <elf.h>
|
||||
-#include <link.h> /* get _DYNAMIC decl and ElfW and ELFW macros */
|
||||
-
|
||||
-
|
||||
-#undef NULL
|
||||
-#define uint64_t efi_uint64_t
|
||||
-#define int64_t efi_int64_t
|
||||
-#define uint32_t efi_uint32_t
|
||||
-#define int32_t efi_int32_t
|
||||
-#define uint16_t efi_uint16_t
|
||||
-#define int16_t efi_int16_t
|
||||
-#define uint8_t efi_uint8_t
|
||||
-#define int8_t efi_int8_t
|
||||
-
|
||||
-#undef NULL
|
||||
-#define uint64_t efi_uint64_t
|
||||
-#define int64_t efi_int64_t
|
||||
-#define uint32_t efi_uint32_t
|
||||
-#define int32_t efi_int32_t
|
||||
-#define uint16_t efi_uint16_t
|
||||
-#define int16_t efi_int16_t
|
||||
-#define uint8_t efi_uint8_t
|
||||
-#define int8_t efi_int8_t
|
||||
-
|
||||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
-EFI_STATUS _relocate (long ldbase, ElfW(Dyn) *dyn, EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
|
||||
+#include <elf.h>
|
||||
+
|
||||
+EFI_STATUS _relocate (long ldbase, Elf64_Dyn *dyn, EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
|
||||
{
|
||||
long relsz = 0, relent = 0;
|
||||
- ElfW(Rel) *rel = 0;
|
||||
+ Elf64_Rel *rel = 0;
|
||||
unsigned long *addr;
|
||||
int i;
|
||||
|
||||
for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
|
||||
switch (dyn[i].d_tag) {
|
||||
case DT_RELA:
|
||||
- rel = (ElfW(Rel)*)
|
||||
+ rel = (Elf64_Rel*)
|
||||
((unsigned long)dyn[i].d_un.d_ptr
|
||||
+ ldbase);
|
||||
break;
|
||||
@@ -111,7 +89,7 @@ EFI_STATUS _relocate (long ldbase, ElfW(Dyn) *dyn, EFI_HANDLE image, EFI_SYSTEM_
|
||||
default:
|
||||
break;
|
||||
}
|
||||
- rel = (ElfW(Rel)*) ((char *) rel + relent);
|
||||
+ rel = (Elf64_Rel*) ((char *) rel + relent);
|
||||
relsz -= relent;
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
diff --git a/gnuefi/setjmp_ia32.S b/gnuefi/setjmp_ia32.S
|
||||
index b22ef02..5f71caf 100644
|
||||
--- a/gnuefi/setjmp_ia32.S
|
||||
+++ b/gnuefi/setjmp_ia32.S
|
||||
@@ -55,7 +55,7 @@
|
||||
*/
|
||||
|
||||
#define EXT_C(sym) sym
|
||||
-#define FUNCTION(x) .globl EXT_C(x) ; .type EXT_C(x), "function" ; EXT_C(x):
|
||||
+#define FUNCTION(x) .globl EXT_C(x) ; .type EXT_C(x), @function ; EXT_C(x):
|
||||
|
||||
.file "setjmp.S"
|
||||
|
||||
diff --git a/gnuefi/setjmp_x86_64.S b/gnuefi/setjmp_x86_64.S
|
||||
index b3561e4..6ef9378 100644
|
||||
--- a/gnuefi/setjmp_x86_64.S
|
||||
+++ b/gnuefi/setjmp_x86_64.S
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#define EXT_C(sym) sym
|
||||
-#define FUNCTION(x) .globl EXT_C(x) ; .type EXT_C(x), "function" ; EXT_C(x):
|
||||
+#define FUNCTION(x) .globl EXT_C(x) ; .type EXT_C(x), @function ; EXT_C(x):
|
||||
|
||||
.file "setjmp.S"
|
||||
|
||||
diff --git a/inc/ia32/efibind.h b/inc/ia32/efibind.h
|
||||
index 722542c..deb9d16 100644
|
||||
--- a/inc/ia32/efibind.h
|
||||
+++ b/inc/ia32/efibind.h
|
||||
@@ -42,14 +42,14 @@ Revision History
|
||||
typedef unsigned char uint8_t;
|
||||
typedef char int8_t;
|
||||
#elif defined(__GNUC__)
|
||||
- typedef unsigned long long uint64_t __attribute__((aligned (8)));
|
||||
- typedef long long int64_t __attribute__((aligned (8)));
|
||||
+ typedef int __attribute__((__mode__(__DI__))) int64_t;
|
||||
+ typedef unsigned int __attribute__((__mode__(__DI__))) uint64_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
- typedef char int8_t;
|
||||
+ typedef signed char int8_t;
|
||||
#elif defined(UNIX_LP64)
|
||||
|
||||
/* Use LP64 programming model from C_FLAGS for integer width declarations */
|
||||
@@ -76,7 +76,7 @@ Revision History
|
||||
typedef char int8_t;
|
||||
#endif
|
||||
#elif defined(__GNUC__)
|
||||
- #include <stdint-gcc.h>
|
||||
+ #include <stdint.h>
|
||||
#endif
|
||||
|
||||
//
|
||||
diff --git a/inc/ia64/efibind.h b/inc/ia64/efibind.h
|
||||
index a1bf3fb..6926876 100644
|
||||
--- a/inc/ia64/efibind.h
|
||||
+++ b/inc/ia64/efibind.h
|
||||
@@ -63,7 +63,7 @@ Revision History
|
||||
typedef char int8_t;
|
||||
#endif
|
||||
#elif defined(__GNUC__)
|
||||
- #include <stdint-gcc.h>
|
||||
+ #include <stdint.h>
|
||||
#endif
|
||||
|
||||
//
|
||||
diff --git a/inc/x86_64/efibind.h b/inc/x86_64/efibind.h
|
||||
index 27c9638..ee620f2 100644
|
||||
--- a/inc/x86_64/efibind.h
|
||||
+++ b/inc/x86_64/efibind.h
|
||||
@@ -51,14 +51,14 @@ Revision History
|
||||
typedef unsigned char uint8_t;
|
||||
typedef char int8_t;
|
||||
#elif defined(__GNUC__)
|
||||
- typedef unsigned long long uint64_t __attribute__((aligned (8)));
|
||||
- typedef long long int64_t __attribute__((aligned (8)));
|
||||
+ typedef int __attribute__((__mode__(__DI__))) int64_t;
|
||||
+ typedef unsigned int __attribute__((__mode__(__DI__))) uint64_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
- typedef char int8_t;
|
||||
+ typedef signed char int8_t;
|
||||
#elif defined(UNIX_LP64)
|
||||
|
||||
/* Use LP64 programming model from C_FLAGS for integer width declarations */
|
||||
@@ -85,7 +85,7 @@ Revision History
|
||||
typedef char int8_t;
|
||||
#endif
|
||||
#elif defined(__GNUC__)
|
||||
- #include <stdint-gcc.h>
|
||||
+ #include <stdint.h>
|
||||
#endif
|
||||
|
||||
//
|
||||
--
|
||||
1.8.2.1
|
||||
|
29
0001-fix-compilation-on-x86_64-without-HAVE_USE_MS_ABI.patch
Normal file
29
0001-fix-compilation-on-x86_64-without-HAVE_USE_MS_ABI.patch
Normal file
@ -0,0 +1,29 @@
|
||||
From 023ad973f8260ab88445ae36365ce309eff8e59b Mon Sep 17 00:00:00 2001
|
||||
From: Nigel Croxon <ncroxon@redhat.com>
|
||||
Date: Tue, 25 Jun 2013 08:45:44 -0400
|
||||
Subject: [PATCH 1/3] fix compilation on x86_64 without HAVE_USE_MS_ABI
|
||||
|
||||
make -C apps would fail on tcc.c because uefi_call_wrapper() doesn't
|
||||
deal correctly with efi_call0-type invocation. Fixed by this patch.
|
||||
|
||||
Signed-off-by: David Decotigny <decot@googlers.com>
|
||||
---
|
||||
inc/x86_64/efibind.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/inc/x86_64/efibind.h b/inc/x86_64/efibind.h
|
||||
index 065a965..2133798 100644
|
||||
--- a/inc/x86_64/efibind.h
|
||||
+++ b/inc/x86_64/efibind.h
|
||||
@@ -368,7 +368,7 @@ UINT64 efi_call10(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
|
||||
|
||||
/* main wrapper (va_num ignored) */
|
||||
#define uefi_call_wrapper(func,va_num,...) \
|
||||
- __VA_ARG_NSUFFIX__(_cast64_efi_call, __VA_ARGS__) (func, __VA_ARGS__)
|
||||
+ __VA_ARG_NSUFFIX__(_cast64_efi_call, __VA_ARGS__) (func , ##__VA_ARGS__)
|
||||
|
||||
#endif
|
||||
#define EFI_FUNCTION __attribute__((ms_abi))
|
||||
--
|
||||
1.8.3.1
|
||||
|
46
0002-be-more-pedantic-when-linking.patch
Normal file
46
0002-be-more-pedantic-when-linking.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From f99c72fe642e7ccc00012f01b8fc2adf8f93a79c Mon Sep 17 00:00:00 2001
|
||||
From: Nigel Croxon <ncroxon@redhat.com>
|
||||
Date: Tue, 25 Jun 2013 08:47:03 -0400
|
||||
Subject: [PATCH 2/3] be more pedantic when linking
|
||||
|
||||
Don't allow duplicate symbols, abort upon first error.
|
||||
also make sure the linker script comes last for apps.
|
||||
|
||||
Signed-off-by: David Decotigny <decot@googlers.com>
|
||||
---
|
||||
Make.defaults | 2 +-
|
||||
apps/Makefile | 8 ++++++--
|
||||
2 files changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/Make.defaults b/Make.defaults
|
||||
index a22a1b4..6b4b6de 100644
|
||||
--- a/Make.defaults
|
||||
+++ b/Make.defaults
|
||||
@@ -114,4 +114,4 @@ CFLAGS += $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing \
|
||||
-fno-merge-constants -ffreestanding -fno-stack-protector \
|
||||
-fno-stack-check
|
||||
ASFLAGS += $(ARCH3264)
|
||||
-LDFLAGS += -nostdlib --no-undefined
|
||||
+LDFLAGS += -nostdlib --warn-common --no-undefined --fatal-warnings
|
||||
diff --git a/apps/Makefile b/apps/Makefile
|
||||
index 773bc08..6834e14 100644
|
||||
--- a/apps/Makefile
|
||||
+++ b/apps/Makefile
|
||||
@@ -52,8 +52,12 @@ ifneq (,$(findstring FreeBSD,$(OS)))
|
||||
LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_fbsd_efi.lds
|
||||
endif
|
||||
|
||||
-LDFLAGS += -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
|
||||
-LOADLIBES = -lefi -lgnuefi $(shell $(CC) $(ARCH3264) -print-libgcc-file-name)
|
||||
+LDFLAGS += -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
|
||||
+
|
||||
+LOADLIBES += -lefi -lgnuefi
|
||||
+LOADLIBES += $(shell $(CC) $(ARCH3264) -print-libgcc-file-name)
|
||||
+LOADLIBES += -T $(LDSCRIPT)
|
||||
+
|
||||
FORMAT = efi-app-$(ARCH)
|
||||
|
||||
TARGETS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi printenv.efi t7.efi tcc.efi modelist.efi route80h.efi
|
||||
--
|
||||
1.8.3.1
|
||||
|
371
0003-Sample-boot-service-driver.patch
Normal file
371
0003-Sample-boot-service-driver.patch
Normal file
@ -0,0 +1,371 @@
|
||||
From b2a2a1fa80dd57be7d5445f1c2fbbe25feedd39d Mon Sep 17 00:00:00 2001
|
||||
From: Nigel Croxon <ncroxon@redhat.com>
|
||||
Date: Tue, 25 Jun 2013 08:53:58 -0400
|
||||
Subject: [PATCH 3/3] Sample boot service driver.
|
||||
|
||||
Signed-off-by: David Decotigny <decot@googlers.com>
|
||||
---
|
||||
apps/Makefile | 11 +++-
|
||||
apps/drv0.c | 193 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
apps/drv0.h | 37 +++++++++++
|
||||
apps/drv0_use.c | 79 +++++++++++++++++++++++
|
||||
4 files changed, 319 insertions(+), 1 deletion(-)
|
||||
create mode 100644 apps/drv0.c
|
||||
create mode 100644 apps/drv0.h
|
||||
create mode 100644 apps/drv0_use.c
|
||||
|
||||
diff --git a/apps/Makefile b/apps/Makefile
|
||||
index 6834e14..8643ba1 100644
|
||||
--- a/apps/Makefile
|
||||
+++ b/apps/Makefile
|
||||
@@ -60,10 +60,19 @@ LOADLIBES += -T $(LDSCRIPT)
|
||||
|
||||
FORMAT = efi-app-$(ARCH)
|
||||
|
||||
-TARGETS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi printenv.efi t7.efi tcc.efi modelist.efi route80h.efi
|
||||
+TARGET_APPS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi \
|
||||
+ printenv.efi t7.efi tcc.efi modelist.efi \
|
||||
+ route80h.efi drv0_use.efi
|
||||
+TARGET_BSDRIVERS = drv0.efi
|
||||
+TARGET_RTDRIVERS =
|
||||
+
|
||||
+TARGETS = $(TARGET_APPS) $(TARGET_BSDRIVERS) $(TARGET_RTDRIVERS)
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
+$(TARGET_BSDRIVERS): FORMAT=efi-bsdrv-$(ARCH)
|
||||
+$(TARGET_RTDRIVERS): FORMAT=efi-rtdrv-$(ARCH)
|
||||
+
|
||||
clean:
|
||||
rm -f $(TARGETS) *~ *.o *.so
|
||||
|
||||
diff --git a/apps/drv0.c b/apps/drv0.c
|
||||
new file mode 100644
|
||||
index 0000000..126e8e7
|
||||
--- /dev/null
|
||||
+++ b/apps/drv0.c
|
||||
@@ -0,0 +1,193 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2013 David Decotigny <decot@googlers.com>
|
||||
+ *
|
||||
+ * Sample EFI shell session, together with drv0_use.efi:
|
||||
+ *
|
||||
+ * # Loading first instance:
|
||||
+ *
|
||||
+ * fs0:\> load drv0.efi
|
||||
+ * Driver instance loaded successfully.
|
||||
+ * load: Image fs0:\drv0.efi loaded at 2FD7C000 - Success
|
||||
+ *
|
||||
+ * # Testing 1st instance:
|
||||
+ *
|
||||
+ * fs0:\> drv0_use.efi
|
||||
+ * Playing with driver instance 0...
|
||||
+ * Hello Sample UEFI Driver!
|
||||
+ * Hello was called 1 time(s).
|
||||
+ *
|
||||
+ * fs0:\> drv0_use.efi
|
||||
+ * Playing with driver instance 0...
|
||||
+ * Hello Sample UEFI Driver!
|
||||
+ * Hello was called 2 time(s).
|
||||
+ *
|
||||
+ * # Loading another instance:
|
||||
+ *
|
||||
+ * fs0:\> load drv0.efi
|
||||
+ * Driver instance loaded successfully.
|
||||
+ * load: Image fs0:\drv0.efi loaded at 2FD6D000 - Success
|
||||
+ *
|
||||
+ * # Using both instances:
|
||||
+ *
|
||||
+ * fs0:\> drv0_use.efi
|
||||
+ * Playing with driver instance 0...
|
||||
+ * Hello Sample UEFI Driver!
|
||||
+ * Hello was called 3 time(s).
|
||||
+ * Playing with driver instance 1...
|
||||
+ * Hello Sample UEFI Driver!
|
||||
+ * Hello was called 1 time(s).
|
||||
+ *
|
||||
+ * fs0:\> drv0_use.efi
|
||||
+ * Playing with driver instance 0...
|
||||
+ * Hello Sample UEFI Driver!
|
||||
+ * Hello was called 4 time(s).
|
||||
+ * Playing with driver instance 1...
|
||||
+ * Hello Sample UEFI Driver!
|
||||
+ * Hello was called 2 time(s).
|
||||
+ *
|
||||
+ * # Removing 1st instance:
|
||||
+ *
|
||||
+ * fs0:\> dh
|
||||
+ * Handle dump
|
||||
+ * 1: Image(DxeCore)
|
||||
+ * [...]
|
||||
+ * 79: Image(\/drv0.efi) ImageDevPath (..A,0x800,0x17F7DF)/\/drv0.efi)
|
||||
+ * 7A: Image(\/drv0.efi) ImageDevPath (..A,0x800,0x17F7DF)/\/drv0.efi)
|
||||
+ *
|
||||
+ * fs0:\> unload 79
|
||||
+ * 79: Image(\/drv0.efi) ImageDevPath (..A,0x800,0x17F7DF)/\/drv0.efi)
|
||||
+ * Unload driver image (y/n)? y
|
||||
+ * Driver instance unloaded.
|
||||
+ * unload: Success
|
||||
+ *
|
||||
+ * # Only 2nd instance remaining:
|
||||
+ *
|
||||
+ * fs0:\> drv0_use.efi
|
||||
+ * Playing with driver instance 0...
|
||||
+ * Hello Sample UEFI Driver!
|
||||
+ * Hello was called 3 time(s).
|
||||
+ *
|
||||
+ * # Removing 2nd/last instance:
|
||||
+ *
|
||||
+ * fs0:\> dh
|
||||
+ * Handle dump
|
||||
+ * 1: Image(DxeCore)
|
||||
+ * [...]
|
||||
+ * 79: Image(\/drv0.efi) ImageDevPath (..A,0x800,0x17F7DF)/\/drv0.efi)
|
||||
+ *
|
||||
+ * fs0:\> unload 79
|
||||
+ * 79: Image(\/drv0.efi) ImageDevPath (..A,0x800,0x17F7DF)/\/drv0.efi)
|
||||
+ * Unload driver image (y/n)? y
|
||||
+ * Driver instance unloaded.
|
||||
+ * unload: Success
|
||||
+ *
|
||||
+ * # Expect error: no other drv0 instance left
|
||||
+ *
|
||||
+ * fs0:\> drv0_use.efi
|
||||
+ * Error looking up handles for proto: 14
|
||||
+ */
|
||||
+
|
||||
+#include <efi.h>
|
||||
+#include <efilib.h>
|
||||
+#include "drv0.h"
|
||||
+
|
||||
+
|
||||
+static const EFI_GUID GnuEfiAppsDrv0ProtocolGuid
|
||||
+ = GNU_EFI_APPS_DRV0_PROTOCOL_GUID;
|
||||
+
|
||||
+static struct {
|
||||
+ GNU_EFI_APPS_DRV0_PROTOCOL Proto;
|
||||
+ UINTN Counter;
|
||||
+} InternalGnuEfiAppsDrv0ProtocolData;
|
||||
+
|
||||
+
|
||||
+static
|
||||
+EFI_STATUS
|
||||
+EFI_FUNCTION
|
||||
+Drv0SayHello(
|
||||
+ IN struct _GNU_EFI_APPS_DRV0_PROTOCOL *This,
|
||||
+ IN const CHAR16 *HelloWho
|
||||
+ )
|
||||
+{
|
||||
+ if (! HelloWho)
|
||||
+ return EFI_INVALID_PARAMETER;
|
||||
+
|
||||
+ Print(L"Hello %s!\n", HelloWho);
|
||||
+ InternalGnuEfiAppsDrv0ProtocolData.Counter ++;
|
||||
+ return EFI_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static
|
||||
+EFI_STATUS
|
||||
+EFI_FUNCTION
|
||||
+Drv0GetNumberOfHello(
|
||||
+ IN struct _GNU_EFI_APPS_DRV0_PROTOCOL *This,
|
||||
+ OUT UINTN *NumberOfHello
|
||||
+ )
|
||||
+{
|
||||
+ if (! NumberOfHello)
|
||||
+ return EFI_INVALID_PARAMETER;
|
||||
+
|
||||
+ *NumberOfHello = InternalGnuEfiAppsDrv0ProtocolData.Counter;
|
||||
+ return EFI_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static
|
||||
+EFI_STATUS
|
||||
+EFI_FUNCTION
|
||||
+Drv0Unload(IN EFI_HANDLE ImageHandle)
|
||||
+{
|
||||
+ LibUninstallProtocolInterfaces(ImageHandle,
|
||||
+ &GnuEfiAppsDrv0ProtocolGuid,
|
||||
+ &InternalGnuEfiAppsDrv0ProtocolData.Proto,
|
||||
+ NULL);
|
||||
+ Print(L"Driver instance unloaded.\n", ImageHandle);
|
||||
+ return EFI_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+EFI_STATUS
|
||||
+efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SysTab)
|
||||
+{
|
||||
+ EFI_STATUS Status;
|
||||
+ EFI_LOADED_IMAGE *LoadedImage = NULL;
|
||||
+
|
||||
+ InitializeLib(ImageHandle, SysTab);
|
||||
+
|
||||
+ /* Initialize global protocol definition + data */
|
||||
+ InternalGnuEfiAppsDrv0ProtocolData.Proto.SayHello
|
||||
+ = (GNU_EFI_APPS_DRV0_SAY_HELLO) Drv0SayHello;
|
||||
+ InternalGnuEfiAppsDrv0ProtocolData.Proto.GetNumberOfHello
|
||||
+ = (GNU_EFI_APPS_DRV0_GET_NUMBER_OF_HELLO) Drv0GetNumberOfHello;
|
||||
+ InternalGnuEfiAppsDrv0ProtocolData.Counter = 0;
|
||||
+
|
||||
+ /* Grab handle to this image: we'll attach our proto instance to it */
|
||||
+ Status = uefi_call_wrapper(BS->OpenProtocol, 6,
|
||||
+ ImageHandle, &LoadedImageProtocol,
|
||||
+ &LoadedImage, ImageHandle,
|
||||
+ NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
+ if (EFI_ERROR(Status)) {
|
||||
+ Print(L"Could not open loaded image protocol: %d\n", Status);
|
||||
+ return Status;
|
||||
+ }
|
||||
+
|
||||
+ /* Attach our proto to the current driver image */
|
||||
+ Status = LibInstallProtocolInterfaces(
|
||||
+ &ImageHandle, &GnuEfiAppsDrv0ProtocolGuid,
|
||||
+ &InternalGnuEfiAppsDrv0ProtocolData.Proto, NULL);
|
||||
+ if (EFI_ERROR(Status)) {
|
||||
+ Print(L"Error registering driver instance: %d\n", Status);
|
||||
+ return Status;
|
||||
+ }
|
||||
+
|
||||
+ /* Register Unload callback, used to unregister current protocol
|
||||
+ * instance from system */
|
||||
+ LoadedImage->Unload = (EFI_IMAGE_UNLOAD)Drv0Unload;
|
||||
+
|
||||
+ Print(L"Driver instance loaded successfully.\n");
|
||||
+ return EFI_SUCCESS; /* at this point, this instance stays resident
|
||||
+ * until image is unloaded, eg. with shell's unload,
|
||||
+ * ExitBootServices() */
|
||||
+}
|
||||
diff --git a/apps/drv0.h b/apps/drv0.h
|
||||
new file mode 100644
|
||||
index 0000000..26d2ffd
|
||||
--- /dev/null
|
||||
+++ b/apps/drv0.h
|
||||
@@ -0,0 +1,37 @@
|
||||
+#ifndef _GNU_EFI_APPS_DRV0_H_
|
||||
+#define _GNU_EFI_APPS_DRV0_H_
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+extern "C" {
|
||||
+#endif
|
||||
+
|
||||
+/* UEFI naming conventions */
|
||||
+#define GNU_EFI_APPS_DRV0_PROTOCOL_GUID \
|
||||
+{ 0xe4dcafd0, 0x586c, 0x4b3d, {0x86, 0xe7, 0x28, 0xde, 0x7f, 0xcc, 0x04, 0xb8} }
|
||||
+
|
||||
+INTERFACE_DECL(_GNU_EFI_APPS_DRV0_PROTOCOL);
|
||||
+
|
||||
+typedef
|
||||
+EFI_STATUS
|
||||
+(EFIAPI *GNU_EFI_APPS_DRV0_SAY_HELLO) (
|
||||
+ IN struct _GNU_EFI_APPS_DRV0_PROTOCOL *This,
|
||||
+ IN const CHAR16 *HelloWho
|
||||
+ );
|
||||
+
|
||||
+typedef
|
||||
+EFI_STATUS
|
||||
+(EFIAPI *GNU_EFI_APPS_DRV0_GET_NUMBER_OF_HELLO) (
|
||||
+ IN struct _GNU_EFI_APPS_DRV0_PROTOCOL *This,
|
||||
+ OUT UINTN *NumberOfHello
|
||||
+ );
|
||||
+
|
||||
+typedef struct _GNU_EFI_APPS_DRV0_PROTOCOL {
|
||||
+ GNU_EFI_APPS_DRV0_SAY_HELLO SayHello;
|
||||
+ GNU_EFI_APPS_DRV0_GET_NUMBER_OF_HELLO GetNumberOfHello;
|
||||
+} GNU_EFI_APPS_DRV0_PROTOCOL;
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+#endif
|
||||
diff --git a/apps/drv0_use.c b/apps/drv0_use.c
|
||||
new file mode 100644
|
||||
index 0000000..f7c5869
|
||||
--- /dev/null
|
||||
+++ b/apps/drv0_use.c
|
||||
@@ -0,0 +1,79 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2013 David Decotigny <decot@googlers.com>
|
||||
+ *
|
||||
+ * See drv0.c for an example session.
|
||||
+ */
|
||||
+
|
||||
+#include <efi.h>
|
||||
+#include <efilib.h>
|
||||
+#include "drv0.h"
|
||||
+
|
||||
+
|
||||
+static EFI_GUID GnuEfiAppsDrv0ProtocolGuid
|
||||
+ = GNU_EFI_APPS_DRV0_PROTOCOL_GUID;
|
||||
+
|
||||
+
|
||||
+static
|
||||
+EFI_STATUS
|
||||
+PlayWithGnuEfiAppsDrv0Protocol(IN EFI_HANDLE DrvHandle) {
|
||||
+ EFI_STATUS Status;
|
||||
+ GNU_EFI_APPS_DRV0_PROTOCOL *drv = NULL;
|
||||
+ UINTN NumberOfHello = 0;
|
||||
+
|
||||
+ Status = uefi_call_wrapper(BS->OpenProtocol, 6,
|
||||
+ DrvHandle,
|
||||
+ &GnuEfiAppsDrv0ProtocolGuid,
|
||||
+ &drv,
|
||||
+ DrvHandle,
|
||||
+ NULL,
|
||||
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
+ if (EFI_ERROR(Status)) {
|
||||
+ Print(L"Cannot open proto: %d\n", Status);
|
||||
+ return Status;
|
||||
+ }
|
||||
+
|
||||
+ Status = uefi_call_wrapper(drv->SayHello, 2, drv, L"Sample UEFI Driver");
|
||||
+ if (EFI_ERROR(Status)) {
|
||||
+ Print(L"Cannot call SayHello: %d\n", Status);
|
||||
+ }
|
||||
+
|
||||
+ Status = uefi_call_wrapper(drv->GetNumberOfHello, 2, drv, &NumberOfHello);
|
||||
+ if (EFI_ERROR(Status)) {
|
||||
+ Print(L"Cannot call GetNumberOfHello: %d\n", Status);
|
||||
+ } else {
|
||||
+ Print(L"Hello was called %d time(s).\n", NumberOfHello);
|
||||
+ }
|
||||
+
|
||||
+ return EFI_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+EFI_STATUS
|
||||
+efi_main (EFI_HANDLE Image, EFI_SYSTEM_TABLE *SysTab)
|
||||
+{
|
||||
+ EFI_STATUS Status;
|
||||
+ EFI_HANDLE *Handles = NULL;
|
||||
+ UINTN i, NoHandles = 0;
|
||||
+
|
||||
+ InitializeLib(Image, SysTab);
|
||||
+
|
||||
+ Status = LibLocateHandle(ByProtocol, &GnuEfiAppsDrv0ProtocolGuid,
|
||||
+ NULL, &NoHandles, &Handles);
|
||||
+ if (EFI_ERROR(Status)) {
|
||||
+ Print(L"Error looking up handles for proto: %d\n", Status);
|
||||
+ return Status;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0 ; i < NoHandles ; ++i)
|
||||
+ {
|
||||
+ Print(L"Playing with driver instance %d...\n", i);
|
||||
+ Status = PlayWithGnuEfiAppsDrv0Protocol(Handles[i]);
|
||||
+ if (EFI_ERROR(Status))
|
||||
+ Print(L"Error playing with instance %d, skipping\n", i);
|
||||
+ }
|
||||
+
|
||||
+ if (Handles)
|
||||
+ FreePool(Handles);
|
||||
+
|
||||
+ return EFI_SUCCESS;
|
||||
+}
|
||||
--
|
||||
1.8.3.1
|
||||
|
50
gnu-efi.spec
50
gnu-efi.spec
@ -1,23 +1,48 @@
|
||||
Summary: Development Libraries and headers for EFI
|
||||
Name: gnu-efi
|
||||
Version: 3.0t
|
||||
Version: 3.0u
|
||||
Release: 0.2%{?dist}
|
||||
Group: Development/System
|
||||
License: BSD
|
||||
URL: ftp://ftp.hpl.hp.com/pub/linux-ia64
|
||||
Source: ftp://ftp.hpl.hp.com/pub/linux-ia64/gnu-efi_%{version}.orig.tar.gz
|
||||
Patch0001: 0001-fix-compilation-on-x86_64-without-HAVE_USE_MS_ABI.patch
|
||||
Patch0002: 0002-be-more-pedantic-when-linking.patch
|
||||
Patch0003: 0003-Sample-boot-service-driver.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
Patch01: 0001-Removes-the-ElfW-macro-usage-from-reloc_ia32.c-and-r.patch
|
||||
Patch02: 0001-Disable-MMX-and-SSE.patch
|
||||
ExclusiveArch: i686 x86_64 ia64
|
||||
BuildRequires: git
|
||||
|
||||
%define debug_package %{nil}
|
||||
|
||||
# Figure out the right file path to use
|
||||
%if 0%{?rhel}
|
||||
%global efidir redhat
|
||||
%endif
|
||||
%if 0%{?fedora}
|
||||
%global efidir fedora
|
||||
%endif
|
||||
|
||||
%description
|
||||
This package contains development headers and libraries for developing
|
||||
applications that run under EFI (Extensible Firmware Interface).
|
||||
|
||||
%package devel
|
||||
Summary: Development Libraries and headers for EFI
|
||||
Group: Development/System
|
||||
Obsoletes: gnu-efi < %{version}-%{release}
|
||||
|
||||
%description devel
|
||||
This package contains development headers and libraries for developing
|
||||
applications that run under EFI (Extensible Firmware Interface).
|
||||
|
||||
%package utils
|
||||
Summary: Utilities for EFI systems
|
||||
Group: Applications/System
|
||||
|
||||
%description utils
|
||||
This package contains utilties for debugging and developing EFI systems.
|
||||
|
||||
%prep
|
||||
%setup -q -n gnu-efi-3.0
|
||||
git init
|
||||
@ -42,21 +67,30 @@ mkdir -p %{buildroot}/%{_libdir}/gnuefi
|
||||
mv %{buildroot}/%{_libdir}/*.lds %{buildroot}/%{_libdir}/*.o %{buildroot}/%{_libdir}/gnuefi
|
||||
|
||||
make -C apps clean route80h.efi modelist.efi
|
||||
mkdir -p %{buildroot}/boot/efi/EFI/redhat/
|
||||
mv apps/{route80h.efi,modelist.efi} %{buildroot}/boot/efi/EFI/redhat/
|
||||
mkdir -p %{buildroot}/boot/efi/EFI/%{efidir}/
|
||||
mv apps/{route80h.efi,modelist.efi} %{buildroot}/boot/efi/EFI/%{efidir}/
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%files
|
||||
%{_libdir}/*
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
%doc README.* ChangeLog
|
||||
%{_includedir}/efi
|
||||
%{_libdir}/*
|
||||
%dir /boot/efi/EFI/redhat/
|
||||
%attr(0644,root,root) /boot/efi/EFI/redhat/*.efi
|
||||
|
||||
%files utils
|
||||
%dir /boot/efi/EFI/%{efidir}/
|
||||
%attr(0644,root,root) /boot/efi/EFI/%{efidir}/*.efi
|
||||
|
||||
%changelog
|
||||
* Tue Sep 24 2013 Peter Jones <pjones@redhat.com> - 3.0u-0.1
|
||||
- Update to 3.0u
|
||||
- Split out subpackages so -devel can be multilib
|
||||
- Fix path in apps subpackage to vary by distro.
|
||||
|
||||
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0t-0.2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user