From 9ba9e85f3f1cc2e7d8b387a03c50eb067d915e0a Mon Sep 17 00:00:00 2001
From: Michal Simek <michal.simek@xilinx.com>
Date: Mon, 25 May 2015 11:37:22 +0200
Subject: [PATCH] net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
---
 include/configs/a3m071.h          | 1 -
 include/configs/bct-brettl2.h     | 1 -
 include/configs/bf518f-ezbrd.h    | 1 -
 include/configs/bf526-ezbrd.h     | 1 -
 include/configs/bf527-ezkit.h     | 1 -
 include/configs/bf537-minotaur.h  | 1 -
 include/configs/bf537-pnav.h      | 1 -
 include/configs/bf537-srv1.h      | 1 -
 include/configs/bf537-stamp.h     | 1 -
 include/configs/bfin_adi_common.h | 1 -
 include/configs/cm-bf527.h        | 1 -
 include/configs/cm-bf537e.h       | 1 -
 include/configs/cm-bf537u.h       | 1 -
 include/configs/dnp5370.h         | 1 -
 include/configs/ip04.h            | 1 -
 include/configs/lsxl.h            | 1 -
 include/configs/tcm-bf518.h       | 1 -
 include/configs/tcm-bf537.h       | 1 -
 lib/Kconfig                       | 3 +++
 net/Kconfig                       | 1 +
 20 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/include/configs/a3m071.h b/include/configs/a3m071.h
index d23d2c4cc5d..f8cea62b596 100644
--- a/include/configs/a3m071.h
+++ b/include/configs/a3m071.h
@@ -60,7 +60,6 @@
 #define CONFIG_BOOTP_SERVERIP
 #define CONFIG_NET_RETRY_COUNT 3
 #define CONFIG_CMD_LINK_LOCAL
-#define CONFIG_LIB_RAND
 #define CONFIG_NETCONSOLE
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
 #define CONFIG_CMD_PING
diff --git a/include/configs/bct-brettl2.h b/include/configs/bct-brettl2.h
index 0d9fe57ba95..36637aef95e 100644
--- a/include/configs/bct-brettl2.h
+++ b/include/configs/bct-brettl2.h
@@ -73,7 +73,6 @@
 #define CONFIG_GATEWAYIP	192.168.233.1
 #define CONFIG_SERVERIP		192.168.233.53
 #define CONFIG_ROOTPATH		"/romfs/brettl2"
-#define CONFIG_LIB_RAND
 #endif
 
 
diff --git a/include/configs/bf518f-ezbrd.h b/include/configs/bf518f-ezbrd.h
index dcd19e4db8a..0df463f5b65 100644
--- a/include/configs/bf518f-ezbrd.h
+++ b/include/configs/bf518f-ezbrd.h
@@ -87,7 +87,6 @@
 #endif
 #define CONFIG_HOSTNAME		bf518f-ezbrd
 #define CONFIG_PHY_ADDR		3
-#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
diff --git a/include/configs/bf526-ezbrd.h b/include/configs/bf526-ezbrd.h
index ad5fa531600..83f57cdcf95 100644
--- a/include/configs/bf526-ezbrd.h
+++ b/include/configs/bf526-ezbrd.h
@@ -85,7 +85,6 @@
 #define CONFIG_NETCONSOLE	1
 #endif
 #define CONFIG_HOSTNAME		bf526-ezbrd
-#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
diff --git a/include/configs/bf527-ezkit.h b/include/configs/bf527-ezkit.h
index b23a250e0ae..32ac961b673 100644
--- a/include/configs/bf527-ezkit.h
+++ b/include/configs/bf527-ezkit.h
@@ -83,7 +83,6 @@
 #define CONFIG_NETCONSOLE	1
 #endif
 #define CONFIG_HOSTNAME		bf527-ezkit
-#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
diff --git a/include/configs/bf537-minotaur.h b/include/configs/bf537-minotaur.h
index 9c7c969e2dc..53b7ab51b8e 100644
--- a/include/configs/bf537-minotaur.h
+++ b/include/configs/bf537-minotaur.h
@@ -87,7 +87,6 @@
 #define CONFIG_SYS_AUTOLOAD	"no"
 #define CONFIG_ROOTPATH		"/romfs"
 
-#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
diff --git a/include/configs/bf537-pnav.h b/include/configs/bf537-pnav.h
index be11a85bc00..850c5164dac 100644
--- a/include/configs/bf537-pnav.h
+++ b/include/configs/bf537-pnav.h
@@ -65,7 +65,6 @@
 #define CONFIG_RMII
 #endif
 #define CONFIG_HOSTNAME		bf537-pnav
-#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
diff --git a/include/configs/bf537-srv1.h b/include/configs/bf537-srv1.h
index 8c9e54d12c3..2da5d293028 100644
--- a/include/configs/bf537-srv1.h
+++ b/include/configs/bf537-srv1.h
@@ -86,7 +86,6 @@
 
 #define CONFIG_SYS_AUTOLOAD	"no"
 #define CONFIG_ROOTPATH		"/romfs"
