Skip to contentSkip to conversation

Convert CONFIG LIB_HW_RAND to Kconfig

PATCH In review Adam Ford 3 participants 3 messages Feb 6, 2018 – Feb 8, 2018 Library code

lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH 1/1 Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't already selected. By migrating LIB_HW_RAND to Kconfig, we can remove this check from config_fallbacks.h and put it into Kconfig

---
 configs/ds414_defconfig         | 1 +
 configs/odroid_defconfig        | 2 ++
 configs/trats2_defconfig        | 2 ++
 configs/trats_defconfig         | 2 ++
 include/config_fallbacks.h      | 7 -------
 include/configs/ds414.h         | 1 -
 include/configs/odroid.h        | 1 -
 include/configs/thunderx_88xx.h | 1 -
 include/configs/trats.h         | 1 -
 include/configs/trats2.h        | 1 -
 lib/Kconfig                     | 8 +++++++-
 scripts/config_whitelist.txt    | 1 -
 12 files changed, 14 insertions(+), 14 deletions(-)
configs/ds414_defconfig +1 -0
index eb3fe75..47d0377 100644
@@ -48,3 +48,4 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
+CONFIG_LIB_RAND=y
configs/odroid_defconfig +2 -0
index 30889c0..14e9283 100644
@@ -62,4 +62,6 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_FUNCTION_THOR=y
 CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_ETHER_SMSC95XX=y
+CONFIG_LIB_RAND=y
+CONFIG_LIB_HW_RAND=y
 CONFIG_ERRNO_STR=y
configs/trats2_defconfig +2 -0
index e28cad5..2cc7c9b 100644
@@ -54,3 +54,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x6601
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_FUNCTION_THOR=y
+CONFIG_LIB_RAND=y
+CONFIG_LIB_HW_RAND=y
configs/trats_defconfig +2 -0
index 6ae39c1..f26e8ef 100644
@@ -53,3 +53,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x6601
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_FUNCTION_THOR=y
+CONFIG_LIB_RAND=y
+CONFIG_LIB_HW_RAND=y
include/config_fallbacks.h +0 -7
index 9695ee7..c11abe6 100644
@@ -54,13 +54,6 @@
 #define CONFIG_LIB_UUID
 #endif
 
-#if (defined(CONFIG_RANDOM_UUID) || \
-	defined(CONFIG_CMD_UUID)) && \
-	(!defined(CONFIG_LIB_RAND) && \
-	!defined(CONFIG_LIB_HW_RAND))
-#define CONFIG_LIB_RAND
-#endif
-
 /* Console I/O Buffer Size */
 #ifndef CONFIG_SYS_CBSIZE
 #if defined(CONFIG_CMD_KGDB)
include/configs/ds414.h +0 -1
index c840c93..b795189 100644
@@ -113,7 +113,6 @@
 #define CONFIG_DDR_32BIT
 
 /* Use random ethernet address if not configured */
-#define CONFIG_LIB_RAND
 #define CONFIG_NET_RANDOM_ETHADDR
 
 /* Default Environment */
include/configs/odroid.h +0 -1
index 60ed013..697e798 100644
@@ -177,7 +177,6 @@
 
 /* Security subsystem - enable hw_rand() */
 #define CONFIG_EXYNOS_ACE_SHA
-#define CONFIG_LIB_HW_RAND
 
 /* USB */
 #define CONFIG_USB_EHCI_EXYNOS
include/configs/thunderx_88xx.h +0 -1
index 34940ef..1f0b9d4 100644
@@ -77,7 +77,6 @@
 #define CONFIG_CMDLINE_EDITING		1
 #define CONFIG_SYS_MAXARGS		64		/* max command args */
 #define CONFIG_NO_RELOCATION		1
-#define CONFIG_LIB_RAND
 #define PLL_REF_CLK			50000000	/* 50 MHz */
 #define NS_PER_REF_CLK_TICK		(1000000000/PLL_REF_CLK)
 
include/configs/trats.h +0 -1
index b97efc2..465eed0 100644
@@ -171,7 +171,6 @@
 
 /* Security subsystem - enable hw_rand() */
 #define CONFIG_EXYNOS_ACE_SHA
-#define CONFIG_LIB_HW_RAND
 
 /* Common misc for Samsung */
 #define CONFIG_MISC_COMMON
include/configs/trats2.h +0 -1
index 871accf..b9bf918 100644
@@ -153,7 +153,6 @@
 
 /* Security subsystem - enable hw_rand() */
 #define CONFIG_EXYNOS_ACE_SHA
-#define CONFIG_LIB_HW_RAND
 
 /* Common misc for Samsung */
 #define CONFIG_MISC_COMMON
lib/Kconfig +7 -1
index 710deb7..8b8d5b8 100644
@@ -66,10 +66,16 @@ config REGEX
 	  "setexpr".
 
 config LIB_RAND
-	bool "Pseudo-random library support "
+	bool "Pseudo-random library support"
+	default y if (RANDOM_UUID || CMD_UUID) && !LIB_HW_RAND
 	help
 	  This library provides pseudo-random number generator functions.
 
+config LIB_HW_RAND
+	bool "HW Engine for random libray support"
+	help
+	  Select this if hardware engine is available for random library support
+
 config SPL_TINY_MEMSET
 	bool "Use a very small memset() in SPL"
 	help
scripts/config_whitelist.txt +0 -1
index 33ef985..4cde67c 100644
@@ -1217,7 +1217,6 @@ CONFIG_LEGACY_BOOTCMD_ENV
 CONFIG_LG4573
 CONFIG_LG4573_BUS
 CONFIG_LG4573_CS
-CONFIG_LIB_HW_RAND
 CONFIG_LIB_UUID
 CONFIG_LINUX
 CONFIG_LINUX_RESET_VEC
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 Convert CONFIG LIB_HW_RAND to Kconfig

Quoted 166 lines · On Tue, 6 Feb 2018 10:18:18 -0600 Adam Ford <[email protected]> wrote:

config_fallbacks.h had some logic to automatically select LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't already selected. By migrating LIB_HW_RAND to Kconfig, we can remove this check from config_fallbacks.h and put it into Kconfig

---
 configs/ds414_defconfig         | 1 +
 configs/odroid_defconfig        | 2 ++
 configs/trats2_defconfig        | 2 ++
 configs/trats_defconfig         | 2 ++
 include/config_fallbacks.h      | 7 -------
 include/configs/ds414.h         | 1 -
 include/configs/odroid.h        | 1 -
 include/configs/thunderx_88xx.h | 1 -
 include/configs/trats.h         | 1 -
 include/configs/trats2.h        | 1 -
 lib/Kconfig                     | 8 +++++++-
 scripts/config_whitelist.txt    | 1 -
 12 files changed, 14 insertions(+), 14 deletions(-)
configs/ds414_defconfig +1 -0
index eb3fe75..47d0377 100644
@@ -48,3 +48,4 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
+CONFIG_LIB_RAND=y
configs/odroid_defconfig +2 -0
index 30889c0..14e9283 100644
@@ -62,4 +62,6 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_FUNCTION_THOR=y
 CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_ETHER_SMSC95XX=y
+CONFIG_LIB_RAND=y
+CONFIG_LIB_HW_RAND=y
 CONFIG_ERRNO_STR=y
configs/trats2_defconfig +2 -0
index e28cad5..2cc7c9b 100644
@@ -54,3 +54,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x6601
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_FUNCTION_THOR=y
+CONFIG_LIB_RAND=y
+CONFIG_LIB_HW_RAND=y
configs/trats_defconfig +2 -0
index 6ae39c1..f26e8ef 100644
@@ -53,3 +53,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x6601
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_FUNCTION_THOR=y
+CONFIG_LIB_RAND=y
+CONFIG_LIB_HW_RAND=y
include/config_fallbacks.h +0 -7
index 9695ee7..c11abe6 100644
@@ -54,13 +54,6 @@
 #define CONFIG_LIB_UUID
 #endif
 
