2017-11-13 04:52:07 +00:00
|
|
|
#
|
2019-08-24 13:22:59 +00:00
|
|
|
# Builds test programs. This is launched from elf_test.BuildElfTestFiles()
|
2017-11-13 04:52:07 +00:00
|
|
|
#
|
|
|
|
# Copyright (C) 2017 Google, Inc
|
|
|
|
# Written by Simon Glass <sjg@chromium.org>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-2.0+
|
|
|
|
#
|
|
|
|
|
2020-09-06 11:46:04 +00:00
|
|
|
HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ )
|
|
|
|
ifeq ($(findstring $(HOSTARCH),"x86" "x86_64"),)
|
|
|
|
ifeq ($(findstring $(MAKECMDGOALS),"help" "clean"),)
|
|
|
|
ifndef CROSS_COMPILE
|
|
|
|
$(error Binman tests need to compile to x86, but the CPU arch of your \
|
|
|
|
machine is $(HOSTARCH). Set CROSS_COMPILE to a suitable cross compiler)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
CC = $(CROSS_COMPILE)gcc
|
|
|
|
OBJCOPY = $(CROSS_COMPILE)objcopy
|
|
|
|
|
2019-08-24 13:22:53 +00:00
|
|
|
VPATH := $(SRC)
|
2019-08-24 13:22:56 +00:00
|
|
|
CFLAGS := -march=i386 -m32 -nostdlib -I $(SRC)../../../include \
|
|
|
|
-Wl,--no-dynamic-linker
|
2017-11-13 04:52:07 +00:00
|
|
|
|
2019-08-24 13:22:54 +00:00
|
|
|
LDS_UCODE := -T $(SRC)u_boot_ucode_ptr.lds
|
2019-08-24 13:22:56 +00:00
|
|
|
LDS_BINMAN := -T $(SRC)u_boot_binman_syms.lds
|
2019-08-24 13:22:58 +00:00
|
|
|
LDS_BINMAN_BAD := -T $(SRC)u_boot_binman_syms_bad.lds
|
2019-11-07 00:22:44 +00:00
|
|
|
LDS_BINMAN_X86 := -T $(SRC)u_boot_binman_syms_x86.lds
|
2021-11-04 03:09:18 +00:00
|
|
|
LDS_BINMAN_EMBED := -T $(SRC)u_boot_binman_embed.lds
|
2022-02-08 18:49:59 +00:00
|
|
|
LDS_EFL_SECTIONS := -T $(SRC)elf_sections.lds
|
2017-11-13 04:52:07 +00:00
|
|
|
|
2017-11-14 01:54:58 +00:00
|
|
|
TARGETS = u_boot_ucode_ptr u_boot_no_ucode_ptr bss_data \
|
|
|
|
u_boot_binman_syms u_boot_binman_syms.bin u_boot_binman_syms_bad \
|
2021-11-04 03:09:18 +00:00
|
|
|
u_boot_binman_syms_size u_boot_binman_syms_x86 embed_data \
|
2022-02-08 18:49:59 +00:00
|
|
|
u_boot_binman_embed u_boot_binman_embed_sm elf_sections
|
2017-11-13 04:52:07 +00:00
|
|
|
|
|
|
|
all: $(TARGETS)
|
|
|
|
|
|
|
|
u_boot_no_ucode_ptr: CFLAGS += $(LDS_UCODE)
|
|
|
|
u_boot_no_ucode_ptr: u_boot_no_ucode_ptr.c
|
|
|
|
|
|
|
|
u_boot_ucode_ptr: CFLAGS += $(LDS_UCODE)
|
|
|
|
u_boot_ucode_ptr: u_boot_ucode_ptr.c
|
|
|
|
|
2019-08-24 13:22:53 +00:00
|
|
|
bss_data: CFLAGS += $(SRC)bss_data.lds
|
2017-11-13 04:52:25 +00:00
|
|
|
bss_data: bss_data.c
|
|
|
|
|
2021-11-04 03:09:16 +00:00
|
|
|
embed_data: CFLAGS += $(SRC)embed_data.lds
|
|
|
|
embed_data: embed_data.c
|
|
|
|
|
2017-11-14 01:54:58 +00:00
|
|
|
u_boot_binman_syms.bin: u_boot_binman_syms
|
2020-09-06 11:46:04 +00:00
|
|
|
$(OBJCOPY) -O binary $< -R .note.gnu.build-id $@
|
2017-11-14 01:54:58 +00:00
|
|
|
|
|
|
|
u_boot_binman_syms: CFLAGS += $(LDS_BINMAN)
|
|
|
|
u_boot_binman_syms: u_boot_binman_syms.c
|
|
|
|
|
2019-11-07 00:22:44 +00:00
|
|
|
u_boot_binman_syms_x86: CFLAGS += $(LDS_BINMAN_X86)
|
|
|
|
u_boot_binman_syms_x86: u_boot_binman_syms_x86.c
|
|
|
|
|
2017-11-14 01:54:58 +00:00
|
|
|
u_boot_binman_syms_bad: CFLAGS += $(LDS_BINMAN_BAD)
|
|
|
|
u_boot_binman_syms_bad: u_boot_binman_syms_bad.c
|
|
|
|
|
|
|
|
u_boot_binman_syms_size: CFLAGS += $(LDS_BINMAN)
|
|
|
|
u_boot_binman_syms_size: u_boot_binman_syms_size.c
|
|
|
|
|
2021-11-04 03:09:18 +00:00
|
|
|
u_boot_binman_embed: CFLAGS += $(LDS_BINMAN_EMBED)
|
|
|
|
u_boot_binman_embed: u_boot_binman_embed.c
|
|
|
|
|
|
|
|
u_boot_binman_embed_sm: CFLAGS += $(LDS_BINMAN_EMBED)
|
|
|
|
u_boot_binman_embed_sm: u_boot_binman_embed_sm.c
|
|
|
|
|
2022-02-08 18:49:59 +00:00
|
|
|
elf_sections: CFLAGS += $(LDS_EFL_SECTIONS)
|
|
|
|
elf_sections: elf_sections.c
|
|
|
|
|
2017-11-13 04:52:07 +00:00
|
|
|
clean:
|
|
|
|
rm -f $(TARGETS)
|
|
|
|
|
|
|
|
help:
|
|
|
|
@echo "Makefile for binman test programs"
|
|
|
|
@echo
|
|
|
|
@echo "Intended for use on x86 hosts"
|
|
|
|
@echo
|
|
|
|
@echo "Targets:"
|
|
|
|
@echo
|
|
|
|
@echo -e "\thelp - Print help (this is it!)"
|
|
|
|
@echo -e "\tall - Builds test programs (default targget)"
|
|
|
|
@echo -e "\tclean - Delete output files"
|