coreinfo: Make better calls to libpayload build scripts

Set LPGCC and LPAS so that CC and AS are maintained.
Clean up the makefile order to check for .config to be easier to
read.
Use objcopy instead of strip and keep the debug symbols file.

Change-Id: I95d6b7a0e3a99a142d3fd6e2ecc61de1d4412402
Signed-off-by: Marc Jones <marc.jones@se-eng.com>
Reviewed-on: http://review.coreboot.org/1994
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
Marc Jones 2012-11-30 17:04:58 -07:00 committed by Ronald G. Minnich
parent bb9490a4b0
commit 5d01b765e3
1 changed files with 25 additions and 26 deletions

View File

@ -18,15 +18,16 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
## ##
export src := $(shell pwd) src := $(shell pwd)
export srctree := $(src) srctree := $(src)
export srck := $(src)/util/kconfig srck := $(src)/util/kconfig
export obj := $(src)/build obj := $(src)/build
export objk := $(src)/build/util/kconfig objk := $(src)/build/util/kconfig
export KERNELVERSION := 0.1.0 export KERNELVERSION := 0.1.0
export KCONFIG_AUTOHEADER := $(obj)/config.h export KCONFIG_AUTOHEADER := $(obj)/config.h
export KCONFIG_AUTOCONFIG := $(obj)/auto.conf export KCONFIG_AUTOCONFIG := $(obj)/auto.conf
export V := $(V)
CONFIG_SHELL := sh CONFIG_SHELL := sh
KBUILD_DEFCONFIG := configs/defconfig KBUILD_DEFCONFIG := configs/defconfig
@ -39,17 +40,17 @@ ifneq ($(V),1)
Q := @ Q := @
endif endif
HOSTCC = gcc HOSTCC ?= gcc
HOSTCXX = g++ HOSTCXX ?= g++
HOSTCFLAGS := -I$(srck) -I$(objk) HOSTCFLAGS := -I$(srck) -I$(objk)
HOSTCXXFLAGS := -I$(srck) -I$(objk) HOSTCXXFLAGS := -I$(srck) -I$(objk)
LIBPAYLOAD_DIR := ../libpayload/install/libpayload LIBPAYLOAD_DIR := ../libpayload/install/libpayload
XCC := CC=$(CC) $(LIBPAYLOAD_DIR)/bin/lpgcc LPCC := $(LIBPAYLOAD_DIR)/bin/lpgcc
AS = $(LIBPAYLOAD_DIR)/bin/lpas LPAS := $(LIBPAYLOAD_DIR)/bin/lpas
STRIP ?= strip OBJCOPY ?= objcopy
INCLUDES = -Ibuild INCLUDES = -I$(obj)
CFLAGS := -Wall -Werror -Os $(INCLUDES) CFLAGS := -Wall -Werror -Os $(INCLUDES)
OBJECTS = cpuinfo_module.o cpuid.S.o pci_module.o coreboot_module.o \ 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 \ nvram_module.o bootlog_module.o ramdump_module.o lar_module.o \
@ -57,32 +58,30 @@ OBJECTS = cpuinfo_module.o cpuid.S.o pci_module.o coreboot_module.o \
OBJS = $(patsubst %,$(obj)/%,$(OBJECTS)) OBJS = $(patsubst %,$(obj)/%,$(OBJECTS))
TARGET = $(obj)/coreinfo.elf TARGET = $(obj)/coreinfo.elf
ifeq ($(strip $(HAVE_DOTCONFIG)),) ifneq ($(strip $(HAVE_DOTCONFIG)),)
all: config
else
include $(src)/.config include $(src)/.config
all: $(TARGET) all: $(TARGET)
$(TARGET): $(src)/.config $(OBJS) prepare $(TARGET): $(src)/.config $(OBJS) prepare
$(Q)printf " LD $(subst $(shell pwd)/,,$(@))\n" $(Q)printf " LPCC $(subst $(shell pwd)/,,$(@))\n"
$(Q)$(XCC) -o $@ $(OBJS) $(Q)$(LPCC) -o $@ $(OBJS)
$(Q)printf " STRIP $(subst $(shell pwd)/,,$(@))\n" $(Q)$(OBJCOPY) --only-keep-debug $@ $(TARGET).debug
$(Q)$(STRIP) -s $@ $(Q)$(OBJCOPY) --strip-debug $@
$(Q)$(OBJCOPY) --add-gnu-debuglink=$(TARGET).debug $@
$(obj)/%.S.o: $(src)/%.S $(obj)/%.S.o: $(src)/%.S
$(Q)printf " AS $(subst $(shell pwd)/,,$(@))\n" $(Q)printf " LPAS $(subst $(shell pwd)/,,$(@))\n"
$(Q)$(AS) -o $@ $< $(Q)$(LPAS) -o $@ $<
$(obj)/%.o: $(src)/%.c $(obj)/%.o: $(src)/%.c
$(Q)printf " CC $(subst $(shell pwd)/,,$(@))\n" $(Q)printf " LPCC $(subst $(shell pwd)/,,$(@))\n"
$(Q)$(XCC) $(CFLAGS) -c -o $@ $< $(Q)$(LPCC) $(CFLAGS) -c -o $@ $<
else
all: config
endif endif
prepare: prepare:
$(Q)mkdir -p $(obj)/util/kconfig/lxdialog $(Q)mkdir -p $(obj)/util/kconfig/lxdialog