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 <yamada.masah...@socionext.com>
Reported-by: Tom Rini <tr...@konsulko.com>>
Reported-by: York Sun <york...@freescale.com>
Reported-by: Stephen Warren <swar...@nvidia.com>
---

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    := \
-- 
1.9.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to