Skip to content

Commit

Permalink
Kconfig: Finish migration of hashing commands
Browse files Browse the repository at this point in the history
Currently these (board agnostic) commands cannot be selected using
menuconfig and friends. Fix this the obvious way.  As part of this,
don't muddle the meaning of CONFIG_HASH_VERIFY to mean both 'hash -v'
and "we have a hashing command" as this makes the Kconfig logic odd.

Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
[trini: Re-apply, add imply for a few cases, run moveconfig.py, also
        migrate CRC32_VERIFY]
Signed-off-by: Tom Rini <trini@konsulko.com>
  • Loading branch information
daniel-thompson authored and trini committed May 31, 2017
1 parent ccbbada commit 221a949
Show file tree
Hide file tree
Showing 54 changed files with 67 additions and 65 deletions.
12 changes: 0 additions & 12 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,6 @@ The following options need to be configured:
CONFIG_CMD_BOOTI * ARM64 Linux kernel Image support
CONFIG_CMD_CACHE * icache, dcache
CONFIG_CMD_CONSOLE coninfo
CONFIG_CMD_CRC32 * crc32
CONFIG_CMD_DHCP * DHCP support
CONFIG_CMD_DIAG * Diagnostics
CONFIG_CMD_ECHO echo arguments
Expand Down Expand Up @@ -889,8 +888,6 @@ The following options need to be configured:
CONFIG_CMD_SETGETDCR Support for DCR Register access
(4xx only)
CONFIG_CMD_SF * Read/write/erase SPI NOR flash
CONFIG_CMD_SHA1SUM * print sha1 memory digest
(requires CONFIG_CMD_MEMORY)
CONFIG_CMD_SOFTSWITCH * Soft switch setting command for BF60x
CONFIG_CMD_SOURCE "source" command Support
CONFIG_CMD_SPI * SPI serial bus support
Expand Down Expand Up @@ -2679,15 +2676,6 @@ The following options need to be configured:
A better solution is to properly configure the firewall,
but sometimes that is not allowed.

- Hashing support:
CONFIG_HASH_VERIFY

Enable the hash verify command (hash -v). This adds to code
size a little.

Note: There is also a sha1sum command, which should perhaps
be deprecated in favour of 'hash sha1'.

- bootcount support:
CONFIG_BOOTCOUNT_LIMIT

Expand Down
2 changes: 2 additions & 0 deletions arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@ config SANDBOX
select DM_SPI
select DM_GPIO
select DM_MMC
imply CRC32_VERIFY
imply CMD_GETTIME
imply CMD_HASH
imply CMD_IO
imply CMD_IOTRACE
imply LZMA
imply CMD_LZMADEC
imply HASH_VERIFY

config SH
bool "SuperH architecture"
Expand Down
5 changes: 5 additions & 0 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -495,15 +495,19 @@ config TARGET_VEXPRESS_CA9X4
config TARGET_BCM23550_W1D
bool "Support bcm23550_w1d"
select CPU_V7
imply CRC32_VERIFY

config TARGET_BCM28155_AP
bool "Support bcm28155_ap"
select CPU_V7
imply CRC32_VERIFY

config TARGET_BCMCYGNUS
bool "Support bcmcygnus"
select CPU_V7
imply CRC32_VERIFY
imply CMD_HASH
imply HASH_VERIFY

config TARGET_BCMNSP
bool "Support bcmnsp"
Expand Down Expand Up @@ -629,6 +633,7 @@ config ARCH_SOCFPGA
select ARCH_MISC_INIT
select SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
select SYS_THUMB_BUILD
imply CRC32_VERIFY

config ARCH_SUNXI
bool "Support sunxi (Allwinner) SoCs"
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/mach-exynos/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ config ARCH_EXYNOS5
select CPU_V7
select BOARD_EARLY_INIT_F
select SHA_HW_ACCEL
imply CRC32_VERIFY
imply CMD_HASH
imply HASH_VERIFY
help
Samsung Exynos5 SoC family are based on ARM Cortex-A15 CPU (and
Cortex-A7 CPU in big.LITTLE configuration). There are multiple SoCs
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-tegra/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ config TEGRA_COMMON
select OF_CONTROL
select VIDCONSOLE_AS_LCD if DM_VIDEO
select BOARD_EARLY_INIT_F
imply CRC32_VERIFY

