Skip to contentSkip to conversation

defaultenv-2: add bootp support

PATCH In review Jean-Christophe PLAGNIOL-VILLARD 2 participants 36 messages Sep 7, 2012 – Sep 8, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover defaultenv-2: add bootp support

HI,

v2:

- add ifdown
- dhcp: switch to global var support
- add dhcp-barebox support to defaultenv-2

this patch serie depends on the previous defaultenv-2-boot-sequence

please pull
The following changes since commit 5b9b40e603d03afe760f9249c2b38e99c3cade92:

defaultenv-2: add boot sequence (2012-09-07 17:46:37 +0800)

are available in the git repository at:

git://git.jcrosoft.org/barebox.git tags/defaultenv-2-bootp

for you to fetch changes up to 30dcb11c5f70bf83e050f6f713ee9c47c9cc5c7b:

defaultenv-2: add symbolic link support to boot/nfs (2012-09-07 20:03:00 +0800)

----------------------------------------------------------------
defaultenv-2: add bootp support

dhcp: add global var support

This way you can specify as previously set the dhcp parameter via global.dhcp.xxx and get the result via global.dhcp.xxx

dhcp: add retries limit support

boot: add bootp support to net (tftp)

boot: add nfs bootp support

Where the kernel and oftree as retrieved via nfs
support also the symlink file so we will mount the correct path to get the file as nfs does not follow the link as it's done on tftp

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (11):
defaultenv: enable glovalvar support
defaultenv: switch hostname to global.hostname
dhcp: switch to global var support
dhcp: add copy_only_if_valid support
dhcp: add retries limit support
defaultenv-2: eth0 add default global.dhcp.vendor_id defaultenv-2/ip: add dhcp-barebox support
defaultenv-2: add ifdown support
defaultenv-2: boot/net add bootp support
defaultenv-2: add net boot support with kernel and oftree via nfs
defaultenv-2: add symbolic link support to boot/nfs

 arch/arm/boards/at91rm9200ek/env/config           |    2 +-
 arch/arm/boards/at91sam9260ek/env/config          |    4 ++--
 arch/arm/boards/at91sam9261ek/env/config          |    4 ++--
 arch/arm/boards/at91sam9263ek/env/config          |    2 +-
 arch/arm/boards/at91sam9m10g45ek/env/config       |    2 +-
 arch/arm/boards/at91sam9x5ek/env/config           |    2 +-
 arch/arm/boards/eukrea_cpuimx25/env/config        |   12 +++++------
 arch/arm/boards/eukrea_cpuimx35/env/config        |   12 +++++------
 arch/arm/boards/eukrea_cpuimx51/env/config        |   12 +++++------
 arch/arm/boards/freescale-mx28-evk/env/config     |   10 ++++-----
 arch/arm/boards/freescale-mx35-3-stack/env/config |   12 +++++------
 arch/arm/boards/freescale-mx53-loco/env/config    |   14 ++++++-------
 arch/arm/boards/freescale-mx53-smd/env/config     |   12 +++++------
 arch/arm/boards/friendlyarm-mini2440/env/config   |   12 +++++------
 arch/arm/boards/guf-cupid/env/config              |   12 +++++------
 arch/arm/boards/guf-neso/env/config               |   12 +++++------
 arch/arm/boards/karo-tx25/env/config              |   12 +++++------
 arch/arm/boards/karo-tx28/env/config              |   12 +++++------
 arch/arm/boards/panda/env/config                  |   10 ++++-----
 arch/arm/boards/pcm027/env/config                 |   12 +++++------
 arch/arm/boards/pcm037/env/config                 |   12 +++++------
 arch/arm/boards/pcm043/env/config                 |   12 +++++------
 arch/arm/boards/pcm049/env/config                 |   12 +++++------
 arch/arm/boards/phycard-a-l1/env/config           |   16 +++++++-------
 arch/arm/boards/phycard-a-xl2/env/config          |   12 +++++------
 arch/arm/boards/phycard-i.MX27/env/config         |   12 +++++------
 arch/arm/boards/qil-a9260/env/config              |    2 +-
 arch/arm/boards/scb9328/env/config                |   12 +++++------
 arch/arm/boards/tny-a926x/env/config              |    6 +++---
 arch/arm/boards/usb-a926x/env/config              |    6 +++---
 common/Kconfig                                    |    1 +
 defaultenv-2/base/bin/bootargs-ip                 |    2 ++
 defaultenv-2/base/bin/ifdown                      |   16 ++++++++++++++
 defaultenv-2/base/bin/ifup                        |    2 +-
 defaultenv-2/base/boot/net                        |   35 ++++++++++++++++++++++++++++++-
 defaultenv-2/base/boot/nfs                        |  133 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 defaultenv-2/base/network/eth0                    |    1 +
 defaultenv/bin/boot                               |   12 +++++------
 defaultenv/bin/init                               |    2 ++
 defaultenv/config                                 |   18 ++++++++--------
 net/dhcp.c                                        |  163 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------
 41 files changed, 486 insertions(+), 183 deletions(-)
 create mode 100644 defaultenv-2/base/bin/ifdown
 create mode 100644 defaultenv-2/base/boot/nfs

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw

PATCH v2 1/11 defaultenv: enable glovalvar support

This will allow to do not have 2 set of var for defaultenv and the new defaultenv-2.

---
 common/Kconfig      |    1 +
 defaultenv/bin/init |    2 ++
 2 files changed, 3 insertions(+)
common/Kconfig +1 -0
index f411719..8fdb2e0 100644
@@ -577,6 +577,7 @@ config DEFAULT_ENVIRONMENT_GENERIC
 	select CMD_CRC
 	select CMD_CRC_CMP
 	select CMD_AUTOMOUNT if HAVE_DEFAULT_ENVIRONMENT_NEW
+	select CMD_GLOBAL
 	prompt "Default environment generic"
 	help
 	  With this option barebox will use the generic default
defaultenv/bin/init +2 -0
index f535e37..adb3c43 100644
@@ -3,6 +3,8 @@
 PATH=/env/bin
 export PATH
 
+global hostname
+
 . /env/config
 if [ -e /dev/nor0 -a -n "$nor_parts" ]; then
 	addpart /dev/nor0 $nor_parts
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH v2 3/11 dhcp: switch to global var support

This way you can specify as previously set the dhcp parameter via global.dhcp.xxx and get the result via global.dhcp.xxx

This is need for the defaultenv-2 to add the bootp suppport. Use it on defaultenv too to have only one set of var.

---
 arch/arm/boards/at91rm9200ek/env/config        |    2 +-
 arch/arm/boards/at91sam9260ek/env/config       |    4 +-
 arch/arm/boards/at91sam9261ek/env/config       |    4 +-
 arch/arm/boards/at91sam9263ek/env/config       |    2 +-
 arch/arm/boards/at91sam9m10g45ek/env/config    |    2 +-
 arch/arm/boards/at91sam9x5ek/env/config        |    2 +-
 arch/arm/boards/freescale-mx53-loco/env/config |    2 +-
 arch/arm/boards/qil-a9260/env/config           |    2 +-
 arch/arm/boards/tny-a926x/env/config           |    6 +-
 arch/arm/boards/usb-a926x/env/config           |    6 +-
 defaultenv/bin/boot                            |   12 +--
 defaultenv/config                              |    2 +-
 net/dhcp.c                                     |  119 ++++++++++++++++++++----
 13 files changed, 123 insertions(+), 42 deletions(-)
arch/arm/boards/at91rm9200ek/env/config +1 -1
index 735bb10..a3830cb 100644
@@ -3,7 +3,7 @@
 # use 'dhcp' to do dhcp in barebox and in kernel
 # use 'none' if you want to skip kernel ip autoconfiguration
 ip=dhcp-barebox
-dhcp_vendor_id=barebox-at91rm9200ek
+global.dhcp.vendor_id=barebox-at91rm9200ek
 
 # or set your networking parameters here
 #eth0.ipaddr=a.b.c.d
arch/arm/boards/at91sam9260ek/env/config +2 -2
index 06b9faf..8e88186 100644
@@ -6,9 +6,9 @@ ip=dhcp-barebox
 
 if [ x$armlinux_architecture = x1099 ]
 then
-	dhcp_vendor_id=barebox-at91sam9260ek
+	global.dhcp.vendor_id=barebox-at91sam9260ek
 else
-	dhcp_vendor_id=barebox-at91sam9g20ek
+	global.dhcp.vendor_id=barebox-at91sam9g20ek
 fi
 
 # or set your networking parameters here
arch/arm/boards/at91sam9261ek/env/config +2 -2
index 820485d..7d85577 100644
@@ -6,9 +6,9 @@ ip=dhcp-barebox
 
 if [ x$armlinux_architecture = x848 ]
 then
-	dhcp_vendor_id=barebox-at91sam9261ek
+	global.dhcp.vendor_id=barebox-at91sam9261ek
 else
-	dhcp_vendor_id=barebox-at91sam9g10ek
+	global.dhcp.vendor_id=barebox-at91sam9g10ek
 fi
 
 # or set your networking parameters here
arch/arm/boards/at91sam9263ek/env/config +1 -1
index a09bc26..5125020 100644
@@ -3,7 +3,7 @@
 # use 'dhcp' to do dhcp in barebox and in kernel
 # use 'none' if you want to skip kernel ip autoconfiguration
 ip=dhcp-barebox
-dhcp_vendor_id=barebox-at91sam9263ek
+global.dhcp.vendor_id=barebox-at91sam9263ek
 
 # or set your networking parameters here
 #eth0.ipaddr=a.b.c.d
arch/arm/boards/at91sam9m10g45ek/env/config +1 -1
index 37a20e9..54ed2cb 100644
@@ -3,7 +3,7 @@
 # use 'dhcp' to do dhcp in barebox and in kernel
 # use 'none' if you want to skip kernel ip autoconfiguration
 ip=dhcp-barebox
-dhcp_vendor_id=barebox-at91sam9m10g45ek
+global.dhcp.vendor_id=barebox-at91sam9m10g45ek
 
 # or set your networking parameters here
 #eth0.ipaddr=a.b.c.d
arch/arm/boards/at91sam9x5ek/env/config +1 -1
index dafe875..6a985ce 100644
@@ -3,7 +3,7 @@
 # use 'dhcp' to do dhcp in barebox and in kernel
 # use 'none' if you want to skip kernel ip autoconfiguration
 ip=dhcp-barebox
-dhcp_vendor_id=barebox-at91sam9x5ek
+global.dhcp.vendor_id=barebox-at91sam9x5ek
 
 # or set your networking parameters here
 #eth0.ipaddr=a.b.c.d
arch/arm/boards/freescale-mx53-loco/env/config +1 -1
index 7226364..9fb39e8 100644
@@ -7,7 +7,7 @@ user=
 # use 'dhcp' to do dhcp in barebox and in kernel
 # use 'none' if you want to skip kernel ip autoconfiguration
 ip=dhcp
-dhcp_vendor_id=barebox-mx53-loco
+global.dhcp.vendor_id=barebox-mx53-loco
 
 # or set your networking parameters here
 #eth0.ipaddr=a.b.c.d
arch/arm/boards/qil-a9260/env/config +1 -1
index c0b5546..9971106 100644
@@ -3,7 +3,7 @@
 # use 'dhcp' to do dhcp in barebox and in kernel
 # use 'none' if you want to skip kernel ip autoconfiguration
 ip=dhcp-barebox
-dhcp_vendor_id=barebox-qil-a9260
+global.dhcp.vendor_id=barebox-qil-a9260
 
 # or set your networking parameters here
 #eth0.ipaddr=a.b.c.d
arch/arm/boards/tny-a926x/env/config +3 -3
index 514fc9f..c19ec4f 100644
@@ -3,9 +3,9 @@
 # use 'dhcp' to do dhcp in barebox and in kernel
 # use 'none' if you want to skip kernel ip autoconfiguration
 ip=dhcp-barebox
-[ x$armlinux_architecture = x2058 ] && dhcp_vendor_id=barebox-tny-a9260
-[ x$armlinux_architecture = x2059 ] && dhcp_vendor_id=barebox-tny-a9g20
-[ x$armlinux_architecture = x2140 ] && dhcp_vendor_id=barebox-tny-a9263
+[ x$armlinux_architecture = x2058 ] && global.dhcp.vendor_id=barebox-tny-a9260
+[ x$armlinux_architecture = x2059 ] && global.dhcp.vendor_id=barebox-tny-a9g20
+[ x$armlinux_architecture = x2140 ] && global.dhcp.vendor_id=barebox-tny-a9263
 
 # or set your networking parameters here
 #eth0.ipaddr=a.b.c.d
