From patchwork Tue Mar 31 12:02:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 456601 X-Patchwork-Delegate: trini@ti.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 9395C1400DE for ; Tue, 31 Mar 2015 23:47:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 522054B615; Tue, 31 Mar 2015 14:47:37 +0200 (CEST) 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 05PmVmRCRwd2; Tue, 31 Mar 2015 14:47:36 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7643F4A044; Tue, 31 Mar 2015 14:47:36 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EA6754A047 for ; Tue, 31 Mar 2015 14:03:01 +0200 (CEST) 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 t1JU2jIBXodr for ; Tue, 31 Mar 2015 14:03:01 +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 conuserg010-v.nifty.com (conuserg010.nifty.com [202.248.44.36]) by theia.denx.de (Postfix) with ESMTPS id 271004A044 for ; Tue, 31 Mar 2015 14:02:57 +0200 (CEST) Received: from beagle.diag.org (KD106154048242.au-net.ne.jp [106.154.48.242]) (authenticated) by conuserg010-v.nifty.com with ESMTP id t2VC2Dwa007417; Tue, 31 Mar 2015 21:02:20 +0900 X-Nifty-SrcIP: [106.154.48.242] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Tue, 31 Mar 2015 21:02:21 +0900 Message-Id: <1427803341-28286-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 X-Mailman-Approved-At: Tue, 31 Mar 2015 14:47:33 +0200 Cc: Marek Vasut , Tom Rini , Jeroen Hofstee , Borislav Petkov , Stephen Warren , Gabe Black , Bill Richardson , Michal Marek , Stefan Roese , York Sun Subject: [U-Boot] [PATCH] kbuild: move ARCH, CPU, etc. to top Makefile to fix random build error X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since the Kconfig conversion, some developers have reported that Kbuild sometimes fails completely at random. According to the error reports, it seems to occur for any target board, but only on very fast computers. The log message for the fail case is like this: make[1]: *** No rule to make target `../arch//cpu/u-boot.lds', needed by `u-boot.lds'. Stop. It looks like the top config.mk has not been included for *some* reason, and $(ARCH) has been left blank. I suspect "autoconf_is_current" is not working in some situation. This commit moves the definition of ARCH, CPU, SOC, etc. to the top Makefile, so they are surely set. Signed-off-by: Masahiro Yamada Reported-by: Tom Rini > Reported-by: York Sun Reported-by: Stephen Warren --- Sorry for leaving this problem so long. I have never been able to reproduce this bug on my computer, so I am not sure this patch can fix the problem. I wrote this patch based on my guess. (I just tested this patch has no bad impact.) Tom, York, Stephen, Could you test this patch fixes the problem? Makefile | 8 ++++++++ arch/arm/config.mk | 7 +++++++ config.mk | 33 ++------------------------------- scripts/Makefile.autoconf | 8 ++++++++ 4 files changed, 25 insertions(+), 31 deletions(-) diff --git a/Makefile b/Makefile index 0d160c9..10af554 100644 --- a/Makefile +++ b/Makefile @@ -236,6 +236,14 @@ export HOSTARCH HOSTOS ######################################################################### +ARCH = $(CONFIG_SYS_ARCH:"%"=%) +CPU = $(CONFIG_SYS_CPU:"%"=%) +SOC = $(CONFIG_SYS_SOC:"%"=%) +VENDOR = $(CONFIG_SYS_VENDOR:"%"=%) +BOARD = $(CONFIG_SYS_BOARD:"%"=%) +CPUDIR = arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),) +BOARDDIR = $(if $(BOARD),$(if $(VENDOR),$(VENDOR)/)$(BOARD)) + # set default to nothing for native builds ifeq ($(HOSTARCH),$(ARCH)) CROSS_COMPILE ?= diff --git a/arch/arm/config.mk b/arch/arm/config.mk index c005ce4..2400c16 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -13,6 +13,13 @@ CONFIG_STANDALONE_LOAD_ADDR = 0xc100000 endif endif +ifdef CONFIG_SPL_BUILD +ifdef CONFIG_TEGRA +CPU := arm720t +CPUDIR := arch/arm/cpu/arm720t +endif +endif + LDFLAGS_FINAL += --gc-sections PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \ -fno-common -ffixed-r9 diff --git a/config.mk b/config.mk index 6282919..61bf255 100644 --- a/config.mk +++ b/config.mk @@ -18,45 +18,16 @@ PLATFORM_LDFLAGS := LDFLAGS := LDFLAGS_FINAL := OBJCOPYFLAGS := -# clear VENDOR for tcsh -VENDOR := ######################################################################### -ARCH := $(CONFIG_SYS_ARCH:"%"=%) -CPU := $(CONFIG_SYS_CPU:"%"=%) -ifdef CONFIG_SPL_BUILD -ifdef CONFIG_TEGRA -CPU := arm720t -endif -endif -BOARD := $(CONFIG_SYS_BOARD:"%"=%) -ifneq ($(CONFIG_SYS_VENDOR),) -VENDOR := $(CONFIG_SYS_VENDOR:"%"=%) -endif -ifneq ($(CONFIG_SYS_SOC),) -SOC := $(CONFIG_SYS_SOC:"%"=%) -endif - -# Some architecture config.mk files need to know what CPUDIR is set to, -# so calculate CPUDIR before including ARCH/SOC/CPU config.mk files. -# Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains -# CPU-specific code. -CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),) - sinclude $(srctree)/arch/$(ARCH)/config.mk # include architecture dependend rules sinclude $(srctree)/$(CPUDIR)/config.mk # include CPU specific rules -ifdef SOC +ifneq ($(SOC),) sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules endif + ifneq ($(BOARD),) -ifdef VENDOR -BOARDDIR = $(VENDOR)/$(BOARD) -else -BOARDDIR = $(BOARD) -endif -endif -ifdef BOARD sinclude $(srctree)/board/$(BOARDDIR)/config.mk # include board specific rules endif diff --git a/scripts/Makefile.autoconf b/scripts/Makefile.autoconf index f054081..66bc1ea 100644 --- a/scripts/Makefile.autoconf +++ b/scripts/Makefile.autoconf @@ -27,6 +27,14 @@ include scripts/Kbuild.include CC = $(CROSS_COMPILE)gcc CPP = $(CC) -E +ARCH = $(CONFIG_SYS_ARCH:"%"=%) +CPU = $(CONFIG_SYS_CPU:"%"=%) +SOC = $(CONFIG_SYS_SOC:"%"=%) +VENDOR = $(CONFIG_SYS_VENDOR:"%"=%) +BOARD = $(CONFIG_SYS_BOARD:"%"=%) +CPUDIR = arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),) +BOARDDIR = $(if $(BOARD),$(if $(VENDOR),$(VENDOR))) + include config.mk UBOOTINCLUDE := \