diff mbox

[U-Boot,v3,15/28] x86: Support building the EFI stub

Message ID 1438713246-1887-16-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Aug. 4, 2015, 6:33 p.m. UTC
Add support for building a 32/64-bit EFI stub for x86. This involves
building the startup and relocation code for either i386 or x86_64.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v3:
- Move 64-bit comment to just above the 64-bit flag adjustments

Changes in v2:
- Add a comment as to why the AFLAGS_REMOVE_.. lines are needed
- Move the crt and reloc files into arch/x86/lib/efi/

 arch/x86/lib/Makefile     |  2 +-
 arch/x86/lib/efi/Makefile | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 arch/x86/lib/efi/Makefile

Comments

Bin Meng Aug. 5, 2015, 12:20 p.m. UTC | #1
On Wed, Aug 5, 2015 at 2:33 AM, Simon Glass <sjg@chromium.org> wrote:
> Add support for building a 32/64-bit EFI stub for x86. This involves
> building the startup and relocation code for either i386 or x86_64.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v3:
> - Move 64-bit comment to just above the 64-bit flag adjustments
>
> Changes in v2:
> - Add a comment as to why the AFLAGS_REMOVE_.. lines are needed
> - Move the crt and reloc files into arch/x86/lib/efi/
>
>  arch/x86/lib/Makefile     |  2 +-
>  arch/x86/lib/efi/Makefile | 24 ++++++++++++++++++++++++
>  2 files changed, 25 insertions(+), 1 deletion(-)
>  create mode 100644 arch/x86/lib/efi/Makefile
>
> diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
> index 43489fd..09c236b 100644
> --- a/arch/x86/lib/Makefile
> +++ b/arch/x86/lib/Makefile
> @@ -34,7 +34,7 @@ obj-$(CONFIG_SYS_X86_TSC_TIMER)       += tsc_timer.o
>  obj-$(CONFIG_CMD_ZBOOT)        += zimage.o
>  obj-$(CONFIG_HAVE_FSP) += fsp/
>
> -extra-$(CONFIG_USE_PRIVATE_LIBGCC) := lib.a
> +extra-$(CONFIG_USE_PRIVATE_LIBGCC) += lib.a
>
>  NORMAL_LIBGCC = $(shell $(CC) $(PLATFORM_CPPFLAGS) -print-libgcc-file-name)
>  OBJCOPYFLAGS := --prefix-symbols=__normal_
> diff --git a/arch/x86/lib/efi/Makefile b/arch/x86/lib/efi/Makefile
> new file mode 100644
> index 0000000..bb7b95b
> --- /dev/null
> +++ b/arch/x86/lib/efi/Makefile
> @@ -0,0 +1,24 @@
> +#
> +# (C) Copyright 2002-2006
> +# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
> +#
> +# SPDX-License-Identifier:     GPL-2.0+
> +#
> +
> +obj-$(CONFIG_EFI_APP) += crt0-efi-ia32.o reloc_ia32.o
> +
> +ifneq ($(CONFIG_EFI_STUB),)
> +
> +CFLAGS_REMOVE_reloc_ia32.o += -mregparm=3
> +CFLAGS_reloc_ia32.o += -fpic -fshort-wchar
> +
> +# When building for 64-bit we must remove the i386-specific flags
> +CFLAGS_REMOVE_reloc_x86_64.o += -mregparm=3 -march=i386 -m32
> +CFLAGS_reloc_x86_64.o += -fpic -fshort-wchar
> +
> +AFLAGS_REMOVE_crt0-efi-x86_64.o += -mregparm=3 -march=i386 -m32
> +AFLAGS_crt0-efi-x86_64.o += -fpic -fshort-wchar
> +
> +extra-$(CONFIG_EFI_STUB_32BIT) += crt0-efi-ia32.o reloc_ia32.o
> +extra-$(CONFIG_EFI_STUB_64BIT) += crt0-efi-x86_64.o reloc_x86_64.o
> +endif
> --

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Simon Glass Aug. 5, 2015, 6:03 p.m. UTC | #2
On 5 August 2015 at 06:20, Bin Meng <bmeng.cn@gmail.com> wrote:
> On Wed, Aug 5, 2015 at 2:33 AM, Simon Glass <sjg@chromium.org> wrote:
>> Add support for building a 32/64-bit EFI stub for x86. This involves
>> building the startup and relocation code for either i386 or x86_64.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>> Changes in v3:
>> - Move 64-bit comment to just above the 64-bit flag adjustments
>>
>> Changes in v2:
>> - Add a comment as to why the AFLAGS_REMOVE_.. lines are needed
>> - Move the crt and reloc files into arch/x86/lib/efi/
>>
>>  arch/x86/lib/Makefile     |  2 +-
>>  arch/x86/lib/efi/Makefile | 24 ++++++++++++++++++++++++
>>  2 files changed, 25 insertions(+), 1 deletion(-)
>>  create mode 100644 arch/x86/lib/efi/Makefile
>>
[snip]
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Applied to u-boot-x86.
diff mbox

Patch

diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 43489fd..09c236b 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -34,7 +34,7 @@  obj-$(CONFIG_SYS_X86_TSC_TIMER)	+= tsc_timer.o
 obj-$(CONFIG_CMD_ZBOOT)	+= zimage.o
 obj-$(CONFIG_HAVE_FSP) += fsp/
 
-extra-$(CONFIG_USE_PRIVATE_LIBGCC) := lib.a
+extra-$(CONFIG_USE_PRIVATE_LIBGCC) += lib.a
 
 NORMAL_LIBGCC = $(shell $(CC) $(PLATFORM_CPPFLAGS) -print-libgcc-file-name)
 OBJCOPYFLAGS := --prefix-symbols=__normal_
diff --git a/arch/x86/lib/efi/Makefile b/arch/x86/lib/efi/Makefile
new file mode 100644
index 0000000..bb7b95b
--- /dev/null
+++ b/arch/x86/lib/efi/Makefile
@@ -0,0 +1,24 @@ 
+#
+# (C) Copyright 2002-2006
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-$(CONFIG_EFI_APP) += crt0-efi-ia32.o reloc_ia32.o
+
+ifneq ($(CONFIG_EFI_STUB),)
+
+CFLAGS_REMOVE_reloc_ia32.o += -mregparm=3
+CFLAGS_reloc_ia32.o += -fpic -fshort-wchar
+
+# When building for 64-bit we must remove the i386-specific flags
+CFLAGS_REMOVE_reloc_x86_64.o += -mregparm=3 -march=i386 -m32
+CFLAGS_reloc_x86_64.o += -fpic -fshort-wchar
+
+AFLAGS_REMOVE_crt0-efi-x86_64.o += -mregparm=3 -march=i386 -m32
+AFLAGS_crt0-efi-x86_64.o += -fpic -fshort-wchar
+
+extra-$(CONFIG_EFI_STUB_32BIT) += crt0-efi-ia32.o reloc_ia32.o
+extra-$(CONFIG_EFI_STUB_64BIT) += crt0-efi-x86_64.o reloc_x86_64.o
+endif