Skip to contentSkip to conversation

Do not use __DATE__ and __TIME__ anymore

PATCH Superseded Masahiro Yamada 4 participants 14 messages Apr 17, 2014 – Apr 18, 2014

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Do not use __DATE__ and __TIME__ anymore

The aim of this series is to prohibit using __DATE__ and __TIME__.

Currently they are used in two files.

[1] arch/blackfin/include/asm/net.h

Blackfin is using __DATE__ as the seed for the random ethernet address.

This feature will be replaced with genericly-used eth_random_addr().

[2] fs/ubifs/super.c

__DATE__ and __TIME__ are used in dbg_msg(), so simply droppred.

Masahiro Yamada (5):
rand: do not surround function declarations by #ifdef
net: rename and refactor eth_rand_ethaddr() function
blackfin: replace bfin_gen_rand_mac() with eth_random_addr()
fs: ubifs: drop __DATE__ and __TIME__
kbuild: build with -Werror=date-time if the compiler supports it

 Makefile                              |  3 +++
 arch/blackfin/include/asm/net.h       | 28 ---------------------------
 board/bct-brettl2/bct-brettl2.c       |  3 +--
 board/bf518f-ezbrd/bf518f-ezbrd.c     |  3 +--
 board/bf526-ezbrd/bf526-ezbrd.c       |  3 +--
 board/bf527-ezkit/bf527-ezkit.c       |  3 +--
 board/bf537-minotaur/bf537-minotaur.c |  3 +--
 board/bf537-pnav/bf537-pnav.c         |  3 +--
 board/bf537-srv1/bf537-srv1.c         |  3 +--
 board/bf537-stamp/bf537-stamp.c       |  3 +--
 board/buffalo/lsxl/lsxl.c             |  2 +-
 board/cm-bf527/cm-bf527.c             |  3 +--
 board/cm-bf537e/cm-bf537e.c           |  3 +--
 board/cm-bf537u/cm-bf537u.c           |  3 +--
 board/dnp5370/dnp5370.c               |  3 +--
 board/ip04/ip04.c                     |  3 +--
 board/tcm-bf518/tcm-bf518.c           |  3 +--
 board/tcm-bf537/tcm-bf537.c           |  3 +--
 drivers/net/dm9000x.c                 |  2 +-
 drivers/net/ftmac110.c                |  2 +-
 fs/ubifs/super.c                      |  1 -
 include/common.h                      |  2 --
 include/configs/bct-brettl2.h         |  1 +
 include/configs/bf518f-ezbrd.h        |  2 +-
 include/configs/bf526-ezbrd.h         |  2 +-
 include/configs/bf527-ezkit.h         |  2 +-
 include/configs/bf537-minotaur.h      |  1 +
 include/configs/bf537-pnav.h          |  2 +-
 include/configs/bf537-srv1.h          |  2 +-
 include/configs/bf537-stamp.h         |  2 +-
 include/configs/cm-bf527.h            |  2 +-
 include/configs/cm-bf537e.h           |  2 +-
 include/configs/cm-bf537u.h           |  2 +-
 include/configs/dnp5370.h             |  2 ++
 include/configs/ip04.h                |  1 +
 include/configs/tcm-bf518.h           |  2 +-
 include/configs/tcm-bf537.h           |  2 +-
 include/net.h                         | 36 ++++++++++++++++++-----------------
 net/eth.c                             | 22 ---------------------
 39 files changed, 56 insertions(+), 114 deletions(-)
 delete mode 100644 arch/blackfin/include/asm/net.h
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/5 rand: do not surround function declarations by #ifdef

---

 include/common.h | 2 --
 1 file changed, 2 deletions(-)
include/common.h +0 -2
index cbd3c9e..49feac2 100644
@@ -834,12 +834,10 @@ char *	strmhz(char *buf, unsigned long hz);
 #include <u-boot/crc.h>
 
 /* lib/rand.c */
-#if defined(CONFIG_LIB_RAND) || defined(CONFIG_LIB_HW_RAND)
 #define RAND_MAX -1U
 void srand(unsigned int seed);
 unsigned int rand(void);
 unsigned int rand_r(unsigned int *seedp);