arch/arm/boards/usb-a926x/env/config +3 -3
index dc0a264..49199ba 100644
@@ -3,9 +3,9 @@
 # use 'dhcp' to do dhcp in barebox and in kernel
 # use 'none' if you want to skip kernel ip autoconfiguration
 ip=dhcp-barebox
-[ x$armlinux_architecture = x1709 ] && dhcp_vendor_id=barebox-usb-a9260
-[ x$armlinux_architecture = x1710 ] && dhcp_vendor_id=barebox-usb-a9263
-[ x$armlinux_architecture = x1841 ] && dhcp_vendor_id=barebox-usb-a9g20
+[ x$armlinux_architecture = x1709 ] && global.dhcp.vendor_id=barebox-usb-a9260
+[ x$armlinux_architecture = x1710 ] && global.dhcp.vendor_id=barebox-usb-a9263
+[ x$armlinux_architecture = x1841 ] && global.dhcp.vendor_id=barebox-usb-a9g20
 
 # or set your networking parameters here
 #eth0.ipaddr=a.b.c.d
defaultenv/bin/boot +6 -6
index 61b893a..4e2056e 100644
@@ -44,14 +44,14 @@ fi
 if [ x$ip = xdhcp -o x$ip = "xdhcp-barebox" ]; then
 	if [ x$kernel_loc = xnfs -o x$kernel_loc = xtftp ]; then
 		dhcp
-		if [ x$rootpath != x ]; then
-			nfsroot=$rootpath
+		if [ x${global.dhcp.rootpath} != x ]; then
+			nfsroot=${global.dhcp.rootpath}
 		fi
-		if [ x$bootfile != x ]; then
-			kernelimage=$bootfile
+		if [ x${global.dhcp.bootfile} != x ]; then
+			kernelimage=${global.dhcp.bootfile}
 		fi
-		if [ x$dhcp_oftree_file != x ]; then
-			oftreeimage=$dhcp_oftree_file
+		if [ x$global.dhcp.oftree_file} != x ]; then
+			oftreeimage=${global.dhcp_oftree_file}
 		fi
 	fi
 fi
defaultenv/config +1 -1
index 81d6f95..391ba47 100644
@@ -11,7 +11,7 @@ fi
 # use 'dhcp' to do dhcp in barebox and in kernel
 # use 'none' if you want to skip kernel ip autoconfiguration
 ip=dhcp
-dhcp_vendor_id=barebox
+global.dhcp.vendor_id=barebox
 
 # or set your networking parameters here
 #eth0.ipaddr=a.b.c.d
net/dhcp.c +100 -19

207 lines not on this page · raw message

Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH v2 4/11 dhcp: add copy_only_if_valid support

In reply to Jean-Christophe PLAGNIOL-VILLARD

This will allow to only update a var if recive a valid data. This is need for hostname.

---
 net/dhcp.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
net/dhcp.c +6 -1
index b4f2830..02dc529 100644
@@ -110,6 +110,7 @@ struct dhcp_opt {
 	unsigned char option;
 	/* request automatically the option when creating the DHCP request */
 	bool optional;
+	bool copy_only_if_valid;
 	const char *barebox_var_name;
 	const char *barebox_dhcp_global;
 	void (*handle)(struct dhcp_opt *opt, unsigned char *data, int tlen);
@@ -153,6 +154,9 @@ static void env_str_handle(struct dhcp_opt *opt, unsigned char *popt, int optlen
 	memcpy(tmp, popt, optlen);
 	tmp[optlen] = 0;
 
+	if (opt->copy_only_if_valid && !strlen(tmp))
+		return;
+
 	if (opt->barebox_var_name)
 		setenv(opt->barebox_var_name, tmp);
 	if (opt->barebox_dhcp_global)
@@ -208,6 +212,7 @@ struct dhcp_opt dhcp_options[] = {
 		.barebox_var_name = "net.nameserver",
 	}, {
 		.option = 12,
+		.copy_only_if_valid = 1,
 		.handle = env_str_handle,
 		.barebox_var_name = "global.hostname",
 	}, {
@@ -647,7 +652,7 @@ static void dhcp_reset_env(void)
 
 	for (i = 0; i < ARRAY_SIZE(dhcp_options); i++) {
 		opt = &dhcp_options[i];
-		if (!opt->barebox_var_name)
+		if (!opt->barebox_var_name || opt->copy_only_if_valid)
 			continue;
 
 		setenv(opt->barebox_var_name,"");
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw

PATCH v2 7/11 defaultenv-2/ip: add dhcp-barebox support

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 defaultenv-2/base/bin/bootargs-ip |    2 ++
 defaultenv-2/base/bin/ifup        |    2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
defaultenv-2/base/bin/bootargs-ip +2 -0
index 2d4486c..caeb5dd 100644
@@ -6,6 +6,8 @@
 
 if [ $ip = dhcp ]; then
 	global.linux.bootargs.dyn.ip="ip=dhcp"
+elif [ $ip = dhcp-barebox ]; then
+	global.linux.bootargs.dyn.ip="ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask::eth0:"
 else
 	global.linux.bootargs.dyn.ip="ip=$ipaddr:$serverip:$gateway:$netmask::eth0:"
 fi
defaultenv-2/base/bin/ifup +1 -1
index 37b986c..554c35e 100644
@@ -52,7 +52,7 @@ if [ "$ip" = static ]; then
 	${interface}.serverip=$serverip
 	${interface}.gateway=$gateway
 	ret=0
-elif [ "$ip" = dhcp ]; then
+elif [ "$ip" = dhcp -o "$ip" = dhcp-barebox ]; then
 	dhcp
 	ret=$?
 	if [ $ret = 0 -a -n "$serverip" ]; then
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#10 lore raw

PATCH v2 8/11 defaultenv-2: add ifdown support

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 defaultenv-2/base/bin/ifdown |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 defaultenv-2/base/bin/ifdown
defaultenv-2/base/bin/ifdown new file +16 -0
new file mode 100644
index 0000000..191144e
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+mkdir -p /tmp/network
+
+if [ $# != 1 ]; then
+	echo "usage: ifdown <interface>"
+	exit 1
+fi
+
+interface="$1"
+
+
+if [ -f /tmp/network/$interface ]; then
+	rm /tmp/network/$interface
+	exit 0
+fi
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#11 lore raw

PATCH v2 9/11 defaultenv-2: boot/net add bootp support

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 defaultenv-2/base/boot/net |   35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
defaultenv-2/base/boot/net +34 -1
index 922bef1..ff05077 100644
@@ -7,8 +7,41 @@ fi
 
 path="/mnt/tftp"
 
+# to get the dhcp info (global.dhcp.rootpath, global.dhcp.bootfile, global.dhcp.oftree_file)
+ifdown eth0
+ifup eth0
+
 global.bootm.image="${path}/${global.user}-linux-${global.hostname}"
 #global.bootm.oftree="${path}/${global.user}-oftree-${global.hostname}"
-nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
+
+if [ -n "${global.dhcp.rootpath}" ]; then
+	bootp=1
+	nfsroot="${global.dhcp.rootpath}"
+else
+	nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
+fi
+
+if [ -n "${global.dhcp.bootfile}" -o -n "${global.dhcp.oftree_file}" ]; then
+	bootp=1
+	path="/mnt/dhcp"
+
+	if [ -d "${path}" ]; then
+		umount "${path}"
+	else
+		mkdir "${path}"
+	fi
+	mount -t tftp $eth0.serverip "${path}"
+
+	[ -n "${global.dhcp.bootfile}" ] && global.bootm.image="${path}/${global.dhcp.bootfile}"
+	[ -n "${global.dhcp.oftree_file}" ] && global.bootm.oftree="${path}/${global.dhcp.oftree_file}"
+fi
+
+if [ x${bootp} = x1 ]; then
+	echo "Boot via bootp/dhcp on server ${eth0.serverip}"
+	[ -n "${global.dhcp.bootfile}" ] && echo "bootm.image => ${global.dhcp.bootfile}"
+	[ -n "${global.dhcp.oftree_file}" ] && echo "bootm.oftree => ${global.dhcp.oftree_file}"
+	[ -n "${global.dhcp.rootpath}" ] && echo "nfsroot => ${global.dhcp.rootpath}"
+fi
+
 bootargs-ip
 bootargs-root-nfs -n "$nfsroot"
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH v2 2/11 defaultenv: switch hostname to global.hostname

In reply to Jean-Christophe PLAGNIOL-VILLARD

Udpate dhcp with it too.

---
 arch/arm/boards/eukrea_cpuimx25/env/config        |   12 ++++++------
 arch/arm/boards/eukrea_cpuimx35/env/config        |   12 ++++++------
 arch/arm/boards/eukrea_cpuimx51/env/config        |   12 ++++++------
 arch/arm/boards/freescale-mx28-evk/env/config     |   10 +++++-----
 arch/arm/boards/freescale-mx35-3-stack/env/config |   12 ++++++------
 arch/arm/boards/freescale-mx53-loco/env/config    |   12 ++++++------
 arch/arm/boards/freescale-mx53-smd/env/config     |   12 ++++++------
 arch/arm/boards/friendlyarm-mini2440/env/config   |   12 ++++++------
 arch/arm/boards/guf-cupid/env/config              |   12 ++++++------
 arch/arm/boards/guf-neso/env/config               |   12 ++++++------
 arch/arm/boards/karo-tx25/env/config              |   12 ++++++------
 arch/arm/boards/karo-tx28/env/config              |   12 ++++++------
 arch/arm/boards/panda/env/config                  |   10 +++++-----
 arch/arm/boards/pcm027/env/config                 |   12 ++++++------
 arch/arm/boards/pcm037/env/config                 |   12 ++++++------
 arch/arm/boards/pcm043/env/config                 |   12 ++++++------
 arch/arm/boards/pcm049/env/config                 |   12 ++++++------
 arch/arm/boards/phycard-a-l1/env/config           |   16 ++++++++--------
 arch/arm/boards/phycard-a-xl2/env/config          |   12 ++++++------
 arch/arm/boards/phycard-i.MX27/env/config         |   12 ++++++------
 arch/arm/boards/scb9328/env/config                |   12 ++++++------
 defaultenv/config                                 |   16 ++++++++--------
 net/dhcp.c                                        |    4 ++--
 23 files changed, 136 insertions(+), 136 deletions(-)
arch/arm/boards/eukrea_cpuimx25/env/config +6 -6
index b6bf93f..9c70988 100644
@@ -24,16 +24,16 @@ rootfs_loc=nand
 
 # rootfs
 rootfs_type=ubifs
-rootfsimage=$hostname/rootfs.$rootfs_type
+rootfsimage=${global.hostname}/rootfs.$rootfs_type
 
 # kernel
-kernelimage=$hostname/uImage-${hostname}.bin
+kernelimage=${global.hostname}/uImage-${global.hostname}.bin
 
 # barebox and it's env
-bareboximage=$hostname/barebox-${hostname}.bin
-bareboxenvimage=$hostname/bareboxenv-${hostname}.bin
+bareboximage=${global.hostname}/barebox-${global.hostname}.bin
+bareboxenvimage=${global.hostname}/bareboxenv-${global.hostname}.bin
 
-nfsroot="$eth0.serverip:/srv/nfs/$hostname"
+nfsroot="$eth0.serverip:/srv/nfs/${global.hostname}"
 
 autoboot_timeout=1
 
@@ -42,7 +42,7 @@ bootargs="console=ttymxc0,115200 otg_mode=$otg_mode video=imxfb:$video"
 nand_parts="256k(barebox)ro,128k(bareboxenv),3M(kernel),-(root)"
 rootfs_mtdblock_nand=3
 nand_device="mxc_nand"
-ubiroot="$hostname-rootfs"
+ubiroot="${global.hostname}-rootfs"
 device_type="nand"
 
 # set a fancy prompt (if support is compiled in)
arch/arm/boards/eukrea_cpuimx35/env/config +6 -6
index 01cbfe9..beb5916 100644
@@ -24,16 +24,16 @@ rootfs_loc=nand
 
 # rootfs
 rootfs_type=ubifs
-rootfsimage=$hostname/rootfs.$rootfs_type
+rootfsimage=${global.hostname}/rootfs.$rootfs_type
 
 # kernel
-kernelimage=$hostname/uImage-${hostname}.bin
+kernelimage=${global.hostname}/uImage-${global.hostname}.bin
 
 # barebox and it's env
-bareboximage=$hostname/barebox-${hostname}.bin
-bareboxenvimage=$hostname/bareboxenv-${hostname}.bin
+bareboximage=${global.hostname}/barebox-${global.hostname}.bin
+bareboxenvimage=${global.hostname}/bareboxenv-${global.hostname}.bin
 
-nfsroot="$eth0.serverip:/srv/nfs/$hostname"
+nfsroot="$eth0.serverip:/srv/nfs/${global.hostname}"
 
 autoboot_timeout=1
 
@@ -42,7 +42,7 @@ bootargs="console=ttymxc0,115200 otg_mode=$otg_mode video=mx3fb:$video"
 nand_parts="256k(barebox)ro,128k(bareboxenv),3M(kernel),-(root)"
 rootfs_mtdblock_nand=3
 nand_device="mxc_nand"
-ubiroot="$hostname-rootfs"
+ubiroot="${global.hostname}-rootfs"
 device_type="nand"
 
 # set a fancy prompt (if support is compiled in)
arch/arm/boards/eukrea_cpuimx51/env/config +6 -6
index 163d026..f30c94f 100644
@@ -27,16 +27,16 @@ rootfs_loc=nand
 
 # rootfs
 rootfs_type=ubifs
-rootfsimage=$hostname/rootfs.$rootfs_type
+rootfsimage=${global.hostname}/rootfs.$rootfs_type
 
 # kernel
-kernelimage=$hostname/uImage-${hostname}.bin
+kernelimage=${global.hostname}/uImage-${global.hostname}.bin
 
 # barebox and it's env
-bareboximage=$hostname/barebox-${hostname}.bin
-bareboxenvimage=$hostname/bareboxenv-${hostname}.bin
+bareboximage=${global.hostname}/barebox-${global.hostname}.bin
+bareboxenvimage=${global.hostname}/bareboxenv-${global.hostname}.bin
 
-nfsroot="$eth0.serverip:/srv/nfs/$hostname"
+nfsroot="$eth0.serverip:/srv/nfs/${global.hostname}"
 
 autoboot_timeout=1
 
@@ -45,7 +45,7 @@ bootargs="console=ttymxc0,115200 otg_mode=$otg_mode video=$video screen_type=$sc
 nand_parts="256k(barebox)ro,128k(bareboxenv),3M(kernel),-(root)"
 rootfs_mtdblock_nand=3
 nand_device="mxc_nand"
-ubiroot="$hostname-rootfs"
+ubiroot="${global.hostname}-rootfs"
 device_type="nand"
 
 # set a fancy prompt (if support is compiled in)
arch/arm/boards/freescale-mx28-evk/env/config +5 -5
index 3951c5b..6628bf0 100644
@@ -24,21 +24,21 @@ rootfs_loc=net
 rootfs_type=ext2
 # where is the rootfs in case of 'rootfs_loc=disk' (linux name)
 rootfs_part_linux_dev=mmcblk0p4
-rootfsimage=rootfs-${hostname}.$rootfs_type
+rootfsimage=rootfs-${global.hostname}.$rootfs_type
 
 # where is the kernel image in case of 'kernel_loc=disk'
 kernel_part=disk0.2
 
-kernelimage=zImage-$hostname
-bareboximage=barebox-${hostname}.bin
-bareboxenvimage=barebox-${hostname}.bin
+kernelimage=zImage-${global.hostname}
+bareboximage=barebox-${global.hostname}.bin
+bareboxenvimage=barebox-${global.hostname}.bin
 
 if [ -n $user ]; then
 	bareboximage="$user"-"$bareboximage"
 	bareboxenvimage="$user"-"$bareboxenvimage"
 	kernelimage="$user"-"$kernelimage"
 	rootfsimage="$user"-"$rootfsimage"
-	nfsroot="/home/$user/nfsroot/$hostname"
+	nfsroot="/home/$user/nfsroot/${global.hostname}"
 else
 	nfsroot="/path/to/nfs/root"
 fi
arch/arm/boards/freescale-mx35-3-stack/env/config +6 -6
index 171ae8c..787c3df 100644
@@ -21,16 +21,16 @@ rootfs_loc=net
 
 # can be either 'jffs2' or 'ubifs'
 rootfs_type=ubifs
-rootfsimage=root-$hostname.$rootfs_type
+rootfsimage=root-${global.hostname}.$rootfs_type
 
-kernelimage=zImage-$hostname
-#kernelimage=uImage-$hostname
-#kernelimage=Image-$hostname
-#kernelimage=Image-$hostname.lzo
+kernelimage=zImage-${global.hostname}
+#kernelimage=uImage-${global.hostname}
+#kernelimage=Image-${global.hostname}
+#kernelimage=Image-${global.hostname}.lzo
 
 if [ -n $user ]; then
 	kernelimage="$user"-"$kernelimage"
-	nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
+	nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
 	rootfsimage="$user"-"$rootfsimage"
 else
 	nfsroot="$eth0.serverip:/path/to/nfs/root"
arch/arm/boards/freescale-mx53-loco/env/config +6 -6
index bceddaf..7226364 100644
@@ -22,16 +22,16 @@ rootfs_loc=net
 
 # can be either 'jffs2' or 'ubifs'
 rootfs_type=ubifs
-rootfsimage=root-$hostname.$rootfs_type
+rootfsimage=root-${global.hostname}.$rootfs_type
 
-kernelimage=zImage-$hostname
-#kernelimage=uImage-$hostname
-#kernelimage=Image-$hostname
-#kernelimage=Image-$hostname.lzo
+kernelimage=zImage-${global.hostname}
+#kernelimage=uImage-${global.hostname}
+#kernelimage=Image-${global.hostname}
+#kernelimage=Image-${global.hostname}.lzo
 
 if [ -n $user ]; then
 	kernelimage="$user"-"$kernelimage"
-	nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
+	nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
 	rootfsimage="$user"-"$rootfsimage"
 else
 	nfsroot="$eth0.serverip:/path/to/nfs/root"
arch/arm/boards/freescale-mx53-smd/env/config +6 -6
index d2afb29..3f9b0ca 100644
@@ -21,16 +21,16 @@ rootfs_loc=net
 
 # can be either 'jffs2' or 'ubifs'
 rootfs_type=ubifs
-rootfsimage=root-$hostname.$rootfs_type
+rootfsimage=root-${global.hostname}.$rootfs_type
 
-kernelimage=zImage-$hostname
-#kernelimage=uImage-$hostname
-#kernelimage=Image-$hostname
-#kernelimage=Image-$hostname.lzo
+kernelimage=zImage-${global.hostname}
+#kernelimage=uImage-${global.hostname}
+#kernelimage=Image-${global.hostname}
+#kernelimage=Image-${global.hostname}.lzo
 
 if [ -n $user ]; then
 	kernelimage="$user"-"$kernelimage"
-	nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
+	nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
 	rootfsimage="$user"-"$rootfsimage"
 else
 	nfsroot="$eth0.serverip:/path/to/nfs/root"
arch/arm/boards/friendlyarm-mini2440/env/config +6 -6
index 77cc34f..b32d1a6 100644
@@ -21,16 +21,16 @@ rootfs_loc=net
 
 # can be either 'jffs2' or 'ubifs'
 rootfs_type=ubifs
-rootfsimage=root-${hostname}.${rootfs_type}
+rootfsimage=root-${global.hostname}.${rootfs_type}
 
-kernelimage=zImage-${hostname}
-#kernelimage=uImage-$hostname
-#kernelimage=Image-$hostname
-#kernelimage=Image-$hostname.lzo
+kernelimage=zImage-${global.hostname}
+#kernelimage=uImage-${global.hostname}
+#kernelimage=Image-${global.hostname}
+#kernelimage=Image-${global.hostname}.lzo
 
 if [ -n $user ]; then
 	kernelimage="${user}"-"${kernelimage}"
-	nfsroot="${eth0.serverip}:/home/${user}/nfsroot/${hostname}"
+	nfsroot="${eth0.serverip}:/home/${user}/nfsroot/${global.hostname}"
 	rootfsimage="${user}"-"${rootfsimage}"
 else
 	nfsroot="${eth0.serverip}:/path/to/nfs/root"
arch/arm/boards/guf-cupid/env/config +6 -6
index 1be875d..505369a 100644
@@ -21,16 +21,16 @@ rootfs_loc=net
 
 # can be either 'jffs2' or 'ubifs'
 rootfs_type=ubifs
-rootfsimage=root-$hostname.$rootfs_type
+rootfsimage=root-${global.hostname}.$rootfs_type
 
-kernelimage=zImage-$hostname
-#kernelimage=uImage-$hostname
-#kernelimage=Image-$hostname
-#kernelimage=Image-$hostname.lzo
+kernelimage=zImage-${global.hostname}
+#kernelimage=uImage-${global.hostname}
+#kernelimage=Image-${global.hostname}
+#kernelimage=Image-${global.hostname}.lzo
 
 if [ -n $user ]; then
 	kernelimage="$user"-"$kernelimage"
-	nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
+	nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
 	rootfsimage="$user"-"$rootfsimage"
 else
 	nfsroot="$eth0.serverip:/path/to/nfs/root"
arch/arm/boards/guf-neso/env/config +6 -6
index 3013728..b39afda 100644
@@ -21,16 +21,16 @@ rootfs_loc=net
 
 # can be either 'jffs2' or 'ubifs'
 rootfs_type=ubifs
-rootfsimage=root-$hostname.$rootfs_type
+rootfsimage=root-${global.hostname}.$rootfs_type
 
-kernelimage=zImage-$hostname
-#kernelimage=uImage-$hostname
-#kernelimage=Image-$hostname
-#kernelimage=Image-$hostname.lzo
+kernelimage=zImage-${global.hostname}
+#kernelimage=uImage-${global.hostname}
+#kernelimage=Image-${global.hostname}
+#kernelimage=Image-${global.hostname}.lzo
 
 if [ -n $user ]; then
 	kernelimage="$user"-"$kernelimage"
-	nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
+	nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
 	rootfsimage="$user"-"$rootfsimage"
 else
 	nfsroot="$eth0.serverip:/path/to/nfs/root"
arch/arm/boards/karo-tx25/env/config +6 -6
index 28a5e7f..e592ce3 100644
@@ -21,16 +21,16 @@ rootfs_loc=net
 
 # can be either 'jffs2' or 'ubifs'
 rootfs_type=ubifs
-rootfsimage=root-$hostname.$rootfs_type
+rootfsimage=root-${global.hostname}.$rootfs_type
 
-kernelimage=zImage-$hostname
-#kernelimage=uImage-$hostname
-#kernelimage=Image-$hostname
-#kernelimage=Image-$hostname.lzo
+kernelimage=zImage-${global.hostname}
+#kernelimage=uImage-${global.hostname}
+#kernelimage=Image-${global.hostname}
+#kernelimage=Image-${global.hostname}.lzo
 
 if [ -n $user ]; then
 	kernelimage="$user"-"$kernelimage"
-	nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
+	nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
 	rootfsimage="$user"-"$rootfsimage"
 else
 	nfsroot="$eth0.serverip:/path/to/nfs/root"
arch/arm/boards/karo-tx28/env/config +6 -6
index b5222e9..fd9b282 100644
@@ -22,16 +22,16 @@ rootfs_loc=net
 
 # can be either 'jffs2' or 'ubifs'
 rootfs_type=ubifs
-rootfsimage=root-$hostname.$rootfs_type
+rootfsimage=root-${global.hostname}.$rootfs_type
 
-kernelimage=zImage-$hostname
-#kernelimage=uImage-$hostname
-#kernelimage=Image-$hostname
-#kernelimage=Image-$hostname.lzo
+kernelimage=zImage-${global.hostname}
+#kernelimage=uImage-${global.hostname}
+#kernelimage=Image-${global.hostname}
+#kernelimage=Image-${global.hostname}.lzo
 
 if [ -n $user ]; then
 	kernelimage="$user"-"$kernelimage"
-	nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
+	nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
 	rootfsimage="$user"-"$rootfsimage"
 else
 	nfsroot="$eth0.serverip:/path/to/nfs/root"
arch/arm/boards/panda/env/config +5 -5
index 29a63f3..af433c8 100644
@@ -18,14 +18,14 @@ kernel_loc=tftp
 # can be either 'net', 'nor', 'nand' or 'initrd'
 rootfs_loc=net
 
-kernelimage=zImage-$hostname
-#kernelimage=uImage-$hostname
-#kernelimage=Image-$hostname
-#kernelimage=Image-${hostname}.lzo
+kernelimage=zImage-${global.hostname}
+#kernelimage=uImage-${global.hostname}
+#kernelimage=Image-${global.hostname}
+#kernelimage=Image-${global.hostname}.lzo
 
 if [ -n $user ]; then
 	kernelimage="$user"-"$kernelimage"
-	nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
+	nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
 	rootfsimage="$user"-"$rootfsimage"
 else
 	nfsroot="$eth0.serverip:/path/to/nfs/root"
arch/arm/boards/pcm027/env/config +6 -6
index 3ed963c..5be7871 100644
@@ -21,16 +21,16 @@ rootfs_loc=net
 
 # can be either 'jffs2' or 'ubifs'
 rootfs_type=ubifs
-rootfsimage=root-$hostname.$rootfs_type
+rootfsimage=root-${global.hostname}.$rootfs_type
 
-kernelimage=zImage-$hostname
-#kernelimage=uImage-$hostname
-#kernelimage=Image-$hostname
-#kernelimage=Image-$hostname.lzo
+kernelimage=zImage-${global.hostname}
+#kernelimage=uImage-${global.hostname}
+#kernelimage=Image-${global.hostname}
+#kernelimage=Image-${global.hostname}.lzo
 
 if [ -n $user ]; then
 	kernelimage="$user"-"$kernelimage"
-	nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
+	nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
 	rootfsimage="$user"-"$rootfsimage"
 else
 	nfsroot="$eth0.serverip:/path/to/nfs/root"
arch/arm/boards/pcm037/env/config +6 -6
index fcdb777..852b83c 100644
@@ -21,16 +21,16 @@ rootfs_loc=net
 
 # can be either 'jffs2' or 'ubifs'
 rootfs_type=ubifs
-rootfsimage=root-$hostname.$rootfs_type
+rootfsimage=root-${global.hostname}.$rootfs_type
 
-kernelimage=zImage-$hostname
-#kernelimage=uImage-$hostname
-#kernelimage=Image-$hostname
-#kernelimage=Image-$hostname.lzo
+kernelimage=zImage-${global.hostname}
+#kernelimage=uImage-${global.hostname}
+#kernelimage=Image-${global.hostname}
+#kernelimage=Image-${global.hostname}.lzo
 
 if [ -n $user ]; then
 	kernelimage="$user"-"$kernelimage"
-	nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
+	nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
 	rootfsimage="$user"-"$rootfsimage"
 else
 	nfsroot="$eth0.serverip:/path/to/nfs/root"
arch/arm/boards/pcm043/env/config +6 -6
index 644c7fb..c2d31a4 100644
@@ -21,16 +21,16 @@ rootfs_loc=net
 
 # can be either 'jffs2' or 'ubifs'
 rootfs_type=ubifs
-rootfsimage=root-$hostname.$rootfs_type
+rootfsimage=root-${global.hostname}.$rootfs_type
 
-kernelimage=zImage-$hostname
-#kernelimage=uImage-$hostname
-#kernelimage=Image-$hostname
-#kernelimage=Image-$hostname.lzo
+kernelimage=zImage-${global.hostname}
+#kernelimage=uImage-${global.hostname}
+#kernelimage=Image-${global.hostname}
+#kernelimage=Image-${global.hostname}.lzo
 
 if [ -n $user ]; then
 	kernelimage="$user"-"$kernelimage"
-	nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
+	nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
 	rootfsimage="$user"-"$rootfsimage"
 else
 	nfsroot="$eth0.serverip:/path/to/nfs/root"
arch/arm/boards/pcm049/env/config +6 -6
index efbe9ea..f5b78e5 100644
@@ -21,16 +21,16 @@ rootfs_loc=net
 
 # can be either 'jffs2' or 'ubifs'
 rootfs_type=ubifs
-rootfsimage=root-${hostname}.$rootfs_type
+rootfsimage=root-${global.hostname}.$rootfs_type
 
-kernelimage=zImage-$hostname
-#kernelimage=uImage-$hostname
-#kernelimage=Image-$hostname
-#kernelimage=Image-${hostname}.lzo
+kernelimage=zImage-${global.hostname}
+#kernelimage=uImage-${global.hostname}
+#kernelimage=Image-${global.hostname}
+#kernelimage=Image-${global.hostname}.lzo
 
 if [ -n $user ]; then
 	kernelimage="$user"-"$kernelimage"
-	nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
+	nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
 	rootfsimage="$user"-"$rootfsimage"
 else
 	nfsroot="$eth0.serverip:/path/to/nfs/root"
arch/arm/boards/phycard-a-l1/env/config +8 -8
index e0f4dcc..6add45c 100644
@@ -26,26 +26,26 @@ rootfs_loc=nand
 rootfs_type=jffs2
 # where is the rootfs in case of 'rootfs_loc=disk' (linux name)
 rootfs_part_linux_dev=mmcblk0p4
-rootfsimage=rootfs-${hostname}.$rootfs_type
+rootfsimage=rootfs-${global.hostname}.$rootfs_type
 
 # where is the kernel image in case of 'kernel_loc=disk'
 kernel_part=disk0.2
 
 # The image type of the kernel. Can be uimage, zimage, raw or raw_lzo
-#kernelimage=zImage-$hostname
-kernelimage=uImage-$hostname
-#kernelimage=Image-$hostname
-#kernelimage=Image-$hostname.lzo
+#kernelimage=zImage-${global.hostname}
+kernelimage=uImage-${global.hostname}
+#kernelimage=Image-${global.hostname}
+#kernelimage=Image-${global.hostname}.lzo
 
-bareboximage=barebox-${hostname}.bin
-bareboxenvimage=barebox-${hostname}.bin
+bareboximage=barebox-${global.hostname}.bin
+bareboxenvimage=barebox-${global.hostname}.bin
 
 if [ -n $user ]; then
 	bareboximage="$user"-"$bareboximage"
 	bareboxenvimage="$user"-"$bareboxenvimage"
 	kernelimage="$user"-"$kernelimage"
 	rootfsimage="$user"-"$rootfsimage"
-	nfsroot="/home/$user/nfsroot/$hostname"
+	nfsroot="/home/$user/nfsroot/${global.hostname}"
 else
 	nfsroot="/path/to/nfs/root"
 fi
arch/arm/boards/phycard-a-xl2/env/config +6 -6
index 59e8eb3..6bc4a59 100644
@@ -20,16 +20,16 @@ rootfs_loc=net
 
 # can be either 'jffs2' or 'ubifs'
 rootfs_type=ubifs
-rootfsimage=root-${hostname}.$rootfs_type
+rootfsimage=root-${global.hostname}.$rootfs_type
 
-kernelimage=zImage-$hostname
-#kernelimage=uImage-$hostname
-#kernelimage=Image-$hostname
-#kernelimage=Image-${hostname}.lzo
+kernelimage=zImage-${global.hostname}
+#kernelimage=uImage-${global.hostname}
+#kernelimage=Image-${global.hostname}
+#kernelimage=Image-${global.hostname}.lzo
 
 if [ -n $user ]; then
 	kernelimage="$user"-"$kernelimage"
-	nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
+	nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
 	rootfsimage="$user"-"$rootfsimage"
 else
 	nfsroot="$eth0.serverip:/path/to/nfs/root"
arch/arm/boards/phycard-i.MX27/env/config +6 -6
index 367029b..e7a77fe 100644
@@ -21,16 +21,16 @@ rootfs_loc=net
 
 # can be either 'jffs2' or 'ubifs'
 rootfs_type=ubifs
-rootfsimage=root-$hostname.$rootfs_type
+rootfsimage=root-${global.hostname}.$rootfs_type
 
-kernelimage=zImage-$hostname
-#kernelimage=uImage-$hostname
-#kernelimage=Image-$hostname
-#kernelimage=Image-$hostname.lzo
+kernelimage=zImage-${global.hostname}
+#kernelimage=uImage-${global.hostname}
+#kernelimage=Image-${global.hostname}
+#kernelimage=Image-${global.hostname}.lzo
 
 if [ -n $user ]; then
 	kernelimage="$user"-"$kernelimage"
-	nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
+	nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
 	rootfsimage="$user"-"$rootfsimage"
 else
 	nfsroot="$eth0.serverip:/path/to/nfs/root"
arch/arm/boards/scb9328/env/config +6 -6
index a8eace7..77dbf03 100644
@@ -21,16 +21,16 @@ rootfs_loc=net
 
 # can be either 'jffs2' or 'ubifs'
 rootfs_type=ubifs
-rootfsimage=root-$hostname.$rootfs_type
+rootfsimage=root-${global.hostname}.$rootfs_type
 
-kernelimage=zImage-$hostname
-#kernelimage=uImage-$hostname
-#kernelimage=Image-$hostname
-#kernelimage=Image-$hostname.lzo
+kernelimage=zImage-${global.hostname}
+#kernelimage=uImage-${global.hostname}
+#kernelimage=Image-${global.hostname}
+#kernelimage=Image-${global.hostname}.lzo
 
 if [ -n $user ]; then
 	kernelimage="$user"-"$kernelimage"
-	nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
+	nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
 	rootfsimage="$user"-"$rootfsimage"
 else
 	nfsroot="$eth0.serverip:/path/to/nfs/root"
defaultenv/config +8 -8
index 7b61d29..81d6f95 100644
@@ -31,25 +31,25 @@ oftree_loc=tftp
 rootfs_type=ubifs
 # where is the rootfs in case of 'rootfs_loc=disk' (linux name)
 rootfs_part_linux_dev=mmcblk0p4
-rootfsimage=rootfs-${hostname}.$rootfs_type
+rootfsimage=rootfs-${global.hostname}.$rootfs_type
 
 # where is the kernel image in case of 'kernel_loc=disk'
 kernel_part=disk0.2
 
-kernelimage=zImage-$hostname
-#kernelimage=uImage-$hostname
-#kernelimage=Image-$hostname
-#kernelimage=Image-$hostname.lzo
+kernelimage=zImage-${global.hostname}
+#kernelimage=uImage-${global.hostname}
+#kernelimage=Image-${global.hostname}
+#kernelimage=Image-${global.hostname}.lzo
 
-bareboximage=barebox-${hostname}.bin
-bareboxenvimage=barebox-${hostname}.bin
+bareboximage=barebox-${global.hostname}.bin
+bareboxenvimage=barebox-${global.hostname}.bin
 
 if [ -n $user ]; then
 	bareboximage="$user"-"$bareboximage"
 	bareboxenvimage="$user"-"$bareboxenvimage"
 	kernelimage="$user"-"$kernelimage"
 	rootfsimage="$user"-"$rootfsimage"
-	nfsroot="/home/$user/nfsroot/$hostname"
+	nfsroot="/home/$user/nfsroot/${global.hostname}"
 else
 	nfsroot="/path/to/nfs/root"
 fi
net/dhcp.c +2 -2
index 79efa3e..e73cc70 100644
@@ -175,7 +175,7 @@ struct dhcp_opt dhcp_options[] = {
 	}, {
 		.option = 12,
 		.handle = env_str_handle,
-		.barebox_var_name = "hostname",
+		.barebox_var_name = "global.hostname",
 	}, {
 		.option = 15,
 		.handle = env_str_handle,
@@ -248,7 +248,7 @@ struct dhcp_param dhcp_params[] = {
 	{
 		.option = DHCP_HOSTNAME,
 		.handle = dhcp_set_string_options,
-		.barebox_var_name = "hostname",
+		.barebox_var_name = "global.hostname",
 	}, {
 		.option = DHCP_VENDOR_ID,
 		.handle = dhcp_set_string_options,
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

PATCH v2 5/11 dhcp: add retries limit support

In reply to Jean-Christophe PLAGNIOL-VILLARD

via -r opt, global.dhcp.retries or dhcp_retries

set the priority order;

This will allow to do not stay infinite loop if no dhcp availlable for boot sequence as example

---
 net/dhcp.c |   33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)
net/dhcp.c +31 -2
index 02dc529..a5fcb14 100644
@@ -700,13 +700,26 @@ static int dhcp_global_init(void)
 }
 late_initcall(dhcp_global_init);
 
+static void dhcp_getenv_int(const char *name, int *i)
+{
+	const char* str = getenv(name);
+
+	if (!str)
+		return;
+
+	*i = simple_strtoul(str, NULL, 10);
+}
+
 static int do_dhcp(int argc, char *argv[])
 {
 	int ret, opt;
+	int retries = -1;
 
 	dhcp_reset_env();
 
-	while((opt = getopt(argc, argv, "H:v:c:u:U:")) > 0) {
+	dhcp_getenv_int("global.dhcp.retries", &retries);
+
+	while((opt = getopt(argc, argv, "H:v:c:u:U:r:")) > 0) {
 		switch(opt) {
 		case 'H':
 			dhcp_set_param_data(DHCP_HOSTNAME, optarg);
@@ -723,9 +736,17 @@ static int do_dhcp(int argc, char *argv[])
 		case 'U':
 			dhcp_set_param_data(DHCP_USER_CLASS, optarg);
 			break;
+		case 'r':
+			retries = simple_strtoul(optarg, NULL, 10);
+			break;
 		}
 	}
 
+	if (!retries) {
+		printf("retries is set to zero, set it to -1\n");
+		retries = -1;
+	}
+
 	dhcp_con = net_udp_new(0xffffffff, PORT_BOOTPS, dhcp_handler, NULL);
 	if (IS_ERR(dhcp_con)) {
 		ret = PTR_ERR(dhcp_con);
@@ -746,11 +767,17 @@ static int do_dhcp(int argc, char *argv[])
 	while (dhcp_state != BOUND) {
 		if (ctrlc())
 			break;
+		if (!retries) {
+			ret = ETIMEDOUT;
+			goto out1;
+		}
 		net_poll();
 		if (is_timeout(dhcp_start, 3 * SECOND)) {
 			dhcp_start = get_time_ns();
 			printf("T ");
 			ret = bootp_request();
+			/* no need to check if retries > 0 as we check if != 0 */
+			retries--;
 			if (ret)
 				goto out1;
 		}
@@ -785,7 +812,8 @@ BAREBOX_CMD_HELP_OPT  ("-u <client_uuid>",
 BAREBOX_CMD_HELP_OPT  ("-U <user_class>",
 "DHCP User class (code 77) submitted in DHCP requests. It can\n"
 "be used in the DHCP server's configuration to select options\n"
-"(e.g. bootfile or server) which are valid for barebox clients only.\n");
+"(e.g. bootfile or server) which are valid for barebox clients only.\n")
+BAREBOX_CMD_HELP_OPT  ("-r <retry>", "retry limi\n");
 BAREBOX_CMD_HELP_END
 
 BAREBOX_CMD_START(dhcp)
@@ -804,3 +832,4 @@ BAREBOX_MAGICVAR_NAMED(global_dhcp_client_id, global.dhcp.client_id, "cliend id
 BAREBOX_MAGICVAR_NAMED(global_dhcp_user_class, global.dhcp.user_class, "user class to send to the DHCP server");
 BAREBOX_MAGICVAR_NAMED(global_dhcp_tftp_server_name, global.dhcp.tftp_server_name, "TFTP server Name returned from DHCP request");
 BAREBOX_MAGICVAR_NAMED(global_dhcp_oftree_file, global.dhcp.oftree_file, "OF tree returned from DHCP request (option 224)");
+BAREBOX_MAGICVAR_NAMED(global_dhcp_retries, global.dhcp.retries, "retry limit");
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#31 lore raw

PATCH v2 10/11 defaultenv-2: add net boot support with kernel and oftree via nfs

In reply to Jean-Christophe PLAGNIOL-VILLARD

This also support the bootp.

---
 defaultenv-2/base/boot/nfs |   75 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 defaultenv-2/base/boot/nfs
defaultenv-2/base/boot/nfs new file +75 -0
new file mode 100644
index 0000000..892f103
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+if [ "$1" = menu ]; then
+	boot-menu-add-entry "$0" "network (nfs, nfs)"
+	exit
+fi
+
+path="/mnt/tftp"
+
+# to get the dhcp info (global.dhcp.rootpath, global.dhcp.bootfile, global.dhcp.oftree_file)
+ifdown eth0
+ifup eth0
+
+global.bootm.image="${path}/${global.user}-linux-${global.hostname}"
+#global.bootm.oftree="${path}/${global.user}-oftree-${global.hostname}"
+
+if [ -n "${global.dhcp.rootpath}" ]; then
+	bootp=1
+	nfsroot="${global.dhcp.rootpath}"
+else
+	nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
+fi
+
+dhcp_patch_base="/mnt/dhcp"
+if [ -d "${dhcp_patch_base}" ]; then
+	umount "${dhcp_patch_base}"
+else
+	mkdir "${dhcp_patch_base}"
+fi
+
+if [ -n "${global.dhcp.bootfile}" ]; then
+	bootp=1
+	path="${dhcp_patch_base}/bootfile"
+
+	if [ -d "${path}" ]; then
+		umount "${path}"
+	else
+		mkdir "${path}"
+	fi
+
+	dirname "${global.dhcp.bootfile}" mnt
+	basename "${global.dhcp.bootfile}" bootfile
+
+	mount -t nfs "${eth0.serverip}:${mnt}" "${path}"
+
+	global.bootm.image="${path}/${bootfile}"
+fi
+
+if [ -n "${global.dhcp.oftree_file}" ]; then
+	bootp=1
+	path="${dhcp_patch_base}/oftree_file"
+
+	if [ -d "${path}" ]; then
+		umount "${path}"
+	else
+		mkdir "${path}"
+	fi
+
+	dirname "${global.dhcp.oftree_file}" mnt
+	basename "${global.dhcp.oftree_file}" bootfile
+
+	mount -t nfs "${eth0.serverip}:${mnt}" "${path}"
+
+	global.bootm.oftree="${path}/${bootfile}"
+fi
+
+if [ x${bootp} = x1 ]; then
+	echo "Boot via bootp/dhcp on server ${eth0.serverip}"
+	[ -n "${global.dhcp.bootfile}" ] && echo "bootm.image => ${global.dhcp.bootfile}"
+	[ -n "${global.dhcp.oftree_file}" ] && echo "bootm.oftree => ${global.dhcp.oftree_file}"
+	[ -n "${global.dhcp.rootpath}" ] && echo "nfsroot => ${global.dhcp.rootpath}"
+fi
+
+bootargs-ip
+bootargs-root-nfs -n "$nfsroot"
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#32 lore raw

PATCH v2 11/11 defaultenv-2: add symbolic link support to boot/nfs

In reply to Jean-Christophe PLAGNIOL-VILLARD

If the symlink is not find on barebox try on the host. So we are back compatible with nfs command.

---
 defaultenv-2/base/boot/nfs |   64 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 61 insertions(+), 3 deletions(-)
defaultenv-2/base/boot/nfs +61 -3
index 892f103..bf27d38 100644
@@ -5,6 +5,8 @@ if [ "$1" = menu ]; then
 	exit
 fi
 
+. /env/data/ansi-colors
+
 path="/mnt/tftp"
 
 # to get the dhcp info (global.dhcp.rootpath, global.dhcp.bootfile, global.dhcp.oftree_file)
@@ -44,6 +46,24 @@ if [ -n "${global.dhcp.bootfile}" ]; then
 	mount -t nfs "${eth0.serverip}:${mnt}" "${path}"
 
 	global.bootm.image="${path}/${bootfile}"
+
+	if [ -L "${global.bootm.image}" ]; then
+		readlink -f "${global.bootm.image}" bootfile_symlink
+
+		# if the file is not on barebox fs assume it's on the host
+		if [ ! -e "${bootfile_symlink}" ]; then
+			dirname "${bootfile_symlink}" mnt
+			basename "${bootfile_symlink}" bootfile
+
+			umount "${path}"
+			mount -t nfs "${eth0.serverip}:${mnt}" "${path}"
+
+			bootfile_symlink="${path}/${bootfile_symlink}"
+			global.bootm.image="${path}/${bootfile}"
+		else
+			global.bootm.image="${bootfile_symlink}"
+		fi
+	fi
 fi
 
 if [ -n "${global.dhcp.oftree_file}" ]; then
@@ -62,13 +82,51 @@ if [ -n "${global.dhcp.oftree_file}" ]; then
 	mount -t nfs "${eth0.serverip}:${mnt}" "${path}"
 
 	global.bootm.oftree="${path}/${bootfile}"
+
+	if [ -L "${global.bootm.oftree}" ]; then
+		readlink -f "${global.bootm.oftree}" oftree_symlink
+
+		# if the file is not on barebox fs assume it's on the host
+		if [ ! -e "${oftree_symlink}" ]; then
+			dirname "${oftree_symlink}" mnt
+			basename "${oftree_symlink}" bootfile
+
+			umount "${path}"
+			mount -t nfs "${eth0.serverip}:${mnt}" "${path}"
+
+			oftree_symlink="${path}/${oftree_symlink}"
+			global.bootm.oftree="${path}/${bootfile}"
+		else
+			global.bootm.oftree="${oftree_symlink}"
+		fi
+	fi
 fi
 
 if [ x${bootp} = x1 ]; then
 	echo "Boot via bootp/dhcp on server ${eth0.serverip}"
-	[ -n "${global.dhcp.bootfile}" ] && echo "bootm.image => ${global.dhcp.bootfile}"
-	[ -n "${global.dhcp.oftree_file}" ] && echo "bootm.oftree => ${global.dhcp.oftree_file}"
-	[ -n "${global.dhcp.rootpath}" ] && echo "nfsroot => ${global.dhcp.rootpath}"
+	if [ -n "${global.dhcp.bootfile}" ]; then
+		echo -n "bootm.image => "
+		if [ "x${bootfile_symlink}" != x ]; then
+			echo -e -n "${CYAN}${global.dhcp.bootfile}${NC}"
+			echo -n " -> ${bootfile_symlink}"
+		else
+			echo -n "${global.dhcp.bootfile}"
+		fi
+		echo ""
+	fi
+
+	if [ -n "${global.dhcp.oftree_file}" ]; then
+		echo "bootm.oftree => "
+		if [ "x${oftree_symlink}" != x ]; then
+			echo -e -n "${CYAN}${global.dhcp.oftree_file}${NC}"
+			echo -n " -> ${oftree_symlink}"
+		else
+			echo -n "${global.dhcp.oftree_file}"
+		fi
+		echo ""
+	fi
+
+	[ -n "${global.dhcp.rootpath}" ] && echo "nfsroot -> ${global.dhcp.rootpath}"
 fi
 
 bootargs-ip
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

PATCH v2 6/11 defaultenv-2: eth0 add default global.dhcp.vendor_id

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 defaultenv-2/base/network/eth0 |    1 +
 1 file changed, 1 insertion(+)
defaultenv-2/base/network/eth0 +1 -0
index 048a288..7e731ca 100644
@@ -2,6 +2,7 @@
 
 # ip setting (static/dhcp)
 ip=dhcp
+global.dhcp.vendor_id=barebox-${global.hostname}
 
 # static setup used if ip=static
 ipaddr=
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer
#12 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD

Given that the bootp support seems to have nearly nothing in common with the boot/net file wouldn't it be better to just add a new file boot/bootp?

Sascha

Quoted 60 lines
---
 defaultenv-2/base/boot/net |   35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
defaultenv-2/base/boot/net +34 -1
index 922bef1..ff05077 100644
@@ -7,8 +7,41 @@ fi
 
 path="/mnt/tftp"
 
+# to get the dhcp info (global.dhcp.rootpath, global.dhcp.bootfile, global.dhcp.oftree_file)
+ifdown eth0
+ifup eth0
+
 global.bootm.image="${path}/${global.user}-linux-${global.hostname}"
 #global.bootm.oftree="${path}/${global.user}-oftree-${global.hostname}"
-nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
+
+if [ -n "${global.dhcp.rootpath}" ]; then
+	bootp=1
+	nfsroot="${global.dhcp.rootpath}"
+else
+	nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
+fi
+
+if [ -n "${global.dhcp.bootfile}" -o -n "${global.dhcp.oftree_file}" ]; then
+	bootp=1
+	path="/mnt/dhcp"
+
+	if [ -d "${path}" ]; then
+		umount "${path}"
+	else
+		mkdir "${path}"
+	fi
+	mount -t tftp $eth0.serverip "${path}"
+
+	[ -n "${global.dhcp.bootfile}" ] && global.bootm.image="${path}/${global.dhcp.bootfile}"
+	[ -n "${global.dhcp.oftree_file}" ] && global.bootm.oftree="${path}/${global.dhcp.oftree_file}"
+fi
+
+if [ x${bootp} = x1 ]; then
+	echo "Boot via bootp/dhcp on server ${eth0.serverip}"
+	[ -n "${global.dhcp.bootfile}" ] && echo "bootm.image => ${global.dhcp.bootfile}"
+	[ -n "${global.dhcp.oftree_file}" ] && echo "bootm.oftree => ${global.dhcp.oftree_file}"
+	[ -n "${global.dhcp.rootpath}" ] && echo "nfsroot => ${global.dhcp.rootpath}"
+fi
+
 bootargs-ip
 bootargs-root-nfs -n "$nfsroot"
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#13 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

Quoted 6 lines · Sascha Hauer
Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD

Given that the bootp support seems to have nearly nothing in common with the boot/net file wouldn't it be better to just add a new file boot/bootp?

why not with the boot sequence we can do so

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#14 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · Sascha Hauer
Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD

Given that the bootp support seems to have nearly nothing in common with the boot/net file wouldn't it be better to just add a new file boot/bootp?

why not with the boot sequence we can do so

I try to implement it but at the end we duplicate it As we may want to just pass the rootpath via bootp

and the reset hardcoded

It's better to keep it's support in the same file as the static params are fallback one

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

maintainer
#15 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · Sascha Hauer
Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD

Given that the bootp support seems to have nearly nothing in common with the boot/net file wouldn't it be better to just add a new file boot/bootp?

Quoted 8 lines
Quoted 1 line

why not with the boot sequence we can do so

I try to implement it but at the end we duplicate it As we may want to just pass the rootpath via bootp

and the reset hardcoded

It's better to keep it's support in the same file as the static params are fallback one

I really don't like the approach at all.

The current /env/boot/* scripts are written with the intention that they should be simple scripts which are easily adjustable. They are also meant as templates to add other board/company/project specific files.

Now it only takes one patch series to turn them into complex scripts which after staring at them for half an hour I still not fully understand. I don't understand why this must be so, because it seems what the scripts do is a complex way of saying:

path=/mnt/tftp global.bootm.image="${path}/${global.dhcp.bootfile}" global.bootm.oftree="${path}/${global.dhcp.oftree_file}" nfsroot="${global.dhcp.rootpath}"
bootargs-ip
bootargs-root-nfs -n "$nfsroot"

Since you introduced a boot sequence support it should be easy to try bootp like above and fall back to the regular net boot if it fails.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer
#33 lore raw

Re: [PATCH 11/11] defaultenv-2: add symbolic link support to boot/nfs

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 32 lines · Jean-Christophe PLAGNIOL-VILLARD

If the symlink is not find on barebox try on the host. So we are back compatible with nfs command.

---
 defaultenv-2/base/boot/nfs |   64 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 61 insertions(+), 3 deletions(-)
defaultenv-2/base/boot/nfs +9 -0
index 892f103..bf27d38 100644
@@ -5,6 +5,8 @@ if [ "$1" = menu ]; then
 	exit
 fi
 
+. /env/data/ansi-colors
+
 path="/mnt/tftp"
 
 # to get the dhcp info (global.dhcp.rootpath, global.dhcp.bootfile, global.dhcp.oftree_file)
@@ -44,6 +46,24 @@ if [ -n "${global.dhcp.bootfile}" ]; then
 	mount -t nfs "${eth0.serverip}:${mnt}" "${path}"
 
 	global.bootm.image="${path}/${bootfile}"
+
+	if [ -L "${global.bootm.image}" ]; then
+		readlink -f "${global.bootm.image}" bootfile_symlink
+
+		# if the file is not on barebox fs assume it's on the host
+		if [ ! -e "${bootfile_symlink}" ]; then
+			dirname "${bootfile_symlink}" mnt

defaultenv-2/base/boot/nfs if [ -n "${global.dhcp.bootfile}" ]; then · line 65

Quoted 10 lines
defaultenv-2/base/boot/nfs +10 -0
+			basename "${bootfile_symlink}" bootfile
+
+			umount "${path}"
+			mount -t nfs "${eth0.serverip}:${mnt}" "${path}"
+
+			bootfile_symlink="${path}/${bootfile_symlink}"
+			global.bootm.image="${path}/${bootfile}"
+		else
+			global.bootm.image="${bootfile_symlink}"
+		fi

symbolic links either point to the target or not, but doing magic on them to try to interpret where they *could* point to is no option.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer
#26 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD
---
 defaultenv-2/base/boot/net |   35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
defaultenv-2/base/boot/net +0 -0
index 922bef1..ff05077 100644

defaultenv-2/base/boot/net fi · line 12

Quoted 6 lines
defaultenv-2/base/boot/net +3 -0
@@ -7,8 +7,41 @@ fi
 
 path="/mnt/tftp"
 
+# to get the dhcp info (global.dhcp.rootpath, global.dhcp.bootfile, global.dhcp.oftree_file)
+ifdown eth0
+ifup eth0

If ifup has been called before the global.dhcp. variables are already set. Why do you force to do this again?

Quoted 12 lines
defaultenv-2/base/boot/net +9 -1
+
 global.bootm.image="${path}/${global.user}-linux-${global.hostname}"
 #global.bootm.oftree="${path}/${global.user}-oftree-${global.hostname}"
-nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
+
+if [ -n "${global.dhcp.rootpath}" ]; then
+	bootp=1
+	nfsroot="${global.dhcp.rootpath}"
+else
+	nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
+fi
+

defaultenv-2/base/boot/net fi · line 33

Quoted 10 lines
defaultenv-2/base/boot/net +10 -0
+if [ -n "${global.dhcp.bootfile}" -o -n "${global.dhcp.oftree_file}" ]; then
+	bootp=1
+	path="/mnt/dhcp"
+
+	if [ -d "${path}" ]; then
+		umount "${path}"
+	else
+		mkdir "${path}"
+	fi
+	mount -t tftp $eth0.serverip "${path}"

That's exactly the path that's already mounted to /mnt/tftp. Why are you doing this?

Quoted 23 lines
defaultenv-2/base/boot/net +12 -0
+
+	[ -n "${global.dhcp.bootfile}" ] && global.bootm.image="${path}/${global.dhcp.bootfile}"
+	[ -n "${global.dhcp.oftree_file}" ] && global.bootm.oftree="${path}/${global.dhcp.oftree_file}"
+fi
+
+if [ x${bootp} = x1 ]; then
+	echo "Boot via bootp/dhcp on server ${eth0.serverip}"
+	[ -n "${global.dhcp.bootfile}" ] && echo "bootm.image => ${global.dhcp.bootfile}"
+	[ -n "${global.dhcp.oftree_file}" ] && echo "bootm.oftree => ${global.dhcp.oftree_file}"
+	[ -n "${global.dhcp.rootpath}" ] && echo "nfsroot => ${global.dhcp.rootpath}"
+fi
+
 bootargs-ip
 bootargs-root-nfs -n "$nfsroot"
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer
#8 lore raw

Re: [PATCH 07/11] defaultenv-2/ip: add dhcp-barebox support

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 24 lines · Jean-Christophe PLAGNIOL-VILLARD
---
 defaultenv-2/base/bin/bootargs-ip |    2 ++
 defaultenv-2/base/bin/ifup        |    2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
defaultenv-2/base/bin/bootargs-ip +2 -0
index 2d4486c..caeb5dd 100644
@@ -6,6 +6,8 @@
 
 if [ $ip = dhcp ]; then
 	global.linux.bootargs.dyn.ip="ip=dhcp"
+elif [ $ip = dhcp-barebox ]; then
+	global.linux.bootargs.dyn.ip="ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask::eth0:"
 else
 	global.linux.bootargs.dyn.ip="ip=$ipaddr:$serverip:$gateway:$netmask::eth0:"
 fi
defaultenv-2/base/bin/ifup +0 -0
index 37b986c..554c35e 100644

defaultenv-2/base/bin/ifup if [ "$ip" = static ]; then · line 58

Quoted 8 lines
defaultenv-2/base/bin/ifup +1 -1
@@ -52,7 +52,7 @@ if [ "$ip" = static ]; then
 	${interface}.serverip=$serverip
 	${interface}.gateway=$gateway
 	ret=0
-elif [ "$ip" = dhcp ]; then
+elif [ "$ip" = dhcp -o "$ip" = dhcp-barebox ]; then
 	dhcp
 	ret=$?
 	if [ $ret = 0 -a -n "$serverip" ]; then

The ifup script is used to configure networking for barebox. This is not the place for configuring kernel behaviour. If you want this add an option to the bootargs-ip script or add a bootargs-ip-barebox script.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#9 lore raw

Re: [PATCH 07/11] defaultenv-2/ip: add dhcp-barebox support

Quoted 29 lines · Sascha Hauer
Quoted 28 lines · Jean-Christophe PLAGNIOL-VILLARD
---
 defaultenv-2/base/bin/bootargs-ip |    2 ++
 defaultenv-2/base/bin/ifup        |    2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
defaultenv-2/base/bin/bootargs-ip +2 -0
index 2d4486c..caeb5dd 100644
@@ -6,6 +6,8 @@
 
 if [ $ip = dhcp ]; then
 	global.linux.bootargs.dyn.ip="ip=dhcp"
+elif [ $ip = dhcp-barebox ]; then
+	global.linux.bootargs.dyn.ip="ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask::eth0:"
 else
 	global.linux.bootargs.dyn.ip="ip=$ipaddr:$serverip:$gateway:$netmask::eth0:"
 fi
defaultenv-2/base/bin/ifup +0 -1
index 37b986c..554c35e 100644
@@ -52,7 +52,7 @@ if [ "$ip" = static ]; then
 	${interface}.serverip=$serverip
 	${interface}.gateway=$gateway
 	ret=0
-elif [ "$ip" = dhcp ]; then
Quoted 8 lines

defaultenv-2/base/bin/ifup if [ "$ip" = static ]; then · line 58

Quoted 4 lines
defaultenv-2/base/bin/ifup +1 -0
+elif [ "$ip" = dhcp -o "$ip" = dhcp-barebox ]; then
 	dhcp
 	ret=$?
 	if [ $ret = 0 -a -n "$serverip" ]; then

The ifup script is used to configure networking for barebox. This is not the place for configuring kernel behaviour. If you want this add an option to the bootargs-ip script or add a bootargs-ip-barebox script.

yes but if you put dhcp-barebox mean 2 stuff you want dhcp in barebox and then pass then to the kernel

we specify this before I wish to keep this specification

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#16 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

In reply to Sascha Hauer
Quoted 36 lines · Sascha Hauer
Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · Sascha Hauer
Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD

Given that the bootp support seems to have nearly nothing in common with the boot/net file wouldn't it be better to just add a new file boot/bootp?

Quoted 8 lines
Quoted 1 line

why not with the boot sequence we can do so

I try to implement it but at the end we duplicate it As we may want to just pass the rootpath via bootp

and the reset hardcoded

It's better to keep it's support in the same file as the static params are fallback one

I really don't like the approach at all.

The current /env/boot/* scripts are written with the intention that they should be simple scripts which are easily adjustable. They are also meant as templates to add other board/company/project specific files.

Now it only takes one patch series to turn them into complex scripts which after staring at them for half an hour I still not fully understand. I don't understand why this must be so, because it seems what the scripts do is a complex way of saying:

path=/mnt/tftp global.bootm.image="${path}/${global.dhcp.bootfile}" global.bootm.oftree="${path}/${global.dhcp.oftree_file}" nfsroot="${global.dhcp.rootpath}"
bootargs-ip
bootargs-root-nfs -n "$nfsroot"

Quoted 2 lines

Since you introduced a boot sequence support it should be easy to try bootp like above and fall back to the regular net boot if it fails.

the issue with nfs is the mount path

you need to mount dirname file

but if the file is a symlink this is where it's complex you need to resolv it and mount the real path

I'd prefer to avoid it but nfs is like this
as you may just be allow to see a part of the host tree via nfs and the host have different mountpoint

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#34 lore raw

Re: [PATCH 11/11] defaultenv-2: add symbolic link support to boot/nfs

In reply to Sascha Hauer
Quoted 38 lines · Sascha Hauer
Quoted 37 lines · Jean-Christophe PLAGNIOL-VILLARD

If the symlink is not find on barebox try on the host. So we are back compatible with nfs command.

---
 defaultenv-2/base/boot/nfs |   64 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 61 insertions(+), 3 deletions(-)
defaultenv-2/base/boot/nfs +14 -0
index 892f103..bf27d38 100644
@@ -5,6 +5,8 @@ if [ "$1" = menu ]; then
 	exit
 fi
 
+. /env/data/ansi-colors
+
 path="/mnt/tftp"
 
 # to get the dhcp info (global.dhcp.rootpath, global.dhcp.bootfile, global.dhcp.oftree_file)
@@ -44,6 +46,24 @@ if [ -n "${global.dhcp.bootfile}" ]; then
 	mount -t nfs "${eth0.serverip}:${mnt}" "${path}"
 
 	global.bootm.image="${path}/${bootfile}"
+
+	if [ -L "${global.bootm.image}" ]; then
+		readlink -f "${global.bootm.image}" bootfile_symlink
+
+		# if the file is not on barebox fs assume it's on the host
+		if [ ! -e "${bootfile_symlink}" ]; then
+			dirname "${bootfile_symlink}" mnt
+			basename "${bootfile_symlink}" bootfile
+
+			umount "${path}"
+			mount -t nfs "${eth0.serverip}:${mnt}" "${path}"
+
Quoted 8 lines

defaultenv-2/base/boot/nfs if [ -n "${global.dhcp.bootfile}" ]; then · line 65

Quoted 5 lines
defaultenv-2/base/boot/nfs +5 -0
+			bootfile_symlink="${path}/${bootfile_symlink}"
+			global.bootm.image="${path}/${bootfile}"
+		else
+			global.bootm.image="${bootfile_symlink}"
+		fi

symbolic links either point to the target or not, but doing magic on them to try to interpret where they *could* point to is no option.

the issue with nfs is the mount path
you need to mount dirname file

but if the file is a symlink this is where it's complex you need to resolv it and mount the real path

I'd prefer to avoid it but nfs is like this
as you may just be allow to see a part of the host tree via nfs and the host have different mountpoint

I use this feature for years on U-Boot before and now on the defaultenv The nfs symlink was managed via the nfs command now that we use the fs on defaultenv-2

I need to have it too or it's never switch to the defaultenv-2 for me.

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#17 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 41 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 36 lines · Sascha Hauer
Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · Sascha Hauer
Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD

Given that the bootp support seems to have nearly nothing in common with the boot/net file wouldn't it be better to just add a new file boot/bootp?

Quoted 8 lines
Quoted 1 line

why not with the boot sequence we can do so

I try to implement it but at the end we duplicate it As we may want to just pass the rootpath via bootp

and the reset hardcoded

It's better to keep it's support in the same file as the static params are fallback one

I really don't like the approach at all.

The current /env/boot/* scripts are written with the intention that they should be simple scripts which are easily adjustable. They are also meant as templates to add other board/company/project specific files.

Now it only takes one patch series to turn them into complex scripts which after staring at them for half an hour I still not fully understand. I don't understand why this must be so, because it seems what the scripts do is a complex way of saying:

path=/mnt/tftp global.bootm.image="${path}/${global.dhcp.bootfile}" global.bootm.oftree="${path}/${global.dhcp.oftree_file}" nfsroot="${global.dhcp.rootpath}"
bootargs-ip
bootargs-root-nfs -n "$nfsroot"

Quoted 2 lines

Since you introduced a boot sequence support it should be easy to try bootp like above and fall back to the regular net boot if it fails.

the issue with nfs is the mount path

Quoted 8 lines

you need to mount dirname file

but if the file is a symlink this is where it's complex you need to resolv it and mount the real path

I'd prefer to avoid it but nfs is like this
as you may just be allow to see a part of the host tree via nfs and the host have different mountpoint

reply to the wrong e-mail

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#27 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

In reply to Sascha Hauer
Quoted 12 lines · Sascha Hauer
Quoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD
---
 defaultenv-2/base/boot/net |   35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
defaultenv-2/base/boot/net +0 -0
index 922bef1..ff05077 100644
@@ -7,8 +7,41 @@ fi
 
Quoted 8 lines

defaultenv-2/base/boot/net fi · line 12

Quoted 5 lines
defaultenv-2/base/boot/net +3 -0
 path="/mnt/tftp"
 
+# to get the dhcp info (global.dhcp.rootpath, global.dhcp.bootfile, global.dhcp.oftree_file)
+ifdown eth0
+ifup eth0

If ifup has been called before the global.dhcp. variables are already set. Why do you force to do this again?

param dhcp may have changed I want to be sure we have the right one

Quoted 18 lines
Quoted 18 lines
defaultenv-2/base/boot/net +14 -1
+
 global.bootm.image="${path}/${global.user}-linux-${global.hostname}"
 #global.bootm.oftree="${path}/${global.user}-oftree-${global.hostname}"
-nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
+
+if [ -n "${global.dhcp.rootpath}" ]; then
+	bootp=1
+	nfsroot="${global.dhcp.rootpath}"
+else
+	nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
+fi
+
+if [ -n "${global.dhcp.bootfile}" -o -n "${global.dhcp.oftree_file}" ]; then
+	bootp=1
+	path="/mnt/dhcp"
+
+	if [ -d "${path}" ]; then
Quoted 8 lines

defaultenv-2/base/boot/net fi · line 33

Quoted 5 lines
defaultenv-2/base/boot/net +5 -0
+		umount "${path}"
+	else
+		mkdir "${path}"
+	fi
+	mount -t tftp $eth0.serverip "${path}"

That's exactly the path that's already mounted to /mnt/tftp. Why are you doing this?

evenif the ip is changed?

Quoted 20 lines
Quoted 20 lines
defaultenv-2/base/boot/net +12 -0
+
+	[ -n "${global.dhcp.bootfile}" ] && global.bootm.image="${path}/${global.dhcp.bootfile}"
+	[ -n "${global.dhcp.oftree_file}" ] && global.bootm.oftree="${path}/${global.dhcp.oftree_file}"
+fi
+
+if [ x${bootp} = x1 ]; then
+	echo "Boot via bootp/dhcp on server ${eth0.serverip}"
+	[ -n "${global.dhcp.bootfile}" ] && echo "bootm.image => ${global.dhcp.bootfile}"
+	[ -n "${global.dhcp.oftree_file}" ] && echo "bootm.oftree => ${global.dhcp.oftree_file}"
+	[ -n "${global.dhcp.rootpath}" ] && echo "nfsroot => ${global.dhcp.rootpath}"
+fi
+
 bootargs-ip
 bootargs-root-nfs -n "$nfsroot"
Signature · 1 line
1.7.10.4
Quoted 11 lines
Quoted 5 lines

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#20 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

In reply to Sascha Hauer
Quoted 36 lines · Sascha Hauer
Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · Sascha Hauer
Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD

Given that the bootp support seems to have nearly nothing in common with the boot/net file wouldn't it be better to just add a new file boot/bootp?

Quoted 8 lines
Quoted 1 line

why not with the boot sequence we can do so

I try to implement it but at the end we duplicate it As we may want to just pass the rootpath via bootp

and the reset hardcoded

It's better to keep it's support in the same file as the static params are fallback one

I really don't like the approach at all.

The current /env/boot/* scripts are written with the intention that they should be simple scripts which are easily adjustable. They are also meant as templates to add other board/company/project specific files.

Now it only takes one patch series to turn them into complex scripts which after staring at them for half an hour I still not fully understand. I don't understand why this must be so, because it seems what the scripts do is a complex way of saying:

path=/mnt/tftp global.bootm.image="${path}/${global.dhcp.bootfile}" global.bootm.oftree="${path}/${global.dhcp.oftree_file}" nfsroot="${global.dhcp.rootpath}"
bootargs-ip
bootargs-root-nfs -n "$nfsroot"

Quoted 2 lines

Since you introduced a boot sequence support it should be easy to try bootp like above and fall back to the regular net boot if it fails.

no as the the nfsroot or global.bootm.oftree or global.bootm.image may or may not specified via dhcp

the oftre is the perfect example you want use the one in the env if not specify it via dhcp and so on

This was a feature of the defaultenv that I use for long time I need to keep it

Best Regards,
J.

Quoted 8 lines

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

maintainer
#28 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 14 lines · Sascha Hauer
Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD
---
 defaultenv-2/base/boot/net |   35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
defaultenv-2/base/boot/net +0 -0
index 922bef1..ff05077 100644
@@ -7,8 +7,41 @@ fi
 
 path="/mnt/tftp"
 
Quoted 7 lines
Quoted 6 lines

defaultenv-2/base/boot/net fi · line 12

Quoted 3 lines
defaultenv-2/base/boot/net +3 -0
+# to get the dhcp info (global.dhcp.rootpath, global.dhcp.bootfile, global.dhcp.oftree_file)
+ifdown eth0
+ifup eth0

If ifup has been called before the global.dhcp. variables are already set. Why do you force to do this again?

param dhcp may have changed I want to be sure we have the right one

Normally you would change it *before* doing network. If you have changed it manually afterwards, then of course you have to make sure the changes are effective using ifdown/ifup manually.

Quoted 26 lines
Quoted 18 lines
Quoted 18 lines
defaultenv-2/base/boot/net +14 -1
+
 global.bootm.image="${path}/${global.user}-linux-${global.hostname}"
 #global.bootm.oftree="${path}/${global.user}-oftree-${global.hostname}"
-nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
+
+if [ -n "${global.dhcp.rootpath}" ]; then
+	bootp=1
+	nfsroot="${global.dhcp.rootpath}"
+else
+	nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
+fi
+
+if [ -n "${global.dhcp.bootfile}" -o -n "${global.dhcp.oftree_file}" ]; then
+	bootp=1
+	path="/mnt/dhcp"
+
+	if [ -d "${path}" ]; then
Quoted 8 lines

defaultenv-2/base/boot/net fi · line 33

Quoted 5 lines
defaultenv-2/base/boot/net +5 -0
+		umount "${path}"
+	else
+		mkdir "${path}"
+	fi
+	mount -t tftp $eth0.serverip "${path}"

That's exactly the path that's already mounted to /mnt/tftp. Why are you doing this?

Quoted 1 line

evenif the ip is changed?

The ip won't change when you drop the ifdown/ifup above.

Quoted 32 lines
Quoted 31 lines
Quoted 25 lines
defaultenv-2/base/boot/net +12 -0
+
+	[ -n "${global.dhcp.bootfile}" ] && global.bootm.image="${path}/${global.dhcp.bootfile}"
+	[ -n "${global.dhcp.oftree_file}" ] && global.bootm.oftree="${path}/${global.dhcp.oftree_file}"
+fi
+
+if [ x${bootp} = x1 ]; then
+	echo "Boot via bootp/dhcp on server ${eth0.serverip}"
+	[ -n "${global.dhcp.bootfile}" ] && echo "bootm.image => ${global.dhcp.bootfile}"
+	[ -n "${global.dhcp.oftree_file}" ] && echo "bootm.oftree => ${global.dhcp.oftree_file}"
+	[ -n "${global.dhcp.rootpath}" ] && echo "nfsroot => ${global.dhcp.rootpath}"
+fi
+
 bootargs-ip
 bootargs-root-nfs -n "$nfsroot"
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer
#18 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 22 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 18 lines

I really don't like the approach at all.

The current /env/boot/* scripts are written with the intention that they should be simple scripts which are easily adjustable. They are also meant as templates to add other board/company/project specific files.

Now it only takes one patch series to turn them into complex scripts which after staring at them for half an hour I still not fully understand. I don't understand why this must be so, because it seems what the scripts do is a complex way of saying:

path=/mnt/tftp global.bootm.image="${path}/${global.dhcp.bootfile}" global.bootm.oftree="${path}/${global.dhcp.oftree_file}" nfsroot="${global.dhcp.rootpath}"
bootargs-ip
bootargs-root-nfs -n "$nfsroot"

Quoted 2 lines

Since you introduced a boot sequence support it should be easy to try bootp like above and fall back to the regular net boot if it fails.

the issue with nfs is the mount path

Quoted 8 lines

you need to mount dirname file

but if the file is a symlink this is where it's complex you need to resolv it and mount the real path

I'd prefer to avoid it but nfs is like this
as you may just be allow to see a part of the host tree via nfs and the host have different mountpoint

Using dhcp for configuring nfs is an abuse of dhcp anyway. Drop it.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer
#21 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 19 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 17 lines

The current /env/boot/* scripts are written with the intention that they should be simple scripts which are easily adjustable. They are also meant as templates to add other board/company/project specific files.

Now it only takes one patch series to turn them into complex scripts which after staring at them for half an hour I still not fully understand. I don't understand why this must be so, because it seems what the scripts do is a complex way of saying:

path=/mnt/tftp global.bootm.image="${path}/${global.dhcp.bootfile}" global.bootm.oftree="${path}/${global.dhcp.oftree_file}" nfsroot="${global.dhcp.rootpath}"
bootargs-ip
bootargs-root-nfs -n "$nfsroot"

Quoted 2 lines

Since you introduced a boot sequence support it should be easy to try bootp like above and fall back to the regular net boot if it fails.

Quoted 8 lines

no as the the nfsroot or global.bootm.oftree or global.bootm.image may or may not specified via dhcp

the oftre is the perfect example you want use the one in the env if not specify it via dhcp and so on

This was a feature of the defaultenv that I use for long time I need to keep it

Look, there are so many possible setups.

- kernel on tftp, disk, nand
- oftree on tftp, disk, nand, none at all
- root on nfs, disk, nand

Even the above makes for 36 combinations, different names/partitions not counted. The setups are board specific, company specific, project specific or person specific. There is no way of making all happy with a single script. Instead the bootscripts are meant as an *example* to get started, they are *not* meant to fit all your and everyone elses needs.

You want to get your oftree path from a dhcp request? Then fine, change global.bootm.oftree to "${path}/${global.dhcp.oftree_file}". You want to use the one from /env/oftree? Then change global.bootm.oftree accordingly. You want to use one as a fallback from another one? Also fine, do some if/else.

But please don't try to force your specific setup to other people.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer
#35 lore raw

Re: [PATCH 11/11] defaultenv-2: add symbolic link support to boot/nfs

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 4 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+		fi

symbolic links either point to the target or not, but doing magic on them to try to interpret where they *could* point to is no option.

the issue with nfs is the mount path
you need to mount dirname file

Quoted 6 lines

but if the file is a symlink this is where it's complex you need to resolv it and mount the real path

I'd prefer to avoid it but nfs is like this
as you may just be allow to see a part of the host tree via nfs and the host have different mountpoint

I'm sure we can find a solution to this, but duplicating this for each nfs access is not really an option.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#22 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

In reply to Sascha Hauer
Quoted 41 lines · Sascha Hauer
Quoted 19 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 17 lines

The current /env/boot/* scripts are written with the intention that they should be simple scripts which are easily adjustable. They are also meant as templates to add other board/company/project specific files.

Now it only takes one patch series to turn them into complex scripts which after staring at them for half an hour I still not fully understand. I don't understand why this must be so, because it seems what the scripts do is a complex way of saying:

path=/mnt/tftp global.bootm.image="${path}/${global.dhcp.bootfile}" global.bootm.oftree="${path}/${global.dhcp.oftree_file}" nfsroot="${global.dhcp.rootpath}"
bootargs-ip
bootargs-root-nfs -n "$nfsroot"

Quoted 2 lines

Since you introduced a boot sequence support it should be easy to try bootp like above and fall back to the regular net boot if it fails.

Quoted 8 lines

no as the the nfsroot or global.bootm.oftree or global.bootm.image may or may not specified via dhcp

the oftre is the perfect example you want use the one in the env if not specify it via dhcp and so on

This was a feature of the defaultenv that I use for long time I need to keep it

Look, there are so many possible setups.

- kernel on tftp, disk, nand
- oftree on tftp, disk, nand, none at all
- root on nfs, disk, nand

Even the above makes for 36 combinations, different names/partitions not counted. The setups are board specific, company specific, project specific or person specific. There is no way of making all happy with a single script. Instead the bootscripts are meant as an *example* to get started, they are *not* meant to fit all your and everyone elses needs.

Quoted 7 lines

You want to get your oftree path from a dhcp request? Then fine, change global.bootm.oftree to "${path}/${global.dhcp.oftree_file}". You want to use the one from /env/oftree? Then change global.bootm.oftree accordingly. You want to use one as a fallback from another one? Also fine, do some if/else.

But please don't try to force your specific setup to other people.

I force nothing I just add the generic bootp support

if someone want specific they modify

this implementatation just repect the previsou one

when booting via network if the dhcp is used in barebox and the dhcp provide bootp information use it otherwise fallback to the one provided by the board

There is no specific setup here just how the bootp is suppose to work

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#19 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

In reply to Sascha Hauer
Quoted 25 lines · Sascha Hauer
Quoted 24 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 18 lines

I really don't like the approach at all.

The current /env/boot/* scripts are written with the intention that they should be simple scripts which are easily adjustable. They are also meant as templates to add other board/company/project specific files.

Now it only takes one patch series to turn them into complex scripts which after staring at them for half an hour I still not fully understand. I don't understand why this must be so, because it seems what the scripts do is a complex way of saying:

path=/mnt/tftp global.bootm.image="${path}/${global.dhcp.bootfile}" global.bootm.oftree="${path}/${global.dhcp.oftree_file}" nfsroot="${global.dhcp.rootpath}"
bootargs-ip
bootargs-root-nfs -n "$nfsroot"

Quoted 2 lines

Since you introduced a boot sequence support it should be easy to try bootp like above and fall back to the regular net boot if it fails.

the issue with nfs is the mount path

you need to mount dirname file

Quoted 8 lines
Quoted 6 lines

but if the file is a symlink this is where it's complex you need to resolv it and mount the real path

I'd prefer to avoid it but nfs is like this
as you may just be allow to see a part of the host tree via nfs and the host have different mountpoint

Using dhcp for configuring nfs is an abuse of dhcp anyway. Drop it.

can not sorry Mandatory for me

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

maintainer
#23 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 12 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 12 lines

Look, there are so many possible setups.

- kernel on tftp, disk, nand
- oftree on tftp, disk, nand, none at all
- root on nfs, disk, nand

Even the above makes for 36 combinations, different names/partitions not counted. The setups are board specific, company specific, project specific or person specific. There is no way of making all happy with a single script. Instead the bootscripts are meant as an *example* to get started, they are *not* meant to fit all your and everyone elses needs.

Quoted 8 lines
Quoted 7 lines

You want to get your oftree path from a dhcp request? Then fine, change global.bootm.oftree to "${path}/${global.dhcp.oftree_file}". You want to use the one from /env/oftree? Then change global.bootm.oftree accordingly. You want to use one as a fallback from another one? Also fine, do some if/else.

But please don't try to force your specific setup to other people.

I force nothing I just add the generic bootp support

Sure you do. For example you leave no option to not use $global.dhcp.rootpath even if set. There is no option to not use $global.dhcp.bootfile even if set. Yes, you could add an option somewhere, but that would make the boot scripts even more complicated.

The boot scripts are not the place to add code. You can add a helper script to do whatever magic you need; and if it's sufficiently useful we can add it to the tree.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#29 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

In reply to Sascha Hauer
Quoted 54 lines · Sascha Hauer
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 14 lines · Sascha Hauer
Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD
---
 defaultenv-2/base/boot/net |   35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
defaultenv-2/base/boot/net +0 -0
index 922bef1..ff05077 100644
@@ -7,8 +7,41 @@ fi
 
 path="/mnt/tftp"
 
Quoted 7 lines
Quoted 6 lines

defaultenv-2/base/boot/net fi · line 12

Quoted 3 lines
defaultenv-2/base/boot/net +3 -0
+# to get the dhcp info (global.dhcp.rootpath, global.dhcp.bootfile, global.dhcp.oftree_file)
+ifdown eth0
+ifup eth0

If ifup has been called before the global.dhcp. variables are already set. Why do you force to do this again?

param dhcp may have changed I want to be sure we have the right one

Normally you would change it *before* doing network. If you have changed it manually afterwards, then of course you have to make sure the changes are effective using ifdown/ifup manually.

Quoted 26 lines
Quoted 26 lines
Quoted 13 lines
defaultenv-2/base/boot/net +9 -1
+
 global.bootm.image="${path}/${global.user}-linux-${global.hostname}"
 #global.bootm.oftree="${path}/${global.user}-oftree-${global.hostname}"
-nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
+
+if [ -n "${global.dhcp.rootpath}" ]; then
+	bootp=1
+	nfsroot="${global.dhcp.rootpath}"
+else
+	nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
+fi
+

defaultenv-2/base/boot/net fi · line 33

Quoted 10 lines
defaultenv-2/base/boot/net +10 -0
+if [ -n "${global.dhcp.bootfile}" -o -n "${global.dhcp.oftree_file}" ]; then
+	bootp=1
+	path="/mnt/dhcp"
+
+	if [ -d "${path}" ]; then
+		umount "${path}"
+	else
+		mkdir "${path}"
+	fi
+	mount -t tftp $eth0.serverip "${path}"

That's exactly the path that's already mounted to /mnt/tftp. Why are you doing this?

Quoted 3 lines
Quoted 1 line

evenif the ip is changed?

The ip won't change when you drop the ifdown/ifup above.

the IP may change balance tftp

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#24 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

In reply to Sascha Hauer
Quoted 19 lines · Sascha Hauer
Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 18 lines

Look, there are so many possible setups.

- kernel on tftp, disk, nand
- oftree on tftp, disk, nand, none at all
- root on nfs, disk, nand

Even the above makes for 36 combinations, different names/partitions not counted. The setups are board specific, company specific, project specific or person specific. There is no way of making all happy with a single script. Instead the bootscripts are meant as an *example* to get started, they are *not* meant to fit all your and everyone elses needs.

You want to get your oftree path from a dhcp request? Then fine, change global.bootm.oftree to "${path}/${global.dhcp.oftree_file}". You want to use the one from /env/oftree? Then change global.bootm.oftree accordingly. You want to use one as a fallback from another one? Also fine, do some if/else.

Quoted 7 lines
Quoted 2 lines
Quoted 1 line

But please don't try to force your specific setup to other people.

I force nothing I just add the generic bootp support

Sure you do. For example you leave no option to not use $global.dhcp.rootpath even if set. There is no option to not use $global.dhcp.bootfile even if set. Yes, you could add an option somewhere, but that would make the boot scripts even more complicated.

I do not want to add options ifs omeone want something different modify it

Quoted 4 lines

The boot scripts are not the place to add code. You can add a helper script to do whatever magic you need; and if it's sufficiently useful we can add it to the tree.

in the case of bootp we need as it's a specifc boot method if you have in mind a code for the helper please show me because I do not see any right now

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

maintainer
#25 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

Quoted 20 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 19 lines · Sascha Hauer
Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 18 lines

Look, there are so many possible setups.

- kernel on tftp, disk, nand
- oftree on tftp, disk, nand, none at all
- root on nfs, disk, nand

Even the above makes for 36 combinations, different names/partitions not counted. The setups are board specific, company specific, project specific or person specific. There is no way of making all happy with a single script. Instead the bootscripts are meant as an *example* to get started, they are *not* meant to fit all your and everyone elses needs.

You want to get your oftree path from a dhcp request? Then fine, change global.bootm.oftree to "${path}/${global.dhcp.oftree_file}". You want to use the one from /env/oftree? Then change global.bootm.oftree accordingly. You want to use one as a fallback from another one? Also fine, do some if/else.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
Quoted 1 line

But please don't try to force your specific setup to other people.

I force nothing I just add the generic bootp support

Sure you do. For example you leave no option to not use $global.dhcp.rootpath even if set. There is no option to not use $global.dhcp.bootfile even if set. Yes, you could add an option somewhere, but that would make the boot scripts even more complicated.

I do not want to add options ifs omeone want something different modify it

Yes, that's my point. For this the scripts have to be modifyable, that means simple. Modifying should not mean hack through ifs/elses.

In barebox we have the problem that it's not really clear what is configuration and what is code. The boot scripts are clearly meant for configuration.

Quoted 6 lines
Quoted 4 lines

The boot scripts are not the place to add code. You can add a helper script to do whatever magic you need; and if it's sufficiently useful we can add it to the tree.

in the case of bootp we need as it's a specifc boot method if you have in mind a code for the helper please show me because I do not see any right now

One could be:

kernel-bootp -m [nfs|tftp]
oftree-bootp -m [nfs|tftp]

These scripts could for example only set global.bootm.image only if not set already. Then you could put the fallback into the next line without additional ifs.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer
#30 lore raw

Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 22 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 9 lines
defaultenv-2/base/boot/net +8 -1
-nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
+
+if [ -n "${global.dhcp.rootpath}" ]; then
+	bootp=1
+	nfsroot="${global.dhcp.rootpath}"
+else
+	nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
+fi
+

defaultenv-2/base/boot/net fi · line 33

Quoted 10 lines
defaultenv-2/base/boot/net +10 -0
+if [ -n "${global.dhcp.bootfile}" -o -n "${global.dhcp.oftree_file}" ]; then
+	bootp=1
+	path="/mnt/dhcp"
+
+	if [ -d "${path}" ]; then
+		umount "${path}"
+	else
+		mkdir "${path}"
+	fi
+	mount -t tftp $eth0.serverip "${path}"

That's exactly the path that's already mounted to /mnt/tftp. Why are you doing this?

Quoted 4 lines
Quoted 3 lines
Quoted 1 line

evenif the ip is changed?

The ip won't change when you drop the ifdown/ifup above.

the IP may change balance tftp

??

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox