Commit b997abd3f06f136b226431a2947520dd5a426869

Authored by Simon Glass
1 parent 476476e73b

x86: Support building the EFI stub

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>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Showing 2 changed files with 25 additions and 1 deletions Side-by-side Diff

arch/x86/lib/Makefile
... ... @@ -34,7 +34,7 @@
34 34 obj-$(CONFIG_CMD_ZBOOT) += zimage.o
35 35 obj-$(CONFIG_HAVE_FSP) += fsp/
36 36  
37   -extra-$(CONFIG_USE_PRIVATE_LIBGCC) := lib.a
  37 +extra-$(CONFIG_USE_PRIVATE_LIBGCC) += lib.a
38 38  
39 39 NORMAL_LIBGCC = $(shell $(CC) $(PLATFORM_CPPFLAGS) -print-libgcc-file-name)
40 40 OBJCOPYFLAGS := --prefix-symbols=__normal_
arch/x86/lib/efi/Makefile
  1 +#
  2 +# (C) Copyright 2002-2006
  3 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4 +#
  5 +# SPDX-License-Identifier: GPL-2.0+
  6 +#
  7 +
  8 +obj-$(CONFIG_EFI_APP) += crt0-efi-ia32.o reloc_ia32.o
  9 +
  10 +ifneq ($(CONFIG_EFI_STUB),)
  11 +
  12 +CFLAGS_REMOVE_reloc_ia32.o += -mregparm=3
  13 +CFLAGS_reloc_ia32.o += -fpic -fshort-wchar
  14 +
  15 +# When building for 64-bit we must remove the i386-specific flags
  16 +CFLAGS_REMOVE_reloc_x86_64.o += -mregparm=3 -march=i386 -m32
  17 +CFLAGS_reloc_x86_64.o += -fpic -fshort-wchar
  18 +
  19 +AFLAGS_REMOVE_crt0-efi-x86_64.o += -mregparm=3 -march=i386 -m32
  20 +AFLAGS_crt0-efi-x86_64.o += -fpic -fshort-wchar
  21 +
  22 +extra-$(CONFIG_EFI_STUB_32BIT) += crt0-efi-ia32.o reloc_ia32.o
  23 +extra-$(CONFIG_EFI_STUB_64BIT) += crt0-efi-x86_64.o reloc_x86_64.o
  24 +endif