[U-Boot] undefined/undocumented CONFIG_CMD_* macros in u-boot

Robert P. J. Day rpjday at crashcourse.ca
Tue Feb 5 16:04:43 CET 2013


   some time ago, i wrote some simple shell scripts that scanned the  
kernel source tree and identified oddities in configuration files --  
things like Kconfig variables that were defined but never used, macros  
that were being tested but were never set, etc.  i just tweaked one of  
those scripts to scan the u-boot tree to locate CONFIG_CMD_* variables  
that were being tested, but weren't "#defined" anywhere.  nothing  
wrong with that, most of them are still documented and i've added at  
the bottom the fairly short output of those u-boot variables as well  
as their occurrence in the tree.

   they fall into three categories, with examples.  here's one where  
there's no #define, but the variable is at least documented so no  
problem:

===== CONFIG_CMD_DS4510_RST
drivers/misc/ds4510.c:#ifdef CONFIG_CMD_DS4510_RST
drivers/misc/ds4510.c:#ifdef CONFIG_CMD_DS4510_RST
drivers/misc/ds4510.c:#ifdef CONFIG_CMD_DS4510_RST
README:		CONFIG_CMD_DS4510_RST	* ds4510 I2C rst command

   here's one where there's no #define, and apparently no  
documentation anywhere:

===== CONFIG_CMD_NAND_YAFFS
common/cmd_nand.c:#ifdef CONFIG_CMD_NAND_YAFFS
common/cmd_nand.c:#ifdef CONFIG_CMD_NAND_YAFFS
drivers/mtd/nand/nand_util.c:#ifdef CONFIG_CMD_NAND_YAFFS
drivers/mtd/nand/nand_util.c:#ifdef CONFIG_CMD_NAND_YAFFS
include/configs/M54418TWR.h:#undef CONFIG_CMD_NAND_YAFFS

  finally, here's a case that looks like a reference to a command that  
was never added and thus represents pointless code:

===== CONFIG_CMD_FUSE
arch/powerpc/cpu/mpc512x/iim.c:#ifdef CONFIG_CMD_FUSE
arch/powerpc/cpu/mpc512x/iim.c:#endif /* CONFIG_CMD_FUSE */
board/esd/mecp5123/mecp5123.c:#if defined(CONFIG_IIM) ||  
defined(CONFIG_CMD_FUSE)
board/pdm360ng/pdm360ng.c:#if defined(CONFIG_IIM) || defined(CONFIG_CMD_FUSE)
board/davedenx/aria/aria.c:#if defined(CONFIG_IIM) || defined(CONFIG_CMD_FUSE)
board/freescale/mpc5121ads/mpc5121ads.c:#if defined(CONFIG_IIM) ||  
defined(CONFIG_CMD_FUSE)
include/configs/mecp5123.h:#undef CONFIG_CMD_FUSE
include/configs/aria.h:#undef CONFIG_CMD_FUSE
include/configs/mpc5121ads.h:#undef CONFIG_CMD_FUSE

   here's the full list -- not all that long:

