Skip to contentSkip to conversation

Kbuild: Fix a false error of sanity check

PATCH New Masahiro Yamada 3 participants 5 messages Feb 25, 2014 Kbuild

lore
Share & tools
lore
#0 lore raw

v2 cover Kbuild: Fix a false error of sanity check

Masahiro Yamada (2):
kbuild: Fix a false error of generic board support
kbuild: Move linker sciript check to prepare1

 Makefile                     | 24 ++++++++++++------------
 include/configs/MPC8536DS.h  |  2 +-
 include/configs/MPC8569MDS.h |  2 +-
 include/configs/MPC8572DS.h  |  2 +-
 include/configs/P1023RDS.h   |  2 +-
 include/configs/P1_P2_RDB.h  |  2 +-
 6 files changed, 17 insertions(+), 17 deletions(-)
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH v2 1/2 kbuild: Fix a false error of generic board support

Before this commit, make terminated with an error where is shouldn't under some condition.

This bug happened when we built a board unsupporting generic board right after building with generic board.

For example, the following sequence failed. (harmony uses generic board but microblaze-generic does not support it)

  $ make harmony_config
  Configuring for harmony board...
  $ make CROSS_COMPILE=arm-linux-gnueabi-
    [ Build succeed ]
  $ make microblaze-generic_config
  Configuring for microblaze-generic board...
  $ make CROSS_COMPILE=microblaze-linux-
  Makefile:488: *** Your architecture does not support generic board.
  Please undefined CONFIG_SYS_GENERIC_BOARD in your board config file.  Stop.

We had to do "make clean" before building the microblaze board.

This commit fixes this unconvenience.

Move generic board sanity check to "prepare1" target, which is run after generation of include/autoconf.mk.

---

Changes in v2:
- Fix commit log.
s/"make mrproper"/"make clean"/

 Makefile | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
Makefile +7 -8
index 84d6db4..fffeb7e 100644
@@ -485,13 +485,6 @@ ifeq ($(wildcard include/config.mk),)
 $(error "System not configured - see README")
 endif
 
-ifeq ($(__HAVE_ARCH_GENERIC_BOARD),)
-ifneq ($(CONFIG_SYS_GENERIC_BOARD),)
-$(error Your architecture does not support generic board. \
-Please undefined CONFIG_SYS_GENERIC_BOARD in your board config file)
-endif
-endif
-
 # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
 # that (or fail if absent).  Otherwise, search for a linker script in a
 # standard location.
@@ -996,7 +989,13 @@ endif
 prepare2: prepare3 outputmakefile
 
 prepare1: prepare2 $(version_h) $(timestamp_h)
-	@:
+ifeq ($(__HAVE_ARCH_GENERIC_BOARD),)
+ifeq ($(CONFIG_SYS_GENERIC_BOARD),y)
+	@echo >&2 "  Your architecture does not support generic board."
+	@echo >&2 "  Please undefine CONFIG_SYS_GENERIC_BOARD in your board config file."
+	@/bin/false
+endif
+endif
 
 archprepare: prepare1 scripts_basic
 
Signature · 1 line
1.8.3.2
#2 lore raw

PATCH v2 1/2 kbuild: Fix a false error of generic board support

Quoted 20 lines · Masahiro Yamada

Before this commit, make terminated with an error where is shouldn't under some condition.

This bug happened when we built a board unsupporting generic board right after building with generic board.

For example, the following sequence failed. (harmony uses generic board but microblaze-generic does not support it)

  $ make harmony_config
  Configuring for harmony board...
  $ make CROSS_COMPILE=arm-linux-gnueabi-
    [ Build succeed ]
  $ make microblaze-generic_config
  Configuring for microblaze-generic board...
  $ make CROSS_COMPILE=microblaze-linux-
  Makefile:488: *** Your architecture does not support generic board.
  Please undefined CONFIG_SYS_GENERIC_BOARD in your board config file.  Stop.
Quoted 8 lines

We had to do "make clean" before building the microblaze board.

This commit fixes this unconvenience.

Move generic board sanity check to "prepare1" target, which is run after generation of include/autoconf.mk.

#3 lore raw

PATCH v2 2/2 kbuild: Move linker sciript check to prepare1

In reply to Masahiro Yamada

Same as the previous commit.
Move sanity check to prepare1 target to avoid nasty troubles.

Before this commit, LDSCRIPT existence was not checked when it was specified by CONFIG_SYS_LDSCRIPT. Now LDSCRIPT existence is checked for all boards.

$(wildcard $(LDSCRIPT)) must point to the linker scripts with absolute path.
Otherwise, make will terminate with a false error on out-of-tree build.

---

Changes in v2:
- Always specify LDSCRIPT with absolute path. Add $(srctree)/ to $(CONFIG_SYS_LDSCRIPT). Modify some config headers to adjust for that.

 Makefile                     | 9 +++++----
 include/configs/MPC8536DS.h  | 2 +-
 include/configs/MPC8569MDS.h | 2 +-
 include/configs/MPC8572DS.h  | 2 +-
 include/configs/P1023RDS.h   | 2 +-
 include/configs/P1_P2_RDB.h  | 2 +-
 6 files changed, 10 insertions(+), 9 deletions(-)
