Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | 3d750d7 | 2011-09-26 14:10:39 +0000 | [diff] [blame] | 2 | # Copyright (c) 2011 The Chromium OS Authors. |
Simon Glass | 3d750d7 | 2011-09-26 14:10:39 +0000 | [diff] [blame] | 3 | |
Masahiro Yamada | 4869aee | 2014-07-30 14:08:23 +0900 | [diff] [blame] | 4 | PLATFORM_CPPFLAGS += -D__SANDBOX__ -U_FORTIFY_SOURCE |
Masahiro Yamada | 57a11eb | 2015-03-19 19:42:52 +0900 | [diff] [blame] | 5 | PLATFORM_CPPFLAGS += -DCONFIG_ARCH_MAP_SYSMEM |
Andy Shevchenko | 5077f43 | 2018-09-03 12:08:10 +0300 | [diff] [blame] | 6 | PLATFORM_CPPFLAGS += -fPIC |
Matthias Weisser | 0d3dd14 | 2011-11-29 12:16:40 +0100 | [diff] [blame] | 7 | PLATFORM_LIBS += -lrt |
Simon Glass | b6f4c1c | 2020-02-03 07:36:12 -0700 | [diff] [blame^] | 8 | SDL_CONFIG ?= sdl2-config |
Simon Glass | 62cf912 | 2013-04-26 02:53:43 +0000 | [diff] [blame] | 9 | |
Simon Glass | d8e2292 | 2015-02-10 18:52:35 -0700 | [diff] [blame] | 10 | # Define this to avoid linking with SDL, which requires SDL libraries |
| 11 | # This can solve 'sdl-config: Command not found' errors |
| 12 | ifneq ($(NO_SDL),) |
| 13 | PLATFORM_CPPFLAGS += -DSANDBOX_NO_SDL |
| 14 | else |
Simon Glass | 73585b9 | 2019-05-18 11:59:47 -0600 | [diff] [blame] | 15 | PLATFORM_LIBS += $(shell $(SDL_CONFIG) --libs) |
| 16 | PLATFORM_CPPFLAGS += $(shell $(SDL_CONFIG) --cflags) |
Simon Glass | 0d10f29 | 2014-02-27 13:26:17 -0700 | [diff] [blame] | 17 | endif |
| 18 | |
Simon Glass | 66cf8f7 | 2018-11-23 21:29:30 -0700 | [diff] [blame] | 19 | cmd_u-boot__ = $(CC) -o $@ -Wl,-T u-boot.lds $(u-boot-init) \ |
Masahiro Yamada | 9f9a4e9 | 2014-02-24 11:12:18 +0900 | [diff] [blame] | 20 | -Wl,--start-group $(u-boot-main) -Wl,--end-group \ |
| 21 | $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map |
Simon Glass | 66c164b | 2014-02-26 15:59:14 -0700 | [diff] [blame] | 22 | |
Simon Glass | 1a3ba62 | 2016-07-04 11:57:46 -0600 | [diff] [blame] | 23 | cmd_u-boot-spl = (cd $(obj) && $(CC) -o $(SPL_BIN) -Wl,-T u-boot-spl.lds \ |
Simon Glass | 66cf8f7 | 2018-11-23 21:29:30 -0700 | [diff] [blame] | 24 | $(patsubst $(obj)/%,%,$(u-boot-spl-init)) \ |
Simon Glass | 1a3ba62 | 2016-07-04 11:57:46 -0600 | [diff] [blame] | 25 | -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 Glass | 66c164b | 2014-02-26 15:59:14 -0700 | [diff] [blame] | 29 | CONFIG_ARCH_DEVICE_TREE := sandbox |
Heinrich Schuchardt | 0f675d9 | 2019-11-07 08:05:17 +0100 | [diff] [blame] | 30 | |
| 31 | ifeq ($(HOST_ARCH),$(HOST_ARCH_X86_64)) |
| 32 | EFI_LDS := ${SRCDIR}/../../../arch/x86/lib/elf_x86_64_efi.lds |
| 33 | EFI_TARGET := --target=efi-app-x86_64 |
| 34 | else ifeq ($(HOST_ARCH),$(HOST_ARCH_X86)) |
| 35 | EFI_LDS := ${SRCDIR}/../../../arch/x86/lib/elf_ia32_efi.lds |
| 36 | EFI_TARGET := --target=efi-app-ia32 |
| 37 | else ifeq ($(HOST_ARCH),$(HOST_ARCH_AARCH64)) |
| 38 | EFI_LDS := ${SRCDIR}/../../../arch/arm/lib/elf_aarch64_efi.lds |
| 39 | OBJCOPYFLAGS += -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 |
| 43 | else ifeq ($(HOST_ARCH),$(HOST_ARCH_ARM)) |
| 44 | EFI_LDS := ${SRCDIR}/../../../arch/arm/lib/elf_arm_efi.lds |
| 45 | OBJCOPYFLAGS += -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 |
| 49 | else ifeq ($(HOST_ARCH),$(HOST_ARCH_RISCV32)) |
| 50 | EFI_LDS := ${SRCDIR}/../../../arch/riscv/lib/elf_riscv32_efi.lds |
| 51 | else ifeq ($(HOST_ARCH),$(HOST_ARCH_RISCV64)) |
| 52 | EFI_LDS := ${SRCDIR}/../../../arch/riscv/lib/elf_riscv64_efi.lds |
| 53 | endif |
| 54 | EFI_CRT0 := crt0_sandbox_efi.o |
| 55 | EFI_RELOC := reloc_sandbox_efi.o |
| 56 | AFLAGS_crt0_sandbox_efi.o += -DHOST_ARCH="$(HOST_ARCH)" |
| 57 | CFLAGS_reloc_sandbox_efi.o += -DHOST_ARCH="$(HOST_ARCH)" |