===== CONFIG_CMD_DS4510_MEM
drivers/misc/ds4510.c:#ifdef CONFIG_CMD_DS4510_MEM
drivers/misc/ds4510.c:#ifdef CONFIG_CMD_DS4510_MEM
drivers/misc/ds4510.c:#ifdef CONFIG_CMD_DS4510_MEM
drivers/misc/ds4510.c:#ifdef CONFIG_CMD_DS4510_MEM
drivers/misc/ds4510.c:#ifdef CONFIG_CMD_DS4510_MEM
README:		CONFIG_CMD_DS4510_MEM	* ds4510 I2C eeprom/sram commansd
===== CONFIG_CMD_DS4510_RST
drivers/misc/ds4510.c:#ifdef CONFIG_CMD_DS4510_RST
drivers/misc/ds4510.c:#ifdef CONFIG_CMD_DS4510_RST
drivers/misc/ds4510.c:#ifdef CONFIG_CMD_DS4510_RST
README:		CONFIG_CMD_DS4510_RST	* ds4510 I2C rst command
===== CONFIG_CMD_ENV_CALLBACK
common/cmd_nvedit.c:#if defined(CONFIG_CMD_ENV_CALLBACK)
common/cmd_nvedit.c:#if defined(CONFIG_CMD_ENV_CALLBACK)
common/cmd_nvedit.c:#if defined(CONFIG_CMD_ENV_CALLBACK)
README:		CONFIG_CMD_ENV_CALLBACK	* display details about env callbacks
===== CONFIG_CMD_ENV_FLAGS
common/cmd_nvedit.c:#if defined(CONFIG_CMD_ENV_FLAGS)
common/cmd_nvedit.c:#if defined(CONFIG_CMD_ENV_FLAGS)
common/cmd_nvedit.c:#if defined(CONFIG_CMD_ENV_FLAGS)
common/env_flags.c:#ifdef CONFIG_CMD_ENV_FLAGS
common/env_flags.c:#endif /* CONFIG_CMD_ENV_FLAGS */
include/env_flags.h:#ifdef CONFIG_CMD_ENV_FLAGS
README:		CONFIG_CMD_ENV_FLAGS	* display details about env flags
===== CONFIG_CMD_FUSE
arch/powerpc/cpu/mpc512x/iim.c:#ifdef CONFIG_CMD_FUSE
arch/powerpc/cpu/mpc512x/iim.c:#endif /* CONFIG_CMD_FUSE */
board/esd/mecp5123/mecp5123.c:#if defined(CONFIG_IIM) ||  
defined(CONFIG_CMD_FUSE)
board/pdm360ng/pdm360ng.c:#if defined(CONFIG_IIM) || defined(CONFIG_CMD_FUSE)
board/davedenx/aria/aria.c:#if defined(CONFIG_IIM) || defined(CONFIG_CMD_FUSE)
board/freescale/mpc5121ads/mpc5121ads.c:#if defined(CONFIG_IIM) ||  
defined(CONFIG_CMD_FUSE)
include/configs/mecp5123.h:#undef CONFIG_CMD_FUSE
include/configs/aria.h:#undef CONFIG_CMD_FUSE
include/configs/mpc5121ads.h:#undef CONFIG_CMD_FUSE
===== CONFIG_CMD_LINK_LOCAL
common/cmd_net.c:#if defined(CONFIG_CMD_LINK_LOCAL)
common/cmd_net.c:#endif  /* CONFIG_CMD_LINK_LOCAL */
doc/README.link-local:When CONFIG_CMD_LINK_LOCAL is defined in the  
board config file,
doc/README.link-local:by env variables.  It depends on  
CONFIG_CMD_LINK_LOCAL, CONFIG_CMD_DHCP,
include/config_uncmd_spl.h:#undef CONFIG_CMD_LINK_LOCAL
include/common.h:	defined(CONFIG_CMD_LINK_LOCAL)
lib/Makefile:COBJS-$(CONFIG_CMD_LINK_LOCAL) += rand.o
net/arp.c:#ifdef CONFIG_CMD_LINK_LOCAL
net/net.c:#if defined(CONFIG_CMD_LINK_LOCAL)
net/link_local.h:#if defined(CONFIG_CMD_LINK_LOCAL)
net/Makefile:COBJS-$(CONFIG_CMD_LINK_LOCAL) += link_local.o
README:		CONFIG_CMD_LINK_LOCAL	* link-local IP address auto-configuration
===== CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES
common/cmd_mtdparts.c:#if defined(CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES)
common/cmd_mtdparts.c:#if defined(CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES)
common/cmd_mtdparts.c:#else /* !defined(CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES) */
common/cmd_mtdparts.c:#endif /* defined(CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES) */
===== CONFIG_CMD_MTDPARTS_SPREAD
common/cmd_mtdparts.c:#if defined(CONFIG_CMD_MTDPARTS_SPREAD)
common/cmd_mtdparts.c:#endif /* CONFIG_CMD_MTDPARTS_SPREAD */
common/cmd_mtdparts.c:#if defined(CONFIG_CMD_MTDPARTS_SPREAD)
common/cmd_mtdparts.c:#if defined(CONFIG_CMD_MTDPARTS_SPREAD)
common/cmd_mtdparts.c:#if defined(CONFIG_CMD_MTDPARTS_SPREAD)
common/cmd_mtdparts.c:#endif /* CONFIG_CMD_MTDPARTS_SPREAD */
common/cmd_mtdparts.c:#if defined(CONFIG_CMD_MTDPARTS_SPREAD)
common/cmd_mtdparts.c:#if defined(CONFIG_CMD_MTDPARTS_SPREAD)
common/cmd_mtdparts.c:#endif /* CONFIG_CMD_MTDPARTS_SPREAD */
drivers/mtd/mtdcore.c:#if defined(CONFIG_CMD_MTDPARTS_SPREAD)
drivers/mtd/mtdcore.c:#endif /* defined(CONFIG_CMD_MTDPARTS_SPREAD) */
===== CONFIG_CMD_NAND_TORTURE
common/cmd_nand.c:#ifdef CONFIG_CMD_NAND_TORTURE
common/cmd_nand.c:#ifdef CONFIG_CMD_NAND_TORTURE
doc/README.nand:   CONFIG_CMD_NAND_TORTURE
doc/README.nand:  Enabled by the CONFIG_CMD_NAND_TORTURE configuration option.
drivers/mtd/nand/nand_util.c:#ifdef CONFIG_CMD_NAND_TORTURE
===== CONFIG_CMD_NAND_TRIMFFS
common/cmd_nand.c:#ifdef CONFIG_CMD_NAND_TRIMFFS
common/cmd_nand.c:#ifdef CONFIG_CMD_NAND_TRIMFFS
doc/README.nand:      Enabled by the CONFIG_CMD_NAND_TRIMFFS macro.  
This command will write to
drivers/mtd/nand/nand_util.c:#ifdef CONFIG_CMD_NAND_TRIMFFS
drivers/mtd/nand/nand_util.c:#ifdef CONFIG_CMD_NAND_TRIMFFS
===== CONFIG_CMD_NAND_YAFFS
common/cmd_nand.c:#ifdef CONFIG_CMD_NAND_YAFFS
common/cmd_nand.c:#ifdef CONFIG_CMD_NAND_YAFFS
drivers/mtd/nand/nand_util.c:#ifdef CONFIG_CMD_NAND_YAFFS
drivers/mtd/nand/nand_util.c:#ifdef CONFIG_CMD_NAND_YAFFS
include/configs/M54418TWR.h:#undef CONFIG_CMD_NAND_YAFFS
===== CONFIG_CMD_SF_TEST
common/cmd_sf.c:#ifdef CONFIG_CMD_SF_TEST
common/cmd_sf.c:#endif /* CONFIG_CMD_SF_TEST */
common/cmd_sf.c:#ifdef CONFIG_CMD_SF_TEST
common/cmd_sf.c:#ifdef CONFIG_CMD_SF_TEST
README:		CONFIG_CMD_SF_TEST
===== CONFIG_CMD_TFTPSRV
common/cmd_net.c:#ifdef CONFIG_CMD_TFTPSRV
include/config_uncmd_spl.h:#undef CONFIG_CMD_TFTPSRV
net/tftp.c:#ifdef CONFIG_CMD_TFTPSRV
net/tftp.c:#ifdef CONFIG_CMD_TFTPSRV
net/tftp.c:#endif /* CONFIG_CMD_TFTPSRV */
net/net.c:#ifdef CONFIG_CMD_TFTPSRV
net/tftp.h:#ifdef CONFIG_CMD_TFTPSRV
README:		CONFIG_CMD_TFTPSRV	* TFTP transfer in server mode
===== CONFIG_CMD_TIMER
common/cmd_misc.c:#ifdef CONFIG_CMD_TIMER
README:		CONFIG_CMD_TIMER	* access to the system tick timer


rday





More information about the U-Boot mailing list