config TEGRA_NO_BPMP
bool "Tegra common options for SoCs without BPMP"
Expand Down
1 change: 1 addition & 0 deletions board/ti/common/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ config TI_COMMON_CMD_OPTIONS
bool "Enable cmd options on TI platforms"
imply CMD_ASKENV
imply CMD_BOOTZ
imply CRC32_VERIFY if ARCH_KEYSTONE
imply CMD_DFU if USB_GADGET_DOWNLOAD
imply CMD_DHCP
imply CMD_EEPROM
Expand Down
26 changes: 25 additions & 1 deletion cmd/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,12 @@ config CMD_CRC32
help
Compute CRC32.

config CRC32_VERIFY
bool "crc32 -v"
depends on CMD_CRC32
help
Add -v option to verify data against a crc32 checksum.

config CMD_EEPROM
bool "eeprom - EEPROM subsystem"
help
Expand Down Expand Up @@ -410,13 +416,25 @@ config CMD_MD5SUM
help
Compute MD5 checksum.

config MD5SUM_VERFIY
config MD5SUM_VERIFY
bool "md5sum -v"
default n
depends on CMD_MD5SUM
help
Add -v option to verify data against an MD5 checksum.

config CMD_SHA1SUM
bool "sha1sum"
select SHA1
help
Compute SHA1 checksum.

config SHA1SUM_VERIFY
bool "sha1sum -v"
depends on CMD_SHA1SUM
help
Add -v option to verify data against a SHA1 checksum.

config LOOPW
bool "loopw"
help
Expand Down Expand Up @@ -1068,6 +1086,12 @@ config CMD_HASH
saved to memory or to an environment variable. It is also possible
to verify a hash against data in memory.

config HASH_VERIFY
bool "hash -v"
depends on CMD_HASH
help
Add -v option to verify data against a hash.

config CMD_TPM
bool "Enable the 'tpm' command"
depends on TPM
Expand Down
8 changes: 4 additions & 4 deletions cmd/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ static int do_mem_crc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])

