Skip to contentSkip to conversation

Allow SOC to be two-levels deep inside CPU

PATCH New Rabin Vincent 1 participant 1 message Apr 13, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 Allow SOC to be two-levels deep inside CPU

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.

---
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(-)
Makefile +1 -1
index 0381c81..ca0dffb 100644
@@ -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
board/freescale/mx51evk/config.mk +1 -1
index af70ec2..8305bfa 100644
@@ -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
config.mk +7 -1
index 73b5195..7070cf1 100644
@@ -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)
doc/README.ARM-SoC +5 -3
index d6bd624..57fc10d 100644
@@ -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
mkconfig +2 -1
index d3109e4..1e162d4 100755
@@ -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
Signature · 1 line
1.7.0