Skip to contentSkip to conversation

board/BuR: simplify default IP-setup on B&R boards.

PATCH In review Hannes Schmelzer 3 participants 4 messages Aug 25, 2015 – Sep 12, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board/BuR: simplify default IP-setup on B&R boards.

To simplify and having a common default IP-setup on all B&R boards we introduce an environment variable "brdefaultip" which does following.

Test if ${ipaddr} is empty, if yes it set's up some defaults:
- ipaddr : 192.168.60.1
- netmask : 255.255.255.0
- gatewayip: 192.168.60.254
- serverip : 192.168.60.254

This environment is ran from CONFIG_PREBOOT.

All other "tricks" are dropped.

---

 board/BuR/kwb/board.c               | 10 ----------
 include/configs/bur_am335x_common.h | 12 +++++-------
 2 files changed, 5 insertions(+), 17 deletions(-)
board/BuR/kwb/board.c +0 -10
index 640aca4..039ec20 100644
@@ -283,16 +283,6 @@ int board_late_init(void)
 	}
 	/* setup vxworks bootline */
 	char *vxworksbootline = (char *)VXWORKS_BOOTLINE;
-
-	/* setup default IP, in case if there is nothing in environment */
-	if (!getenv("ipaddr")) {
-		setenv("ipaddr", "192.168.60.1");
-		setenv("netmask", "255.255.255.0");
-		setenv("serverip", "192.168.60.254");
-		setenv("gatewayip", "192.168.60.254");
-		puts("net: had no IP! made default setup.\n");
-	}
-
 	sprintf(vxworksbootline,
 		"%s h=%s e=%s:%s g=%s %s o=0x%08x;0x%08x;0x%08x;0x%08x",
 		DEFAULT_BOOTLINE,
include/configs/bur_am335x_common.h +5 -7
index 838ef1f..c696092 100644
@@ -14,18 +14,16 @@
 /* ------------------------------------------------------------------------- */
 #define BUR_COMMON_ENV \
 "usbscript=usb start && fatload usb 0 0x80000000 usbscript.img && source\0" \
-"defaultip=192.168.60.253\0" \
-"defaultsip=192.168.60.254\0" \
+"brdefaultip=if test -r ${ipaddr}; then; else" \
+" setenv ipaddr 192.168.60.1; setenv serverip 192.168.60.254;" \
+" setenv gatewayip 192.168.60.254; setenv netmask 255.255.255.0; fi;\0" \
 "netconsole=echo switching to network console ...; " \
-"if dhcp; then setenv ncip ${serverip}; " \
-"else " \
-"setenv ncip 192.168.60.254; setenv serverip 192.168.60.254; " \
-"setenv gatewayip 192.168.60.254; setenv ipaddr 192.168.60.1; " \
-"fi; " \
+"if dhcp; then; else run brdefaultip; fi; setenv ncip ${serverip}; " \
 "setcurs 1 9; lcdputs myip; setcurs 10 9; lcdputs ${ipaddr};" \
 "setcurs 1 10;lcdputs serverip; setcurs 10 10; lcdputs ${serverip};" \
 "setenv stdout nc;setenv stdin nc;setenv stderr nc\0"
 
+#define CONFIG_PREBOOT			"run brdefaultip"
 #define CONFIG_CMD_TIME
 
 #define CONFIG_SYS_GENERIC_BOARD
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 board/BuR: simplify default IP-setup on B&R boards.

Quoted 9 lines · Hannes Schmelzer

To simplify and having a common default IP-setup on all B&R boards we introduce an environment variable "brdefaultip" which does following.

Test if ${ipaddr} is empty, if yes it set's up some defaults:
- ipaddr : 192.168.60.1
- netmask : 255.255.255.0
- gatewayip: 192.168.60.254
- serverip : 192.168.60.254

Quoted 6 lines

This environment is ran from CONFIG_PREBOOT.

All other "tricks" are dropped.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150825/7e960723/attachment.sig>
#2 lore raw

PATCH 1/1 board/BuR: simplify default IP-setup on B&R boards.

In reply to Hannes Schmelzer

Hi Hannes,

Quoted 9 lines · Hannes Schmelzer

To simplify and having a common default IP-setup on all B&R boards we introduce an environment variable "brdefaultip" which does following.

Test if ${ipaddr} is empty, if yes it set's up some defaults:
- ipaddr : 192.168.60.1
- netmask : 255.255.255.0
- gatewayip: 192.168.60.254
- serverip : 192.168.60.254

Quoted 5 lines

This environment is ran from CONFIG_PREBOOT.

All other "tricks" are dropped.

#3 lore raw
In reply to Hannes Schmelzer
Quoted 9 lines · Hannes Petermaier

To simplify and having a common default IP-setup on all B&R boards we introduce an environment variable "brdefaultip" which does following.

Test if ${ipaddr} is empty, if yes it set's up some defaults:
- ipaddr : 192.168.60.1
- netmask : 255.255.255.0
- gatewayip: 192.168.60.254
- serverip : 192.168.60.254

Quoted 7 lines

This environment is ran from CONFIG_PREBOOT.

All other "tricks" are dropped.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150912/322036a4/attachment.sig>