Config: Add "board options" column to boards.cfg
PATCH 1/1 Config: Add "board options" column to boards.cfg
There are some boards where it's not currently possible to detect all board information at runtime, therefore I introduced a new column called "options" to boards.cfg .
This column can contain multiple options, separated by comma [,] . This column is case sensitive. In case there's a simple options like 256M_U_BOOT, it's plain expanded to "#define CONFIG_256M_U_BOOT" in config.h . In case there's an assignment, like "ram=8192", it's expanded to "#define CONFIG_RAM 8192" in config.h . There can also be multiple such options, then each is expanded to separate "#define CONFIG_xyz" statement.
Also, I had to add fallback logic, because each of the board variants has a distinct name. This led to the mkconfig #including incorrect board configuration file (<configs/whole-board-configuration-name.h> aka. the value in column one). I implemented a logic which checks if such file exists and if it does not, it includes<configs/board-name.h> aka. the value in third column.
---
v2: Add multiple options support
Makefile | 22 ---------------------- boards.cfg | 9 +++++++-- mkconfig | 20 +++++++++++++++++++- 3 files changed, 26 insertions(+), 25 deletions(-)
Makefile +0 -22
@@ -2179,28 +2179,6 @@ scpu_config: unconfig fi @$(MKCONFIG) -n $@ -a pdnb3 arm ixp pdnb3 prodrive -polaris_config \ -trizepsiv_config : unconfig - @mkdir -p $(obj)include - @if [ "$(findstring polaris,$@)" ] ; then \ - echo "#define CONFIG_POLARIS 1" >>$(obj)include/config.h ; \ - fi; - @$(MKCONFIG) -n $@ -a trizepsiv arm pxa trizepsiv - -vpac270_nor_256M_config \ -vpac270_nor_128M_config \ -vpac270_onenand_config : unconfig - @mkdir -p $(obj)include - @if [ "$(findstring onenand,$@)" ] ; then \ - echo "#define CONFIG_ONENAND_U_BOOT" \ - >>$(obj)include/config.h ; \ - fi; - @if [ "$(findstring 256M,$@)" ] ; then \ - echo "#define CONFIG_256M_U_BOOT" \ - >>$(obj)include/config.h ; \ - fi; - @$(MKCONFIG) -n $@ -a vpac270 arm pxa vpac270 - ######################################################################### ## ARM1136 Systems #########################################################################
boards.cfg +7 -2
@@ -17,8 +17,8 @@ # # :.,$! sort -f -k2,2 -k3,3 -k6,6 -k5,5 -k1,1 # -# Target ARCH CPU Board name Vendor SoC -########################################################################### +# Target ARCH CPU Board name Vendor SoC Options +############################################################################################### qong arm arm1136 - davedenx mx31 mx31ads arm arm1136 - freescale mx31
@@ -64,6 +64,11 @@ lubbock arm pxa palmld arm pxa palmtc arm pxa pleb2 arm pxa +polaris arm pxa trizepsiv - - POLARIS +trizepsiv arm pxa trizepsiv +vpac270_nor_128M arm pxa vpac270 +vpac270_nor_256M arm pxa vpac270 - - 256M_U_BOOT +vpac270_onenand arm pxa vpac270 - - ONENAND_U_BOOT xaeniax arm pxa xm250 arm pxa zipitz2 arm pxa
mkconfig +19 -1
@@ -17,6 +17,7 @@ cpu="" board="" vendor="" soc="" +options="" if [ \( $# -eq 2 \) -a \( "$1" = "-A" \) ] ; then # Automatic mode
@@ -41,7 +42,7 @@ while [ $# -gt 0 ] ; do done [ $# -lt 4 ] && exit 1 -[ $# -gt 6 ] && exit 1 +[ $# -gt 7 ] && exit 1 CONFIG_NAME="${1%_config}"
@@ -56,6 +57,7 @@ else fi [ $# -gt 4 ] && [ "$5" != "-" ] && vendor="$5" [ $# -gt 5 ] && [ "$6" != "-" ] && soc="$6" +[ $# -gt 6 ] && [ "$7" != "-" ] && options="$7" if [ "${ARCH}" -a "${ARCH}" != "${arch}" ]; then echo "Failed: \$ARCH=${ARCH}, should be '${arch}' for ${BOARD_NAME}" 1>&2
@@ -129,6 +131,22 @@ for i in ${TARGETS} ; do echo "#define CONFIG_MK_${i} 1" >>config.h ; done +if [ -n "${options}" ] ; then + echo "${options}" | tr "," "\n" | while read line ; do + echo "#define CONFIG_${line}" | tr "=" "\t" >>config.h ; + done ; +fi + +# If there's no config file for the configuration, try config file for the +# board instead. +if [ ! -e configs/${CONFIG_NAME}.h ] ; then + if [ -e configs/${board}.h ] ; then + CONFIG_NAME=${board} ; + else + exit 1 ; + fi; +fi + cat << EOF >> config.h #define CONFIG_BOARDDIR board/$BOARDDIR #include <config_defaults.h>
Signature · 1 line
1.7.1
PATCH 1/1 Config: Add "board options" column to boards.cfg
Quoted 11 lines · On Monday, September 20, 2010 19:26:44 Marek Vasut wrote:
There are some boards where it's not currently possible to detect all board information at runtime, therefore I introduced a new column called "options" to boards.cfg .
This column can contain multiple options, separated by comma [,] . This column is case sensitive. In case there's a simple options like 256M_U_BOOT, it's plain expanded to "#define
CONFIG_256M_U_BOOT" inconfig.h. In case there's an assignment, like "ram=8192", it's expanded to "#defineCONFIG_RAM8192" inconfig.h. There can also be multiple such options, then each is expanded to separate "#defineCONFIG_xyz" statement.
Quoted 6 lines
Also, I had to add fallback logic, because each of the board variants has a distinct name. This led to the mkconfig #including incorrect board configuration file (<
configs/whole-board-configuration-name.h> aka. the value in column one). I implemented a logic which checks if such file exists and if it does not, it includes<configs/board-name.h> aka. the value in third column.
why not use the existing -t option instead of introducing your own new "options" argument t mkconfig ?
-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/20100920/f0bcccb9/attachment.pgp
PATCH 1/1 Config: Add "board options" column to boards.cfg
In reply to Marek VasutDear Marek Vasut,
please fix the mail addresses. My address is wd at denx.de
Quoted 10 lines · In message <[email protected]> you wrote:
There are some boards where it's not currently possible to detect all board information at runtime, therefore I introduced a new column called "options" to boards.cfg .
This column can contain multiple options, separated by comma [,] . This column is case sensitive. In case there's a simple options like 256M_U_BOOT, it's plain expanded to "#define
CONFIG_256M_U_BOOT" inconfig.h. In case there's an assignment, like "ram=8192", it's expanded to "#defineCONFIG_RAM8192" inconfig.h. There can also be multiple such options, then each is expanded to separate "#defineCONFIG_xyz" statement.
I don't understand what you mean by "is case sensitive" when in the end you seem to convert everything to upper case?
I would not make any statement about case sensistivity and copy the settings unchanged. It is up to the user to provide valid (upper case) macro names, and it leaves the option to deviate and use locer case identifiers in case this should ever be needed for some special purpose. Also, it makes the code simpler.
And, as Mike pointed out, please reuse the "-y" option.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de It is easier to write an incorrect program than understand a correct one.