2018-05-06 21:58:06 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0+
|
2011-09-26 14:10:39 +00:00
|
|
|
# Copyright (c) 2011 The Chromium OS Authors.
|
|
|
|
|
2014-07-30 05:08:23 +00:00
|
|
|
PLATFORM_CPPFLAGS += -D__SANDBOX__ -U_FORTIFY_SOURCE
|
2018-09-03 09:08:10 +00:00
|
|
|
PLATFORM_CPPFLAGS += -fPIC
|
2011-11-29 11:16:40 +00:00
|
|
|
PLATFORM_LIBS += -lrt
|
2020-02-03 14:36:12 +00:00
|
|
|
SDL_CONFIG ?= sdl2-config
|
2013-04-26 02:53:43 +00:00
|
|
|
|
2015-02-11 01:52:35 +00:00
|
|
|
# Define this to avoid linking with SDL, which requires SDL libraries
|
|
|
|
# This can solve 'sdl-config: Command not found' errors
|
|
|
|
ifneq ($(NO_SDL),)
|
|
|
|
PLATFORM_CPPFLAGS += -DSANDBOX_NO_SDL
|
|
|
|
else
|
2019-05-18 17:59:47 +00:00
|
|
|
PLATFORM_LIBS += $(shell $(SDL_CONFIG) --libs)
|
|
|
|
PLATFORM_CPPFLAGS += $(shell $(SDL_CONFIG) --cflags)
|
2014-02-27 20:26:17 +00:00
|
|
|
endif
|
|
|
|
|
2022-05-30 10:00:05 +00:00
|
|
|
SANITIZERS :=
|
|
|
|
ifdef CONFIG_ASAN
|
|
|
|
SANITIZERS += -fsanitize=address
|
|
|
|
endif
|
2022-05-30 10:00:11 +00:00
|
|
|
ifdef CONFIG_FUZZ
|
|
|
|
SANITIZERS += -fsanitize=fuzzer
|
|
|
|
endif
|
2022-05-30 10:00:05 +00:00
|
|
|
KBUILD_CFLAGS += $(SANITIZERS)
|
|
|
|
|
2018-11-24 04:29:30 +00:00
|
|
|
cmd_u-boot__ = $(CC) -o $@ -Wl,-T u-boot.lds $(u-boot-init) \
|
2022-05-30 10:00:05 +00:00
|
|
|
$(KBUILD_LDFLAGS:%=-Wl,%) \
|
|
|
|
$(SANITIZERS) \
|
|
|
|
$(LTO_FINAL_LDFLAGS) \
|
2021-05-20 11:24:02 +00:00
|
|
|
-Wl,--whole-archive \
|
|
|
|
$(u-boot-main) \
|
2021-05-20 11:24:07 +00:00
|
|
|
$(u-boot-keep-syms-lto) \
|
2021-05-20 11:24:02 +00:00
|
|
|
-Wl,--no-whole-archive \
|
2014-02-24 02:12:18 +00:00
|
|
|
$(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map
|
2014-02-26 22:59:14 +00:00
|
|
|
|
2016-07-04 17:57:46 +00:00
|
|
|
cmd_u-boot-spl = (cd $(obj) && $(CC) -o $(SPL_BIN) -Wl,-T u-boot-spl.lds \
|
2022-05-30 10:00:05 +00:00
|
|
|
$(KBUILD_LDFLAGS:%=-Wl,%) \
|
|
|
|
$(SANITIZERS) \
|
|
|
|
$(LTO_FINAL_LDFLAGS) \
|
2018-11-24 04:29:30 +00:00
|
|
|
$(patsubst $(obj)/%,%,$(u-boot-spl-init)) \
|
2021-05-20 11:24:02 +00:00
|
|
|
-Wl,--whole-archive \
|
|
|
|
$(patsubst $(obj)/%,%,$(u-boot-spl-main)) \
|
|
|
|
$(patsubst $(obj)/%,%,$(u-boot-spl-platdata)) \
|
2021-05-20 11:24:07 +00:00
|
|
|
$(patsubst $(obj)/%,%,$(u-boot-spl-keep-syms-lto)) \
|
2021-05-20 11:24:02 +00:00
|
|
|
-Wl,--no-whole-archive \
|
2016-07-04 17:57:46 +00:00
|
|
|
$(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot-spl.map -Wl,--gc-sections)
|
|
|
|
|
2014-02-26 22:59:14 +00:00
|
|
|
CONFIG_ARCH_DEVICE_TREE := sandbox
|
2019-11-07 07:05:17 +00:00
|
|
|
|
|
|
|
ifeq ($(HOST_ARCH),$(HOST_ARCH_X86_64))
|
|
|
|
EFI_LDS := ${SRCDIR}/../../../arch/x86/lib/elf_x86_64_efi.lds
|
|
|
|
EFI_TARGET := --target=efi-app-x86_64
|
|
|
|
else ifeq ($(HOST_ARCH),$(HOST_ARCH_X86))
|
|
|
|
EFI_LDS := ${SRCDIR}/../../../arch/x86/lib/elf_ia32_efi.lds
|
|
|
|
EFI_TARGET := --target=efi-app-ia32
|
|
|
|
else ifeq ($(HOST_ARCH),$(HOST_ARCH_AARCH64))
|
|
|
|
EFI_LDS := ${SRCDIR}/../../../arch/arm/lib/elf_aarch64_efi.lds
|
|
|
|
OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .data \
|
2022-05-30 10:00:04 +00:00
|
|
|
-j __u_boot_list -j .rela.dyn -j .got -j .got.plt \
|
2019-11-07 07:05:17 +00:00
|
|
|
-j .binman_sym_table -j .text_rest \
|
|
|
|
-j .efi_runtime -j .efi_runtime_rel
|
|
|
|
else ifeq ($(HOST_ARCH),$(HOST_ARCH_ARM))
|
|
|
|
EFI_LDS := ${SRCDIR}/../../../arch/arm/lib/elf_arm_efi.lds
|
|
|
|
OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .hash \
|
2022-05-30 10:00:04 +00:00
|
|
|
-j .data -j .got -j .got.plt -j __u_boot_list -j .rel.dyn \
|
2019-11-07 07:05:17 +00:00
|
|
|
-j .binman_sym_table -j .text_rest \
|
|
|
|
-j .efi_runtime -j .efi_runtime_rel
|
|
|
|
else ifeq ($(HOST_ARCH),$(HOST_ARCH_RISCV32))
|
|
|
|
EFI_LDS := ${SRCDIR}/../../../arch/riscv/lib/elf_riscv32_efi.lds
|
|
|
|
else ifeq ($(HOST_ARCH),$(HOST_ARCH_RISCV64))
|
|
|
|
EFI_LDS := ${SRCDIR}/../../../arch/riscv/lib/elf_riscv64_efi.lds
|
|
|
|
endif
|
|
|
|
EFI_CRT0 := crt0_sandbox_efi.o
|
|
|
|
EFI_RELOC := reloc_sandbox_efi.o
|
|
|
|
AFLAGS_crt0_sandbox_efi.o += -DHOST_ARCH="$(HOST_ARCH)"
|
|
|
|
CFLAGS_reloc_sandbox_efi.o += -DHOST_ARCH="$(HOST_ARCH)"
|