[U-Boot] scripts to sanity-check the Kconfig files
Masahiro Yamada
yamada.masahiro at socionext.com
Wed Jan 4 16:38:24 CET 2017
2017-01-05 0:22 GMT+09:00 Michal Simek <monstr at monstr.eu>:
> On 4.1.2017 15:38, Robert P. J. Day wrote:
>>
>> while i'm in a chatty mood, a few years back, i wrote some simple
>> shell scripts that scanned the linux kernel source tree for
>> inconsistencies in the Kconfig files, and pointed out things like
>> "config" entries that were never used or tested, "select" directives
>> that referred to non-existent variables, and so on.
>>
>> i just ran that first script on the current u-boot source, and there
>> are quite a number of these. as just partial output, here are some
>> Kconfig variables that are (apparently, as long as i didn't screw up
>> anything in the script) defined but never used or tested anywhere:
>>
>> ... snip ...
>> >>>>> CMD_MX_CYCLIC
>> cmd/Kconfig:338:config CMD_MX_CYCLIC
>> >>>>> CPU_SPECIFIC_OPTIONS
>> arch/x86/cpu/ivybridge/Kconfig:23:config CPU_SPECIFIC_OPTIONS
>> arch/x86/cpu/broadwell/Kconfig:21:config CPU_SPECIFIC_OPTIONS
>> >>>>> DEBUG_EFI_CONSOLE
>> drivers/serial/Kconfig:115:config DEBUG_EFI_CONSOLE
>> >>>>> DM_MOD_EXP
>> drivers/crypto/rsa_mod_exp/Kconfig:1:config DM_MOD_EXP
>> ... snip ...
>>
>> so as to that first example, that shows that the variable
>> CMD_MX_CYCLIC is defined in cmd/Kconfig:
>>
>> config CMD_MX_CYCLIC
>> bool "mdc, mwc"
>> help
>> mdc - memory display cyclic
>> mwc - memory write cyclic
>>
>> but is never tested for anything, and a grep seems to show that:
>>
>> $ grep -r CMD_MX_CYCLIC *
>> cmd/Kconfig:config CMD_MX_CYCLIC
>> configs/sandbox_noblk_defconfig:CONFIG_CMD_MX_CYCLIC=y
>> configs/sandbox_spl_defconfig:CONFIG_CMD_MX_CYCLIC=y
>> configs/sandbox_defconfig:CONFIG_CMD_MX_CYCLIC=y
>> $
>>
>> OTOH, if you search for just "MX_CYCLIC":
>>
>> $ grep -r MX_CYCLIC *A
>> cmd/Kconfig:config CMD_MX_CYCLIC
>> cmd/mem.c:#ifdef CONFIG_MX_CYCLIC
>> cmd/mem.c:#endif /* CONFIG_MX_CYCLIC */
>> cmd/mem.c:#ifdef CONFIG_MX_CYCLIC
>> cmd/mem.c:#endif /* CONFIG_MX_CYCLIC */
>> configs/sandbox_noblk_defconfig:CONFIG_CMD_MX_CYCLIC=y
>> configs/sandbox_spl_defconfig:CONFIG_CMD_MX_CYCLIC=y
>> configs/sandbox_defconfig:CONFIG_CMD_MX_CYCLIC=y
>> include/configs/ea20.h:#define CONFIG_MX_CYCLIC
>> include/configs/lwmon5.h:#define CONFIG_MX_CYCLIC 1 /* enable mdc/mwc commands */
>> include/configs/M5249EVB.h:#define CONFIG_MX_CYCLIC 1 /* enable mdc/mwc commands */
>> include/configs/PMC405DE.h:#define CONFIG_MX_CYCLIC 1 /* enable mdc/mwc commands */
>> include/configs/x600.h:#define CONFIG_MX_CYCLIC /* enable mdc/mwc commands */
>> include/configs/ipam390.h:#define CONFIG_MX_CYCLIC
>> include/configs/da850evm.h:#define CONFIG_MX_CYCLIC
>> include/configs/bcm23550_w1d.h:#define CONFIG_MX_CYCLIC
>> include/configs/bcm28155_ap.h:#define CONFIG_MX_CYCLIC
>> include/configs/omapl138_lcdk.h:#define CONFIG_MX_CYCLIC
>> include/configs/bcm_ep_board.h:#define CONFIG_MX_CYCLIC
>> include/configs/amcore.h:#define CONFIG_MX_CYCLIC 1 /* enable mdc/mwc commands */
>> include/configs/digsy_mtc.h:#define CONFIG_MX_CYCLIC 1
>> include/configs/amcc-common.h:#define CONFIG_MX_CYCLIC /* enable mdc/mwc commands */
>> include/configs/xtfpga.h:#define CONFIG_MX_CYCLIC
>> include/configs/xilinx-ppc.h:#define CONFIG_MX_CYCLIC /* enable mdc/mwc commands */
>> include/configs/ti_armv7_keystone2.h:#define CONFIG_MX_CYCLIC
>> include/configs/PMC440.h:#define CONFIG_MX_CYCLIC 1 /* enable mdc/mwc commands */
>> include/configs/calimain.h:#define CONFIG_MX_CYCLIC
>> include/configs/legoev3.h:#define CONFIG_MX_CYCLIC
>> README:- CONFIG_MX_CYCLIC
>> scripts/config_whitelist.txt:CONFIG_MX_CYCLIC
>> $
>>
>> so it would appear that the *correct* spelling is "CONFIG_MX_CYCLIC"
>> as defined in the header file, which is what is being tested in the
>> source file cmd/mem.c.
>
> I looked at this. Correct name should be CONFIG_CMD_MX_CYCLIC and for
> the rest s/CONFIG_MX_CYCLIC/CONFIG_CMD_MX_CYCLIC/g with move to defconfig.
> + in Kconfig there should be dependecy on CMD_MEMORY.
>
For this one, it seems my mistake:
commit 60296a835cb176695a3ce3a50a843d2f03b77d32
Author: Masahiro Yamada <yamada.m at jp.panasonic.com>
Date: Thu Nov 13 19:29:08 2014 +0900
commands: add more command entries in Kconfig
This commit adds some of command entries (CONFIG_CMD_*) to
cover include/config_cmd_default.h and a little extra.
Because U-Boot supports lots of commands, they should be categorized
according to their usage.
Signed-off-by: Masahiro Yamada <yamada.m at jp.panasonic.com>
I do not remember why.
As Michal suggested, renaming to CONFIG_CMD_MX_CYCLIC seems better...
--
Best Regards
Masahiro Yamada
More information about the U-Boot
mailing list