[U-Boot] [PATCH 0/4] Kconfig: convert MD5 and CMD_MD5SUM

This series move CONFIG_MD5 and the associated CONFIG_CMD_MD5SUM over to Kconfig, so it can easily be selected either by menuconfig or by a _defconfig (without resorting to header file hacks).
Cheers, Andre.
Andre Przywara (4): kirkwood: remove get_random_hex() and MD5 dependency Kconfig: introduce md5sum command selection Kconfig: define MD5 dependency for FIT support configs: move CMD_MD5SUM definition to defconfigs
Kconfig | 1 + arch/arm/mach-kirkwood/include/mach/config.h | 1 - arch/arm/mach-kirkwood/include/mach/cpu.h | 1 - cmd/Kconfig | 14 ++++++++++++++ configs/dragonboard410c_defconfig | 1 + configs/sandbox_defconfig | 1 + configs/sandbox_noblk_defconfig | 1 + configs/sandbox_spl_defconfig | 1 + configs/sh7752evb_defconfig | 1 + configs/sh7753evb_defconfig | 1 + configs/sh7757lcr_defconfig | 1 + include/configs/dragonboard410c.h | 4 ---- include/configs/sandbox.h | 1 - include/configs/sh7752evb.h | 2 -- include/configs/sh7753evb.h | 2 -- include/configs/sh7757lcr.h | 2 -- include/image.h | 1 - lib/Kconfig | 4 ++++ scripts/config_whitelist.txt | 3 --- 19 files changed, 26 insertions(+), 17 deletions(-)

Commit 19a5944fcd62 ("mvgbe: remove setting of ethaddr within the driver") removed the usage of get_random_hex() from the mvgbe driver about six years ago. However the prototype of that function survived till today in some kirkwood header file. Remove that prototype and the CONFIG_MD5 dependency triggered by that.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- arch/arm/mach-kirkwood/include/mach/config.h | 1 - arch/arm/mach-kirkwood/include/mach/cpu.h | 1 - 2 files changed, 2 deletions(-)
diff --git a/arch/arm/mach-kirkwood/include/mach/config.h b/arch/arm/mach-kirkwood/include/mach/config.h index 446457f..b786df0 100644 --- a/arch/arm/mach-kirkwood/include/mach/config.h +++ b/arch/arm/mach-kirkwood/include/mach/config.h @@ -24,7 +24,6 @@ #endif /* CONFIG_KW88F6281 */
#include <asm/arch/soc.h> -#define CONFIG_MD5 /* get_random_hex on krikwood needs MD5 support */ #define CONFIG_KIRKWOOD_EGIGA_INIT /* Enable GbePort0/1 for kernel */ #define CONFIG_KIRKWOOD_RGMII_PAD_1V8 /* Set RGMII Pad voltage to 1.8V */ #define CONFIG_KIRKWOOD_PCIE_INIT /* Enable PCIE Port0 for kernel */ diff --git a/arch/arm/mach-kirkwood/include/mach/cpu.h b/arch/arm/mach-kirkwood/include/mach/cpu.h index 926d347..ab704d9 100644 --- a/arch/arm/mach-kirkwood/include/mach/cpu.h +++ b/arch/arm/mach-kirkwood/include/mach/cpu.h @@ -139,7 +139,6 @@ struct kwgpio_registers { /* * functions */ -unsigned char get_random_hex(void); unsigned int mvebu_sdram_bar(enum memory_bank bank); unsigned int mvebu_sdram_bs(enum memory_bank bank); void mvebu_sdram_size_adjust(enum memory_bank bank);

On 14 March 2017 at 19:19, Andre Przywara andre.przywara@arm.com wrote:
Commit 19a5944fcd62 ("mvgbe: remove setting of ethaddr within the driver") removed the usage of get_random_hex() from the mvgbe driver about six years ago. However the prototype of that function survived till today in some kirkwood header file. Remove that prototype and the CONFIG_MD5 dependency triggered by that.
Signed-off-by: Andre Przywara andre.przywara@arm.com
arch/arm/mach-kirkwood/include/mach/config.h | 1 - arch/arm/mach-kirkwood/include/mach/cpu.h | 1 - 2 files changed, 2 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On 15.03.2017 02:19, Andre Przywara wrote:
Commit 19a5944fcd62 ("mvgbe: remove setting of ethaddr within the driver") removed the usage of get_random_hex() from the mvgbe driver about six years ago. However the prototype of that function survived till today in some kirkwood header file. Remove that prototype and the CONFIG_MD5 dependency triggered by that.
Signed-off-by: Andre Przywara andre.przywara@arm.com
arch/arm/mach-kirkwood/include/mach/config.h | 1 - arch/arm/mach-kirkwood/include/mach/cpu.h | 1 - 2 files changed, 2 deletions(-)
diff --git a/arch/arm/mach-kirkwood/include/mach/config.h b/arch/arm/mach-kirkwood/include/mach/config.h index 446457f..b786df0 100644 --- a/arch/arm/mach-kirkwood/include/mach/config.h +++ b/arch/arm/mach-kirkwood/include/mach/config.h @@ -24,7 +24,6 @@ #endif /* CONFIG_KW88F6281 */
#include <asm/arch/soc.h> -#define CONFIG_MD5 /* get_random_hex on krikwood needs MD5 support */ #define CONFIG_KIRKWOOD_EGIGA_INIT /* Enable GbePort0/1 for kernel */ #define CONFIG_KIRKWOOD_RGMII_PAD_1V8 /* Set RGMII Pad voltage to 1.8V */ #define CONFIG_KIRKWOOD_PCIE_INIT /* Enable PCIE Port0 for kernel */ diff --git a/arch/arm/mach-kirkwood/include/mach/cpu.h b/arch/arm/mach-kirkwood/include/mach/cpu.h index 926d347..ab704d9 100644 --- a/arch/arm/mach-kirkwood/include/mach/cpu.h +++ b/arch/arm/mach-kirkwood/include/mach/cpu.h @@ -139,7 +139,6 @@ struct kwgpio_registers { /*
- functions
*/ -unsigned char get_random_hex(void); unsigned int mvebu_sdram_bar(enum memory_bank bank); unsigned int mvebu_sdram_bs(enum memory_bank bank); void mvebu_sdram_size_adjust(enum memory_bank bank);
Reviewed-by: Stefan Roese sr@denx.de
Thanks, Stefan

On Wed, Mar 15, 2017 at 01:19:04AM +0000, Andre Przywara wrote:
Commit 19a5944fcd62 ("mvgbe: remove setting of ethaddr within the driver") removed the usage of get_random_hex() from the mvgbe driver about six years ago. However the prototype of that function survived till today in some kirkwood header file. Remove that prototype and the CONFIG_MD5 dependency triggered by that.
Signed-off-by: Andre Przywara andre.przywara@arm.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

So far CONFIG_MD5SUM would need to be set by a board's include file. Since the command is really generic, move it over to Kconfig to allow it to be defined by either a board's defconfig, menuconfig or some config snippet merged via mergeconfig.sh.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- cmd/Kconfig | 14 ++++++++++++++ lib/Kconfig | 4 ++++ 2 files changed, 18 insertions(+)
diff --git a/cmd/Kconfig b/cmd/Kconfig index ef53156..25e3b78 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -338,6 +338,20 @@ config CMD_CRC32 help Compute CRC32.
+config CMD_MD5SUM + bool "md5sum" + default n + select MD5 + help + Compute MD5 checksum. + +config MD5SUM_VERFIY + bool "md5sum -v" + default n + depends on CMD_MD5SUM + help + Add -v option to verify data against an MD5 checksum. + config LOOPW bool "loopw" help diff --git a/lib/Kconfig b/lib/Kconfig index b16062f..65c0157 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -101,6 +101,10 @@ config SHA_PROG_HW_ACCEL SHA1/SHA256 progressive hashing. Data can be streamed in a block at a time and the hashing is performed in hardware. + +config MD5 + bool + endmenu
menu "Compression Support"

