Skip to contentSkip to conversation

build: define CPU only when arch/${ARCH}/cpu/${CPU} exists

PATCH In review Masahiro Yamada 3 participants 4 messages Jun 24, 2014 – Jul 9, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: define CPU only when arch/${ARCH}/cpu/${CPU} exists

The directory arch/${ARCH}/cpu/${CPU} does not exist in avr32, blackfin, microblaze, nios2, openrisc, sandbox, x86.

These architectures have only one CPU type. Defining CPU should not be required for such architectures.

This commit allows cpu field (= the 3rd field of boards.cfg) to be kept blank.

Cc Andreas Bie?mann <[email protected]>
Cc Simon Glass <[email protected]>
Cc Sonic Zhang <[email protected]>
Cc Michal Simek <[email protected]>
Cc Thomas Chou <[email protected]>
Cc Stefan Kristiansson <[email protected]>

---

I built all the boards and compared MD5SUM.
I confirmed that the same binaries are generated with/without this patch.

 .../sandbox/include/asm/{arch-sandbox => }/sound.h |   0
 boards.cfg                                         | 104 ++++++++++-----------
 config.mk                                          |   5 +-
 drivers/sound/sandbox.c                            |   2 +-
 mkconfig                                           |  11 ++-
 5 files changed, 62 insertions(+), 60 deletions(-)
 rename arch/sandbox/include/asm/{arch-sandbox => }/sound.h (100%)
arch/sandbox/include/asm/sound.h renamed from arch/sandbox/include/asm/arch-sandbox/sound.h +0 -0
similarity index 100%
rename from arch/sandbox/include/asm/arch-sandbox/sound.h
rename to arch/sandbox/include/asm/sound.h
boards.cfg +52 -52

146 lines not on this page · raw message

config.mk +1 -4
index 05864aa..bd74732 100644
@@ -24,10 +24,7 @@ OBJCOPYFLAGS :=
 # 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/$(CPU)
-ifneq ($(srctree)/$(CPUDIR),$(wildcard $(srctree)/$(CPUDIR)))
-CPUDIR=arch/$(ARCH)/cpu
-endif
+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
drivers/sound/sandbox.c +1 -1
index fe5c9e9..5599bb9 100644
@@ -5,7 +5,7 @@
  */
 
 #include <common.h>
-#include <asm/arch/sound.h>
+#include <asm/sound.h>
 #include <asm/sdl.h>
 
 int sound_play(uint32_t msec, uint32_t frequency)
mkconfig +8 -3
index 2bf5897..401f262 100755
@@ -55,6 +55,11 @@ CONFIG_NAME="${7%_config}"
 arch="$2"
 cpu=`echo $3 | awk 'BEGIN {FS = ":"} ; {print $1}'`
 spl_cpu=`echo $3 | awk 'BEGIN {FS = ":"} ; {print $2}'`
+
+if [ "$cpu" = "-" ] ; then
+	cpu=
+fi
+
 if [ "$6" = "<none>" ] ; then
 	board=
 elif [ "$6" = "-" ] ; then
@@ -114,10 +119,10 @@ fi
 
 rm -f asm/arch
 
-if [ -z "${soc}" ] ; then
-	ln -s ${LNPREFIX}arch-${cpu} asm/arch
-else
+if [ "${soc}" ] ; then
 	ln -s ${LNPREFIX}arch-${soc} asm/arch
+elif [ "${cpu}" ] ; then
+	ln -s ${LNPREFIX}arch-${cpu} asm/arch
 fi
 
 if [ -z "$KBUILD_SRC" ] ; then
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 build: define CPU only when arch/${ARCH}/cpu/${CPU} exists

Hi Masahiro,

Quoted 9 lines · Masahiro Yamada

The directory arch/${ARCH}/cpu/${CPU} does not exist in avr32, blackfin, microblaze, nios2, openrisc, sandbox, x86.

These architectures have only one CPU type. Defining CPU should not be required for such architectures.

