Author: mjones Date: Mon Jul 19 20:33:46 2010 New Revision: 135 URL: http://tracker.coreboot.org/trac/filo/changeset/135
Log: This patch builds libpayload for filo from filo. There are two steps: 1) load libpayload kconfig while configuring filo. 2) build libpayload before filo building. it can be used by : $MAKE LIBCONFIG_PATH=/path/to/libpayload"
The filo copy of libpayload is kept locally in the build directory for the next rebuild.
Signed-off-by: Cai Bai Yin caibaiyin.pku@gmail.com Acked-by: Patrick Georgi patrick.georgi@coresystems.de Acked-by: Marc Jones marcj303@gmail.com
Modified: trunk/filo/Makefile trunk/filo/util/kconfig/Makefile
Modified: trunk/filo/Makefile ============================================================================== --- trunk/filo/Makefile Mon Jul 19 19:56:38 2010 (r134) +++ trunk/filo/Makefile Mon Jul 19 20:33:46 2010 (r135) @@ -24,6 +24,7 @@ export srck := $(src)/util/kconfig export obj := $(src)/build export objk := $(src)/build/util/kconfig +export LIBCONFIG_PATH := $(src)/../libpayload
export KERNELVERSION := $(PROGRAM_VERSION) export KCONFIG_AUTOHEADER := $(obj)/config.h @@ -102,19 +103,29 @@
TARGET = $(obj)/filo.elf
+HAVE_LIBCONFIG := $(wildcard $(LIBCONFIG_PATH)) + +all: prepare $(obj)/version.h $(TARGET) + + HAVE_LIBPAYLOAD := $(wildcard $(LIBPAYLOAD)) -ifeq ($(strip $(HAVE_LIBPAYLOAD)),) -all: - @printf "\nError: libpayload is not installed!\nexpected: $(LIBPAYLOAD).\n" +ifneq ($(strip $(HAVE_LIBPAYLOAD)),) +libpayload: + @printf "Found Libpayload $(LIBPAYLOAD).\n" else -all: prepare $(obj)/version.h $(TARGET) +libpayload: $(src)/$(LIB_CONFIG) + $(Q)printf "building libpayload.\n" + $(Q)make -C $(LIBCONFIG_PATH) distclean + $(Q)cp lib.config $(LIBCONFIG_PATH)/.config + $(Q)make -C $(LIBCONFIG_PATH) oldconfig + $(Q)make -C $(LIBCONFIG_PATH) DESTDIR=$(src)/build install endif
-$(obj)/filo: $(src)/.config $(OBJS) +$(obj)/filo: $(src)/.config $(OBJS) libpayload $(Q)printf " LD $(subst $(shell pwd)/,,$(@))\n" $(Q)$(LD) -N -T $(ARCHDIR-y)/ldscript -o $@ $(OBJS) $(LIBPAYLOAD) $(LIBGCC)
-$(TARGET): $(obj)/filo +$(TARGET): $(obj)/filo libpayload $(Q)cp $(obj)/filo $@ $(Q)$(NM) $(obj)/filo | sort > $(obj)/filo.map $(Q)printf " STRIP $(subst $(shell pwd)/,,$(@))\n" @@ -122,7 +133,7 @@
include util/kconfig/Makefile
-$(obj)/%.o: $(src)/%.c +$(obj)/%.o: $(src)/%.c libpayload $(Q)printf " CC $(subst $(shell pwd)/,,$(@))\n" $(Q)$(CC) -MMD $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
@@ -148,7 +159,7 @@
distclean: clean $(Q)rm -rf build - $(Q)rm -f .config .config.old ..config.tmp .kconfig.d .tmpconfig* + $(Q)rm -f .config lib.config .config.old ..config.tmp .kconfig.d .tmpconfig*
FORCE:
Modified: trunk/filo/util/kconfig/Makefile ============================================================================== --- trunk/filo/util/kconfig/Makefile Mon Jul 19 19:56:38 2010 (r134) +++ trunk/filo/util/kconfig/Makefile Mon Jul 19 20:33:46 2010 (r135) @@ -12,23 +12,161 @@
Kconfig := Config.in
+FILO_CONFIG := $(src)/.config +LIB_CONFIG := $(src)/lib.config +HAVE_FILO_CONFIG := $(wildcard $(FILO_CONFIG)) +HAVE_LIB_CONFIG := $(wildcard $(LIB_CONFIG)) + +ifneq ($(strip $(HAVE_FILO_CONFIG)),) +ifneq ($(strip $(HAVE_LIB_CONFIG)),) xconfig: prepare $(objk)/qconf + $(Q)printf "Libpayload config for FILO.\n" + $(Q)mv $(FILO_CONFIG) $(FILO_CONFIG)."temp" + $(Q)mv $(LIB_CONFIG) $(FILO_CONFIG) + $(Q)$(objk)/qconf $(LIBCONFIG_PATH)/Config.in + $(Q)mv $(FILO_CONFIG) $(LIB_CONFIG) + $(Q)printf "Libpayload config done.\n" + $(Q)mv $(FILO_CONFIG)."temp" $(FILO_CONFIG) $(Q)$(objk)/qconf $(Kconfig) +else +xconfig: prepare $(objk)/qconf + $(Q)printf "Lost libpayload config file.\n" + $(Q)rm -f $(FILO_CONFIG) +endif +else +xconfig: prepare $(objk)/qconf + $(Q)printf "Libpayload config for FILO.\n" + $(Q)$(objk)/qconf $(LIBCONFIG_PATH)/Config.in + $(Q)mv $(FILO_CONFIG) $(LIB_CONFIG) + $(Q)printf "Libpayload config done.\n" + $(Q)$(objk)/qconf $(Kconfig) +endif
+ifneq ($(strip $(HAVE_FILO_CONFIG)),) +ifneq ($(strip $(HAVE_LIB_CONFIG)),) +gconfig: prepare $(objk)/gconf + $(Q)printf "Libpayload config for FILO.\n" + $(Q)mv $(FILO_CONFIG) $(FILO_CONFIG)."temp" + $(Q)mv $(LIB_CONFIG) $(FILO_CONFIG) + $(Q)$(objk)/gconf $(LIBCONFIG_PATH)/Config.in + $(Q)mv $(FILO_CONFIG) $(LIB_CONFIG) + $(Q)printf "Libpayload config done.\n" + $(Q)mv $(FILO_CONFIG)."temp" $(FILO_CONFIG) + $(Q)$(objk)/gconf $(Kconfig) +else +gconfig: prepare $(objk)/gconf + $(Q)printf "Lost libpayload config file.\n" + $(Q)rm -f $(FILO_CONFIG) +endif +else gconfig: prepare $(objk)/gconf + $(Q)printf "Libpayload config for FILO.\n" + $(Q)$(objk)/gconf $(LIBCONFIG_PATH)/Config.in + $(Q)mv $(FILO_CONFIG) $(LIB_CONFIG) + $(Q)printf "Libpayload config done.\n" $(Q)$(objk)/gconf $(Kconfig) +endif
+ifneq ($(strip $(HAVE_FILO_CONFIG)),) +ifneq ($(strip $(HAVE_LIB_CONFIG)),) +menuconfig: prepare $(objk)/mconf + $(Q)printf "Libpayload config for FILO.\n" + $(Q)mv $(FILO_CONFIG) $(FILO_CONFIG)."temp" + $(Q)mv $(LIB_CONFIG) $(FILO_CONFIG) + $(Q)$(objk)/mconf $(LIBCONFIG_PATH)/Config.in + $(Q)mv $(FILO_CONFIG) $(LIB_CONFIG) + $(Q)printf "Libpayload config done.\n" + $(Q)mv $(FILO_CONFIG)."temp" $(FILO_CONFIG) + $(Q)$(objk)/mconf $(Kconfig) +else +menuconfig: prepare $(objk)/mconf + $(Q)printf "Lost libpayload config file.\n" + $(Q)rm -f $(FILO_CONFIG) +endif +else menuconfig: prepare $(objk)/mconf + $(Q)printf "Libpayload config for FILO.\n" + $(Q)$(objk)/mconf $(LIBCONFIG_PATH)/Config.in + $(Q)mv $(FILO_CONFIG) $(LIB_CONFIG) + $(Q)printf "Libpayload config done.\n" $(Q)$(objk)/mconf $(Kconfig) +endif
+ifneq ($(strip $(HAVE_FILO_CONFIG)),) +ifneq ($(strip $(HAVE_LIB_CONFIG)),) config: prepare $(objk)/conf + $(Q)printf "Libpayload config for FILO.\n" + $(Q)mv $(FILO_CONFIG) $(FILO_CONFIG)."temp" + $(Q)mv $(LIB_CONFIG) $(FILO_CONFIG) + $(Q)$(objk)/conf $(LIBCONFIG_PATH)/Config.in + $(Q)mv $(FILO_CONFIG) $(LIB_CONFIG) + $(Q)printf "Libpayload config done.\n" + $(Q)mv $(FILO_CONFIG)."temp" $(FILO_CONFIG) $(Q)$(objk)/conf $(Kconfig) +else +config: prepare $(objk)/conf + $(Q)printf "Lost libpayload config file.\n" + $(Q)rm -f $(FILO_CONFIG) +endif +else +config: prepare $(objk)/conf + $(Q)printf "Libpayload config for FILO.\n" + $(Q)$(objk)/conf $(LIBCONFIG_PATH)/Config.in + $(Q)mv $(FILO_CONFIG) $(LIB_CONFIG) + $(Q)printf "Libpayload config done.\n" + $(Q)$(objk)/conf $(Kconfig) +endif
+ifneq ($(strip $(HAVE_FILO_CONFIG)),) +ifneq ($(strip $(HAVE_LIB_CONFIG)),) +oldconfig: prepare $(objk)/conf + $(Q)printf "Libpayload config for FILO.\n" + $(Q)mv $(FILO_CONFIG) $(FILO_CONFIG)."temp" + $(Q)mv $(LIB_CONFIG) $(FILO_CONFIG) + $(Q)$(objk)/conf -o $(LIBCONFIG_PATH)/Config.in + $(Q)mv $(FILO_CONFIG) $(LIB_CONFIG) + $(Q)printf "Libpayload config done.\n" + $(Q)mv $(FILO_CONFIG)."temp" $(FILO_CONFIG) + $(Q)$(objk)/conf -o $(Kconfig) +else oldconfig: prepare $(objk)/conf + $(Q)printf "Lost libpayload config file.\n" + $(Q)rm -f $(FILO_CONFIG) +endif +else +oldconfig: prepare $(objk)/conf + $(Q)printf "Libpayload config for FILO.\n" + $(Q)$(objk)/conf -o $(LIBCONFIG_PATH)/Config.in + $(Q)mv .config $(LIB_CONFIG) + $(Q)printf "Libpayload config done.\n" $(Q)$(objk)/conf -o $(Kconfig) +endif
+ifneq ($(strip $(HAVE_FILO_CONFIG)),) +ifneq ($(strip $(HAVE_LIB_CONFIG)),) silentoldconfig: prepare $(objk)/conf + $(Q)printf "Libpayload config for FILO.\n" + $(Q)mv $(FILO_CONFIG) $(FILO_CONFIG)."temp" + $(Q)mv $(LIB_CONFIG) $(FILO_CONFIG) + $(Q)$(objk)/conf -s $(LIBCONFIG_PATH)/Config.in + $(Q)mv $(FILO_CONFIG) $(LIB_CONFIG) + $(Q)printf "Libpayload config done.\n" + $(Q)mv $(FILO_CONFIG)."temp" $(FILO_CONFIG) $(Q)$(objk)/conf -s $(Kconfig) +else +silentoldconfig: prepare $(objk)/conf + $(Q)printf "Lost libpayload config file.\n" + $(Q)rm -f $(FILO_CONFIG) +endif +else +silentoldconfig: prepare $(objk)/conf + $(Q)printf "Libpayload config for FILO.\n" + $(Q)$(objk)/conf -s $(LIBCONFIG_PATH)/Config.in + $(Q)mv .config $(LIB_CONFIG) + $(Q)printf "Libpayload config done.\n" + $(Q)$(objk)/conf -s $(Kconfig) + +endif
# --- UNUSED, ignore ---------------------------------------------------------- # Create new linux.pot file