-#if (defined(CONFIG_RANDOM_UUID) || \
-	defined(CONFIG_CMD_UUID)) && \
-	(!defined(CONFIG_LIB_RAND) && \
-	!defined(CONFIG_LIB_HW_RAND))
-#define CONFIG_LIB_RAND
-#endif
-
 /* Console I/O Buffer Size */
 #ifndef CONFIG_SYS_CBSIZE
 #if defined(CONFIG_CMD_KGDB)
include/configs/ds414.h +0 -1
index c840c93..b795189 100644
@@ -113,7 +113,6 @@
 #define CONFIG_DDR_32BIT
 
 /* Use random ethernet address if not configured */
-#define CONFIG_LIB_RAND
 #define CONFIG_NET_RANDOM_ETHADDR
 
 /* Default Environment */
include/configs/odroid.h +0 -1
index 60ed013..697e798 100644
@@ -177,7 +177,6 @@
 
 /* Security subsystem - enable hw_rand() */
 #define CONFIG_EXYNOS_ACE_SHA
-#define CONFIG_LIB_HW_RAND
 
 /* USB */
 #define CONFIG_USB_EHCI_EXYNOS
(quoted diff) +0 -0

b/include/configs/thunderx_88xx.h index 34940ef..1f0b9d4 100644

include/configs/thunderx_88xx.h +0 -0
@@ -77,7 +77,6 @@
 #define CONFIG_CMDLINE_EDITING		1
 #define CONFIG_SYS_MAXARGS		64		/* max

command args */ #define CONFIG_NO_RELOCATION 1
-#define CONFIG_LIB_RAND
#define PLL_REF_CLK 50000000 /* 50 MHz
*/ #define NS_PER_REF_CLK_TICK (1000000000/PLL_REF_CLK)

include/configs/trats.h +0 -1
index b97efc2..465eed0 100644
@@ -171,7 +171,6 @@
 
 /* Security subsystem - enable hw_rand() */
 #define CONFIG_EXYNOS_ACE_SHA
-#define CONFIG_LIB_HW_RAND
 
 /* Common misc for Samsung */
 #define CONFIG_MISC_COMMON
include/configs/trats2.h +0 -1
index 871accf..b9bf918 100644
@@ -153,7 +153,6 @@
 
 /* Security subsystem - enable hw_rand() */
 #define CONFIG_EXYNOS_ACE_SHA
-#define CONFIG_LIB_HW_RAND
 
 /* Common misc for Samsung */
 #define CONFIG_MISC_COMMON
lib/Kconfig +2 -1
index 710deb7..8b8d5b8 100644
@@ -66,10 +66,16 @@ config REGEX
 	  "setexpr".
 
 config LIB_RAND
-	bool "Pseudo-random library support "
+	bool "Pseudo-random library support"
+	default y if (RANDOM_UUID || CMD_UUID) && !LIB_HW_RAND
 	help
 	  This library provides pseudo-random number generator

functions.

lib/Kconfig +4 -0
+config LIB_HW_RAND
+	bool "HW Engine for random libray support"
+	help
+	  Select this if hardware engine is available for random

library support +
config SPL_TINY_MEMSET

lib/Kconfig +0 -0
 	bool "Use a very small memset() in SPL"
 	help
(quoted diff) +0 -0

b/scripts/config_whitelist.txt index 33ef985..4cde67c 100644

scripts/config_whitelist.txt CONFIG_LEGACY_BOOTCMD_ENV · line 1222

Quoted 7 lines
scripts/config_whitelist.txt +0 -1
@@ -1217,7 +1217,6 @@ CONFIG_LEGACY_BOOTCMD_ENV
 CONFIG_LG4573
 CONFIG_LG4573_BUS
 CONFIG_LG4573_CS
-CONFIG_LIB_HW_RAND
 CONFIG_LIB_UUID
 CONFIG_LINUX
 CONFIG_LINUX_RESET_VEC

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180206/c5db0cc0/attachment.sig>