Re: [PATCH v2 5/5] efi: efistub: convert into static library

2014-07-02 Thread Matt Fleming
On Thu, 26 Jun, at 04:23:37PM, Ard Biesheuvel wrote:
 This patch changes both x86 and arm64 efistub implementations from #including
 shared .c files under drivers/firmware/efi to building the shared code as a
 static library.
 
 The x86 code uses a stub built into the boot executable which uncompresses the
 kernel at boot time. In this case, the library is linked into the 
 decompressor.
 
 In the arm64 case, the stub is part of the kernel proper so the library is
 linked into the kernel proper as well.
 
 Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org

OK, this breaks the ia64 build because of the following...

/drivers/firmware/efi/libstub/efi-stub-helper.c:14:21: fatal error: asm/efi.h: 
No such file or directory

 diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
 index e1096539eedb..d9abdbc962f1 100644
 --- a/drivers/firmware/efi/Makefile
 +++ b/drivers/firmware/efi/Makefile
 @@ -1,7 +1,7 @@
  #
  # Makefile for linux kernel
  #
 -obj-$(CONFIG_EFI)+= efi.o vars.o
 +obj-$(CONFIG_EFI)+= efi.o vars.o libstub/
  obj-$(CONFIG_EFI_VARS)   += efivars.o
  obj-$(CONFIG_EFI_VARS_PSTORE)+= efi-pstore.o
  obj-$(CONFIG_UEFI_CPER)  += cper.o

I guess what we need is CONFIG_EFI_LIBSTUB selected by both
CONFIG_EFI_STUB (for x86) and CONFIG_EFI_ARMSTUB (for arm64)? e.g.

obj-$(CONFIG_EFI_LIBSTUB)   libstub/

-- 
Matt Fleming, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line unsubscribe linux-efi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 5/5] efi: efistub: convert into static library

2014-07-02 Thread Ard Biesheuvel
On 2 July 2014 13:15, Matt Fleming m...@console-pimps.org wrote:
 On Thu, 26 Jun, at 04:23:37PM, Ard Biesheuvel wrote:
 This patch changes both x86 and arm64 efistub implementations from #including
 shared .c files under drivers/firmware/efi to building the shared code as a
 static library.

 The x86 code uses a stub built into the boot executable which uncompresses 
 the
 kernel at boot time. In this case, the library is linked into the 
 decompressor.

 In the arm64 case, the stub is part of the kernel proper so the library is
 linked into the kernel proper as well.

 Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org

 OK, this breaks the ia64 build because of the following...

 /drivers/firmware/efi/libstub/efi-stub-helper.c:14:21: fatal error: 
 asm/efi.h: No such file or directory

 diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
 index e1096539eedb..d9abdbc962f1 100644
 --- a/drivers/firmware/efi/Makefile
 +++ b/drivers/firmware/efi/Makefile
 @@ -1,7 +1,7 @@
  #
  # Makefile for linux kernel
  #
 -obj-$(CONFIG_EFI)+= efi.o vars.o
 +obj-$(CONFIG_EFI)+= efi.o vars.o libstub/
  obj-$(CONFIG_EFI_VARS)   += efivars.o
  obj-$(CONFIG_EFI_VARS_PSTORE)+= efi-pstore.o
  obj-$(CONFIG_UEFI_CPER)  += cper.o

 I guess what we need is CONFIG_EFI_LIBSTUB selected by both
 CONFIG_EFI_STUB (for x86) and CONFIG_EFI_ARMSTUB (for arm64)? e.g.

 obj-$(CONFIG_EFI_LIBSTUB)   libstub/


Yes, that seems the appropriate way to deal with this.
Let me respin so I can fix the other thing I mentioned yesterday as well.

-- 
Ard.
--
To unsubscribe from this list: send the line unsubscribe linux-efi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 5/5] efi: efistub: convert into static library

2014-07-02 Thread Ard Biesheuvel
Would something like this

ifneq ($(CONFIG_EFI_STUB)$(CONFIG_EFI_ARMSTUB),nn)
obj-y += libstub/
endif

be too hideous?



On 2 July 2014 13:23, Ard Biesheuvel ard.biesheu...@linaro.org wrote:
 On 2 July 2014 13:15, Matt Fleming m...@console-pimps.org wrote:
 On Thu, 26 Jun, at 04:23:37PM, Ard Biesheuvel wrote:
 This patch changes both x86 and arm64 efistub implementations from 
 #including
 shared .c files under drivers/firmware/efi to building the shared code as a
 static library.

 The x86 code uses a stub built into the boot executable which uncompresses 
 the
 kernel at boot time. In this case, the library is linked into the 
 decompressor.

 In the arm64 case, the stub is part of the kernel proper so the library is
 linked into the kernel proper as well.

 Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org

 OK, this breaks the ia64 build because of the following...

 /drivers/firmware/efi/libstub/efi-stub-helper.c:14:21: fatal error: 
 asm/efi.h: No such file or directory

 diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
 index e1096539eedb..d9abdbc962f1 100644
 --- a/drivers/firmware/efi/Makefile
 +++ b/drivers/firmware/efi/Makefile
 @@ -1,7 +1,7 @@
  #
  # Makefile for linux kernel
  #
 -obj-$(CONFIG_EFI)+= efi.o vars.o
 +obj-$(CONFIG_EFI)+= efi.o vars.o libstub/
  obj-$(CONFIG_EFI_VARS)   += efivars.o
  obj-$(CONFIG_EFI_VARS_PSTORE)+= efi-pstore.o
  obj-$(CONFIG_UEFI_CPER)  += cper.o

 I guess what we need is CONFIG_EFI_LIBSTUB selected by both
 CONFIG_EFI_STUB (for x86) and CONFIG_EFI_ARMSTUB (for arm64)? e.g.

 obj-$(CONFIG_EFI_LIBSTUB)   libstub/


 Yes, that seems the appropriate way to deal with this.
 Let me respin so I can fix the other thing I mentioned yesterday as well.

 --
 Ard.
