config.mk 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # SPDX-License-Identifier: GPL-2.0+
  2. # Copyright (c) 2011 The Chromium OS Authors.
  3. PLATFORM_CPPFLAGS += -D__SANDBOX__ -U_FORTIFY_SOURCE
  4. PLATFORM_CPPFLAGS += -DCONFIG_ARCH_MAP_SYSMEM
  5. PLATFORM_CPPFLAGS += -fPIC
  6. PLATFORM_LIBS += -lrt
  7. SDL_CONFIG ?= sdl-config
  8. # Define this to avoid linking with SDL, which requires SDL libraries
  9. # This can solve 'sdl-config: Command not found' errors
  10. ifneq ($(NO_SDL),)
  11. PLATFORM_CPPFLAGS += -DSANDBOX_NO_SDL
  12. else
  13. PLATFORM_LIBS += $(shell $(SDL_CONFIG) --libs)
  14. PLATFORM_CPPFLAGS += $(shell $(SDL_CONFIG) --cflags)
  15. endif
  16. cmd_u-boot__ = $(CC) -o $@ -Wl,-T u-boot.lds $(u-boot-init) \
  17. -Wl,--start-group $(u-boot-main) -Wl,--end-group \
  18. $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map
  19. cmd_u-boot-spl = (cd $(obj) && $(CC) -o $(SPL_BIN) -Wl,-T u-boot-spl.lds \
  20. $(patsubst $(obj)/%,%,$(u-boot-spl-init)) \
  21. -Wl,--start-group $(patsubst $(obj)/%,%,$(u-boot-spl-main)) \
  22. $(patsubst $(obj)/%,%,$(u-boot-spl-platdata)) -Wl,--end-group \
  23. $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot-spl.map -Wl,--gc-sections)
  24. CONFIG_ARCH_DEVICE_TREE := sandbox
  25. ifeq ($(HOST_ARCH),$(HOST_ARCH_X86_64))
  26. EFI_LDS := ${SRCDIR}/../../../arch/x86/lib/elf_x86_64_efi.lds
  27. EFI_TARGET := --target=efi-app-x86_64
  28. else ifeq ($(HOST_ARCH),$(HOST_ARCH_X86))
  29. EFI_LDS := ${SRCDIR}/../../../arch/x86/lib/elf_ia32_efi.lds
  30. EFI_TARGET := --target=efi-app-ia32
  31. else ifeq ($(HOST_ARCH),$(HOST_ARCH_AARCH64))
  32. EFI_LDS := ${SRCDIR}/../../../arch/arm/lib/elf_aarch64_efi.lds
  33. OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .data \
  34. -j .u_boot_list -j .rela.dyn -j .got -j .got.plt \
  35. -j .binman_sym_table -j .text_rest \
  36. -j .efi_runtime -j .efi_runtime_rel
  37. else ifeq ($(HOST_ARCH),$(HOST_ARCH_ARM))
  38. EFI_LDS := ${SRCDIR}/../../../arch/arm/lib/elf_arm_efi.lds
  39. OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .hash \
  40. -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn \
  41. -j .binman_sym_table -j .text_rest \
  42. -j .efi_runtime -j .efi_runtime_rel
  43. else ifeq ($(HOST_ARCH),$(HOST_ARCH_RISCV32))
  44. EFI_LDS := ${SRCDIR}/../../../arch/riscv/lib/elf_riscv32_efi.lds
  45. else ifeq ($(HOST_ARCH),$(HOST_ARCH_RISCV64))
  46. EFI_LDS := ${SRCDIR}/../../../arch/riscv/lib/elf_riscv64_efi.lds
  47. endif
  48. EFI_CRT0 := crt0_sandbox_efi.o
  49. EFI_RELOC := reloc_sandbox_efi.o
  50. AFLAGS_crt0_sandbox_efi.o += -DHOST_ARCH="$(HOST_ARCH)"
  51. CFLAGS_reloc_sandbox_efi.o += -DHOST_ARCH="$(HOST_ARCH)"