blob: 189e9c2b0c6d3fc20ffaec6ad13ef7f2b27942c8 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001# SPDX-License-Identifier: GPL-2.0+
Simon Glass4b0730d2011-09-26 14:10:39 +00002# Copyright (c) 2011 The Chromium OS Authors.
Simon Glass4b0730d2011-09-26 14:10:39 +00003
Masahiro Yamada90f984e2014-07-30 14:08:23 +09004PLATFORM_CPPFLAGS += -D__SANDBOX__ -U_FORTIFY_SOURCE
Masahiro Yamada0a9e7ee2015-03-19 19:42:52 +09005PLATFORM_CPPFLAGS += -DCONFIG_ARCH_MAP_SYSMEM
Andy Shevchenkoe599c4e72018-09-03 12:08:10 +03006PLATFORM_CPPFLAGS += -fPIC
Matthias Weisserd99a6872011-11-29 12:16:40 +01007PLATFORM_LIBS += -lrt
Simon Glass96d0cd42020-02-03 07:36:12 -07008SDL_CONFIG ?= sdl2-config
Simon Glassa733b062013-04-26 02:53:43 +00009
Simon Glasse50ab222015-02-10 18:52:35 -070010# Define this to avoid linking with SDL, which requires SDL libraries
11# This can solve 'sdl-config: Command not found' errors
12ifneq ($(NO_SDL),)
13PLATFORM_CPPFLAGS += -DSANDBOX_NO_SDL
14else
Simon Glasse8a7b302019-05-18 11:59:47 -060015PLATFORM_LIBS += $(shell $(SDL_CONFIG) --libs)
16PLATFORM_CPPFLAGS += $(shell $(SDL_CONFIG) --cflags)
Simon Glassbbc09bf2014-02-27 13:26:17 -070017endif
18
Simon Glass40e9ede2018-11-23 21:29:30 -070019cmd_u-boot__ = $(CC) -o $@ -Wl,-T u-boot.lds $(u-boot-init) \
Masahiro Yamadaad0fed42014-02-24 11:12:18 +090020 -Wl,--start-group $(u-boot-main) -Wl,--end-group \
21 $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map
Simon Glass714a5622014-02-26 15:59:14 -070022
Simon Glass4cfc4162016-07-04 11:57:46 -060023cmd_u-boot-spl = (cd $(obj) && $(CC) -o $(SPL_BIN) -Wl,-T u-boot-spl.lds \
Simon Glass40e9ede2018-11-23 21:29:30 -070024 $(patsubst $(obj)/%,%,$(u-boot-spl-init)) \
Simon Glass4cfc4162016-07-04 11:57:46 -060025 -Wl,--start-group $(patsubst $(obj)/%,%,$(u-boot-spl-main)) \
26 $(patsubst $(obj)/%,%,$(u-boot-spl-platdata)) -Wl,--end-group \
27 $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot-spl.map -Wl,--gc-sections)
28
Simon Glass714a5622014-02-26 15:59:14 -070029CONFIG_ARCH_DEVICE_TREE := sandbox
Heinrich Schuchardt3b4847c2019-11-07 08:05:17 +010030
31ifeq ($(HOST_ARCH),$(HOST_ARCH_X86_64))
32EFI_LDS := ${SRCDIR}/../../../arch/x86/lib/elf_x86_64_efi.lds
33EFI_TARGET := --target=efi-app-x86_64
34else ifeq ($(HOST_ARCH),$(HOST_ARCH_X86))
35EFI_LDS := ${SRCDIR}/../../../arch/x86/lib/elf_ia32_efi.lds
36EFI_TARGET := --target=efi-app-ia32
37else ifeq ($(HOST_ARCH),$(HOST_ARCH_AARCH64))
38EFI_LDS := ${SRCDIR}/../../../arch/arm/lib/elf_aarch64_efi.lds
39OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .data \
40 -j .u_boot_list -j .rela.dyn -j .got -j .got.plt \
41 -j .binman_sym_table -j .text_rest \
42 -j .efi_runtime -j .efi_runtime_rel
43else ifeq ($(HOST_ARCH),$(HOST_ARCH_ARM))
44EFI_LDS := ${SRCDIR}/../../../arch/arm/lib/elf_arm_efi.lds
45OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .hash \
46 -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn \
47 -j .binman_sym_table -j .text_rest \
48 -j .efi_runtime -j .efi_runtime_rel
49else ifeq ($(HOST_ARCH),$(HOST_ARCH_RISCV32))
50EFI_LDS := ${SRCDIR}/../../../arch/riscv/lib/elf_riscv32_efi.lds
51else ifeq ($(HOST_ARCH),$(HOST_ARCH_RISCV64))
52EFI_LDS := ${SRCDIR}/../../../arch/riscv/lib/elf_riscv64_efi.lds
53endif
54EFI_CRT0 := crt0_sandbox_efi.o
55EFI_RELOC := reloc_sandbox_efi.o
56AFLAGS_crt0_sandbox_efi.o += -DHOST_ARCH="$(HOST_ARCH)"
57CFLAGS_reloc_sandbox_efi.o += -DHOST_ARCH="$(HOST_ARCH)"