-#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
diff --git a/include/configs/bf537-stamp.h b/include/configs/bf537-stamp.h
index 41f1b1f071c..84ef4ed4c28 100644
--- a/include/configs/bf537-stamp.h
+++ b/include/configs/bf537-stamp.h
@@ -65,7 +65,6 @@
 #define CONFIG_NETCONSOLE	1
 #endif
 #define CONFIG_HOSTNAME		bf537-stamp
-#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
diff --git a/include/configs/bfin_adi_common.h b/include/configs/bfin_adi_common.h
index b475b169fe2..1c9d5845784 100644
--- a/include/configs/bfin_adi_common.h
+++ b/include/configs/bfin_adi_common.h
@@ -17,7 +17,6 @@
 #  define CONFIG_BOOTP_DNS
 #  define CONFIG_BOOTP_NTPSERVER
 #  define CONFIG_BOOTP_RANDOM_DELAY
-#  define CONFIG_LIB_RAND
 #  define CONFIG_KEEP_SERVERADDR
 #  define CONFIG_CMD_DNS
 #  define CONFIG_CMD_PING
diff --git a/include/configs/cm-bf527.h b/include/configs/cm-bf527.h
index 387f1cb7674..e9e4e1414a9 100644
--- a/include/configs/cm-bf527.h
+++ b/include/configs/cm-bf527.h
@@ -83,7 +83,6 @@
 #define CONFIG_NETCONSOLE	1
 #endif
 #define CONFIG_HOSTNAME		cm-bf527
-#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
diff --git a/include/configs/cm-bf537e.h b/include/configs/cm-bf537e.h
index 95afd512171..0eebe565031 100644
--- a/include/configs/cm-bf537e.h
+++ b/include/configs/cm-bf537e.h
@@ -71,7 +71,6 @@
 #define CONFIG_NETCONSOLE	1
 #endif
 #define CONFIG_HOSTNAME		cm-bf537e
-#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
diff --git a/include/configs/cm-bf537u.h b/include/configs/cm-bf537u.h
index 4df4a05c7dd..3a2d72626c7 100644
--- a/include/configs/cm-bf537u.h
+++ b/include/configs/cm-bf537u.h
@@ -69,7 +69,6 @@
 #define CONFIG_NETCONSOLE	1
 #endif
 #define CONFIG_HOSTNAME		cm-bf537u
-#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
diff --git a/include/configs/dnp5370.h b/include/configs/dnp5370.h
index 69a26869ab3..3cbd67f6b02 100644
--- a/include/configs/dnp5370.h
+++ b/include/configs/dnp5370.h
@@ -56,7 +56,6 @@
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_PING
 
-#define CONFIG_LIB_RAND
 #endif
 
 /*
diff --git a/include/configs/ip04.h b/include/configs/ip04.h
index 2bd81fc5cf2..73bbcb6b69c 100644
--- a/include/configs/ip04.h
+++ b/include/configs/ip04.h
@@ -77,7 +77,6 @@
 #define DM9000_IO		CONFIG_DM9000_BASE
 #define DM9000_DATA		(CONFIG_DM9000_BASE + 2)
 
-#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h
index 490f84eb752..7d22173943b 100644
--- a/include/configs/lsxl.h
+++ b/include/configs/lsxl.h
@@ -37,7 +37,6 @@
 #define CONFIG_MISC_INIT_R
 #define CONFIG_SHOW_BOOT_PROGRESS
 
-#define CONFIG_LIB_RAND
 #define CONFIG_KIRKWOOD_GPIO
 #define CONFIG_OF_LIBFDT
 
diff --git a/include/configs/tcm-bf518.h b/include/configs/tcm-bf518.h
index e726b29da56..1e74535b5c9 100644
--- a/include/configs/tcm-bf518.h
+++ b/include/configs/tcm-bf518.h
@@ -66,7 +66,6 @@
 #define CONFIG_NETCONSOLE	1
 #endif
 #define CONFIG_HOSTNAME		tcm-bf518
-#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
diff --git a/include/configs/tcm-bf537.h b/include/configs/tcm-bf537.h
index 33265801a6b..a8947c59349 100644
--- a/include/configs/tcm-bf537.h
+++ b/include/configs/tcm-bf537.h
@@ -71,7 +71,6 @@
 #define CONFIG_NETCONSOLE	1
 #endif
 #define CONFIG_HOSTNAME		tcm-bf537
-#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
diff --git a/lib/Kconfig b/lib/Kconfig
index 5b6cf3d68df..3c8de869b1f 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -44,6 +44,9 @@ config REGEX
 	  regex support to some commands, for example "env grep" and
 	  "setexpr".
 
+config LIB_RAND
+	bool
+
 source lib/rsa/Kconfig
 
 menu "Hashing Support"
diff --git a/net/Kconfig b/net/Kconfig
index 524b7e4da23..9a9846e1874 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -10,6 +10,7 @@ if NET
 
 config NET_RANDOM_ETHADDR
 	bool "Random ethaddr if unset"
+	select LIB_RAND
 	help
 	  Selecting this will allow the Ethernet interface to function
 	  even when the ethaddr variable for that interface is unset.
-- 
GitLab