From patchwork Fri Aug 16 07:14:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ying.zhang@freescale.com X-Patchwork-Id: 267584 X-Patchwork-Delegate: yorksun@freescale.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 16F2F2C023C for ; Fri, 16 Aug 2013 18:15:13 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6C12D4A027; Fri, 16 Aug 2013 10:15:11 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Gs6zBdThMB8S; Fri, 16 Aug 2013 10:15:11 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 96DD24A01E; Fri, 16 Aug 2013 10:15:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 975084A01E for ; Fri, 16 Aug 2013 10:15:03 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BTr0eI7Vaa0D for ; Fri, 16 Aug 2013 10:14:58 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from db9outboundpool.messaging.microsoft.com (mail-db9lp0252.outbound.messaging.microsoft.com [213.199.154.252]) by theia.denx.de (Postfix) with ESMTPS id 0D90D4A01C for ; Fri, 16 Aug 2013 10:14:51 +0200 (CEST) Received: from mail55-db9-R.bigfish.com (10.174.16.231) by DB9EHSOBE030.bigfish.com (10.174.14.93) with Microsoft SMTP Server id 14.1.225.22; Fri, 16 Aug 2013 08:14:49 +0000 Received: from mail55-db9 (localhost [127.0.0.1]) by mail55-db9-R.bigfish.com (Postfix) with ESMTP id E9E38400229 for ; Fri, 16 Aug 2013 08:14:49 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1f42h208ch1ee6h1de0h1fdah2073h1202h1e76h1d1ah1d2ah1fc6hzz1de098h8275bh1de097hz2dh2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h1354h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1b2fh1fb3h1d0ch1d2eh1d3fh1dc1h1dfeh1dffh1e23h1fe8h1ff5h1155h) Received: from mail55-db9 (localhost.localdomain [127.0.0.1]) by mail55-db9 (MessageSwitch) id 13766408881503_20539; Fri, 16 Aug 2013 08:14:47 +0000 (UTC) Received: from DB9EHSMHS029.bigfish.com (unknown [10.174.16.229]) by mail55-db9.bigfish.com (Postfix) with ESMTP id F037A32004B for ; Fri, 16 Aug 2013 08:14:47 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB9EHSMHS029.bigfish.com (10.174.14.39) with Microsoft SMTP Server (TLS) id 14.16.227.3; Fri, 16 Aug 2013 08:14:47 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server (TLS) id 14.3.136.1; Fri, 16 Aug 2013 08:14:46 +0000 Received: from localhost.localdomain (tank.ap.freescale.net [10.193.20.104]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id r7G8Eh6q015669; Fri, 16 Aug 2013 01:14:44 -0700 From: To: Date: Fri, 16 Aug 2013 15:14:44 +0800 Message-ID: <1376637284-4538-1-git-send-email-ying.zhang@freescale.com> X-Mailer: git-send-email 1.7.0.4 MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% Cc: scottwood@freescale.com, R58495@freescale.com, X.Xie@freescale.com, Ying Zhang Subject: [U-Boot] [PATCH v4] SPL: Makefile: Build a separate autoconf.mk for SPL X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Ying Zhang SPL defines CONFIG_SPL_BUILD but this does not percolate to the autoconf.mk Makefile. As a result the build breaks when CONFIG_SPL_BUILD is used in the board-specific include header file. With this, there is a possibility of having a CONFIG option defined in the header file but not defined in the Makefile causing all kinds of build failure and problems. It also messes things for up, for example, when one might want to undefine options to keep the SPL small and doesn't want to be stuck with the CONFIG options used for U-boot. Lastly, this also avoids defining special CONFIG_SPL_ variables for cases where some options are required in U-boot but not in SPL. We add a spl-autoconf.mk rule that is generated for SPL with the CONFIG_SPL_BUILD flag and conditionally include it for SPL builds. Signed-off-by: Ying Zhang --- Change from v3: - No change. Change from v2: - Fixed the reported build breakage of am335x_evm_usbspl. Change from v1: - Fixed issue where builds in a different directory were failing. Makefile | 19 +++++++++++++++++-- config.mk | 6 ++++++ spl/Makefile | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d545d30..75df06a 100644 --- a/Makefile +++ b/Makefile @@ -613,6 +613,7 @@ updater: # Explicitly make _depend in subdirs containing multiple targets to prevent # parallel sub-makes creating .depend files simultaneously. depend dep: $(TIMESTAMP_FILE) $(VERSION_FILE) \ + $(obj)include/spl-autoconf.mk \ $(obj)include/autoconf.mk \ $(obj)include/generated/generic-asm-offsets.h \ $(obj)include/generated/asm-offsets.h @@ -694,12 +695,23 @@ $(obj)include/autoconf.mk: $(obj)include/config.h sed -n -f tools/scripts/define2mk.sed > $@.tmp && \ mv $@.tmp $@ +# Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL) +$(obj)include/spl-autoconf.mk: $(obj)include/config.h + @$(XECHO) Generating $@ ; \ + set -e ; \ + : Extract the config macros ; \ + $(CPP) $(CFLAGS) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM include/common.h | \ + sed -n -f tools/scripts/define2mk.sed > $@.tmp && \ + mv $@.tmp $@ + $(obj)include/generated/generic-asm-offsets.h: $(obj)include/autoconf.mk.dep \ + $(obj)include/spl-autoconf.mk \ $(obj)lib/asm-offsets.s @$(XECHO) Generating $@ tools/scripts/make-asm-offsets $(obj)lib/asm-offsets.s $@ $(obj)lib/asm-offsets.s: $(obj)include/autoconf.mk.dep \ + $(obj)include/spl-autoconf.mk \ $(src)lib/asm-offsets.c @mkdir -p $(obj)lib $(CC) -DDO_DEPS_ONLY \ @@ -707,11 +719,13 @@ $(obj)lib/asm-offsets.s: $(obj)include/autoconf.mk.dep \ -o $@ $(src)lib/asm-offsets.c -c -S $(obj)include/generated/asm-offsets.h: $(obj)include/autoconf.mk.dep \ + $(obj)include/spl-autoconf.mk \ $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s @$(XECHO) Generating $@ tools/scripts/make-asm-offsets $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s $@ -$(obj)$(CPUDIR)/$(SOC)/asm-offsets.s: $(obj)include/autoconf.mk.dep +$(obj)$(CPUDIR)/$(SOC)/asm-offsets.s: $(obj)include/autoconf.mk.dep \ + $(obj)include/spl-autoconf.mk @mkdir -p $(obj)$(CPUDIR)/$(SOC) if [ -f $(src)$(CPUDIR)/$(SOC)/asm-offsets.c ];then \ $(CC) -DDO_DEPS_ONLY \ @@ -783,7 +797,8 @@ include/license.h: tools/bin2header COPYING unconfig: @rm -f $(obj)include/config.h $(obj)include/config.mk \ $(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \ - $(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep + $(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep \ + $(obj)include/spl-autoconf.mk %_config:: unconfig @$(MKCONFIG) -A $(@:_config=) diff --git a/config.mk b/config.mk index 3e84f36..54e99f4 100644 --- a/config.mk +++ b/config.mk @@ -145,7 +145,13 @@ CHECK = sparse ######################################################################### # Load generated board configuration +ifeq ($(CONFIG_SPL_BUILD),y) +# Include SPL autoconf +sinclude $(OBJTREE)/include/spl-autoconf.mk +else +# Include normal autoconf sinclude $(OBJTREE)/include/autoconf.mk +endif sinclude $(OBJTREE)/include/config.mk # Some architecture config.mk files need to know what CPUDIR is set to, diff --git a/spl/Makefile b/spl/Makefile index 6e5299b..43db01f 100644 --- a/spl/Makefile +++ b/spl/Makefile @@ -80,6 +80,7 @@ LIBS-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/memory.o LIBS-$(CONFIG_SPL_NET_SUPPORT) += net/libnet.o LIBS-$(CONFIG_SPL_ETH_SUPPORT) += drivers/net/libnet.o LIBS-$(CONFIG_SPL_ETH_SUPPORT) += drivers/net/phy/libphy.o +LIBS-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/net/phy/libphy.o LIBS-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += drivers/usb/musb-new/libusb_musb-new.o LIBS-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/usb/gadget/libusb_gadget.o