On 14 March 2017 at 19:19, Andre Przywara andre.przywara@arm.com wrote:
So far CONFIG_MD5SUM would need to be set by a board's include file. Since the command is really generic, move it over to Kconfig to allow it to be defined by either a board's defconfig, menuconfig or some config snippet merged via mergeconfig.sh.
Signed-off-by: Andre Przywara andre.przywara@arm.com
cmd/Kconfig | 14 ++++++++++++++ lib/Kconfig | 4 ++++ 2 files changed, 18 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org

On Wed, Mar 15, 2017 at 01:19:05AM +0000, Andre Przywara wrote:
So far CONFIG_MD5SUM would need to be set by a board's include file. Since the command is really generic, move it over to Kconfig to allow it to be defined by either a board's defconfig, menuconfig or some config snippet merged via mergeconfig.sh.
Signed-off-by: Andre Przywara andre.przywara@arm.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

FIT images require MD5 support to verify image checksums. So far this was expressed by defining a CPP symbol in image.h. Since MD5 is now a first class Kconfig citizen, express that in Kconfig instead.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- Kconfig | 1 + include/image.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/Kconfig b/Kconfig index 81b4226..e0744d1 100644 --- a/Kconfig +++ b/Kconfig @@ -144,6 +144,7 @@ menu "Boot images"
config FIT bool "Support Flattened Image Tree" + select MD5 help This option allows you to boot the new uImage structure, Flattened Image Tree. FIT is formally a FDT, which can include diff --git a/include/image.h b/include/image.h index 1e686b7..2372518 100644 --- a/include/image.h +++ b/include/image.h @@ -67,7 +67,6 @@ struct lmb; # endif # else # define CONFIG_CRC32 /* FIT images need CRC32 support */ -# define CONFIG_MD5 /* and MD5 */ # define CONFIG_SHA1 /* and SHA1 */ # define CONFIG_SHA256 /* and SHA256 */ # define IMAGE_ENABLE_CRC32 1

On 14 March 2017 at 19:19, Andre Przywara andre.przywara@arm.com wrote:
FIT images require MD5 support to verify image checksums. So far this was expressed by defining a CPP symbol in image.h. Since MD5 is now a first class Kconfig citizen, express that in Kconfig instead.
Signed-off-by: Andre Przywara andre.przywara@arm.com
Kconfig | 1 + include/image.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Wed, Mar 15, 2017 at 01:19:06AM +0000, Andre Przywara wrote:
FIT images require MD5 support to verify image checksums. So far this was expressed by defining a CPP symbol in image.h. Since MD5 is now a first class Kconfig citizen, express that in Kconfig instead.
Signed-off-by: Andre Przywara andre.przywara@arm.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

