listing apparently "bad" Kconfig options in Makefiles
as a final(?) example of one of my originally Linux kernel-relatedKbuild cleanup scripts, i have one that identifies Makefile entries that refer to Kbuild options that are not defined in any Kconfig file (IIRC, they might be defined manually in a defconfig file, i'll have to refresh my memory, but tradition suggests that "CONFIG_"-prefixed variables are meant to be defined in Kconfig files).
i ran this script on the entire u-boot code base, and posted the
results here (not overly long):
https://crashcourse.ca/dokuwiki/doku.php?id=u-boot_make_badref
so let me elaborate with a couple examples.
first, there's this output:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
NATSEMI
./drivers/net/Makefile:obj-$(CONFIG_NATSEMI) += natsemi.o
so what's the story with CONFIG_NATSEMI? first, it clearly is not defined in a Kconfig file anywhere:
$ git grep "config NATSEMI" $
so where does it occur?
$ git grep CONFIG_NATSEMI README: CONFIG_NATSEMI drivers/net/Makefile:obj-$(CONFIG_NATSEMI) += natsemi.o include/netdev.h:#ifdef CONFIG_NATSEMI scripts/config_whitelist.txt:CONFIG_NATSEMI $
pretty clearly(?), it's documented and tested and whitelisted, while never being defined anywhere. a wild guess suggests it really should say CONFIG_PHY_NATSEMI:
$ git grep CONFIG_PHY_NATSEMI configs/brppt1_mmc_defconfig:CONFIG_PHY_NATSEMI=y configs/brppt1_nand_defconfig:CONFIG_PHY_NATSEMI=y configs/brppt1_spi_defconfig:CONFIG_PHY_NATSEMI=y configs/microblaze-generic_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_versal_virt_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zc1751_xm015_dc1_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zc1751_xm016_dc2_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zc1751_xm017_dc3_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zc1751_xm018_dc4_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zc1751_xm019_dc5_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zcu102_rev1_0_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zcu102_revA_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zcu102_revB_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zcu104_revA_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zcu104_revC_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zcu106_revA_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zcu111_revA_defconfig:CONFIG_PHY_NATSEMI=y drivers/net/phy/Makefile:obj-$(CONFIG_PHY_NATSEMI) += natsemi.o drivers/net/phy/phy.c:#ifdef CONFIG_PHY_NATSEMI include/config_phylib_all_drivers.h:#define CONFIG_PHY_NATSEMI include/configs/pengwyn.h:#define CONFIG_PHY_NATSEMI include/configs/rut.h:#define CONFIG_PHY_NATSEMI include/configs/spear6xx_evb.h:#define CONFIG_PHY_NATSEMI $
as established back in 2015:
commit f96fe2c0a8a72d675532d79df49cbfe3464154a5
Author: Michal Simek <[email protected]> Date: Wed Sep 23 19:35:31 2015 +0200
ARM64: zynqmp: Enable NATSEMI phys
(quoted diff) +0 -0
b/include/configs/xilinx_zynqmp.h
index 5008722bf4..eae1a4988b 100644
include/configs/xilinx_zynqmp.h +1 -0
@@ -193,6 +193,7 @@# define CONFIG_MII # define CONFIG_SYS_FAULT_ECHO_LINK_DOWN # define CONFIG_PHY_MARVELL +# define CONFIG_PHY_NATSEMI # define CONFIG_PHY_TI #endif
and as a second (far more trivial) example, there's this:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
RTC_DAVINCI
./drivers/rtc/Makefile:obj-$(CONFIG_RTC_DAVINCI) += davinci.o
where does that string occur? apparently, in only one place so it clearly is utterly worthless as it is currently spelled:
$ git grep RTC_DAVINCI drivers/rtc/Makefile:obj-$(CONFIG_RTC_DAVINCI) += davinci.o $
anyway, people are free to peruse that page to see if anything jumps
out at them. i'll spend a few minutes today wiki'ing all of the scripts so people can run them on whatever part of the code base amuses them. thanks for your patience.
rday
Signature · 7 lines
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================Hi,
Quoted 35 lines · Robert P. J. Day
as a final(?) example of one of my originally Linux kernel-related
Kbuildcleanup scripts, i have one that identifiesMakefileentries that refer toKbuildoptions that are not defined in anyKconfigfile (IIRC, they might be defined manually in a defconfig file, i'll have to refresh my memory, but tradition suggests that "CONFIG_"-prefixed variables are meant to be defined inKconfigfiles).i ran this script on the entire u-boot code base, and posted the
results here (not overly long):https://crashcourse.ca/dokuwiki/doku.php?id=u-boot_make_badref
so let me elaborate with a couple examples.
first, there's this output:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
NATSEMI
./drivers/net/Makefile:obj-$(CONFIG_NATSEMI) += natsemi.o
so what's the story with
CONFIG_NATSEMI? first, it clearly is not defined in aKconfigfile anywhere:$ git grep "config NATSEMI" $so where does it occur?
$ git grep CONFIG_NATSEMI README: CONFIG_NATSEMI drivers/net/Makefile:obj-$(CONFIG_NATSEMI) += natsemi.o include/netdev.h:#ifdef CONFIG_NATSEMI scripts/config_whitelist.txt:CONFIG_NATSEMI $
Quoted 3 lines
pretty clearly(?), it's documented and tested and whitelisted, while never being defined anywhere. a wild guess suggests it really should say
CONFIG_PHY_NATSEMI:
There is natsemi driver and maybe any platform which was using is removed now.
Quoted 18 lines
$ git grep CONFIG_PHY_NATSEMI configs/brppt1_mmc_defconfig:CONFIG_PHY_NATSEMI=y configs/brppt1_nand_defconfig:CONFIG_PHY_NATSEMI=y configs/brppt1_spi_defconfig:CONFIG_PHY_NATSEMI=y configs/microblaze-generic_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_versal_virt_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zc1751_xm015_dc1_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zc1751_xm016_dc2_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zc1751_xm017_dc3_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zc1751_xm018_dc4_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zc1751_xm019_dc5_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zcu102_rev1_0_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zcu102_revA_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zcu102_revB_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zcu104_revA_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zcu104_revC_defconfig:CONFIG_PHY_NATSEMI=y configs/xilinx_zynqmp_zcu106_revA_defconfig:CONFIG_PHY_NATSEMI=y
Quoted 8 lines
configs/xilinx_zynqmp_zcu111_revA_defconfig:CONFIG_PHY_NATSEMI=y drivers/net/phy/Makefile:obj-$(CONFIG_PHY_NATSEMI) += natsemi.o drivers/net/phy/phy.c:#ifdef CONFIG_PHY_NATSEMI include/config_phylib_all_drivers.h:#define CONFIG_PHY_NATSEMI include/configs/pengwyn.h:#define CONFIG_PHY_NATSEMI include/configs/rut.h:#define CONFIG_PHY_NATSEMI include/configs/spear6xx_evb.h:#define CONFIG_PHY_NATSEMI $
And this is just natsemi ethernet phy which is in Kconfig already.
drivers/net/phy/Kconfig:168:config PHY_NATSEMI drivers/net/phy/Makefile:24:obj-$(CONFIG_PHY_NATSEMI) += natsemi.o
Quoted 17 lines
as established back in 2015:
commit
f96fe2c0a8a72d675532d79df49cbfe3464154a5Author: Michal Simek <[email protected]> Date: Wed Sep 23 19:35:31 2015 +0200ARM64: zynqmp: Enable NATSEMI phys
Signed-off-by Michal Simek <[email protected]>include/configs/xilinx_zynqmp.h +0
-0
include/configs/xilinx_zynqmp.h line 198
Quoted 6 lines
include/configs/xilinx_zynqmp.h +1
-0@@ -193,6 +193,7 @@# define CONFIG_MII # define CONFIG_SYS_FAULT_ECHO_LINK_DOWN # define CONFIG_PHY_MARVELL +# define CONFIG_PHY_NATSEMI # define CONFIG_PHY_TI #endif
And this enabling only phy.
Thanks,
Michal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190423/c9a4dda9/attachment.sig>