[PATCHv2 1/2] Allow SOC to be two-levels deep inside CPU
Rabin Vincent
rabin.vincent at stericsson.com
Tue Apr 13 11:48:56 CEST 2010
On ARM, it has been suggested to place Cortex-A8 SoC directories in
arch/arm/cpu/cortex/a8 and Cortex-A9 SoC directories in
arch/arm/cpu/cortex/a9, with common code kept in arch/arm/cpu/cortex.
To allow this, if the mkconfig argument for the CPU includes a slash,
make mkconfig split the variable, at the slash, into a $CPU and a
$SUBCPU.
SOC directories will be expected to be present in $SOCDIR, which will
either be $CPUDIR/$SOC or $CPUDIR/$SUBCPU/$SOC, depending on whether a
SUBCPU is used.
The top-level Makefile will continue to look for the CPU-specific
config.mk and Makefile inside $CPUDIR. CPU-specific Makefiles can
choose to include code from inside $SUBCPU as necessary.
Acked-by: Michael Brandt <michael.brandt at stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent at stericsson.com>
---
v2: use ifdef/else/endif
Makefile | 2 +-
board/freescale/mx51evk/config.mk | 2 +-
config.mk | 8 +++++++-
doc/README.ARM-SoC | 8 +++++---
mkconfig | 3 ++-
5 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index 0381c81..ca0dffb 100644
--- a/Makefile
+++ b/Makefile
@@ -190,7 +190,7 @@ LIBS += $(shell if [ -f board/$(VENDOR)/common/Makefile ]; then echo \
"board/$(VENDOR)/common/lib$(VENDOR).a"; fi)
LIBS += $(CPUDIR)/lib$(CPU).a
ifdef SOC
-LIBS += $(CPUDIR)/$(SOC)/lib$(SOC).a
+LIBS += $(SOCDIR)/lib$(SOC).a
endif
ifeq ($(CPU),ixp)
LIBS += arch/arm/cpu/ixp/npe/libnpe.a
diff --git a/board/freescale/mx51evk/config.mk b/board/freescale/mx51evk/config.mk
index af70ec2..8305bfa 100644
--- a/board/freescale/mx51evk/config.mk
+++ b/board/freescale/mx51evk/config.mk
@@ -20,6 +20,6 @@
# MA 02111-1307 USA
#
-LDSCRIPT = $(CPUDIR)/$(SOC)/u-boot.lds
+LDSCRIPT = $(SOCDIR)/u-boot.lds
TEXT_BASE = 0x97800000
IMX_CONFIG = $(SRCTREE)/board/$(BOARDDIR)/imximage.cfg
diff --git a/config.mk b/config.mk
index 73b5195..7070cf1 100644
--- a/config.mk
+++ b/config.mk
@@ -119,11 +119,17 @@ ifneq ($(SRCTREE)/$(CPUDIR),$(wildcard $(SRCTREE)/$(CPUDIR)))
CPUDIR=arch/$(ARCH)/cpu
endif
+ifdef SUBCPU
+SOCDIR = $(CPUDIR)/$(SUBCPU)/$(SOC)
+else
+SOCDIR = $(CPUDIR)/$(SOC)
+endif
+
sinclude $(TOPDIR)/arch/$(ARCH)/config.mk # include architecture dependend rules
sinclude $(TOPDIR)/$(CPUDIR)/config.mk # include CPU specific rules
ifdef SOC
-sinclude $(TOPDIR)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules
+sinclude $(TOPDIR)/$(SOCDIR)/config.mk # include SoC specific rules
endif
ifdef VENDOR
BOARDDIR = $(VENDOR)/$(BOARD)
diff --git a/doc/README.ARM-SoC b/doc/README.ARM-SoC
index d6bd624..57fc10d 100644
--- a/doc/README.ARM-SoC
+++ b/doc/README.ARM-SoC
@@ -10,12 +10,14 @@ resides in
$(CPUDIR)/
and code that is specific to some SoC (i.e. vendor specific
-peripherals around the core) is moved into
+peripherals around the core) is moved into $(SOCDIR), which is
+one of
$(CPUDIR)/$(SOC)/
+ $(CPUDIR)/$(SUBCPU)/$(SOC)/
-Thus a library/archive "$(CPUDIR)/$(SOC)/lib$(SOC).a" will be build
-and linked. Examples will be
+Thus a library/archive "$(SOCDIR)/lib$(SOC).a" will be build and linked.
+Examples will be
arch/arm/cpu/arm920t/imx/
arch/arm/cpu/arm920t/s3c24x0
diff --git a/mkconfig b/mkconfig
index d3109e4..1e162d4 100755
--- a/mkconfig
+++ b/mkconfig
@@ -70,7 +70,8 @@ fi
# Create include file for Make
#
echo "ARCH = $2" > config.mk
-echo "CPU = $3" >> config.mk
+echo "CPU =" `echo $3 | cut -f1 -d/` >> config.mk
+echo "SUBCPU =" `echo $3 | cut -f2 -s -d/` >> config.mk
echo "BOARD = $4" >> config.mk
[ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk
--
1.7.0
More information about the U-Boot
mailing list