[U-Boot] [RFC PATCH 5/7] Adjust Kconfig scripts for use by U-Boot

Masahiro Yamada yamada.m at jp.panasonic.com
Fri May 31 12:01:01 CEST 2013


Hi, Tom.


> We would probably want to change it to something like:
> - Do you want the standard baud rate table?
>   Yes: 9600/19200/38400/57600/115200
>   No: Prompt for string value of comma sep list of rates
> 
> And in the right header:
> #ifdef CONFIG_SYS_STD_BAUD_RATE
> #define BAUDRATTE_TABLE { 9600, .... }
> #else
> #define BAUDRATE_TABLE { CONFIG_SYS_PROMPTED_VALUE }
> #endif

Could you explain a little further?

According to Documentation/kbuild/kconfig-languate.txt,
Kconfig treats "bool"/"tristate"/"string"/"hex"/"int" types.
Which type can we use for CONFIG_SYS_PROMPTED_VALUE?

Kconfig allows one value for hex and int type,
so we can't use them.

For a test, I wrote Kconfig using string type as follows:



config SYS_STD_BAUD_RATE
       bool "Do you want the standard baud rate table?"

config SYS_PROMPTED_VALUE
       string "Input comma sep list of baud rates"
       depends on !SYS_STD_BAUD_RATE




I got .config as follows:

# CONFIG_SYS_STD_BAUD_RATE is not set
CONFIG_SYS_PROMPTED_VALUE="19200,38400,115200"


And I got include/generated/autoconf.h as follows:

#define CONFIG_SYS_PROMPTED_VALUE "19200,38400,115200"



So, my question is how to create
a comma sep value list 19200,38400,115200
from a string "19200,38400,115200".

I am afraid 
> #define BAUDRATE_TABLE { CONFIG_SYS_PROMPTED_VALUE }
does not work.



I did not think of any good idea to treat this with
preprocessor.

Only idea I was stuck for was to parse the string 
at runtime.


#define CONFIG_SYS_BAUDRATE_TABLE  "19200,38400,115200"
#define MAX_BAUD_RATE_TABLE  16

int baudrate_table[MAX_BAUD_RATE_TABLE];
int string2array(int *, const char *);

   string2array(baudrate_table, CONFIG_SYS_BUADRATE_TABLE);


Any other ideas?



> > And also, some config files still include macros without CONFIG_ prefix.
> > For example, LINUX_BOOT_PARAM_ADDR, PHYS_SDRAM_1, PHYS_SDRAM_2, etc.
> 
> These don't belong in the config file, and need to be either in the
> board or <asm/arch/> or similar construct instead.

I see.

Actually, some include/configs/*.h  files still include them,
so we need to move them to somewhere else, or add prefix
like CONFIG_LINUX_BOOT_PARAM_ADDR.

Best Regards,
Masahiro Yamada




More information about the U-Boot mailing list