Boards with an apparent need for the md5sum command had the connected config symbol defined in their board header file. Move this over to the respective defconfig files now that md5sum is configured via Kconfig. (This is a manual effort, which differs from moveconfig.py, not sure who is right here. Boards except sandbox loose the md5sum command with moveconfig.py, though it was explicitly mentioned in their config.h's)
Signed-off-by: Andre Przywara andre.przywara@arm.com --- configs/dragonboard410c_defconfig | 1 + configs/sandbox_defconfig | 1 + configs/sandbox_noblk_defconfig | 1 + configs/sandbox_spl_defconfig | 1 + configs/sh7752evb_defconfig | 1 + configs/sh7753evb_defconfig | 1 + configs/sh7757lcr_defconfig | 1 + include/configs/dragonboard410c.h | 4 ---- include/configs/sandbox.h | 1 - include/configs/sh7752evb.h | 2 -- include/configs/sh7753evb.h | 2 -- include/configs/sh7757lcr.h | 2 -- scripts/config_whitelist.txt | 3 --- 13 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/configs/dragonboard410c_defconfig b/configs/dragonboard410c_defconfig index 7435818..6b50964 100644 --- a/configs/dragonboard410c_defconfig +++ b/configs/dragonboard410c_defconfig @@ -36,3 +36,4 @@ CONFIG_USB_EHCI_MSM=y CONFIG_USB_ULPI_VIEWPORT=y CONFIG_USB_ULPI=y CONFIG_USB_STORAGE=y +CONFIG_CMD_MD5SUM=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index 01f6f5d..7f3f5ac 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -22,6 +22,7 @@ CONFIG_CMD_BOOTZ=y # CONFIG_CMD_IMLS is not set CONFIG_CMD_ASKENV=y CONFIG_CMD_GREPENV=y +CONFIG_CMD_MD5SUM=y CONFIG_LOOPW=y CONFIG_CMD_MEMTEST=y CONFIG_CMD_MX_CYCLIC=y diff --git a/configs/sandbox_noblk_defconfig b/configs/sandbox_noblk_defconfig index 10e12bf..3f8e70d 100644 --- a/configs/sandbox_noblk_defconfig +++ b/configs/sandbox_noblk_defconfig @@ -22,6 +22,7 @@ CONFIG_CMD_BOOTZ=y # CONFIG_CMD_IMLS is not set CONFIG_CMD_ASKENV=y CONFIG_CMD_GREPENV=y +CONFIG_CMD_MD5SUM=y CONFIG_LOOPW=y CONFIG_CMD_MEMTEST=y CONFIG_CMD_MX_CYCLIC=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index 281e441..ade6714 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -29,6 +29,7 @@ CONFIG_CMD_BOOTZ=y # CONFIG_CMD_IMLS is not set CONFIG_CMD_ASKENV=y CONFIG_CMD_GREPENV=y +CONFIG_CMD_MD5SUM=y CONFIG_LOOPW=y CONFIG_CMD_MEMTEST=y CONFIG_CMD_MX_CYCLIC=y diff --git a/configs/sh7752evb_defconfig b/configs/sh7752evb_defconfig index ace7553..224b55b 100644 --- a/configs/sh7752evb_defconfig +++ b/configs/sh7752evb_defconfig @@ -27,6 +27,7 @@ CONFIG_CMD_EXT2=y CONFIG_MAC_PARTITION=y CONFIG_DOS_PARTITION=y CONFIG_MMC=y +CONFIG_CMD_MD5SUM=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_STMICRO=y diff --git a/configs/sh7753evb_defconfig b/configs/sh7753evb_defconfig index 48e3d55..7bf8862 100644 --- a/configs/sh7753evb_defconfig +++ b/configs/sh7753evb_defconfig @@ -26,6 +26,7 @@ CONFIG_CMD_EXT2=y CONFIG_MAC_PARTITION=y CONFIG_DOS_PARTITION=y CONFIG_MMC=y +CONFIG_CMD_MD5SUM=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_STMICRO=y diff --git a/configs/sh7757lcr_defconfig b/configs/sh7757lcr_defconfig index dc6f4e1..00870ac 100644 --- a/configs/sh7757lcr_defconfig +++ b/configs/sh7757lcr_defconfig @@ -27,6 +27,7 @@ CONFIG_CMD_EXT2=y CONFIG_MAC_PARTITION=y CONFIG_DOS_PARTITION=y CONFIG_MMC=y +CONFIG_CMD_MD5SUM=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_USE_PRIVATE_LIBGCC=y diff --git a/include/configs/dragonboard410c.h b/include/configs/dragonboard410c.h index 7f0742a..238f4cd 100644 --- a/include/configs/dragonboard410c.h +++ b/include/configs/dragonboard410c.h @@ -46,12 +46,8 @@ #define CONFIG_USB_ETHER_MCS7830 #define CONFIG_USB_ETHER_SMSC95XX
-/* Libraries */ -#define CONFIG_MD5 - /* Extra Commands */ #define CONFIG_CMD_ENV -#define CONFIG_CMD_MD5SUM /* Enable that for switching of boot partitions */ /* Disabled by default as some sub-commands can brick eMMC */ /*#define CONFIG_SUPPORT_EMMC_BOOT */ diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index ac7973c..ad687b1 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -44,7 +44,6 @@ #define CONFIG_CMD_CBFS #define CONFIG_CMD_CRAMFS #define CONFIG_HOST_MAX_DEVICES 4 -#define CONFIG_CMD_MD5SUM
/* * Size of malloc() pool, before and after relocation diff --git a/include/configs/sh7752evb.h b/include/configs/sh7752evb.h index d818981..9b12324 100644 --- a/include/configs/sh7752evb.h +++ b/include/configs/sh7752evb.h @@ -16,8 +16,6 @@
#define CONFIG_CMD_DFL #define CONFIG_CMD_SDRAM -#define CONFIG_CMD_MD5SUM -#define CONFIG_MD5
#define CONFIG_BAUDRATE 115200 #define CONFIG_BOOTARGS "console=ttySC2,115200 root=/dev/nfs ip=dhcp" diff --git a/include/configs/sh7753evb.h b/include/configs/sh7753evb.h index a7d8de4..a4818ff 100644 --- a/include/configs/sh7753evb.h +++ b/include/configs/sh7753evb.h @@ -16,8 +16,6 @@
#define CONFIG_CMD_DFL #define CONFIG_CMD_SDRAM -#define CONFIG_CMD_MD5SUM -#define CONFIG_MD5
#define CONFIG_BAUDRATE 115200 #define CONFIG_BOOTARGS "console=ttySC2,115200 root=/dev/nfs ip=dhcp" diff --git a/include/configs/sh7757lcr.h b/include/configs/sh7757lcr.h index c21a5f8..8b33998 100644 --- a/include/configs/sh7757lcr.h +++ b/include/configs/sh7757lcr.h @@ -16,8 +16,6 @@ #define CONFIG_SYS_TEXT_BASE 0x8ef80000
#define CONFIG_CMD_SDRAM -#define CONFIG_CMD_MD5SUM -#define CONFIG_MD5
#define CONFIG_BAUDRATE 115200 #define CONFIG_BOOTARGS "console=ttySC2,115200 root=/dev/nfs ip=dhcp" diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index f38e56c..9192461 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -509,7 +509,6 @@ CONFIG_CMD_LDRINFO CONFIG_CMD_LOADY CONFIG_CMD_LZMADEC CONFIG_CMD_MAX6957 -CONFIG_CMD_MD5SUM CONFIG_CMD_MEM CONFIG_CMD_MFSL CONFIG_CMD_MMC_SPI @@ -1882,8 +1881,6 @@ CONFIG_MCFRTC CONFIG_MCFTMR CONFIG_MCFUART CONFIG_MCLK_DIS -CONFIG_MD5 -CONFIG_MD5SUM_VERIFY CONFIG_MDIO_TIMEOUT CONFIG_MECP5123 CONFIG_MEMSIZE

Hi Andre,
On 14 March 2017 at 19:19, Andre Przywara andre.przywara@arm.com wrote:
Boards with an apparent need for the md5sum command had the connected config symbol defined in their board header file. Move this over to the respective defconfig files now that md5sum is configured via Kconfig. (This is a manual effort, which differs from moveconfig.py, not sure who is right here. Boards except sandbox loose the md5sum command with moveconfig.py, though it was explicitly mentioned in their config.h's)
Signed-off-by: Andre Przywara andre.przywara@arm.com
configs/dragonboard410c_defconfig | 1 + configs/sandbox_defconfig | 1 + configs/sandbox_noblk_defconfig | 1 + configs/sandbox_spl_defconfig | 1 + configs/sh7752evb_defconfig | 1 + configs/sh7753evb_defconfig | 1 + configs/sh7757lcr_defconfig | 1 + include/configs/dragonboard410c.h | 4 ---- include/configs/sandbox.h | 1 - include/configs/sh7752evb.h | 2 -- include/configs/sh7753evb.h | 2 -- include/configs/sh7757lcr.h | 2 -- scripts/config_whitelist.txt | 3 --- 13 files changed, 7 insertions(+), 14 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
That's odd - did you check that these boards actually do end up with it. I've not seen that problem with moveconfig.py before.
Regards, SImon

On Wed, Mar 15, 2017 at 01:19:07AM +0000, Andre Przywara wrote:
Boards with an apparent need for the md5sum command had the connected config symbol defined in their board header file. Move this over to the respective defconfig files now that md5sum is configured via Kconfig. (This is a manual effort, which differs from moveconfig.py, not sure who is right here. Boards except sandbox loose the md5sum command with moveconfig.py, though it was explicitly mentioned in their config.h's)
Signed-off-by: Andre Przywara andre.przywara@arm.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!
participants (4)
-
Andre Przywara
-
Simon Glass
-
Stefan Roese
-
Tom Rini