diff options
author | Martin Roth <martinroth@google.com> | 2015-11-16 22:33:48 -0700 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2015-12-02 16:07:40 +0100 |
commit | cacbcf481513b69fe379058803800731b85d2660 (patch) | |
tree | 26c431f3ca0d318c9b3f03a8d20336ca4b568810 | |
parent | 89b4abdf80ae64374f378058bc3f2f5484a7f977 (diff) |
coreinfo: use coreboot crosscompiler
Set up coreinfo makefile to use .xcompile and the coreboot 32-bit cross
compiler toolchain.
Restrict to x86_32 gcc compiler.
Tested in QEMU
Change-Id: I1cc180a5eeaf6cb9a36fdcef70a9819d0f459168
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/12454
Tested-by: build bot (Jenkins)
Tested-by: BSI firmware lab <coreboot-labor@bsi.bund.de>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
-rw-r--r-- | payloads/coreinfo/Makefile | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/payloads/coreinfo/Makefile b/payloads/coreinfo/Makefile index 507e535e1c..6f7ce51fec 100644 --- a/payloads/coreinfo/Makefile +++ b/payloads/coreinfo/Makefile @@ -49,23 +49,43 @@ HOSTCXXFLAGS := -I$(srck) -I$(objk) LIBCONFIG_PATH := ../libpayload LIBPAYLOAD_DIR := build/libpayload -LPCC := $(LIBPAYLOAD_DIR)/libpayload/bin/lpgcc -LPAS := $(LIBPAYLOAD_DIR)/libpayload/bin/lpas HAVE_LIBPAYLOAD := $(wildcard $(LIBPAYLOAD_DIR)/libpayload/lib/libpayload.a) LIB_CONFIG ?= defconfig OBJCOPY ?= objcopy INCLUDES = -I$(obj) -include $(LIBPAYLOAD_DIR)/libpayload/include/kconfig.h -CFLAGS := -Wall -Werror -Os -fno-builtin $(INCLUDES) OBJECTS = cpuinfo_module.o cpuid.S.o pci_module.o coreboot_module.o \ nvram_module.o bootlog_module.o ramdump_module.o lar_module.o \ multiboot_module.o cbfs_module.o coreinfo.o OBJS = $(patsubst %,$(obj)/%,$(OBJECTS)) TARGET = $(obj)/coreinfo.elf +all: real-all + +# in addition to the dependency below, create the file if it doesn't exist +# to silence warnings about a file that would be generated anyway. +$(if $(wildcard .xcompile),,$(eval $(shell ../../util/xcompile/xcompile $(XGCCPATH) > .xcompile || rm -f .xcompile))) +.xcompile: ../../util/xcompile/xcompile + $< $(XGCCPATH) > $@.tmp + \mv -f $@.tmp $@ 2> /dev/null || rm -f $@.tmp $@ + +CONFIG_COMPILER_GCC := y +ARCH-y := x86_32 + +include .xcompile + +CC := $(CC_$(ARCH-y)) +AS := $(AS_$(ARCH-y)) +OBJCOPY := $(OBJCOPY_$(ARCH-y)) + +LPCC := CC=$(CC) $(LIBPAYLOAD_DIR)/libpayload/bin/lpgcc +LPAS := AS=$(AS) $(LIBPAYLOAD_DIR)/libpayload/bin/lpas + +CFLAGS += -Wall -Werror -Os -fno-builtin $(CFLAGS_$(ARCH-y)) $(INCLUDES) + ifneq ($(strip $(HAVE_DOTCONFIG)),) include $(src)/.config -all: $(TARGET) +real-all: $(TARGET) $(TARGET): $(src)/.config $(obj)/config.h $(OBJS) libpayload printf " LPCC $(subst $(shell pwd)/,,$(@)) (LINK)\n" @@ -83,7 +103,7 @@ $(obj)/%.o: $(src)/%.c libpayload $(LPCC) $(CFLAGS) -c -o $@ $< else -all: config +real-all: config endif ifneq ($(strip $(HAVE_LIBPAYLOAD)),) @@ -92,9 +112,9 @@ libpayload: else libpayload: printf "Building libpayload @ $(LIBCONFIG_PATH).\n" - make -C $(LIBCONFIG_PATH) distclean - make -C $(LIBCONFIG_PATH) $(LIB_CONFIG) - make -C $(LIBCONFIG_PATH) DESTDIR=$(shell pwd)/$(LIBPAYLOAD_DIR) install + $(MAKE) -C $(LIBCONFIG_PATH) distclean + $(MAKE) -C $(LIBCONFIG_PATH) $(LIB_CONFIG) + $(MAKE) -C $(LIBCONFIG_PATH) DESTDIR=$(shell pwd)/$(LIBPAYLOAD_DIR) install endif $(obj)/config.h: |