av = argv + 1;
ac = argc - 1;
#ifdef CONFIG_HASH_VERIFY
#ifdef CONFIG_CRC32_VERIFY
if (strcmp(*av, "-v") == 0) {
flags |= HASH_FLAG_VERIFY | HASH_FLAG_ENV;
av++;
Expand Down Expand Up @@ -1238,15 +1238,15 @@ U_BOOT_CMD(

#ifdef CONFIG_CMD_CRC32

#ifndef CONFIG_HASH_VERIFY
#ifndef CONFIG_CRC32_VERIFY

U_BOOT_CMD(
crc32, 4, 1, do_mem_crc,
"checksum calculation",
"address count [addr]\n - compute CRC32 checksum [save at addr]"
);

#else /* CONFIG_HASH_VERIFY */
#else /* CONFIG_CRC32_VERIFY */

U_BOOT_CMD(
crc32, 5, 1, do_mem_crc,
Expand All @@ -1255,7 +1255,7 @@ U_BOOT_CMD(
"-v address count crc\n - verify crc of memory area"
);

#endif /* CONFIG_HASH_VERIFY */
#endif /* CONFIG_CRC32_VERIFY */

#endif

Expand Down
14 changes: 4 additions & 10 deletions common/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,9 @@ static struct hash_algo hash_algo[] = {
},
};

#if defined(CONFIG_SHA256) || defined(CONFIG_CMD_SHA1SUM)
#define MULTI_HASH
#endif

#if defined(CONFIG_HASH_VERIFY) || defined(CONFIG_CMD_HASH)
#define MULTI_HASH
#endif

/* Try to minimize code size for boards that don't want much hashing */
#ifdef MULTI_HASH
#if defined(CONFIG_SHA256) || defined(CONFIG_CMD_SHA1SUM) || \
defined(CONFIG_CRC32_VERIFY) || defined(CONFIG_CMD_HASH)
#define multi_hash() 1
#else
#define multi_hash() 0
Expand Down Expand Up @@ -424,7 +417,8 @@ int hash_command(const char *algo_name, int flags, cmd_tbl_t *cmdtp, int flag,
unmap_sysmem(buf);

/* Try to avoid code bloat when verify is not needed */
#ifdef CONFIG_HASH_VERIFY
#if defined(CONFIG_CRC32_VERIFY) || defined(CONFIG_SHA1SUM_VERIFY) || \
defined(CONFIG_HASH_VERIFY)
if (flags & HASH_FLAG_VERIFY) {
#else
if (0) {
Expand Down
1 change: 1 addition & 0 deletions configs/apalis_imx6_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ CONFIG_CMD_BOOTZ=y
# CONFIG_CMD_IMLS is not set
# CONFIG_CMD_XIMG is not set
CONFIG_CMD_ASKENV=y
CONFIG_CRC32_VERIFY=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_MMC=y
CONFIG_CMD_I2C=y
Expand Down
1 change: 1 addition & 0 deletions configs/apalis_imx6_nospl_com_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CONFIG_CMD_BOOTZ=y
# CONFIG_CMD_IMLS is not set
# CONFIG_CMD_XIMG is not set
CONFIG_CMD_ASKENV=y
CONFIG_CRC32_VERIFY=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_MMC=y
CONFIG_CMD_I2C=y
Expand Down
1 change: 1 addition & 0 deletions configs/apalis_imx6_nospl_it_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CONFIG_CMD_BOOTZ=y
# CONFIG_CMD_IMLS is not set
# CONFIG_CMD_XIMG is not set
CONFIG_CMD_ASKENV=y
CONFIG_CRC32_VERIFY=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_MMC=y
CONFIG_CMD_I2C=y
Expand Down
2 changes: 2 additions & 0 deletions configs/bcm958622hr_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ CONFIG_CMD_ASKENV=y
# CONFIG_CMD_SETEXPR is not set
CONFIG_CMD_CACHE=y
CONFIG_CMD_TIME=y
CONFIG_CRC32_VERIFY=y
CONFIG_CMD_HASH=y
CONFIG_HASH_VERIFY=y
CONFIG_CMD_FAT=y
# CONFIG_MMC is not set
CONFIG_SYS_NS16550=y
Expand Down
1 change: 1 addition & 0 deletions configs/calimain_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ CONFIG_SYS_PROMPT="Calimain > "
CONFIG_AUTOBOOT_KEYED=y
CONFIG_AUTOBOOT_STOP_STR="\x0b"
CONFIG_CMD_ASKENV=y
CONFIG_CRC32_VERIFY=y
CONFIG_CMD_GPIO=y
# CONFIG_CMD_SETEXPR is not set
CONFIG_CMD_DHCP=y
Expand Down
1 change: 1 addition & 0 deletions configs/colibri_imx6_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ CONFIG_CMD_BOOTZ=y
# CONFIG_CMD_IMLS is not set
# CONFIG_CMD_XIMG is not set
CONFIG_CMD_ASKENV=y
CONFIG_CRC32_VERIFY=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_MMC=y
CONFIG_CMD_I2C=y
Expand Down
1 change: 1 addition & 0 deletions configs/colibri_imx6_nospl_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CONFIG_CMD_BOOTZ=y
# CONFIG_CMD_IMLS is not set
# CONFIG_CMD_XIMG is not set
CONFIG_CMD_ASKENV=y
CONFIG_CRC32_VERIFY=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_MMC=y
CONFIG_CMD_I2C=y
Expand Down
1 change: 1 addition & 0 deletions configs/da850_am18xxevm_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CONFIG_SPL_BOARD_INIT=y
CONFIG_HUSH_PARSER=y
# CONFIG_CMD_IMLS is not set
CONFIG_CMD_ASKENV=y
CONFIG_CRC32_VERIFY=y
# CONFIG_CMD_FLASH is not set
CONFIG_CMD_MMC=y
CONFIG_CMD_SF=y
Expand Down
1 change: 1 addition & 0 deletions configs/da850evm_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CONFIG_SYS_PROMPT="U-Boot > "
CONFIG_CMD_BOOTZ=y
# CONFIG_CMD_IMLS is not set
CONFIG_CMD_ASKENV=y
CONFIG_CRC32_VERIFY=y
# CONFIG_CMD_FLASH is not set
CONFIG_CMD_MMC=y
CONFIG_CMD_SF=y
Expand Down
1 change: 1 addition & 0 deletions configs/da850evm_direct_nor_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ CONFIG_BOARD_EARLY_INIT_F=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="U-Boot > "
CONFIG_CMD_ASKENV=y
CONFIG_CRC32_VERIFY=y
CONFIG_CMD_SF=y
# CONFIG_CMD_SETEXPR is not set
CONFIG_CMD_DHCP=y
Expand Down
1 change: 1 addition & 0 deletions configs/ea20_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="ea20 > "
# CONFIG_CMD_IMLS is not set
CONFIG_CMD_ASKENV=y
CONFIG_CRC32_VERIFY=y
# CONFIG_CMD_FLASH is not set
CONFIG_CMD_SF=y
CONFIG_CMD_SPI=y
Expand Down
1 change: 1 addition & 0 deletions configs/imx6qdl_icore_mmc_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ CONFIG_SPL_EXT_SUPPORT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="icorem6qdl> "
# CONFIG_CMD_IMLS is not set
CONFIG_CRC32_VERIFY=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_MMC=y
CONFIG_CMD_I2C=y
Expand Down
1 change: 1 addition & 0 deletions configs/imx6qdl_icore_rqs_mmc_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ CONFIG_SPL_EXT_SUPPORT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="icorem6qdl-rqs> "
# CONFIG_CMD_IMLS is not set
CONFIG_CRC32_VERIFY=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_MMC=y
CONFIG_CMD_I2C=y
Expand Down
1 change: 1 addition & 0 deletions configs/imx6ul_geam_mmc_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CONFIG_SPL_EXT_SUPPORT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="geam6ul> "
# CONFIG_CMD_IMLS is not set
CONFIG_CRC32_VERIFY=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_MMC=y
CONFIG_CMD_I2C=y
Expand Down
1 change: 1 addition & 0 deletions configs/imx6ul_geam_nand_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CONFIG_SPL_DMA_SUPPORT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="geam6ul> "
# CONFIG_CMD_IMLS is not set
CONFIG_CRC32_VERIFY=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_MMC=y
CONFIG_CMD_NAND=y
Expand Down
1 change: 1 addition & 0 deletions configs/imx6ul_isiot_emmc_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CONFIG_SPL_EXT_SUPPORT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="isiotmx6ul> "
# CONFIG_CMD_IMLS is not set
CONFIG_CRC32_VERIFY=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_MMC=y
CONFIG_CMD_GPIO=y
Expand Down
1 change: 1 addition & 0 deletions configs/imx6ul_isiot_mmc_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CONFIG_SPL_EXT_SUPPORT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="isiotmx6ul> "
# CONFIG_CMD_IMLS is not set
CONFIG_CRC32_VERIFY=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_MMC=y
CONFIG_CMD_I2C=y
Expand Down
1 change: 1 addition & 0 deletions configs/imx6ul_isiot_nand_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CONFIG_SPL_DMA_SUPPORT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="isiotmx6ul> "
# CONFIG_CMD_IMLS is not set
CONFIG_CRC32_VERIFY=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_MMC=y
CONFIG_CMD_NAND=y
Expand Down
1 change: 1 addition & 0 deletions configs/ipam390_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="U-Boot > "
# CONFIG_CMD_IMLS is not set
CONFIG_CMD_ASKENV=y
CONFIG_CRC32_VERIFY=y
# CONFIG_CMD_FLASH is not set
# CONFIG_CMD_SETEXPR is not set
CONFIG_CMD_DHCP=y
Expand Down
1 change: 1 addition & 0 deletions configs/legoev3_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ CONFIG_AUTOBOOT_PROMPT="Autoboot in %d seconds - press 'l' to stop...\n"
CONFIG_AUTOBOOT_STOP_STR="l"
# CONFIG_CMD_IMLS is not set
CONFIG_CMD_ASKENV=y
CONFIG_CRC32_VERIFY=y
# CONFIG_CMD_FLASH is not set
CONFIG_CMD_MMC=y
CONFIG_CMD_SF=y
Expand Down
1 change: 1 addition & 0 deletions configs/omapl138_lcdk_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CONFIG_SPL_BOARD_INIT=y
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5
CONFIG_HUSH_PARSER=y
# CONFIG_CMD_IMLS is not set
CONFIG_CRC32_VERIFY=y
# CONFIG_CMD_EEPROM is not set
# CONFIG_CMD_FLASH is not set
# CONFIG_CMD_GPIO is not set
Expand Down
1 change: 1 addition & 0 deletions configs/xtfpga_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ CONFIG_AUTOBOOT_KEYED=y
CONFIG_AUTOBOOT_PROMPT="Autobooting in %d seconds, press <SPACE> to stop\n"
CONFIG_AUTOBOOT_STOP_STR=" "
CONFIG_CMD_ASKENV=y
CONFIG_CRC32_VERIFY=y
CONFIG_CMD_DHCP=y
CONFIG_CMD_PING=y
CONFIG_CMD_DIAG=y
Expand Down
Loading

0 comments on commit 221a949

Please sign in to comment.