[U-Boot] [PATCH] Add support to mkconfig for setting simple #defines in config.h

Kumar Gala galak at kernel.crashing.org
Fri Aug 7 16:03:03 CEST 2009


To simplify the top level makefile it useful to be able to set
some #defines in config.h to express different configurations.

Added a -D option that allows us to replace:

MPC8536DS_36BIT_config \
MPC8536DS_config:       unconfig
        @mkdir -p $(obj)include
        @echo "#define CONFIG_$(@:_config=) 1"  >$(obj)include/config.h
        @$(MKCONFIG) -a MPC8536DS ppc mpc85xx mpc8536ds freescale

with:

MPC8536DS_36BIT_config \
MPC8536DS_config:       unconfig
	@$(MKCONFIG) -D $(@:_config=)=1 MPC8536DS ppc mpc85xx mpc8536ds freescale

Signed-off-by: Kumar Gala <galak at kernel.crashing.org>
---
 mkconfig |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/mkconfig b/mkconfig
index b0bbbd1..8d778e5 100755
--- a/mkconfig
+++ b/mkconfig
@@ -10,12 +10,14 @@
 
 APPEND=no	# Default: Create new config file
 BOARD_NAME=""	# Name to print in make output
+DEFINES=""
 
 while [ $# -gt 0 ] ; do
 	case "$1" in
 	--) shift ; break ;;
 	-a) shift ; APPEND=yes ;;
 	-n) shift ; BOARD_NAME="${1%%_config}" ; shift ;;
+	-D) shift ; DEFINES="#define ${1/=/\t}\n"${DEFINES} ; shift ;;
 	*)  break ;;
 	esac
 done
@@ -84,5 +86,7 @@ fi
 echo "/* Automatically generated - do not edit */" >>config.h
 echo "#include <configs/$1.h>" >>config.h
 echo "#include <asm/config.h>" >>config.h
+echo -e ${DEFINES} >> config.h
+
 
 exit 0
-- 
1.6.0.6



More information about the U-Boot mailing list