[U-Boot] listing apparently "bad" Kconfig options in Makefiles

as a final(?) example of one of my originally Linux kernel-related Kbuild 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:
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 michal.simek@xilinx.com Date: Wed Sep 23 19:35:31 2015 +0200
ARM64: zynqmp: Enable NATSEMI phys
Signed-off-by: Michal Simek michal.simek@xilinx.com
diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h index 5008722bf4..eae1a4988b 100644 --- a/include/configs/xilinx_zynqmp.h +++ b/include/configs/xilinx_zynqmp.h @@ -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:
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

Hi,
On 13. 04. 19 13:01, Robert P. J. Day wrote:
as a final(?) example of one of my originally Linux kernel-related Kbuild 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:
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:
There is natsemi driver and maybe any platform which was using is removed now.
$ 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 $
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
as established back in 2015:
commit f96fe2c0a8a72d675532d79df49cbfe3464154a5 Author: Michal Simek michal.simek@xilinx.com Date: Wed Sep 23 19:35:31 2015 +0200
ARM64: zynqmp: Enable NATSEMI phys Signed-off-by: Michal Simek <michal.simek@xilinx.com>
diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h index 5008722bf4..eae1a4988b 100644 --- a/include/configs/xilinx_zynqmp.h +++ b/include/configs/xilinx_zynqmp.h @@ -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
participants (2)
-
Michal Simek
-
Robert P. J. Day