Makefile +5 -4
index fffeb7e..d3b0afb 100644
@@ -495,7 +495,7 @@ ifndef LDSCRIPT
 	#LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
 	ifdef CONFIG_SYS_LDSCRIPT
 		# need to strip off double quotes
-		LDSCRIPT := $(CONFIG_SYS_LDSCRIPT:"%"=%)
+		LDSCRIPT := $(srctree)/$(CONFIG_SYS_LDSCRIPT:"%"=%)
 	endif
 endif
 
@@ -518,9 +518,6 @@ ifndef LDSCRIPT
 		# We don't expect a Makefile here
 		LDSCRIPT_MAKEFILE_DIR =
 	endif
-	ifeq ($(wildcard $(LDSCRIPT)),)
-$(error could not find linker script)
-	endif
 endif
 
 else
@@ -996,6 +993,10 @@ ifeq ($(CONFIG_SYS_GENERIC_BOARD),y)
 	@/bin/false
 endif
 endif
+ifeq ($(wildcard $(LDSCRIPT)),)
+	@echo >&2 "  Could not find linker script."
+	@/bin/false
+endif
 
 archprepare: prepare1 scripts_basic
 
include/configs/MPC8536DS.h +1 -1
index 57bf04f..9846118 100644
@@ -24,7 +24,7 @@
 #define CONFIG_SYS_TEXT_BASE_SPL 0xfff00000
 #define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE_SPL /* start of monitor */
 #else
-#define CONFIG_SYS_LDSCRIPT $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
+#define CONFIG_SYS_LDSCRIPT $(CPUDIR)/u-boot-nand.lds
 #define CONFIG_SYS_TEXT_BASE	0xf8f82000
 #endif /* CONFIG_NAND_SPL */
 #endif
include/configs/MPC8569MDS.h +1 -1
index 33cadb9..58b9c26 100644
@@ -56,7 +56,7 @@ extern unsigned long get_clock_freq(void);
 #define CONFIG_SYS_TEXT_BASE_SPL 0xfff00000
 #define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE_SPL /* start of monitor */
 #else
-#define CONFIG_SYS_LDSCRIPT $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
+#define CONFIG_SYS_LDSCRIPT $(CPUDIR)/u-boot-nand.lds
 #define CONFIG_SYS_TEXT_BASE	0xf8f82000
 #endif
 #endif
include/configs/MPC8572DS.h +1 -1
index f457719..7b63945 100644
@@ -24,7 +24,7 @@
 #define CONFIG_SYS_TEXT_BASE_SPL 0xfff00000
 #define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE_SPL /* start of monitor */
 #else
-#define CONFIG_SYS_LDSCRIPT $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
+#define CONFIG_SYS_LDSCRIPT $(CPUDIR)/u-boot-nand.lds
 #define CONFIG_SYS_TEXT_BASE	0xf8f82000
 #endif /* CONFIG_NAND_SPL */
 #endif
include/configs/P1023RDS.h +1 -1
index ec72c78..2ffa354 100644
@@ -26,7 +26,7 @@
 #ifdef CONFIG_NAND_SPL
 #define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE_SPL /* start of monitor */
 #else
-#define CONFIG_SYS_LDSCRIPT $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
+#define CONFIG_SYS_LDSCRIPT $(CPUDIR)/u-boot-nand.lds
 #define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE	/* start of monitor */
 #endif /* CONFIG_NAND_SPL */
 #endif
include/configs/P1_P2_RDB.h +1 -1
index 32ed0c2..2ffaf5c 100644
@@ -38,7 +38,7 @@
 #define CONFIG_SYS_TEXT_BASE_SPL 0xfff00000
 #define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE_SPL /* start of monitor */
 #else
-#define CONFIG_SYS_LDSCRIPT $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
+#define CONFIG_SYS_LDSCRIPT $(CPUDIR)/u-boot-nand.lds
 #define CONFIG_SYS_TEXT_BASE		0xf8f82000
 #endif /* CONFIG_NAND_SPL */
 #endif
Signature · 1 line
1.8.3.2
#4 lore raw

v2 cover Kbuild: Fix a false error of sanity check

In reply to Masahiro Yamada
Quoted 5 lines · Masahiro Yamada

Masahiro Yamada (2):
kbuild: Fix a false error of generic board support
kbuild: Move linker sciript check to prepare1

Quoted 7 lines
 Makefile                     | 24 ++++++++++++------------
 include/configs/MPC8536DS.h  |  2 +-
 include/configs/MPC8569MDS.h |  2 +-
 include/configs/MPC8572DS.h  |  2 +-
 include/configs/P1023RDS.h   |  2 +-
 include/configs/P1_P2_RDB.h  |  2 +-
 6 files changed, 17 insertions(+), 17 deletions(-)

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140225/b91f63cb/attachment.pgp>