-#endif
 
 /* common/console.c */
 int	console_init_f(void);	/* Before relocation; uses the serial  stuff	*/
Signature · 1 line
1.8.3.2
#2 lore raw

PATCH 2/5 net: rename and refactor eth_rand_ethaddr() function

In reply to Masahiro Yamada

Some functions in include/net.h are ported from
include/linux/etherdevice.h of Linux Kernel.

For ex.
is_zero_ether_addr()
is_multicast_ether_addr()
is_broadcast_ether_addr()
is_valid_ether_addr();

So, we should use the same function name as Linux Kernel, eth_rand_addr(), for consistency.

Because eth_rand_addr() is impilemented as inline function, it should not be surrounded by ifdef CONFIG_RANDOM_MACADDR.

---

 board/buffalo/lsxl/lsxl.c |  2 +-
 drivers/net/dm9000x.c     |  2 +-
 drivers/net/ftmac110.c    |  2 +-
 include/net.h             | 36 +++++++++++++++++++-----------------
 net/eth.c                 | 22 ----------------------
 5 files changed, 22 insertions(+), 42 deletions(-)
board/buffalo/lsxl/lsxl.c +1 -1
index eca1683..659a124 100644
@@ -231,7 +231,7 @@ static void rescue_mode(void)
 	printf("Entering rescue mode..\n");
 #ifdef CONFIG_RANDOM_MACADDR
 	if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
-		eth_random_enetaddr(enetaddr);
+		eth_random_addr(enetaddr);
 		if (eth_setenv_enetaddr("ethaddr", enetaddr)) {
 			printf("Failed to set ethernet address\n");
 				set_led(LED_ALARM_BLINKING);
drivers/net/dm9000x.c +1 -1
index b68d808..4de9d41 100644
@@ -345,7 +345,7 @@ static int dm9000_init(struct eth_device *dev, bd_t *bd)
 	if (!is_valid_ether_addr(dev->enetaddr)) {
 #ifdef CONFIG_RANDOM_MACADDR
 		printf("Bad MAC address (uninitialized EEPROM?), randomizing\n");
-		eth_random_enetaddr(dev->enetaddr);
+		eth_random_addr(dev->enetaddr);
 		printf("MAC: %pM\n", dev->enetaddr);
 #else
 		printf("WARNING: Bad MAC address (uninitialized EEPROM?)\n");
drivers/net/ftmac110.c +1 -1
index 8eee272..98c4f09 100644
@@ -425,7 +425,7 @@ int ftmac110_initialize(bd_t *bis)
 	dev->recv = ftmac110_recv;
 
 	if (!eth_getenv_enetaddr_by_index("eth", card_nr, dev->enetaddr))
-		eth_random_enetaddr(dev->enetaddr);
+		eth_random_addr(dev->enetaddr);
 
 	/* allocate tx descriptors (it must be 16 bytes aligned) */
 	chip->txd = dma_alloc_coherent(
include/net.h +19 -17
index 0802fad..735b0b9 100644
@@ -130,23 +130,6 @@ extern int eth_setenv_enetaddr(char *name, const uchar *enetaddr);
 extern int eth_getenv_enetaddr_by_index(const char *base_name, int index,
 					uchar *enetaddr);
 
-#ifdef CONFIG_RANDOM_MACADDR
-/*
- * The u-boot policy does not allow hardcoded ethernet addresses. Under the
- * following circumstances a random generated address is allowed:
- *  - in emergency cases, where you need a working network connection to set
- *    the ethernet address.
- *    Eg. you want a rescue boot and don't have a serial port to access the
- *    CLI to set environment variables.
- *
- * In these cases, we generate a random locally administered ethernet address.
- *
- * Args:
- *  enetaddr - returns 6 byte hardware address
- */
-extern void eth_random_enetaddr(uchar *enetaddr);
-#endif
-
 extern int usb_eth_initialize(bd_t *bi);
 extern int eth_init(bd_t *bis);			/* Initialize the device */
 extern int eth_send(void *packet, int length);	   /* Send a packet */
@@ -674,6 +657,25 @@ static inline int is_valid_ether_addr(const u8 *addr)
 	return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr);
 }
 
+/**
+ * eth_random_addr - Generate software assigned random Ethernet address
+ * @addr: Pointer to a six-byte array containing the Ethernet address
+ *
+ * Generate a random Ethernet address (MAC) that is not multicast
+ * and has the local assigned bit set.
+ */
+static inline void eth_random_addr(uchar *addr)
+{
+	int i;
+	unsigned int seed = get_timer(0);
+
+	for (i = 0; i < 6; i++)
+		addr[i] = rand_r(&seed);
+
+	addr[0] &= 0xfe;	/* clear multicast bit */
+	addr[0] |= 0x02;	/* set local assignment bit (IEEE802) */
+}
+
 /* Convert an IP address to a string */
 extern void ip_to_string(IPaddr_t x, char *s);
 
net/eth.c +0 -22
index 32bd10c..99386e3 100644
@@ -63,28 +63,6 @@ static int eth_mac_skip(int index)
 	return ((skip_state = getenv(enetvar)) != NULL);
 }
 
-#ifdef CONFIG_RANDOM_MACADDR
-void eth_random_enetaddr(uchar *enetaddr)
-{
-	uint32_t rval;
-
-	srand(get_timer(0));
-
-	rval = rand();
-	enetaddr[0] = rval & 0xff;
-	enetaddr[1] = (rval >> 8) & 0xff;
-	enetaddr[2] = (rval >> 16) & 0xff;
-
-	rval = rand();
-	enetaddr[3] = rval & 0xff;
-	enetaddr[4] = (rval >> 8) & 0xff;
-	enetaddr[5] = (rval >> 16) & 0xff;
-
-	/* make sure it's local and unicast */
-	enetaddr[0] = (enetaddr[0] | 0x02) & ~0x01;
-}
-#endif
-
 /*
  * CPU and board-specific Ethernet initializations.  Aliased function
  * signals caller to move on
Signature · 1 line
1.8.3.2
#3 lore raw

PATCH 2/5 net: rename and refactor eth_rand_ethaddr() function

Quoted 10 lines · Masahiro Yamada

Some functions in include/net.h are ported from
include/linux/etherdevice.h of Linux Kernel.

For ex.
is_zero_ether_addr()
is_multicast_ether_addr()
is_broadcast_ether_addr()
is_valid_ether_addr();

Quoted 7 lines

So, we should use the same function name as Linux Kernel, eth_rand_addr(), for consistency.

Because eth_rand_addr() is impilemented as inline function, it should not be surrounded by ifdef CONFIG_RANDOM_MACADDR.

#4 lore raw

PATCH 2/5 net: rename and refactor eth_rand_ethaddr() function

In reply to Masahiro Yamada

Dear Masahiro,

Quoted 9 lines · In message <[email protected]> you…

Some functions in include/net.h are ported from
include/linux/etherdevice.h of Linux Kernel.

For ex.
is_zero_ether_addr()
is_multicast_ether_addr()
is_broadcast_ether_addr()
is_valid_ether_addr();

Quoted 5 lines

So, we should use the same function name as Linux Kernel, eth_rand_addr(), for consistency.

Because eth_rand_addr() is impilemented as inline function, it should not be surrounded by ifdef CONFIG_RANDOM_MACADDR.

None of this is mentioned in the description of this patch series in your cover letter.

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
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 It is common sense to take a method and try it. If it fails, admit it frankly and try another. But above all, try something.
- Franklin D. Roosevelt

#5 lore raw

PATCH 3/5 blackfin: replace bfin_gen_rand_mac() with eth_random_addr()

In reply to Masahiro Yamada

bfin_gen_rand_mac() uses __DATE__ as the seed for random ethernet address. This is not good.

In the first place, it should not be implemented as a Bfin-specific function. Use eth_random_addr() instead.

---

 arch/blackfin/include/asm/net.h       | 28 ----------------------------
 board/bct-brettl2/bct-brettl2.c       |  3 +--
 board/bf518f-ezbrd/bf518f-ezbrd.c     |  3 +--
 board/bf526-ezbrd/bf526-ezbrd.c       |  3 +--
 board/bf527-ezkit/bf527-ezkit.c       |  3 +--
 board/bf537-minotaur/bf537-minotaur.c |  3 +--
 board/bf537-pnav/bf537-pnav.c         |  3 +--
 board/bf537-srv1/bf537-srv1.c         |  3 +--
 board/bf537-stamp/bf537-stamp.c       |  3 +--
 board/cm-bf527/cm-bf527.c             |  3 +--
 board/cm-bf537e/cm-bf537e.c           |  3 +--
 board/cm-bf537u/cm-bf537u.c           |  3 +--
 board/dnp5370/dnp5370.c               |  3 +--
 board/ip04/ip04.c                     |  3 +--
 board/tcm-bf518/tcm-bf518.c           |  3 +--
 board/tcm-bf537/tcm-bf537.c           |  3 +--
 include/configs/bct-brettl2.h         |  1 +
 include/configs/bf518f-ezbrd.h        |  2 +-
 include/configs/bf526-ezbrd.h         |  2 +-
 include/configs/bf527-ezkit.h         |  2 +-
 include/configs/bf537-minotaur.h      |  1 +
 include/configs/bf537-pnav.h          |  2 +-
 include/configs/bf537-srv1.h          |  2 +-
 include/configs/bf537-stamp.h         |  2 +-
 include/configs/cm-bf527.h            |  2 +-
 include/configs/cm-bf537e.h           |  2 +-
 include/configs/cm-bf537u.h           |  2 +-
 include/configs/dnp5370.h             |  2 ++
 include/configs/ip04.h                |  1 +
 include/configs/tcm-bf518.h           |  2 +-
 include/configs/tcm-bf537.h           |  2 +-
 31 files changed, 31 insertions(+), 69 deletions(-)
 delete mode 100644 arch/blackfin/include/asm/net.h
arch/blackfin/include/asm/net.h deleted +0 -28
deleted file mode 100644
index 97cb466..0000000
@@ -1,28 +0,0 @@
-/*
- * net.h - misc Blackfin network helpers
- *
- * Copyright (c) 2008-2009 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later.
- */
-
-#ifndef __ASM_BFIN_RAND_MAC__
-#define __ASM_BFIN_RAND_MAC__
-
-/* If the board does not have a real MAC assigned to it, then generate a
- * locally administrated pseudo-random one based on CYCLES and compile date.
- */
-static inline void bfin_gen_rand_mac(uchar *mac_addr)
-{
-	/* make something up */
-	const char s[] = __DATE__;
-	size_t i;
-	u32 cycles;
-	for (i = 0; i < 6; ++i) {
-		asm("%0 = CYCLES;" : "=r" (cycles));
-		mac_addr[i] = cycles ^ s[i];
-	}
-	mac_addr[0] = (mac_addr[0] | 0x02) & ~0x01; /* make it local unicast */
-}
-
-#endif
board/bct-brettl2/bct-brettl2.c +1 -2
index de5b9ff..6be9b18 100644
@@ -12,7 +12,6 @@
 #include <asm/blackfin.h>
 #include <asm/portmux.h>
 #include <asm/gpio.h>
-#include <asm/net.h>
 #include <net.h>
 #include <netdev.h>
 #include <miiphy.h>
@@ -33,7 +32,7 @@ int checkboard(void)
 static void board_init_enetaddr(uchar *mac_addr)
 {
 	puts("Warning: Generating 'random' MAC address\n");
-	bfin_gen_rand_mac(mac_addr);
+	eth_random_addr(mac_addr);
 	eth_setenv_enetaddr("ethaddr", mac_addr);
 }
 
board/bf518f-ezbrd/bf518f-ezbrd.c +1 -2
index 09a2353..3a94a57 100644
@@ -13,7 +13,6 @@
 #include <netdev.h>
 #include <spi.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 #include <asm/portmux.h>
 #include <asm/mach-common/bits/otp.h>
 #include <asm/sdh.h>
@@ -48,7 +47,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		bfin_gen_rand_mac(mac_addr);
+		eth_random_addr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
board/bf526-ezbrd/bf526-ezbrd.c +1 -2
index 4695b11..368d6be 100644
@@ -12,7 +12,6 @@
 #include <net.h>
 #include <netdev.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 #include <asm/mach-common/bits/otp.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -45,7 +44,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		bfin_gen_rand_mac(mac_addr);
+		eth_random_addr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
board/bf527-ezkit/bf527-ezkit.c +1 -2
index 211cf24..88e1869 100644
@@ -13,7 +13,6 @@
 #include <netdev.h>
 #include <asm/blackfin.h>
 #include <asm/gpio.h>
-#include <asm/net.h>
 #include <asm/mach-common/bits/otp.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -47,7 +46,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		bfin_gen_rand_mac(mac_addr);
+		eth_random_addr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
board/bf537-minotaur/bf537-minotaur.c +1 -2
index 920429c..ca61ef9 100644
@@ -12,7 +12,6 @@
 #include <netdev.h>
 #include <net.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -27,7 +26,7 @@ int checkboard(void)
 static void board_init_enetaddr(uchar *mac_addr)
 {
 	puts("Warning: Generating 'random' MAC address\n");
-	bfin_gen_rand_mac(mac_addr);
+	eth_random_addr(mac_addr);
 	eth_setenv_enetaddr("ethaddr", mac_addr);
 }
 
board/bf537-pnav/bf537-pnav.c +1 -2
index c512528..df00110 100644
@@ -12,7 +12,6 @@
 #include <netdev.h>
 #include <net.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -27,7 +26,7 @@ int checkboard(void)
 static void board_init_enetaddr(uchar *mac_addr)
 {
 	puts("Warning: Generating 'random' MAC address\n");
-	bfin_gen_rand_mac(mac_addr);
+	eth_random_addr(mac_addr);
 	eth_setenv_enetaddr("ethaddr", mac_addr);
 }
 
board/bf537-srv1/bf537-srv1.c +1 -2
index 04d3891..725296a 100644
@@ -12,7 +12,6 @@
 #include <netdev.h>
 #include <net.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -27,7 +26,7 @@ int checkboard(void)
 static void board_init_enetaddr(uchar *mac_addr)
 {
 	puts("Warning: Generating 'random' MAC address\n");
-	bfin_gen_rand_mac(mac_addr);
+	eth_random_addr(mac_addr);
 	eth_setenv_enetaddr("ethaddr", mac_addr);
 }
 
board/bf537-stamp/bf537-stamp.c +1 -2
index 5fdf837..32045a9 100644
@@ -13,7 +13,6 @@
 #include <config.h>
 #include <command.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 #include <net.h>
 #include <asm/mach-common/bits/bootrom.h>
 #include <netdev.h>
@@ -48,7 +47,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		bfin_gen_rand_mac(mac_addr);
+		eth_random_addr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
board/cm-bf527/cm-bf527.c +1 -2
index a5f70a4..1533eb9 100644
@@ -11,7 +11,6 @@
 #include <net.h>
 #include <netdev.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 #include <asm/mach-common/bits/otp.h>
 #include "../cm-bf537e/gpio_cfi_flash.h"
 
@@ -46,7 +45,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		bfin_gen_rand_mac(mac_addr);
+		eth_random_addr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
board/cm-bf537e/cm-bf537e.c +1 -2
index 8daf3ad..e79f90f 100644
@@ -12,7 +12,6 @@
 #include <net.h>
 #include <netdev.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 #include "gpio_cfi_flash.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -32,7 +31,7 @@ static void board_init_enetaddr(char *var)
 		return;
 
 	printf("Warning: %s: generating 'random' MAC address\n", var);
-	bfin_gen_rand_mac(enetaddr);
+	eth_random_addr(enetaddr);
 	eth_setenv_enetaddr(var, enetaddr);
 }
 
board/cm-bf537u/cm-bf537u.c +1 -2
index 5941b5f..632cbda 100644
@@ -12,7 +12,6 @@
 #include <net.h>
 #include <netdev.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 #include "../cm-bf537e/gpio_cfi_flash.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -32,7 +31,7 @@ static void board_init_enetaddr(char *var)
 		return;
 
 	printf("Warning: %s: generating 'random' MAC address\n", var);
-	bfin_gen_rand_mac(enetaddr);
+	eth_random_addr(enetaddr);
 	eth_setenv_enetaddr(var, enetaddr);
 }
 
board/dnp5370/dnp5370.c +1 -2
index 4b3873b..df721c9 100644
@@ -14,7 +14,6 @@
 #include <common.h>
 #include <config.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 #include <net.h>
 #include <netdev.h>
 #include <asm/gpio.h>
@@ -55,7 +54,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		bfin_gen_rand_mac(mac_addr);
+		eth_random_addr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
board/ip04/ip04.c +1 -2
index c8ae512..ae52633 100644
@@ -13,7 +13,6 @@
 #include <common.h>
 #include <net.h>
 #include <netdev.h>
-#include <asm/net.h>
 
 int checkboard(void)
 {
@@ -33,7 +32,7 @@ int misc_init_r(void)
 	uchar enetaddr[6];
 	if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
 		puts("Warning: Generating 'random' MAC address\n");
-		bfin_gen_rand_mac(enetaddr);
+		eth_random_addr(enetaddr);
 		eth_setenv_enetaddr("ethaddr", enetaddr);
 	}
 
board/tcm-bf518/tcm-bf518.c +1 -2
index 5964059..5d25fcd 100644
@@ -11,7 +11,6 @@
 #include <net.h>
 #include <netdev.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 #include <asm/mach-common/bits/otp.h>
 #include <asm/sdh.h>
 
@@ -47,7 +46,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		bfin_gen_rand_mac(mac_addr);
+		eth_random_addr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
board/tcm-bf537/tcm-bf537.c +1 -2
index 38aaae6..a4f0f71 100644
@@ -12,7 +12,6 @@
 #include <net.h>
 #include <netdev.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 #include "../cm-bf537e/gpio_cfi_flash.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -32,7 +31,7 @@ static void board_init_enetaddr(char *var)
 		return;
 
 	printf("Warning: %s: generating 'random' MAC address\n", var);
-	bfin_gen_rand_mac(enetaddr);
+	eth_random_addr(enetaddr);
 	eth_setenv_enetaddr(var, enetaddr);
 }
 
include/configs/bct-brettl2.h +1 -0
index 06f095c..c1eda96 100644
@@ -75,6 +75,7 @@
 #define CONFIG_ROOTPATH		"/romfs/brettl2"
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR	02:80:ad:20:31:e8 */
+#define CONFIG_LIB_RAND
 #endif
 
 
include/configs/bf518f-ezbrd.h +1 -1
index 9eb85eb..9e374c4 100644
@@ -89,7 +89,7 @@
 #define CONFIG_PHY_ADDR		3
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR	02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
include/configs/bf526-ezbrd.h +1 -1
index 3065d22..972eca9 100644
@@ -87,7 +87,7 @@
 #define CONFIG_HOSTNAME		bf526-ezbrd
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR	02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
include/configs/bf527-ezkit.h +1 -1
index 748ddb3..92c183e 100644
@@ -85,7 +85,7 @@
 #define CONFIG_HOSTNAME		bf527-ezkit
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR	02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
include/configs/bf537-minotaur.h +1 -0
index 156eeab..3bc364c 100644
@@ -89,6 +89,7 @@
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR	02:80:ad:20:31:42 */
 
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
include/configs/bf537-pnav.h +1 -1
index 3aa3d50..ba74a69 100644
@@ -67,7 +67,7 @@
 #define CONFIG_HOSTNAME		bf537-pnav
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR	02:80:ad:24:21:18 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
include/configs/bf537-srv1.h +1 -1
index e12d761..0b723cf 100644
@@ -88,7 +88,7 @@
 #define CONFIG_ROOTPATH		"/romfs"
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR	02:80:ad:20:31:42 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
include/configs/bf537-stamp.h +1 -1
index e1705ca..a302f83 100644
@@ -67,7 +67,7 @@
 #define CONFIG_HOSTNAME		bf537-stamp
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR	02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
include/configs/cm-bf527.h +1 -1
index 384d871..8d3ae49 100644
@@ -85,7 +85,7 @@
 #define CONFIG_HOSTNAME		cm-bf527
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR	02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
include/configs/cm-bf537e.h +1 -1
index 67cf801..47967d7 100644
@@ -73,7 +73,7 @@
 #define CONFIG_HOSTNAME		cm-bf537e
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR	02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
include/configs/cm-bf537u.h +1 -1
index 34ce75b..88c9982 100644
@@ -71,7 +71,7 @@
 #define CONFIG_HOSTNAME		cm-bf537u
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR	02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
include/configs/dnp5370.h +2 -0
index 4f2c742..3f1f9f3 100644
@@ -55,6 +55,8 @@
 
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_PING
+
+#define CONFIG_LIB_RAND
 #endif
 
 /*
include/configs/ip04.h +1 -0
index 0efa2b7..3767502 100644
@@ -77,6 +77,7 @@
 #define DM9000_IO		CONFIG_DM9000_BASE
 #define DM9000_DATA		(CONFIG_DM9000_BASE + 2)
 
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
include/configs/tcm-bf518.h +1 -1
index 1ff34d5..a77ba69 100644
@@ -68,7 +68,7 @@
 #define CONFIG_HOSTNAME		tcm-bf518
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR	02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
include/configs/tcm-bf537.h +1 -1
index 370d97f..c4c1c57 100644
@@ -73,7 +73,7 @@
 #define CONFIG_HOSTNAME		tcm-bf537
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR	02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
Signature · 1 line
1.8.3.2
#6 lore raw

PATCH 3/5 blackfin: replace bfin_gen_rand_mac() with eth_random_addr()

include/configs/tcm-bf537.h line 76

Quoted 8 lines · On Thu 17 Apr 2014 17:00:30 Masahiro Yamada wrote:
include/configs/tcm-bf537.h +1 -1
@@ -73,7 +73,7 @@
 #define CONFIG_HOSTNAME		tcm-bf537
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR	02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND

this should be in bfin_adi_common.h instead. i think that replaces the majority of your config updates (if not all).
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140417/786f80f3/attachment.pgp>

#7 lore raw

PATCH 3/5 blackfin: replace bfin_gen_rand_mac() with eth_random_addr()

Hi Mike,

Quoted 13 lines · On Thu, 17 Apr 2014 15:07:50 -0400 Mike Frysinger <[email protected]> wrote:

include/configs/tcm-bf537.h line 76

Quoted 8 lines · On Thu 17 Apr 2014 17:00:30 Masahiro Yamada wrote:
include/configs/tcm-bf537.h +1 -1
@@ -73,7 +73,7 @@
 #define CONFIG_HOSTNAME		tcm-bf537
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR	02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND

this should be in bfin_adi_common.h instead. i think that replaces the majority of your config updates (if not all).
-mike

Are you sure?

There are 35 blackfin boards in boards.cfg. There are only 15 boards using random MAC address.

Besides, I think your suggestion does not work
because for ex. bf537-minotaur board is not including bfin_adi_common.h.

Best Regards
Masahiro Yamada

#8 lore raw

PATCH 4/5 fs: ubifs: drop __DATE__ and __TIME__

In reply to Masahiro Yamada

__DATE__ and __TIME__ should not be used anymore.
Drop the debug message using them.

---

 fs/ubifs/super.c | 1 -
 1 file changed, 1 deletion(-)
fs/ubifs/super.c +0 -1
index 67f115f..748ab67 100644
@@ -734,7 +734,6 @@ static int mount_ubifs(struct ubifs_info *c)
 	ubifs_msg("reserved for root:  %llu bytes (%llu KiB)",
 		c->report_rp_size, c->report_rp_size >> 10);
 
-	dbg_msg("compiled on:         " __DATE__ " at " __TIME__);
 	dbg_msg("min. I/O unit size:  %d bytes", c->min_io_size);
 	dbg_msg("LEB size:            %d bytes (%d KiB)",
 		c->leb_size, c->leb_size >> 10);
Signature · 1 line
1.8.3.2
#9 lore raw

PATCH 5/5 kbuild: build with -Werror=date-time if the compiler supports it

In reply to Masahiro Yamada

This commit has been imported from Linux Kernel:

commit fe7c36c7bde12190341722af69358e42171162f3
Author: Josh Triplett <[email protected]>
Date: Mon Dec 23 13:56:06 2013 -0800

Makefile: Build with -Werror=date-time if the compiler supports it

GCC 4.9 and newer have a new warning -Wdate-time, which warns on any use of __DATE__, __TIME__, or __TIMESTAMP__, which would make the build non-deterministic. Now that the kernel does not use any of those macros, turn on -Werror=date-time if available, to keep it that way.

The kernel already (optionally) records this information at build time in a single place; other kernel code should not duplicate that.

---

 Makefile | 3 +++
 1 file changed, 3 insertions(+)
Makefile +3 -0
index 0191869..09a370f 100644
@@ -578,6 +578,9 @@ KBUILD_AFLAGS += -Wa,-gstabs,-S
 endif
 endif
 
+# Prohibit date/time macros, which would make the build non-deterministic
+KBUILD_CFLAGS   += $(call cc-option,-Werror=date-time)
+
 ifneq ($(CONFIG_SYS_TEXT_BASE),)
 KBUILD_CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE)
 endif
Signature · 1 line
1.8.3.2
#10 lore raw

cover Do not use __DATE__ and __TIME__ anymore

In reply to Masahiro Yamada

Dear Masahiro,

Quoted 2 lines · In message <[email protected]> you…

The aim of this series is to prohibit using __DATE__ and __TIME__.

What is bad about using these?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
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
It is easier to change the specification to fit the program than vice
versa.
#11 lore raw

cover Do not use __DATE__ and __TIME__ anymore

Hi Wolfgang

Quoted 7 lines · On Thu, 17 Apr 2014 13:07:32 +0200 Wolfgang Denk <[email protected]> wrote:

Dear Masahiro,

Quoted 2 lines · In message <[email protected]> you…

The aim of this series is to prohibit using __DATE__ and __TIME__.

What is bad about using these?

include/generated/timestamp_autogenerated.h provides us the last build date correctly because it is touched every time.

__DATE__ or __TIME__ might give us unexpectedly old date because it is not updated unless the source file is modified.

One more reason.
Using __DATE__ / __TIME__ here and there makes the binary comparison difficult.

I often use MD5SUM comparison
to confirm that my changes to the build system still produce the same output.

I want to generate the completely same result
if the source code is the same.

This can be achieved by simply disabling the timestamp file and version file.
I want to gather timestamp stuff to one place for easy control of it.

Best Regards
Masahiro Yamada

#12 lore raw

cover Do not use __DATE__ and __TIME__ anymore

Dear Masahiro,

Quoted 2 lines · In message <[email protected]> you wrote:

I want to gather timestamp stuff to one place for easy control of it.

All understood - but this should be documented in the commit message.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
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
We are Microsoft. Unix is irrelevant. Openness is futile.  Prepare to
be assimilated.
#13 lore raw

cover Do not use __DATE__ and __TIME__ anymore

In reply to Masahiro Yamada
Quoted 1 line · On Thu 17 Apr 2014 17:00:27 Masahiro Yamada wrote:

The aim of this series is to prohibit using __DATE__ and __TIME__.

as long as the version.h isn't impacted, this should fine. i don't think it is as it looks like the build will generate U_BOOT_DATE and U_BOOT_TIME into a const string by hand.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140417/d21a8ee1/attachment.pgp>