diff mbox

[U-Boot] blackfin: fix undefined reference to srand and rand

Message ID 1434017803-22823-1-git-send-email-yamada.masahiro@socionext.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Masahiro Yamada June 11, 2015, 10:16 a.m. UTC
Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR.  So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error.  This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX.  Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint.  A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 configs/bf527-ezkit-v2_defconfig | 1 +
 configs/bf533-ezkit_defconfig    | 1 +
 configs/bf533-stamp_defconfig    | 1 +
 configs/bf538f-ezkit_defconfig   | 1 +
 configs/bf548-ezkit_defconfig    | 1 +
 configs/bf561-acvilon_defconfig  | 1 +
 configs/bf561-ezkit_defconfig    | 1 +
 configs/bf609-ezkit_defconfig    | 1 +
 configs/br4_defconfig            | 1 +
 configs/cm-bf533_defconfig       | 1 +
 configs/cm-bf548_defconfig       | 1 +
 configs/cm-bf561_defconfig       | 1 +
 configs/ibf-dsp561_defconfig     | 1 +
 configs/pr1_defconfig            | 1 +
 lib/Kconfig                      | 4 +++-
 15 files changed, 17 insertions(+), 1 deletion(-)

Comments

Joe Hershberger June 11, 2015, 2:25 p.m. UTC | #1
Hi Masahiro-san,

On Thu, Jun 11, 2015 at 5:16 AM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
> accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.
>
> Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
> CONFIG_NET_RANDOM_ETHADDR.  So, commit 9ba9e85f3f1c should not have
> touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
> header files, which caused undefined reference to srand and rand.
> CONFIG_LIB_RAND=y must be revived for such boards.
>
> BTW, this commit indeed makes it better, but even with this fix,
> three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
> build due to region 'ram' overflowed error.  This was cause by
> commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
> because CMD_NET selects NET, and NET selects REGEX.  Eventually,
> some boards were newly enabled with CONFIG_REGEX, increasing the
> memory footprint.  A patch is expected to fix the build error.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---

This is surprising. I would have expected moveconfig.py to take care
of this... but I guess since the LIB_RAND option was not selectable it
only dropped the headers and did not add it to the defconfigs. I guess
there's a lesson to learn there about how to use the tool... making
sure to make the option selectable when running it, and only making it
hidden if nothing selects it. I should have have thought of that when
cleaning up Michal's patch. Apologies.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

Thanks,
-Joe
Masahiro Yamada June 11, 2015, 4:01 p.m. UTC | #2
2015-06-11 23:25 GMT+09:00 Joe Hershberger <joe.hershberger@gmail.com>:
> Hi Masahiro-san,
>
> On Thu, Jun 11, 2015 at 5:16 AM, Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
>> Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
>> accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.
>>
>> Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
>> CONFIG_NET_RANDOM_ETHADDR.  So, commit 9ba9e85f3f1c should not have
>> touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
>> header files, which caused undefined reference to srand and rand.
>> CONFIG_LIB_RAND=y must be revived for such boards.
>>
>> BTW, this commit indeed makes it better, but even with this fix,
>> three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
>> build due to region 'ram' overflowed error.  This was cause by
>> commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
>> because CMD_NET selects NET, and NET selects REGEX.  Eventually,
>> some boards were newly enabled with CONFIG_REGEX, increasing the
>> memory footprint.  A patch is expected to fix the build error.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> ---
>
> This is surprising. I would have expected moveconfig.py to take care
> of this... but I guess since the LIB_RAND option was not selectable it
> only dropped the headers and did not add it to the defconfigs. I guess
> there's a lesson to learn there about how to use the tool... making
> sure to make the option selectable when running it, and only making it
> hidden if nothing selects it. I should have have thought of that when
> cleaning up Michal's patch. Apologies.


Another lesson to learn:
Please do build test before sending/applying a patch.
Tom Rini June 12, 2015, 12:12 p.m. UTC | #3
On Thu, Jun 11, 2015 at 07:16:43PM +0900, Masahiro Yamada wrote:

> Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
> accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.
> 
> Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
> CONFIG_NET_RANDOM_ETHADDR.  So, commit 9ba9e85f3f1c should not have
> touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
> header files, which caused undefined reference to srand and rand.
> CONFIG_LIB_RAND=y must be revived for such boards.
> 
> BTW, this commit indeed makes it better, but even with this fix,
> three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
> build due to region 'ram' overflowed error.  This was cause by
> commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
> because CMD_NET selects NET, and NET selects REGEX.  Eventually,
> some boards were newly enabled with CONFIG_REGEX, increasing the
> memory footprint.  A patch is expected to fix the build error.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/configs/bf527-ezkit-v2_defconfig b/configs/bf527-ezkit-v2_defconfig
index f963502..dd48d6a 100644
--- a/configs/bf527-ezkit-v2_defconfig
+++ b/configs/bf527-ezkit-v2_defconfig
@@ -3,3 +3,4 @@  CONFIG_TARGET_BF527_EZKIT=y
 CONFIG_SYS_EXTRA_OPTIONS="BF527_EZKIT_REV_2_1"
 CONFIG_CMD_NET=y
 CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
+CONFIG_LIB_RAND=y
diff --git a/configs/bf533-ezkit_defconfig b/configs/bf533-ezkit_defconfig
index 66c1145..04210d8 100644
--- a/configs/bf533-ezkit_defconfig
+++ b/configs/bf533-ezkit_defconfig
@@ -2,3 +2,4 @@  CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF533_EZKIT=y
 CONFIG_CMD_NET=y
 CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
