From: Tom Rini Date: Sun, 4 Dec 2022 15:14:16 +0000 (-0500) Subject: kbuild: Remove checking for adhoc CONFIG symbols X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=9ef3ba85bf38289a3e3b0dcb92fad9480a0b1834;p=u-boot.git kbuild: Remove checking for adhoc CONFIG symbols At this point all listed adhoc CONFIG symbols have been migrated to Kconfig or removed from the tree or renamed to CFG (or similar). We also now have CI tests that will error on any new introductions, and checkpatch.pl also looks. We can now remove these hooks and related scripts. Signed-off-by: Tom Rini --- diff --git a/Makefile b/Makefile index 8cd873fd5f..5610f7b492 100644 --- a/Makefile +++ b/Makefile @@ -1075,10 +1075,6 @@ cmd_lzma = lzma -c -z -k -9 $< > $@ cfg: u-boot.cfg -quiet_cmd_cfgcheck = CFGCHK $2 -cmd_cfgcheck = $(srctree)/scripts/check-config.sh $2 \ - $(srctree)/scripts/config_whitelist.txt $(srctree) - quiet_cmd_ofcheck = OFCHK $2 cmd_ofcheck = $(srctree)/scripts/check-of.sh $2 \ $(srctree)/scripts/of_allowlist.txt @@ -1146,10 +1142,6 @@ endif $(call deprecated,CONFIG_TIMER,Timer drivers,v2023.01,$(if $(strip $(CFG_SYS_TIMER_RATE)$(CFG_SYS_TIMER_COUNTER)),x)) $(call deprecated,CONFIG_DM_SERIAL,Serial drivers,v2023.04,$(CONFIG_SERIAL)) $(call deprecated,CONFIG_DM_SCSI,SCSI drivers,v2023.04,$(CONFIG_SCSI)) - @# Check that this build does not use CONFIG options that we do not - @# know about unless they are in Kconfig. All the existing CONFIG - @# options are whitelisted, so new ones should not be added. - $(call cmd,cfgcheck,u-boot.cfg) @# Check that this build does not override OF_HAS_PRIOR_STAGE by @# disabling OF_BOARD. $(call cmd,ofcheck,$(KCONFIG_CONFIG)) diff --git a/scripts/build-whitelist.sh b/scripts/build-whitelist.sh deleted file mode 100755 index 37630c0271..0000000000 --- a/scripts/build-whitelist.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -# Copyright (c) 2016 Google, Inc -# Written by Simon Glass -# - -# This script creates the configuration whitelist file. This file contains -# all the config options which are allowed to be used outside Kconfig. -# Please do not add things to the whitelist. Instead, add your new option -# to Kconfig. -# -export LC_ALL=C LC_COLLATE=C - -# Looks for the rest of the CONFIG options, but exclude those in Kconfig and -# defconfig files. -# -git grep CONFIG_ | \ - egrep -vi "(Kconfig:|defconfig:|README|\.py|\.pl:)" \ - | tr ' \t' '\n\n' \ - | sed -n 's/^\(CONFIG_[A-Za-z0-9_]*\).*/\1/p' \ - |sort |uniq >scripts/config_whitelist.txt.tmp1; - -# Finally, we need a list of the valid Kconfig options to exclude these from -# the whitelist. -cat `find . -name "Kconfig*"` |sed -n \ - -e 's/^\s*config *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \ - -e 's/^\s*menuconfig *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \ - |sort |uniq >scripts/config_whitelist.txt.tmp2 - -# Use only the options that are present in the first file but not the second. -comm -23 scripts/config_whitelist.txt.tmp1 scripts/config_whitelist.txt.tmp2 \ - |sort |uniq >scripts/config_whitelist.txt.tmp3 - -# If scripts/config_whitelist.txt already exists, take the intersection of the -# current list and the new one. We do not want to increase whitelist options. -if [ -r scripts/config_whitelist.txt ]; then - comm -12 scripts/config_whitelist.txt.tmp3 scripts/config_whitelist.txt \ - > scripts/config_whitelist.txt.tmp4 - mv scripts/config_whitelist.txt.tmp4 scripts/config_whitelist.txt -else - mv scripts/config_whitelist.txt.tmp3 scripts/config_whitelist.txt -fi - -rm scripts/config_whitelist.txt.tmp* - -unset LC_ALL LC_COLLATE diff --git a/scripts/check-config.sh b/scripts/check-config.sh deleted file mode 100755 index cc1c9a54d9..0000000000 --- a/scripts/check-config.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh -# Copyright (c) 2016 Google, Inc -# Written by Simon Glass -# -# Check that the u-boot.cfg file provided does not introduce any new -# ad-hoc CONFIG options -# -# Use scripts/build-whitelist.sh to generate the list of current ad-hoc -# CONFIG options (those which are not in Kconfig). - -# Usage -# check-config.sh -# -# For example: -# scripts/check-config.sh b/chromebook_link/u-boot.cfg kconfig_whitelist.txt . - -set -e -set -u - -PROG_NAME="${0##*/}" - -usage() { - echo "$PROG_NAME " - exit 1 -} - -[ $# -ge 3 ] || usage - -path="$1" -whitelist="$2" -srctree="$3" - -# Temporary files -configs="${path}.configs" -suspects="${path}.suspects" -ok="${path}.ok" -new_adhoc="${path}.adhoc" - -export LC_ALL=C -export LC_COLLATE=C - -cat ${path} |sed -nr 's/^#define (CONFIG_[A-Za-z0-9_]*).*/\1/p' |sort |uniq \ - >${configs} - -comm -23 ${configs} ${whitelist} > ${suspects} - -cat `find ${srctree} -name "Kconfig*"` |sed -nr \ - -e 's/^[[:blank:]]*config *([A-Za-z0-9_]*).*$/CONFIG_\1/p' \ - -e 's/^[[:blank:]]*menuconfig ([A-Za-z0-9_]*).*$/CONFIG_\1/p' \ - |sort |uniq > ${ok} -comm -23 ${suspects} ${ok} >${new_adhoc} -if [ -s ${new_adhoc} ]; then - echo >&2 "Error: You must add new CONFIG options using Kconfig" - echo >&2 "The following new ad-hoc CONFIG options were detected:" - cat >&2 ${new_adhoc} - echo >&2 - echo >&2 "Please add these via Kconfig instead. Find a suitable Kconfig" - echo >&2 "file and add a 'config' or 'menuconfig' option." - # Don't delete the temporary files in case they are useful - exit 1 -else - rm ${suspects} ${ok} ${new_adhoc} -fi diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt deleted file mode 100644 index 9e346fbc44..0000000000 --- a/scripts/config_whitelist.txt +++ /dev/null @@ -1,245 +0,0 @@ -CONFIG_ARM_GIC_BASE_ADDRESS -CONFIG_BOARDDIR -CONFIG_DFU_ALT -CONFIG_DFU_ALT_BOOT_EMMC -CONFIG_DFU_ALT_BOOT_SD -CONFIG_DFU_ALT_SYSTEM -CONFIG_DFU_ENV_SETTINGS -CONFIG_DM9000_BASE -CONFIG_DM9000_BYTE_SWAPPED -CONFIG_DM9000_NO_SROM -CONFIG_DM9000_USE_16BIT -CONFIG_DW_WDT_CLOCK_KHZ -CONFIG_ENV_FLAGS_LIST_STATIC -CONFIG_ENV_IS_EMBEDDED -CONFIG_ENV_SETTINGS_BUTTONS_AND_LEDS -CONFIG_ENV_SETTINGS_NAND_V1 -CONFIG_ENV_SETTINGS_NAND_V2 -CONFIG_ENV_SETTINGS_V1 -CONFIG_ENV_SETTINGS_V2 -CONFIG_ENV_SROM_BANK -CONFIG_ENV_TOTAL_SIZE -CONFIG_ET1100_BASE -CONFIG_ETHBASE -CONFIG_EXTRA_ENV_SETTINGS -CONFIG_FB_ADDR -CONFIG_FDTADDR -CONFIG_FDTFILE -CONFIG_FEC_ENET_DEV -CONFIG_FEC_FIXED_SPEED -CONFIG_FEC_MXC_PHYADDR -CONFIG_FLASH_BR_PRELIM -CONFIG_FLASH_OR_PRELIM -CONFIG_FLASH_SECTOR_SIZE -CONFIG_FLASH_SHOW_PROGRESS -CONFIG_FLASH_SPANSION_S29WS_N -CONFIG_FLASH_VERIFY -CONFIG_FM_PLAT_CLK_DIV -CONFIG_FSL_CPLD -CONFIG_FSL_ESDHC_PIN_MUX -CONFIG_FSL_FM_10GEC_REGULAR_NOTATION -CONFIG_FSL_ISBC_KEY_EXT -CONFIG_FSL_PMIC_BITLEN -CONFIG_FSL_PMIC_BUS -CONFIG_FSL_PMIC_CLK -CONFIG_FSL_PMIC_CS -CONFIG_FSL_PMIC_MODE -CONFIG_FSL_SDHC_V2_3 -CONFIG_FSL_SERDES1 -CONFIG_FSL_SERDES2 -CONFIG_GATEWAYIP -CONFIG_GMII -CONFIG_G_DNL_THOR_PRODUCT_NUM -CONFIG_G_DNL_THOR_VENDOR_NUM -CONFIG_G_DNL_UMS_PRODUCT_NUM -CONFIG_G_DNL_UMS_VENDOR_NUM -CONFIG_HDMI_ENCODER_I2C_ADDR -CONFIG_HOSTNAME -CONFIG_HSMMC2_8BIT -CONFIG_HW_ENV_SETTINGS -CONFIG_I2C_ENV_EEPROM_BUS -CONFIG_I2C_MULTI_BUS -CONFIG_I2C_MVTWSI -CONFIG_I2C_MVTWSI_BASE0 -CONFIG_I2C_MVTWSI_BASE1 -CONFIG_I2C_RTC_ADDR -CONFIG_ICS307_REFCLK_HZ -CONFIG_IMX6_PWM_PER_CLK -CONFIG_IPADDR -CONFIG_IRAM_BASE -CONFIG_IRAM_END -CONFIG_IRAM_SIZE -CONFIG_IRAM_TOP -CONFIG_KSNET_CPSW_NUM_PORTS -CONFIG_KSNET_MAC_ID_BASE -CONFIG_KSNET_MDIO_PHY_CONFIG_ENABLE -CONFIG_KSNET_NETCP_BASE -CONFIG_KSNET_NETCP_V1_0 -CONFIG_KSNET_NETCP_V1_5 -CONFIG_KSNET_SERDES_LANES_PER_SGMII -CONFIG_KSNET_SERDES_SGMII2_BASE -CONFIG_KSNET_SERDES_SGMII_BASE -CONFIG_L1_INIT_RAM -CONFIG_L2_CACHE -CONFIG_LEGACY_BOOTCMD_ENV -CONFIG_LOWPOWER_ADDR -CONFIG_LOWPOWER_FLAG -CONFIG_LPC32XX_NAND_MLC_BUSY_DELAY -CONFIG_LPC32XX_NAND_MLC_NAND_TA -CONFIG_LPC32XX_NAND_MLC_RD_HIGH -CONFIG_LPC32XX_NAND_MLC_RD_LOW -CONFIG_LPC32XX_NAND_MLC_TCEA_DELAY -CONFIG_LPC32XX_NAND_MLC_WR_HIGH -CONFIG_LPC32XX_NAND_MLC_WR_LOW -CONFIG_LPC32XX_NAND_SLC_RDR_CLKS -CONFIG_LPC32XX_NAND_SLC_RHOLD -CONFIG_LPC32XX_NAND_SLC_RSETUP -CONFIG_LPC32XX_NAND_SLC_RWIDTH -CONFIG_LPC32XX_NAND_SLC_WDR_CLKS -CONFIG_LPC32XX_NAND_SLC_WHOLD -CONFIG_LPC32XX_NAND_SLC_WSETUP -CONFIG_LPC32XX_NAND_SLC_WWIDTH -CONFIG_MACB_SEARCH_PHY -CONFIG_MALLOC_F_ADDR -CONFIG_MALTA -CONFIG_MAX_DSP_CPUS -CONFIG_MAX_MEM_MAPPED -CONFIG_MAX_RAM_BANK_SIZE -CONFIG_MEMSIZE_IN_BYTES -CONFIG_MEM_INIT_VALUE -CONFIG_MFG_ENV_SETTINGS -CONFIG_MII_DEFAULT_TSEC -CONFIG_MIU_2BIT_21_7_INTERLEAVED -CONFIG_MIU_2BIT_INTERLEAVED -CONFIG_MMC_DEFAULT_DEV -CONFIG_MONITOR_IS_IN_RAM -CONFIG_MTD_NAND_VERIFY_WRITE -CONFIG_MVGBE_PORTS -CONFIG_MXC_GPT_HCLK -CONFIG_MXC_NAND_HWECC -CONFIG_MXC_NAND_IP_REGS_BASE -CONFIG_MXC_NAND_REGS_BASE -CONFIG_MXC_UART_BASE -CONFIG_MXC_USB_FLAGS -CONFIG_MXC_USB_PORT -CONFIG_MXC_USB_PORTSC -CONFIG_NAND_6BYTES_OOB_FREE_10BYTES_ECC -CONFIG_NAND_CS_INIT -CONFIG_NETDEV -CONFIG_NETMASK -CONFIG_NORBOOT -CONFIG_NUM_DSP_CPUS -CONFIG_ODROID_REV_AIN -CONFIG_OTHBOOTARGS -CONFIG_OVERWRITE_ETHADDR_ONCE -CONFIG_PCIE_IMX_PERST_GPIO -CONFIG_PCIE_IMX_POWER_GPIO -CONFIG_PEN_ADDR_BIG_ENDIAN -CONFIG_PHY_BASE_ADR -CONFIG_PHY_ET1011C_TX_CLK_FIX -CONFIG_PHY_ID -CONFIG_PHY_INTERFACE_MODE -CONFIG_PHY_IRAM_BASE -CONFIG_PL011_CLOCK -CONFIG_PL01x_PORTS -CONFIG_PME_PLAT_CLK_DIV -CONFIG_POST -CONFIG_POSTBOOTMENU -CONFIG_POST_EXTERNAL_WORD_FUNCS -CONFIG_POWER_LTC3676_I2C_ADDR -CONFIG_POWER_PFUZE100_I2C_ADDR -CONFIG_POWER_PFUZE3000_I2C_ADDR -CONFIG_PPC_SPINTABLE_COMPATIBLE -CONFIG_PRAM -CONFIG_PSRAM_SCFG -CONFIG_QBMAN_CLK_DIV -CONFIG_RAMBOOT_SPIFLASH -CONFIG_RAMBOOT_TEXT_BASE -CONFIG_RAMDISK_ADDR -CONFIG_RD_LVL -CONFIG_RESET_VECTOR_ADDRESS -CONFIG_ROCKCHIP_SDHCI_MAX_FREQ -CONFIG_ROOTPATH -CONFIG_SANDBOX_ARCH -CONFIG_SANDBOX_SDL -CONFIG_SANDBOX_SPI_MAX_BUS -CONFIG_SANDBOX_SPI_MAX_CS -CONFIG_SAR2_REG -CONFIG_SAR_REG -CONFIG_SCIF_A -CONFIG_SCSI_DEV_LIST -CONFIG_SC_TIMER_CLK -CONFIG_SERIAL_BOOT -CONFIG_SERVERIP -CONFIG_SETUP_INITRD_TAG -CONFIG_SET_DFU_ALT_BUF_LEN -CONFIG_SH_ETHER_ALIGNE_SIZE -CONFIG_SH_ETHER_CACHE_INVALIDATE -CONFIG_SH_ETHER_CACHE_WRITEBACK -CONFIG_SH_ETHER_PHY_ADDR -CONFIG_SH_ETHER_PHY_MODE -CONFIG_SH_ETHER_USE_PORT -CONFIG_SH_QSPI_BASE -CONFIG_SLIC -CONFIG_SMDK5420 -CONFIG_SMP_PEN_ADDR -CONFIG_SOCRATES -CONFIG_SPI_ADDR -CONFIG_SPI_BOOTING -CONFIG_SPI_FLASH_QUAD -CONFIG_SPI_FLASH_SIZE -CONFIG_SPI_HALF_DUPLEX -CONFIG_SPI_N25Q256A_RESET -CONFIG_STACKBASE -CONFIG_STANDALONE_LOAD_ADDR -CONFIG_STD_DEVICES_SETTINGS -CONFIG_SYS_BAUDRATE_TABLE -CONFIG_TEGRA_BOARD_STRING -CONFIG_TEGRA_ENABLE_UARTA -CONFIG_TEGRA_ENABLE_UARTD -CONFIG_TEGRA_SLINK_CTRLS -CONFIG_TEGRA_SPI -CONFIG_TEGRA_UARTA_GPU -CONFIG_TEGRA_UARTA_SDIO1 -CONFIG_TEGRA_VDD_CORE_TPS62361B_SET3 -CONFIG_TEGRA_VDD_CORE_TPS62366A_SET1 -CONFIG_TESTPIN_MASK -CONFIG_TESTPIN_REG -CONFIG_THOR_RESET_OFF -CONFIG_TPM_TIS_BASE_ADDRESS -CONFIG_TSEC1 -CONFIG_TSEC1_NAME -CONFIG_TSEC2 -CONFIG_TSEC2_NAME -CONFIG_TSEC3 -CONFIG_TSEC3_NAME -CONFIG_TSEC4 -CONFIG_TSEC4_NAME -CONFIG_TSECV2 -CONFIG_TSECV2_1 -CONFIG_TSEC_TBICR_SETTINGS -CONFIG_UBIFS_VOLUME -CONFIG_UBI_PART -CONFIG_UBOOTPATH -CONFIG_UBOOT_SECTOR_COUNT -CONFIG_UBOOT_SECTOR_START -CONFIG_UEC_ETH -CONFIG_USART_BASE -CONFIG_USART_ID -CONFIG_USBD_HS -CONFIG_USB_BOOTING -CONFIG_USB_EXT2_BOOT -CONFIG_USB_FAT_BOOT -CONFIG_USB_ISP1301_I2C_ADDR -CONFIG_U_BOOT_HDR_SIZE -CONFIG_VAR_SIZE_SPL -CONFIG_VERY_BIG_RAM -CONFIG_VSC7385_IMAGE -CONFIG_VSC7385_IMAGE_SIZE -CONFIG_WATCHDOG_PRESC -CONFIG_WATCHDOG_RC -CONFIG_WATCHDOG_TIMEOUT -CONFIG_X86EMU_RAW_IO -CONFIG_X86_MRC_ADDR -CONFIG_X86_REFCODE_ADDR -CONFIG_X86_REFCODE_RUN_ADDR diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 09617a07f9..8f084a6070 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -443,22 +443,6 @@ def cleanup_headers(configs, args): cleanup_one_header(header_path, patterns, args) cleanup_empty_blocks(header_path, args) -def cleanup_whitelist(configs, args): - """Delete config whitelist entries - - Args: - configs: A list of CONFIGs to remove. - args (Namespace): program arguments - """ - if not confirm(args, 'Clean up whitelist entries?'): - return - - lines = read_file(os.path.join('scripts', 'config_whitelist.txt')) - - lines = [x for x in lines if x.strip() not in configs] - - write_file(os.path.join('scripts', 'config_whitelist.txt'), lines) - def find_matching(patterns, line): for pat in patterns: if pat.search(line): @@ -1558,14 +1542,10 @@ def do_find_config(config_list): """ all_configs, all_defconfigs, config_db, defconfig_db = read_database() - # Get the whitelist - adhoc_configs = set(read_file('scripts/config_whitelist.txt')) - # Start with all defconfigs out = all_defconfigs # Work through each config in turn - adhoc = [] for item in config_list: # Get the real config name and whether we want this config or not cfg = item @@ -1574,10 +1554,6 @@ def do_find_config(config_list): want = False cfg = cfg[1:] - if cfg in adhoc_configs: - adhoc.append(cfg) - continue - # Search everything that is still in the running. If it has a config # that we want, or doesn't have one that we don't, add it into the # running for the next stage @@ -1588,11 +1564,8 @@ def do_find_config(config_list): has_cfg = defconfig_matches(config_db[defc], re_match) if has_cfg == want: out.add(defc) - if adhoc: - print(f"Error: Not in Kconfig: %s" % ' '.join(adhoc)) - else: - print(f'{len(out)} matches') - print(' '.join(item.split('_defconfig')[0] for item in out)) + print(f'{len(out)} matches') + print(' '.join(item.split('_defconfig')[0] for item in out)) def prefix_config(cfg): @@ -1739,7 +1712,6 @@ doc/develop/moveconfig.rst for documentation.''' if configs: cleanup_headers(configs, args) - cleanup_whitelist(configs, args) cleanup_readme(configs, args) if args.commit: