From: Hamish Guthrie <hcg@openwrt.org>
Date: Thu, 14 Jun 2007 13:46:24 +0000 (+0000)
Subject: Added config parameters for u-boot client IP address as well as TFTP server IP address.
X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=ff17ac5ec3a0a27a7a4e183788efa37d1090cdef;p=openwrt%2Fstaging%2Fsvanheule.git

Added config parameters for u-boot client IP address as well as TFTP server IP address.

SVN-Revision: 7632
---

diff --git a/target/linux/at91-2.6/image/Config.in b/target/linux/at91-2.6/image/Config.in
index 38ce0acb55..6607f6c325 100644
--- a/target/linux/at91-2.6/image/Config.in
+++ b/target/linux/at91-2.6/image/Config.in
@@ -1,8 +1,3 @@
-config AT91_ROMBOOT
-	bool "Build romboot loader"
-	depends LINUX_2_6_AT91
-	default y
-
 config AT91_DFBOOT
 	bool "Build dataflashboot loader"
 	depends LINUX_2_6_AT91
@@ -16,9 +11,25 @@ config AT91_UBOOT
 config UBOOT_TARGET
 	string "U-Boot Board Configuration"
 	depends LINUX_2_6_AT91
+	depends AT91_UBOOT
 	default "vlink"
 	help
-	  For all supported boards there are reqdy-to-use default
+	  For all supported boards there are ready-to-use default
 		configurations available; just type "<board_name>".
 
+config UBOOT_IPADDR
+	string "IP Address for U-Boot"
+	depends LINUX_2_6_AT91
+	depends AT91_UBOOT
+	default "192.168.0.178"
+	help
+	  IP address of device to be used in U-Boot
+
+config UBOOT_SERVERIP
+	string "IP Address of TFTP server"
+	depends LINUX_2_6_AT91
+	depends AT91_UBOOT
+	default "192.168.0.232"
+	help
+	  IP address of TFTP server for U-Boot
 
diff --git a/target/linux/at91-2.6/image/u-boot/Makefile b/target/linux/at91-2.6/image/u-boot/Makefile
index 35b1e9bff1..6fd667de12 100644
--- a/target/linux/at91-2.6/image/u-boot/Makefile
+++ b/target/linux/at91-2.6/image/u-boot/Makefile
@@ -22,13 +22,19 @@ PKG_CAT:=bzcat
 include $(INCLUDE_DIR)/package.mk
 
 UBOOT_CONFIG=$(strip $(subst ",, $(CONFIG_UBOOT_TARGET)))
+LAN_IP=$(strip $(CONFIG_UBOOT_IPADDR))
+LAN_SERVERIP=$(strip $(subst ",, $(CONFIG_UBOOT_SERVERIP)))
 
 define Build/Compile
 	$(MAKE) -C $(PKG_BUILD_DIR) $(UBOOT_CONFIG)_config
 	export CROSS_COMPILE=$(TARGET_CROSS); \
+	export LAN_IP=$(LAN_IP); \
+	export LAN_SERVERIP=$(LAN_SERVERIP); \
 	$(MAKE) -C $(PKG_BUILD_DIR)
 	mkdir -p $(PKG_BUILD_DIR)/ubclient
 	$(CP) ./ubclient/* $(PKG_BUILD_DIR)/ubclient
+	export LAN_IP=$(LAN_IP); \
+	export LAN_SERVERIP=$(LAN_SERVERIP); \
 	$(MAKE) -C $(PKG_BUILD_DIR)/ubclient \
 		$(TARGET_CONFIGURE_OPTS) \
 		CFLAGS="$(TARGET_CFLAGS) -Dtarget_$(BOARD)=1"
diff --git a/target/linux/at91-2.6/image/u-boot/patches/013-params-in-config.patch b/target/linux/at91-2.6/image/u-boot/patches/013-params-in-config.patch
new file mode 100644
index 0000000000..11ff2a39cb
--- /dev/null
+++ b/target/linux/at91-2.6/image/u-boot/patches/013-params-in-config.patch
@@ -0,0 +1,24 @@
+--- u-boot-1.1.4.old/tools/Makefile	2007-06-13 13:35:59.000000000 +0200
++++ u-boot-1.1.4/tools/Makefile	2007-06-14 15:33:04.000000000 +0200
+@@ -153,7 +153,7 @@
+ 		$(STRIP) $@
+ 
+ ubparams.o: ubparams.c
+-		$(CC) -g $(CFLAGS) -c $<
++		$(CC) -g $(CFLAGS) -DLAN_IP=$(LAN_IP) -DLAN_SERVERIP=$(LAN_SERVERIP) -c $<
+ 
+ envcrc.o:	envcrc.c
+ 		$(CC) -g $(CFLAGS) -c $<
+--- u-boot-1.1.4.old/tools/ubparams.c	2007-06-13 13:35:59.000000000 +0200
++++ u-boot-1.1.4/tools/ubparams.c	2007-06-14 15:31:55.000000000 +0200
+@@ -44,8 +44,8 @@
+ 	"bootargs=setenv bootargs root=/dev/mtdblock3 ro init=/etc/preinit console=/dev/ttyS0,115200,mem=32M\0"
+ 	"bootcmd=bootm 0xc0042000\0"
+ 	"ethaddr=00:30:49:00:00:01\0"
+-	"ipaddr=10.0.1.73\0"
+-	"serverip=10.0.1.210\0"
++	"ipaddr=" MK_STR(LAN_IP) "\0"
++	"serverip=" MK_STR(LAN_SERVERIP) "\0"
+ 	"serial#=MX070205484\0"
+ 	"\0"
+ 	};
diff --git a/target/linux/at91-2.6/image/u-boot/ubclient/Makefile b/target/linux/at91-2.6/image/u-boot/ubclient/Makefile
index c79260e450..f8ff67cd18 100644
--- a/target/linux/at91-2.6/image/u-boot/ubclient/Makefile
+++ b/target/linux/at91-2.6/image/u-boot/ubclient/Makefile
@@ -6,7 +6,7 @@ crc32.c:
 	ln -s ../lib_generic/crc32.c ./
 
 %.o: %.c
-	$(CC) -I ../include $(CFLAGS) $(EXTRA_FLAGS) -c -o $@ $^
+	$(CC) -I ../include $(CFLAGS) $(EXTRA_FLAGS) -DLAN_IP=$(LAN_IP) -DLAN_SERVERIP=$(LAN_SERVERIP) -c -o $@ $^
 
 ubpar: ubpar.o crc32.o
 	$(CC) -o $@ $^
diff --git a/target/linux/at91-2.6/image/u-boot/ubclient/ubpar.c b/target/linux/at91-2.6/image/u-boot/ubclient/ubpar.c
index 228a578a61..3f6c070017 100644
--- a/target/linux/at91-2.6/image/u-boot/ubclient/ubpar.c
+++ b/target/linux/at91-2.6/image/u-boot/ubclient/ubpar.c
@@ -29,6 +29,17 @@ extern unsigned long crc32 (unsigned long, const unsigned char *, unsigned int);
 #define ENV_CRC ~0
 #endif
 
+#ifdef LAN_IP
+	#warning LAN_IP
+#else
+	#warning LAN_IP NOT DEFINED
+#endif
+#ifdef LAN_SERVERIP
+	#warning LAN_SERVERIP
+#else
+	#warning LAN_SERVERIP NOT DEFINED
+#endif
+
 static char *environment[] = {
 	"bootdelay=3\0"
 	"baudrate=115200\0"
@@ -41,8 +52,8 @@ static char *environment[] = {
 	"flash=run fbargs; bootm 0xc0042000\0"
 	"bootargs=setenv bootargs root=/dev/mtdblock3 ro init=/etc/preinit console=/dev/ttyS0,115200,mem=32M\0"
 	"bootcmd=bootm 0xc0042000\0"
-	"ipaddr=10.0.1.73\0"
-	"serverip=10.0.1.210\0"
+	"ipaddr=" MK_STR(LAN_IP) "\0"
+	"serverip=" MK_STR(LAN_SERVERIP) "\0"
 	"\0"
 	};