This commit allows cpu field (= the 3rd field of boards.cfg) to be kept blank.

Quoted 7 lines
Cc Andreas Bie?mann <[email protected]>
Cc Simon Glass <[email protected]>
Cc Sonic Zhang <[email protected]>
Cc Michal Simek <[email protected]>
Cc Thomas Chou <[email protected]>
Cc Stefan Kristiansson <[email protected]>

But see question below.

Quoted 17 lines
mkconfig +5 -0
index 2bf5897..401f262 100755
@@ -55,6 +55,11 @@ CONFIG_NAME="${7%_config}"
 arch="$2"
 cpu=`echo $3 | awk 'BEGIN {FS = ":"} ; {print $1}'`
 spl_cpu=`echo $3 | awk 'BEGIN {FS = ":"} ; {print $2}'`
+
+if [ "$cpu" = "-" ] ; then
+       cpu=
+fi
+
 if [ "$6" = "<none>" ] ; then
        board=
 elif [ "$6" = "-" ] ; then

mkconfig fi · line 122

Quoted 7 lines
mkconfig +1 -3
@@ -114,10 +119,10 @@ fi
 
 rm -f asm/arch
 
-if [ -z "${soc}" ] ; then
-       ln -s ${LNPREFIX}arch-${cpu} asm/arch
-else
+if [ "${soc}" ] ; then

Will this work OK in dash? (or non-bash)

Quoted 9 lines
mkconfig +2 -1
        ln -s ${LNPREFIX}arch-${soc} asm/arch
+elif [ "${cpu}" ] ; then
+       ln -s ${LNPREFIX}arch-${cpu} asm/arch
 fi
 
 if [ -z "$KBUILD_SRC" ] ; then
--

1.9.1

Regards,
Simon

#2 lore raw

PATCH 1/1 build: define CPU only when arch/${ARCH}/cpu/${CPU} exists

Hi Simon,

Quoted 20 lines · On Mon, 7 Jul 2014 16:44:36 -0600 Simon Glass <[email protected]> wrote:

But see question below.

Quoted 18 lines
mkconfig +5 -0
index 2bf5897..401f262 100755
@@ -55,6 +55,11 @@ CONFIG_NAME="${7%_config}"
 arch="$2"
 cpu=`echo $3 | awk 'BEGIN {FS = ":"} ; {print $1}'`
 spl_cpu=`echo $3 | awk 'BEGIN {FS = ":"} ; {print $2}'`
+
+if [ "$cpu" = "-" ] ; then
+       cpu=
+fi
+
 if [ "$6" = "<none>" ] ; then
        board=
 elif [ "$6" = "-" ] ; then
@@ -114,10 +119,10 @@ fi
 
Quoted 9 lines

mkconfig fi · line 122

Quoted 6 lines
mkconfig +1 -3
 rm -f asm/arch
 
-if [ -z "${soc}" ] ; then
-       ln -s ${LNPREFIX}arch-${cpu} asm/arch
-else
+if [ "${soc}" ] ; then

Will this work OK in dash? (or non-bash)

Yes.
I am dash-user. :-)
This is working on dash too.

Best Regards
Masahiro Yamada

#3 lore raw
In reply to Masahiro Yamada
Quoted 9 lines · Masahiro Yamada

The directory arch/${ARCH}/cpu/${CPU} does not exist in avr32, blackfin, microblaze, nios2, openrisc, sandbox, x86.

These architectures have only one CPU type. Defining CPU should not be required for such architectures.

This commit allows cpu field (= the 3rd field of boards.cfg) to be kept blank.

Quoted 7 lines
Cc Andreas Bie?mann <[email protected]>
Cc Simon Glass <[email protected]>
Cc Sonic Zhang <[email protected]>
Cc Michal Simek <[email protected]>
Cc Thomas Chou <[email protected]>
Cc Stefan Kristiansson <[email protected]>

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/20140707/d13a8f9e/attachment.pgp>