+CONFIG_LIB_RAND=y
diff --git a/configs/bf533-stamp_defconfig b/configs/bf533-stamp_defconfig
index ca1202d..191e2d6 100644
--- a/configs/bf533-stamp_defconfig
+++ b/configs/bf533-stamp_defconfig
@@ -2,3 +2,4 @@  CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF533_STAMP=y
 CONFIG_CMD_NET=y
 CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
+CONFIG_LIB_RAND=y
diff --git a/configs/bf538f-ezkit_defconfig b/configs/bf538f-ezkit_defconfig
index 84449ec..f8ae21b 100644
--- a/configs/bf538f-ezkit_defconfig
+++ b/configs/bf538f-ezkit_defconfig
@@ -2,3 +2,4 @@  CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF538F_EZKIT=y
 CONFIG_CMD_NET=y
 CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
+CONFIG_LIB_RAND=y
diff --git a/configs/bf548-ezkit_defconfig b/configs/bf548-ezkit_defconfig
index 46c8fe2..6bd9e9b 100644
--- a/configs/bf548-ezkit_defconfig
+++ b/configs/bf548-ezkit_defconfig
@@ -2,3 +2,4 @@  CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF548_EZKIT=y
 CONFIG_CMD_NET=y
 CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
+CONFIG_LIB_RAND=y
diff --git a/configs/bf561-acvilon_defconfig b/configs/bf561-acvilon_defconfig
index b558066..7a65892 100644
--- a/configs/bf561-acvilon_defconfig
+++ b/configs/bf561-acvilon_defconfig
@@ -2,3 +2,4 @@  CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF561_ACVILON=y
 CONFIG_CMD_NET=y
 CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
+CONFIG_LIB_RAND=y
diff --git a/configs/bf561-ezkit_defconfig b/configs/bf561-ezkit_defconfig
index 0ef1a1c..e8a1ea4 100644
--- a/configs/bf561-ezkit_defconfig
+++ b/configs/bf561-ezkit_defconfig
@@ -2,3 +2,4 @@  CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF561_EZKIT=y
 CONFIG_CMD_NET=y
 CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
+CONFIG_LIB_RAND=y
diff --git a/configs/bf609-ezkit_defconfig b/configs/bf609-ezkit_defconfig
index 72e0606..d8c2629 100644
--- a/configs/bf609-ezkit_defconfig
+++ b/configs/bf609-ezkit_defconfig
@@ -3,3 +3,4 @@  CONFIG_NETDEVICES=y
 CONFIG_TARGET_BF609_EZKIT=y
 CONFIG_CMD_NET=y
 CONFIG_ETH_DESIGNWARE=y
+CONFIG_LIB_RAND=y
diff --git a/configs/br4_defconfig b/configs/br4_defconfig
index e6970a4..7247b9c 100644
--- a/configs/br4_defconfig
+++ b/configs/br4_defconfig
@@ -2,3 +2,4 @@  CONFIG_BLACKFIN=y
 CONFIG_TARGET_BR4=y
 CONFIG_CMD_NET=y
 CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
+CONFIG_LIB_RAND=y
diff --git a/configs/cm-bf533_defconfig b/configs/cm-bf533_defconfig
index 42d568e..89a5c0f 100644
--- a/configs/cm-bf533_defconfig
+++ b/configs/cm-bf533_defconfig
@@ -2,3 +2,4 @@  CONFIG_BLACKFIN=y
 CONFIG_TARGET_CM_BF533=y
 CONFIG_CMD_NET=y
 CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
+CONFIG_LIB_RAND=y
diff --git a/configs/cm-bf548_defconfig b/configs/cm-bf548_defconfig
index 906a9bd..b9b6044 100644
--- a/configs/cm-bf548_defconfig
+++ b/configs/cm-bf548_defconfig
@@ -2,3 +2,4 @@  CONFIG_BLACKFIN=y
 CONFIG_TARGET_CM_BF548=y
 CONFIG_CMD_NET=y
 CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
+CONFIG_LIB_RAND=y
diff --git a/configs/cm-bf561_defconfig b/configs/cm-bf561_defconfig
index 023cc65..a304e57 100644
--- a/configs/cm-bf561_defconfig
+++ b/configs/cm-bf561_defconfig
@@ -2,3 +2,4 @@  CONFIG_BLACKFIN=y
 CONFIG_TARGET_CM_BF561=y
 CONFIG_CMD_NET=y
 CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
+CONFIG_LIB_RAND=y
diff --git a/configs/ibf-dsp561_defconfig b/configs/ibf-dsp561_defconfig
index eb80798..15f24bb 100644
--- a/configs/ibf-dsp561_defconfig
+++ b/configs/ibf-dsp561_defconfig
@@ -1,3 +1,4 @@ 
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_IBF_DSP561=y
 CONFIG_CMD_NET=y
+CONFIG_LIB_RAND=y
diff --git a/configs/pr1_defconfig b/configs/pr1_defconfig
index f85cc77..a8eb7f3 100644
--- a/configs/pr1_defconfig
+++ b/configs/pr1_defconfig
@@ -2,3 +2,4 @@  CONFIG_BLACKFIN=y
 CONFIG_TARGET_PR1=y
 CONFIG_CMD_NET=y
 CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
+CONFIG_LIB_RAND=y
diff --git a/lib/Kconfig b/lib/Kconfig
index 3c8de86..7ec8c98 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -45,7 +45,9 @@  config REGEX
 	  "setexpr".
 
 config LIB_RAND
-	bool
+	bool "Pseudo-random library support "
+	help
+	  This library provides pseudo-random number generator functions.
 
 source lib/rsa/Kconfig