--
To unsubscribe from this list: send the line unsubscribe linux-efi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 5/5] efi: efistub: convert into static library

2014-06-26 Thread Ard Biesheuvel
This patch changes both x86 and arm64 efistub implementations from #including
shared .c files under drivers/firmware/efi to building the shared code as a
static library.

The x86 code uses a stub built into the boot executable which uncompresses the
kernel at boot time. In this case, the library is linked into the decompressor.

In the arm64 case, the stub is part of the kernel proper so the library is
linked into the kernel proper as well.

Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org
---
 arch/arm64/Kconfig |  1 +
 arch/arm64/Makefile|  1 +
 arch/arm64/kernel/efi-stub.c   |  5 -
 arch/x86/boot/compressed/Makefile  |  3 ++-
 arch/x86/boot/compressed/eboot.c   |  2 --
 drivers/firmware/efi/Kconfig   |  3 +++
 drivers/firmware/efi/Makefile  |  2 +-
 drivers/firmware/efi/libstub/Makefile  | 26 ++
 drivers/firmware/efi/{ = libstub}/arm-stub.c  | 14 ++--
 .../firmware/efi/{ = libstub}/efi-stub-helper.c   |  0
 drivers/firmware/efi/{ = libstub}/efistub.h   |  0
 drivers/firmware/efi/{ = libstub}/fdt.c   |  0
 12 files changed, 41 insertions(+), 16 deletions(-)
 create mode 100644 drivers/firmware/efi/libstub/Makefile
 rename drivers/firmware/efi/{ = libstub}/arm-stub.c (96%)
 rename drivers/firmware/efi/{ = libstub}/efi-stub-helper.c (100%)
 rename drivers/firmware/efi/{ = libstub}/efistub.h (100%)
 rename drivers/firmware/efi/{ = libstub}/fdt.c (100%)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 93e11f4d9513..f766f346022d 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -300,6 +300,7 @@ config EFI
select UCS2_STRING
select EFI_PARAMS_FROM_FDT
select EFI_RUNTIME_WRAPPERS
+   select EFI_ARMSTUB
default y
help
  This option provides support for runtime services provided
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 8185a913c5ed..bb8f21a626c0 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -48,6 +48,7 @@ core-$(CONFIG_XEN) += arch/arm64/xen/
 core-$(CONFIG_CRYPTO) += arch/arm64/crypto/
 libs-y := arch/arm64/lib/ $(libs-y)
 libs-y += $(LIBGCC)
+libs-$(CONFIG_EFI) += drivers/firmware/efi/libstub/
 
 # Default target when executing plain make
 KBUILD_IMAGE   := Image.gz
diff --git a/arch/arm64/kernel/efi-stub.c b/arch/arm64/kernel/efi-stub.c
index e4999021b07d..12456a7d3fa2 100644
--- a/arch/arm64/kernel/efi-stub.c
+++ b/arch/arm64/kernel/efi-stub.c
@@ -13,11 +13,6 @@
 #include asm/efi.h
 #include asm/sections.h
 
-/* Include shared EFI stub code */
-#include ../../../drivers/firmware/efi/efi-stub-helper.c
-#include ../../../drivers/firmware/efi/fdt.c
-#include ../../../drivers/firmware/efi/arm-stub.c
-
 
 efi_status_t handle_kernel_image(efi_system_table_t *sys_table,
 unsigned long *image_addr,
diff --git a/arch/x86/boot/compressed/Makefile 
b/arch/x86/boot/compressed/Makefile
index 0fcd9133790c..7a801a310e37 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -33,7 +33,8 @@ VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o 
$(obj)/misc.o \
 $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
 
 ifeq ($(CONFIG_EFI_STUB), y)
-   VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
+   VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \
+   $(objtree)/drivers/firmware/efi/libstub/lib.a
 endif
 
 $(obj)/vmlinux: $(VMLINUX_OBJS) FORCE
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index d338c134c659..d4d865438a0c 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -280,8 +280,6 @@ void efi_char16_printk(efi_system_table_t *table, 
efi_char16_t *str)
}
 }
 
-#include ../../../../drivers/firmware/efi/efi-stub-helper.c
-
 static void find_bits(unsigned long mask, u8 *pos, u8 *size)
 {
u8 first, len;
diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
index 04a7af46736a..395e76d9a1b5 100644
--- a/drivers/firmware/efi/Kconfig
+++ b/drivers/firmware/efi/Kconfig
@@ -61,6 +61,9 @@ config EFI_RUNTIME_WRAPPERS
  in which case it needs to provide #definitions of efi_call_virt and
  __efi_call_virt in asm/efi.h
 
+config EFI_ARMSTUB
+   bool
+
 endmenu
 
 config UEFI_CPER
diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
index e1096539eedb..d9abdbc962f1 100644
--- a/drivers/firmware/efi/Makefile
+++ b/drivers/firmware/efi/Makefile
@@ -1,7 +1,7 @@
 #
 # Makefile for linux kernel
 #
-obj-$(CONFIG_EFI)  += efi.o vars.o
+obj-$(CONFIG_EFI)  += efi.o vars.o libstub/
 obj-$(CONFIG_EFI_VARS) += efivars.o
 obj-$(CONFIG_EFI_VARS_PSTORE)  += efi-pstore.o