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

Mike Frysinger vapier at gentoo.org
Thu Aug 13 22:02:19 CEST 2009


On Thursday 13 August 2009 14:38:45 Scott Wood wrote:
> Mike Frysinger wrote:
> > On Thursday 13 August 2009 11:28:09 Scott Wood wrote:
> >> Mike Frysinger wrote:
> >>> On Friday 07 August 2009 15:22:15 Scott Wood wrote:
> >>>> On Fri, Aug 07, 2009 at 09:03:03AM -0500, Kumar Gala wrote:
> >>>>>  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 ;;
> >>>>
> >>>> How about something like:
> >>>>
> >>>> -D) shift ; DEFINES="${1//_/ } ${DEFINES}"; shift ;;
> >>>
> >>> mkconfig's interpreter is /bin/sh, so if you want to use the string
> >>> replace bashism, you'll have to change it to /bin/bash.  or use the
> >>> POSIX: "#define ${1%%=*}\t${1#*=}\n${DEFINES}"
> >>
> >> Do you have a non-bash version of my alternative (which handles multiple
> >> symbols rather than one symbol/value pair per -D)?
> >
> > i dont know what you mean by one symbol/value pair per -D.  i assume that
> > the -D option here has the exact same behavior as that of gcc.
>
> That's what Kumar's patch has it do, but I'm not sure that it's the most
> useful thing to expose to the makefile.  Maybe we should use a different
> option letter (-d?) and implement the GCC-like symbol/value semantics
> later if we end up needing it.

if the proposed mkconfig -D isnt like gcc's -D, then a new letter should be 
picked i think to avoid confusion

> > do you have an example invocation of mkconfig to show what you mean ?
>
> Consider a target such as BOARDNAME_66MHz_NANDBOOT_PCISLAVE.
>
> It could then invoke "$(MKCONFIG) -D $@ -a configname arch cpu board".
> mkconfig would break up the -D argument into:
>
> #define CONFIG_BOARDNAME
> #define CONFIG_66MHz
> #define CONFIG_NANDBOOT
> #define CONFIG_PCISLAVE

then yes, a sed would have to be used.  maybe something like:
DEFINES="`echo "_$*" | sed 's:_:\n#define CONFIG_:g'`${DEFINES}" ; shift ;;
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090813/61280f37/attachment.pgp 


More information about the U-Boot mailing list