mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 00/11 v2] defaultenv-2: add bootp support
@ 2012-09-07 12:07 Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 12:13 ` [PATCH 01/11] defaultenv: enable glovalvar support Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-07 12:07 UTC (permalink / raw)
  To: barebox

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

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

----------------------------------------------------------------
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 01/11] defaultenv: enable glovalvar support
  2012-09-07 12:07 [PATCH 00/11 v2] defaultenv-2: add bootp support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-07 12:13 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 12:13   ` [PATCH 02/11] defaultenv: switch hostname to global.hostname Jean-Christophe PLAGNIOL-VILLARD
                     ` (9 more replies)
  0 siblings, 10 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-07 12:13 UTC (permalink / raw)
  To: barebox

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

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/Kconfig      |    1 +
 defaultenv/bin/init |    2 ++
 2 files changed, 3 insertions(+)

diff --git a/common/Kconfig b/common/Kconfig
index f411719..8fdb2e0 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -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
diff --git a/defaultenv/bin/init b/defaultenv/bin/init
index f535e37..adb3c43 100644
--- a/defaultenv/bin/init
+++ b/defaultenv/bin/init
@@ -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
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 02/11] defaultenv: switch hostname to global.hostname
  2012-09-07 12:13 ` [PATCH 01/11] defaultenv: enable glovalvar support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-07 12:13   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 12:13   ` [PATCH 03/11] dhcp: switch to global var support Jean-Christophe PLAGNIOL-VILLARD
                     ` (8 subsequent siblings)
  9 siblings, 0 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-07 12:13 UTC (permalink / raw)
  To: barebox

Udpate dhcp with it too.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 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(-)

diff --git a/arch/arm/boards/eukrea_cpuimx25/env/config b/arch/arm/boards/eukrea_cpuimx25/env/config
index b6bf93f..9c70988 100644
--- a/arch/arm/boards/eukrea_cpuimx25/env/config
+++ b/arch/arm/boards/eukrea_cpuimx25/env/config
@@ -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)
diff --git a/arch/arm/boards/eukrea_cpuimx35/env/config b/arch/arm/boards/eukrea_cpuimx35/env/config
index 01cbfe9..beb5916 100644
--- a/arch/arm/boards/eukrea_cpuimx35/env/config
+++ b/arch/arm/boards/eukrea_cpuimx35/env/config
@@ -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)
diff --git a/arch/arm/boards/eukrea_cpuimx51/env/config b/arch/arm/boards/eukrea_cpuimx51/env/config
index 163d026..f30c94f 100644
--- a/arch/arm/boards/eukrea_cpuimx51/env/config
+++ b/arch/arm/boards/eukrea_cpuimx51/env/config
@@ -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)
diff --git a/arch/arm/boards/freescale-mx28-evk/env/config b/arch/arm/boards/freescale-mx28-evk/env/config
index 3951c5b..6628bf0 100644
--- a/arch/arm/boards/freescale-mx28-evk/env/config
+++ b/arch/arm/boards/freescale-mx28-evk/env/config
@@ -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
diff --git a/arch/arm/boards/freescale-mx35-3-stack/env/config b/arch/arm/boards/freescale-mx35-3-stack/env/config
index 171ae8c..787c3df 100644
--- a/arch/arm/boards/freescale-mx35-3-stack/env/config
+++ b/arch/arm/boards/freescale-mx35-3-stack/env/config
@@ -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"
diff --git a/arch/arm/boards/freescale-mx53-loco/env/config b/arch/arm/boards/freescale-mx53-loco/env/config
index bceddaf..7226364 100644
--- a/arch/arm/boards/freescale-mx53-loco/env/config
+++ b/arch/arm/boards/freescale-mx53-loco/env/config
@@ -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"
diff --git a/arch/arm/boards/freescale-mx53-smd/env/config b/arch/arm/boards/freescale-mx53-smd/env/config
index d2afb29..3f9b0ca 100644
--- a/arch/arm/boards/freescale-mx53-smd/env/config
+++ b/arch/arm/boards/freescale-mx53-smd/env/config
@@ -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"
diff --git a/arch/arm/boards/friendlyarm-mini2440/env/config b/arch/arm/boards/friendlyarm-mini2440/env/config
index 77cc34f..b32d1a6 100644
--- a/arch/arm/boards/friendlyarm-mini2440/env/config
+++ b/arch/arm/boards/friendlyarm-mini2440/env/config
@@ -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"
diff --git a/arch/arm/boards/guf-cupid/env/config b/arch/arm/boards/guf-cupid/env/config
index 1be875d..505369a 100644
--- a/arch/arm/boards/guf-cupid/env/config
+++ b/arch/arm/boards/guf-cupid/env/config
@@ -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"
diff --git a/arch/arm/boards/guf-neso/env/config b/arch/arm/boards/guf-neso/env/config
index 3013728..b39afda 100644
--- a/arch/arm/boards/guf-neso/env/config
+++ b/arch/arm/boards/guf-neso/env/config
@@ -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"
diff --git a/arch/arm/boards/karo-tx25/env/config b/arch/arm/boards/karo-tx25/env/config
index 28a5e7f..e592ce3 100644
--- a/arch/arm/boards/karo-tx25/env/config
+++ b/arch/arm/boards/karo-tx25/env/config
@@ -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"
diff --git a/arch/arm/boards/karo-tx28/env/config b/arch/arm/boards/karo-tx28/env/config
index b5222e9..fd9b282 100644
--- a/arch/arm/boards/karo-tx28/env/config
+++ b/arch/arm/boards/karo-tx28/env/config
@@ -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"
diff --git a/arch/arm/boards/panda/env/config b/arch/arm/boards/panda/env/config
index 29a63f3..af433c8 100644
--- a/arch/arm/boards/panda/env/config
+++ b/arch/arm/boards/panda/env/config
@@ -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"
diff --git a/arch/arm/boards/pcm027/env/config b/arch/arm/boards/pcm027/env/config
index 3ed963c..5be7871 100644
--- a/arch/arm/boards/pcm027/env/config
+++ b/arch/arm/boards/pcm027/env/config
@@ -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"
diff --git a/arch/arm/boards/pcm037/env/config b/arch/arm/boards/pcm037/env/config
index fcdb777..852b83c 100644
--- a/arch/arm/boards/pcm037/env/config
+++ b/arch/arm/boards/pcm037/env/config
@@ -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"
diff --git a/arch/arm/boards/pcm043/env/config b/arch/arm/boards/pcm043/env/config
index 644c7fb..c2d31a4 100644
--- a/arch/arm/boards/pcm043/env/config
+++ b/arch/arm/boards/pcm043/env/config
@@ -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"
diff --git a/arch/arm/boards/pcm049/env/config b/arch/arm/boards/pcm049/env/config
index efbe9ea..f5b78e5 100644
--- a/arch/arm/boards/pcm049/env/config
+++ b/arch/arm/boards/pcm049/env/config
@@ -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"
diff --git a/arch/arm/boards/phycard-a-l1/env/config b/arch/arm/boards/phycard-a-l1/env/config
index e0f4dcc..6add45c 100644
--- a/arch/arm/boards/phycard-a-l1/env/config
+++ b/arch/arm/boards/phycard-a-l1/env/config
@@ -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
diff --git a/arch/arm/boards/phycard-a-xl2/env/config b/arch/arm/boards/phycard-a-xl2/env/config
index 59e8eb3..6bc4a59 100644
--- a/arch/arm/boards/phycard-a-xl2/env/config
+++ b/arch/arm/boards/phycard-a-xl2/env/config
@@ -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"
diff --git a/arch/arm/boards/phycard-i.MX27/env/config b/arch/arm/boards/phycard-i.MX27/env/config
index 367029b..e7a77fe 100644
--- a/arch/arm/boards/phycard-i.MX27/env/config
+++ b/arch/arm/boards/phycard-i.MX27/env/config
@@ -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"
diff --git a/arch/arm/boards/scb9328/env/config b/arch/arm/boards/scb9328/env/config
index a8eace7..77dbf03 100644
--- a/arch/arm/boards/scb9328/env/config
+++ b/arch/arm/boards/scb9328/env/config
@@ -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"
diff --git a/defaultenv/config b/defaultenv/config
index 7b61d29..81d6f95 100644
--- a/defaultenv/config
+++ b/defaultenv/config
@@ -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
diff --git a/net/dhcp.c b/net/dhcp.c
index 79efa3e..e73cc70 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -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,
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 03/11] dhcp: switch to global var support
  2012-09-07 12:13 ` [PATCH 01/11] defaultenv: enable glovalvar support Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 12:13   ` [PATCH 02/11] defaultenv: switch hostname to global.hostname Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-07 12:13   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 12:13   ` [PATCH 04/11] dhcp: add copy_only_if_valid support Jean-Christophe PLAGNIOL-VILLARD
                     ` (7 subsequent siblings)
  9 siblings, 0 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-07 12:13 UTC (permalink / raw)
  To: barebox

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.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 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(-)

diff --git a/arch/arm/boards/at91rm9200ek/env/config b/arch/arm/boards/at91rm9200ek/env/config
index 735bb10..a3830cb 100644
--- a/arch/arm/boards/at91rm9200ek/env/config
+++ b/arch/arm/boards/at91rm9200ek/env/config
@@ -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
diff --git a/arch/arm/boards/at91sam9260ek/env/config b/arch/arm/boards/at91sam9260ek/env/config
index 06b9faf..8e88186 100644
--- a/arch/arm/boards/at91sam9260ek/env/config
+++ b/arch/arm/boards/at91sam9260ek/env/config
@@ -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
diff --git a/arch/arm/boards/at91sam9261ek/env/config b/arch/arm/boards/at91sam9261ek/env/config
index 820485d..7d85577 100644
--- a/arch/arm/boards/at91sam9261ek/env/config
+++ b/arch/arm/boards/at91sam9261ek/env/config
@@ -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
diff --git a/arch/arm/boards/at91sam9263ek/env/config b/arch/arm/boards/at91sam9263ek/env/config
index a09bc26..5125020 100644
--- a/arch/arm/boards/at91sam9263ek/env/config
+++ b/arch/arm/boards/at91sam9263ek/env/config
@@ -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
diff --git a/arch/arm/boards/at91sam9m10g45ek/env/config b/arch/arm/boards/at91sam9m10g45ek/env/config
index 37a20e9..54ed2cb 100644
--- a/arch/arm/boards/at91sam9m10g45ek/env/config
+++ b/arch/arm/boards/at91sam9m10g45ek/env/config
@@ -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
diff --git a/arch/arm/boards/at91sam9x5ek/env/config b/arch/arm/boards/at91sam9x5ek/env/config
index dafe875..6a985ce 100644
--- a/arch/arm/boards/at91sam9x5ek/env/config
+++ b/arch/arm/boards/at91sam9x5ek/env/config
@@ -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
diff --git a/arch/arm/boards/freescale-mx53-loco/env/config b/arch/arm/boards/freescale-mx53-loco/env/config
index 7226364..9fb39e8 100644
--- a/arch/arm/boards/freescale-mx53-loco/env/config
+++ b/arch/arm/boards/freescale-mx53-loco/env/config
@@ -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
diff --git a/arch/arm/boards/qil-a9260/env/config b/arch/arm/boards/qil-a9260/env/config
index c0b5546..9971106 100644
--- a/arch/arm/boards/qil-a9260/env/config
+++ b/arch/arm/boards/qil-a9260/env/config
@@ -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
diff --git a/arch/arm/boards/tny-a926x/env/config b/arch/arm/boards/tny-a926x/env/config
index 514fc9f..c19ec4f 100644
--- a/arch/arm/boards/tny-a926x/env/config
+++ b/arch/arm/boards/tny-a926x/env/config
@@ -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
diff --git a/arch/arm/boards/usb-a926x/env/config b/arch/arm/boards/usb-a926x/env/config
index dc0a264..49199ba 100644
--- a/arch/arm/boards/usb-a926x/env/config
+++ b/arch/arm/boards/usb-a926x/env/config
@@ -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
diff --git a/defaultenv/bin/boot b/defaultenv/bin/boot
index 61b893a..4e2056e 100644
--- a/defaultenv/bin/boot
+++ b/defaultenv/bin/boot
@@ -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
diff --git a/defaultenv/config b/defaultenv/config
index 81d6f95..391ba47 100644
--- a/defaultenv/config
+++ b/defaultenv/config
@@ -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
diff --git a/net/dhcp.c b/net/dhcp.c
index e73cc70..b4f2830 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -19,6 +19,8 @@
 #include <magicvar.h>
 #include <linux/err.h>
 #include <getopt.h>
+#include <globalvar.h>
+#include <init.h>
 
 #define OPT_SIZE 312	/* Minimum DHCP Options size per RFC2131 - results in 576 byte pkt */
 
@@ -78,11 +80,38 @@ static IPaddr_t net_dhcp_server_ip;
 static uint64_t dhcp_start;
 static char dhcp_tftpname[256];
 
+static const char* dhcp_get_barebox_global(const char * var)
+{
+	char * var_global = asprintf("global.dhcp.%s", var);
+	const char *val;
+
+	if (!var_global)
+		return NULL;
+
+	val = getenv(var_global);
+	free(var_global);
+	return val;
+}
+
+static int dhcp_set_barebox_global(const char * var, char *val)
+{
+	char * var_global = asprintf("global.dhcp.%s", var);
+	int ret;
+
+	if (!var_global)
+		return -ENOMEM;
+
+	ret = setenv(var_global, val);
+	free(var_global);
+	return ret;
+}
+
 struct dhcp_opt {
 	unsigned char option;
 	/* request automatically the option when creating the DHCP request */
 	bool optional;
 	const char *barebox_var_name;
+	const char *barebox_dhcp_global;
 	void (*handle)(struct dhcp_opt *opt, unsigned char *data, int tlen);
 	void *data;
 
@@ -123,7 +152,12 @@ static void env_str_handle(struct dhcp_opt *opt, unsigned char *popt, int optlen
 
 	memcpy(tmp, popt, optlen);
 	tmp[optlen] = 0;
-	setenv(opt->barebox_var_name, tmp);
+
+	if (opt->barebox_var_name)
+		setenv(opt->barebox_var_name, tmp);
+	if (opt->barebox_dhcp_global)
+		dhcp_set_barebox_global(opt->barebox_dhcp_global, tmp);
+
 }
 
 static void copy_uint32_handle(struct dhcp_opt *opt, unsigned char *popt, int optlen)
@@ -183,7 +217,7 @@ struct dhcp_opt dhcp_options[] = {
 	}, {
 		.option = 17,
 		.handle = env_str_handle,
-		.barebox_var_name = "rootpath",
+		.barebox_dhcp_global = "rootpath",
 	}, {
 		.option = 51,
 		.handle = copy_uint32_handle,
@@ -196,22 +230,23 @@ struct dhcp_opt dhcp_options[] = {
 	}, {
 		.option = 66,
 		.handle = env_str_handle,
-		.barebox_var_name = "dhcp_tftp_server_name",
+		.barebox_dhcp_global = "tftp_server_name",
 		.data = dhcp_tftpname,
 	}, {
 		.option = 67,
 		.handle = bootfile_vendorex_handle,
-		.barebox_var_name = "bootfile",
+		.barebox_dhcp_global = "bootfile",
 	}, {
 		.option = 224,
 		.handle = env_str_handle,
-		.barebox_var_name = "dhcp_oftree_file",
+		.barebox_dhcp_global = "oftree_file",
 	},
 };
 
 struct dhcp_param {
 	unsigned char option;
 	const char *barebox_var_name;
+	const char *barebox_dhcp_global;
 	int (*handle)(struct dhcp_param *param, u8 *e);
 	void *data;
 };
@@ -224,6 +259,9 @@ static int dhcp_set_string_options(struct dhcp_param *param, u8 *e)
 	if (!str && param->barebox_var_name)
 		str = (char*)getenv(param->barebox_var_name);
 
+	if (!str && param->barebox_dhcp_global)
+		str = (char*)dhcp_get_barebox_global(param->barebox_dhcp_global);
+
 	if (!str)
 		return 0;
 
@@ -252,19 +290,19 @@ struct dhcp_param dhcp_params[] = {
 	}, {
 		.option = DHCP_VENDOR_ID,
 		.handle = dhcp_set_string_options,
-		.barebox_var_name = "dhcp_vendor_id",
+		.barebox_dhcp_global = "vendor_id",
 	}, {
 		.option = DHCP_CLIENT_ID,
 		.handle = dhcp_set_string_options,
-		.barebox_var_name = "dhcp_client_id",
+		.barebox_dhcp_global = "client_id",
 	}, {
 		.option = DHCP_USER_CLASS,
 		.handle = dhcp_set_string_options,
-		.barebox_var_name = "dhcp_user_class",
+		.barebox_dhcp_global = "user_class",
 	}, {
 		.option = DHCP_CLIENT_UUID,
 		.handle = dhcp_set_string_options,
-		.barebox_var_name = "dhcp_client_uuid",
+		.barebox_dhcp_global = "client_uuid",
 	}
 };
 
@@ -345,8 +383,10 @@ static void bootp_copy_net_params(struct bootp *bp)
 	if (tmp_ip != 0)
 		net_set_serverip(tmp_ip);
 
-	if (strlen(bp->bp_file) > 0)
+	if (strlen(bp->bp_file) > 0) {
 		setenv("bootfile", bp->bp_file);
+		dhcp_set_barebox_global("bootfile", bp->bp_file);
+	}
 
 	debug("bootfile: %s\n", bp->bp_file);
 }
@@ -611,9 +651,50 @@ static void dhcp_reset_env(void)
 			continue;
 
 		setenv(opt->barebox_var_name,"");
+		if (opt->barebox_dhcp_global)
+			dhcp_set_barebox_global(opt->barebox_dhcp_global,"");
 	}
 }
 
+static void dhcp_global_add(const char *var)
+{
+	char * var_global = asprintf("dhcp.%s", var);
+
+	if (!var_global)
+		return;
+
+	globalvar_add_simple(var_global);
+	free(var_global);
+}
+
+static int dhcp_global_init(void)
+{
+	struct dhcp_opt *opt;
+	struct dhcp_param *param;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(dhcp_options); i++) {
+		opt = &dhcp_options[i];
+
+		if (!opt->barebox_dhcp_global)
+			continue;
+
+		dhcp_global_add(opt->barebox_dhcp_global);
+	}
+
+	for (i = 0; i < ARRAY_SIZE(dhcp_params); i++) {
+		param = &dhcp_params[i];
+
+		if (!param->barebox_dhcp_global)
+			continue;
+
+		dhcp_global_add(param->barebox_dhcp_global);
+	}
+
+	return 0;
+}
+late_initcall(dhcp_global_init);
+
 static int do_dhcp(int argc, char *argv[])
 {
 	int ret, opt;
@@ -709,12 +790,12 @@ BAREBOX_CMD_START(dhcp)
 	BAREBOX_CMD_COMPLETE(empty_complete)
 BAREBOX_CMD_END
 
-BAREBOX_MAGICVAR(bootfile, "bootfile returned from DHCP request");
-BAREBOX_MAGICVAR(hostname, "hostname to send or returned from DHCP request");
-BAREBOX_MAGICVAR(rootpath, "rootpath returned from DHCP request");
-BAREBOX_MAGICVAR(dhcp_vendor_id, "vendor id to send to the DHCP server");
-BAREBOX_MAGICVAR(dhcp_client_uuid, "cliend uuid to send to the DHCP server");
-BAREBOX_MAGICVAR(dhcp_client_id, "cliend id to send to the DHCP server");
-BAREBOX_MAGICVAR(dhcp_user_class, "user class to send to the DHCP server");
-BAREBOX_MAGICVAR(dhcp_tftp_server_name, "TFTP server Name returned from DHCP request");
-BAREBOX_MAGICVAR(dhcp_oftree_file, "OF tree returned from DHCP request (option 224)");
+BAREBOX_MAGICVAR_NAMED(global_hostname, global.hostname, "hostname to send or returned from DHCP request");
+BAREBOX_MAGICVAR_NAMED(global_dhcp_bootfile, global.dhcp.bootfile, "bootfile returned from DHCP request");
+BAREBOX_MAGICVAR_NAMED(global_dhcp_rootpath, global.dhcp.rootpath, "rootpath returned from DHCP request");
+BAREBOX_MAGICVAR_NAMED(global_dhcp_vendor_id, global.dhcp.vendor_id, "vendor id to send to the DHCP server");
+BAREBOX_MAGICVAR_NAMED(global_dhcp_client_uuid, global.dhcp.client_uuid, "cliend uuid to send to the DHCP server");
+BAREBOX_MAGICVAR_NAMED(global_dhcp_client_id, global.dhcp.client_id, "cliend id to send to the DHCP server");
+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)");
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 04/11] dhcp: add copy_only_if_valid support
  2012-09-07 12:13 ` [PATCH 01/11] defaultenv: enable glovalvar support Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 12:13   ` [PATCH 02/11] defaultenv: switch hostname to global.hostname Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 12:13   ` [PATCH 03/11] dhcp: switch to global var support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-07 12:13   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 12:13   ` [PATCH 05/11] dhcp: add retries limit support Jean-Christophe PLAGNIOL-VILLARD
                     ` (6 subsequent siblings)
  9 siblings, 0 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-07 12:13 UTC (permalink / raw)
  To: barebox

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

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 net/dhcp.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/dhcp.c b/net/dhcp.c
index b4f2830..02dc529 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -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,"");
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 05/11] dhcp: add retries limit support
  2012-09-07 12:13 ` [PATCH 01/11] defaultenv: enable glovalvar support Jean-Christophe PLAGNIOL-VILLARD
                     ` (2 preceding siblings ...)
  2012-09-07 12:13   ` [PATCH 04/11] dhcp: add copy_only_if_valid support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-07 12:13   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 12:13   ` [PATCH 06/11] defaultenv-2: eth0 add default global.dhcp.vendor_id Jean-Christophe PLAGNIOL-VILLARD
                     ` (5 subsequent siblings)
  9 siblings, 0 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-07 12:13 UTC (permalink / raw)
  To: barebox

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

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 net/dhcp.c |   33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/net/dhcp.c b/net/dhcp.c
index 02dc529..a5fcb14 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -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");
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 06/11] defaultenv-2: eth0 add default global.dhcp.vendor_id
  2012-09-07 12:13 ` [PATCH 01/11] defaultenv: enable glovalvar support Jean-Christophe PLAGNIOL-VILLARD
                     ` (3 preceding siblings ...)
  2012-09-07 12:13   ` [PATCH 05/11] dhcp: add retries limit support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-07 12:13   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 12:13   ` [PATCH 07/11] defaultenv-2/ip: add dhcp-barebox support Jean-Christophe PLAGNIOL-VILLARD
                     ` (4 subsequent siblings)
  9 siblings, 0 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-07 12:13 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 defaultenv-2/base/network/eth0 |    1 +
 1 file changed, 1 insertion(+)

diff --git a/defaultenv-2/base/network/eth0 b/defaultenv-2/base/network/eth0
index 048a288..7e731ca 100644
--- a/defaultenv-2/base/network/eth0
+++ b/defaultenv-2/base/network/eth0
@@ -2,6 +2,7 @@
 
 # ip setting (static/dhcp)
 ip=dhcp
+global.dhcp.vendor_id=barebox-${global.hostname}
 
 # static setup used if ip=static
 ipaddr=
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 07/11] defaultenv-2/ip: add dhcp-barebox support
  2012-09-07 12:13 ` [PATCH 01/11] defaultenv: enable glovalvar support Jean-Christophe PLAGNIOL-VILLARD
                     ` (4 preceding siblings ...)
  2012-09-07 12:13   ` [PATCH 06/11] defaultenv-2: eth0 add default global.dhcp.vendor_id Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-07 12:13   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-08 14:04     ` Sascha Hauer
  2012-09-07 12:13   ` [PATCH 08/11] defaultenv-2: add ifdown support Jean-Christophe PLAGNIOL-VILLARD
                     ` (3 subsequent siblings)
  9 siblings, 1 reply; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-07 12:13 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 defaultenv-2/base/bin/bootargs-ip |    2 ++
 defaultenv-2/base/bin/ifup        |    2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/defaultenv-2/base/bin/bootargs-ip b/defaultenv-2/base/bin/bootargs-ip
index 2d4486c..caeb5dd 100644
--- a/defaultenv-2/base/bin/bootargs-ip
+++ b/defaultenv-2/base/bin/bootargs-ip
@@ -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
diff --git a/defaultenv-2/base/bin/ifup b/defaultenv-2/base/bin/ifup
index 37b986c..554c35e 100644
--- a/defaultenv-2/base/bin/ifup
+++ b/defaultenv-2/base/bin/ifup
@@ -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
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 08/11] defaultenv-2: add ifdown support
  2012-09-07 12:13 ` [PATCH 01/11] defaultenv: enable glovalvar support Jean-Christophe PLAGNIOL-VILLARD
                     ` (5 preceding siblings ...)
  2012-09-07 12:13   ` [PATCH 07/11] defaultenv-2/ip: add dhcp-barebox support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-07 12:13   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 12:13   ` [PATCH 09/11] defaultenv-2: boot/net add bootp support Jean-Christophe PLAGNIOL-VILLARD
                     ` (2 subsequent siblings)
  9 siblings, 0 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-07 12:13 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 defaultenv-2/base/bin/ifdown |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 defaultenv-2/base/bin/ifdown

diff --git a/defaultenv-2/base/bin/ifdown b/defaultenv-2/base/bin/ifdown
new file mode 100644
index 0000000..191144e
--- /dev/null
+++ b/defaultenv-2/base/bin/ifdown
@@ -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
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-07 12:13 ` [PATCH 01/11] defaultenv: enable glovalvar support Jean-Christophe PLAGNIOL-VILLARD
                     ` (6 preceding siblings ...)
  2012-09-07 12:13   ` [PATCH 08/11] defaultenv-2: add ifdown support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-07 12:13   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 18:21     ` Sascha Hauer
  2012-09-08 13:56     ` Sascha Hauer
  2012-09-07 12:13   ` [PATCH 10/11] defaultenv-2: add net boot support with kernel and oftree via nfs Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 12:13   ` [PATCH 11/11] defaultenv-2: add symbolic link support to boot/nfs Jean-Christophe PLAGNIOL-VILLARD
  9 siblings, 2 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-07 12:13 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 defaultenv-2/base/boot/net |   35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/defaultenv-2/base/boot/net b/defaultenv-2/base/boot/net
index 922bef1..ff05077 100644
--- a/defaultenv-2/base/boot/net
+++ b/defaultenv-2/base/boot/net
@@ -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"
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 10/11] defaultenv-2: add net boot support with kernel and oftree via nfs
  2012-09-07 12:13 ` [PATCH 01/11] defaultenv: enable glovalvar support Jean-Christophe PLAGNIOL-VILLARD
                     ` (7 preceding siblings ...)
  2012-09-07 12:13   ` [PATCH 09/11] defaultenv-2: boot/net add bootp support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-07 12:13   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 12:13   ` [PATCH 11/11] defaultenv-2: add symbolic link support to boot/nfs Jean-Christophe PLAGNIOL-VILLARD
  9 siblings, 0 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-07 12:13 UTC (permalink / raw)
  To: barebox

This also support the bootp.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 defaultenv-2/base/boot/nfs |   75 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 defaultenv-2/base/boot/nfs

diff --git a/defaultenv-2/base/boot/nfs b/defaultenv-2/base/boot/nfs
new file mode 100644
index 0000000..892f103
--- /dev/null
+++ b/defaultenv-2/base/boot/nfs
@@ -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"
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 11/11] defaultenv-2: add symbolic link support to boot/nfs
  2012-09-07 12:13 ` [PATCH 01/11] defaultenv: enable glovalvar support Jean-Christophe PLAGNIOL-VILLARD
                     ` (8 preceding siblings ...)
  2012-09-07 12:13   ` [PATCH 10/11] defaultenv-2: add net boot support with kernel and oftree via nfs Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-07 12:13   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-08 13:49     ` Sascha Hauer
  9 siblings, 1 reply; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-07 12:13 UTC (permalink / raw)
  To: barebox

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

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 defaultenv-2/base/boot/nfs |   64 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 61 insertions(+), 3 deletions(-)

diff --git a/defaultenv-2/base/boot/nfs b/defaultenv-2/base/boot/nfs
index 892f103..bf27d38 100644
--- a/defaultenv-2/base/boot/nfs
+++ b/defaultenv-2/base/boot/nfs
@@ -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
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-07 12:13   ` [PATCH 09/11] defaultenv-2: boot/net add bootp support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-07 18:21     ` Sascha Hauer
  2012-09-08  5:40       ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-08 13:56     ` Sascha Hauer
  1 sibling, 1 reply; 36+ messages in thread
From: Sascha Hauer @ 2012-09-07 18:21 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Fri, Sep 07, 2012 at 02:13:35PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

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

> ---
>  defaultenv-2/base/boot/net |   35 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 34 insertions(+), 1 deletion(-)
> 
> diff --git a/defaultenv-2/base/boot/net b/defaultenv-2/base/boot/net
> index 922bef1..ff05077 100644
> --- a/defaultenv-2/base/boot/net
> +++ b/defaultenv-2/base/boot/net
> @@ -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"
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-07 18:21     ` Sascha Hauer
@ 2012-09-08  5:40       ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-08  6:17         ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-08  5:40 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 20:21 Fri 07 Sep     , Sascha Hauer wrote:
> On Fri, Sep 07, 2012 at 02:13:35PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> 
> 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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-08  5:40       ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-08  6:17         ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-08 13:47           ` Sascha Hauer
  0 siblings, 1 reply; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-08  6:17 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 07:40 Sat 08 Sep     , Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 20:21 Fri 07 Sep     , Sascha Hauer wrote:
> > On Fri, Sep 07, 2012 at 02:13:35PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > 
> > 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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-08  6:17         ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-08 13:47           ` Sascha Hauer
  2012-09-08 14:42             ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-08 14:51             ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 36+ messages in thread
From: Sascha Hauer @ 2012-09-08 13:47 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sat, Sep 08, 2012 at 08:17:30AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 07:40 Sat 08 Sep     , Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 20:21 Fri 07 Sep     , Sascha Hauer wrote:
> > > On Fri, Sep 07, 2012 at 02:13:35PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > 
> > > 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

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

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 11/11] defaultenv-2: add symbolic link support to boot/nfs
  2012-09-07 12:13   ` [PATCH 11/11] defaultenv-2: add symbolic link support to boot/nfs Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-08 13:49     ` Sascha Hauer
  2012-09-08 14:47       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 36+ messages in thread
From: Sascha Hauer @ 2012-09-08 13:49 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Fri, Sep 07, 2012 at 02:13:37PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> If the symlink is not find on barebox try on the host.
> So we are back compatible with nfs command.
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  defaultenv-2/base/boot/nfs |   64 +++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 61 insertions(+), 3 deletions(-)
> 
> diff --git a/defaultenv-2/base/boot/nfs b/defaultenv-2/base/boot/nfs
> index 892f103..bf27d38 100644
> --- a/defaultenv-2/base/boot/nfs
> +++ b/defaultenv-2/base/boot/nfs
> @@ -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

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

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-07 12:13   ` [PATCH 09/11] defaultenv-2: boot/net add bootp support Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 18:21     ` Sascha Hauer
@ 2012-09-08 13:56     ` Sascha Hauer
  2012-09-08 14:37       ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 36+ messages in thread
From: Sascha Hauer @ 2012-09-08 13:56 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Fri, Sep 07, 2012 at 02:13:35PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  defaultenv-2/base/boot/net |   35 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 34 insertions(+), 1 deletion(-)
> 
> diff --git a/defaultenv-2/base/boot/net b/defaultenv-2/base/boot/net
> index 922bef1..ff05077 100644
> --- a/defaultenv-2/base/boot/net
> +++ b/defaultenv-2/base/boot/net
> @@ -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?

> +
>  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}"

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


> +
> +	[ -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"
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 07/11] defaultenv-2/ip: add dhcp-barebox support
  2012-09-07 12:13   ` [PATCH 07/11] defaultenv-2/ip: add dhcp-barebox support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-08 14:04     ` Sascha Hauer
  2012-09-08 14:23       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 36+ messages in thread
From: Sascha Hauer @ 2012-09-08 14:04 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Fri, Sep 07, 2012 at 02:13:33PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  defaultenv-2/base/bin/bootargs-ip |    2 ++
>  defaultenv-2/base/bin/ifup        |    2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/defaultenv-2/base/bin/bootargs-ip b/defaultenv-2/base/bin/bootargs-ip
> index 2d4486c..caeb5dd 100644
> --- a/defaultenv-2/base/bin/bootargs-ip
> +++ b/defaultenv-2/base/bin/bootargs-ip
> @@ -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
> diff --git a/defaultenv-2/base/bin/ifup b/defaultenv-2/base/bin/ifup
> index 37b986c..554c35e 100644
> --- a/defaultenv-2/base/bin/ifup
> +++ b/defaultenv-2/base/bin/ifup
> @@ -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


-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 07/11] defaultenv-2/ip: add dhcp-barebox support
  2012-09-08 14:04     ` Sascha Hauer
@ 2012-09-08 14:23       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-08 14:23 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 16:04 Sat 08 Sep     , Sascha Hauer wrote:
> On Fri, Sep 07, 2012 at 02:13:33PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  defaultenv-2/base/bin/bootargs-ip |    2 ++
> >  defaultenv-2/base/bin/ifup        |    2 +-
> >  2 files changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/defaultenv-2/base/bin/bootargs-ip b/defaultenv-2/base/bin/bootargs-ip
> > index 2d4486c..caeb5dd 100644
> > --- a/defaultenv-2/base/bin/bootargs-ip
> > +++ b/defaultenv-2/base/bin/bootargs-ip
> > @@ -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
> > diff --git a/defaultenv-2/base/bin/ifup b/defaultenv-2/base/bin/ifup
> > index 37b986c..554c35e 100644
> > --- a/defaultenv-2/base/bin/ifup
> > +++ b/defaultenv-2/base/bin/ifup
> > @@ -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.
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-08 13:56     ` Sascha Hauer
@ 2012-09-08 14:37       ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-08 15:09         ` Sascha Hauer
  0 siblings, 1 reply; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-08 14:37 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 15:56 Sat 08 Sep     , Sascha Hauer wrote:
> On Fri, Sep 07, 2012 at 02:13:35PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  defaultenv-2/base/boot/net |   35 ++++++++++++++++++++++++++++++++++-
> >  1 file changed, 34 insertions(+), 1 deletion(-)
> > 
> > diff --git a/defaultenv-2/base/boot/net b/defaultenv-2/base/boot/net
> > index 922bef1..ff05077 100644
> > --- a/defaultenv-2/base/boot/net
> > +++ b/defaultenv-2/base/boot/net
> > @@ -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?
param dhcp may have changed I want to be sure we have the right one
> 
> > +
> >  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}"
> 
> That's exactly the path that's already mounted to /mnt/tftp. Why are you
> doing this?
evenif the ip is changed?
> 
> 
> > +
> > +	[ -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"
> > -- 
> > 1.7.10.4
> > 
> > 
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
> > 
> 
> -- 
> 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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-08 13:47           ` Sascha Hauer
@ 2012-09-08 14:42             ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-08 14:48               ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-08 15:10               ` Sascha Hauer
  2012-09-08 14:51             ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 2 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-08 14:42 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 15:47 Sat 08 Sep     , Sascha Hauer wrote:
> On Sat, Sep 08, 2012 at 08:17:30AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 07:40 Sat 08 Sep     , Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 20:21 Fri 07 Sep     , Sascha Hauer wrote:
> > > > On Fri, Sep 07, 2012 at 02:13:35PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > > 
> > > > 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
> 
> 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.
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 11/11] defaultenv-2: add symbolic link support to boot/nfs
  2012-09-08 13:49     ` Sascha Hauer
@ 2012-09-08 14:47       ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-08 17:09         ` Sascha Hauer
  0 siblings, 1 reply; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-08 14:47 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 15:49 Sat 08 Sep     , Sascha Hauer wrote:
> On Fri, Sep 07, 2012 at 02:13:37PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > If the symlink is not find on barebox try on the host.
> > So we are back compatible with nfs command.
> > 
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  defaultenv-2/base/boot/nfs |   64 +++++++++++++++++++++++++++++++++++++++++---
> >  1 file changed, 61 insertions(+), 3 deletions(-)
> > 
> > diff --git a/defaultenv-2/base/boot/nfs b/defaultenv-2/base/boot/nfs
> > index 892f103..bf27d38 100644
> > --- a/defaultenv-2/base/boot/nfs
> > +++ b/defaultenv-2/base/boot/nfs
> > @@ -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
> 
> 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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-08 14:42             ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-08 14:48               ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-08 15:10               ` Sascha Hauer
  1 sibling, 0 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-08 14:48 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 16:42 Sat 08 Sep     , Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 15:47 Sat 08 Sep     , Sascha Hauer wrote:
> > On Sat, Sep 08, 2012 at 08:17:30AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 07:40 Sat 08 Sep     , Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > On 20:21 Fri 07 Sep     , Sascha Hauer wrote:
> > > > > On Fri, Sep 07, 2012 at 02:13:35PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > > > 
> > > > > 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
> > 
> > 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.
> 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
reply to the wrong e-mail

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-08 13:47           ` Sascha Hauer
  2012-09-08 14:42             ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-08 14:51             ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-08 15:27               ` Sascha Hauer
  1 sibling, 1 reply; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-08 14:51 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 15:47 Sat 08 Sep     , Sascha Hauer wrote:
> On Sat, Sep 08, 2012 at 08:17:30AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 07:40 Sat 08 Sep     , Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 20:21 Fri 07 Sep     , Sascha Hauer wrote:
> > > > On Fri, Sep 07, 2012 at 02:13:35PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > > 
> > > > 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
> 
> 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.
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.
> 
> Sascha
> 
> -- 
> 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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-08 14:37       ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-08 15:09         ` Sascha Hauer
  2012-09-08 17:14           ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 36+ messages in thread
From: Sascha Hauer @ 2012-09-08 15:09 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sat, Sep 08, 2012 at 04:37:13PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 15:56 Sat 08 Sep     , Sascha Hauer wrote:
> > On Fri, Sep 07, 2012 at 02:13:35PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > ---
> > >  defaultenv-2/base/boot/net |   35 ++++++++++++++++++++++++++++++++++-
> > >  1 file changed, 34 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/defaultenv-2/base/boot/net b/defaultenv-2/base/boot/net
> > > index 922bef1..ff05077 100644
> > > --- a/defaultenv-2/base/boot/net
> > > +++ b/defaultenv-2/base/boot/net
> > > @@ -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?
> 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.

> > 
> > > +
> > >  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}"
> > 
> > That's exactly the path that's already mounted to /mnt/tftp. Why are you
> > doing this?
> evenif the ip is changed?

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

> > 
> > 
> > > +
> > > +	[ -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"
> > > -- 
> > > 1.7.10.4
> > > 
> > > 
> > > _______________________________________________
> > > barebox mailing list
> > > barebox@lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/barebox
> > > 
> > 
> > -- 
> > 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 |
> 

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-08 14:42             ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-08 14:48               ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-08 15:10               ` Sascha Hauer
  2012-09-08 17:13                 ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 36+ messages in thread
From: Sascha Hauer @ 2012-09-08 15:10 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sat, Sep 08, 2012 at 04:42:03PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > 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.
> 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

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

Sascha

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-08 14:51             ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-08 15:27               ` Sascha Hauer
  2012-09-08 17:12                 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 36+ messages in thread
From: Sascha Hauer @ 2012-09-08 15:27 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sat, Sep 08, 2012 at 04:51:25PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > 
> > 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.
> 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

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 11/11] defaultenv-2: add symbolic link support to boot/nfs
  2012-09-08 14:47       ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-08 17:09         ` Sascha Hauer
  0 siblings, 0 replies; 36+ messages in thread
From: Sascha Hauer @ 2012-09-08 17:09 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sat, Sep 08, 2012 at 04:47:46PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > +		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'm sure we can find a solution to this, but duplicating this for each
nfs access is not really an option.

Sascha


-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-08 15:27               ` Sascha Hauer
@ 2012-09-08 17:12                 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-08 17:22                   ` Sascha Hauer
  0 siblings, 1 reply; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-08 17:12 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 17:27 Sat 08 Sep     , Sascha Hauer wrote:
> On Sat, Sep 08, 2012 at 04:51:25PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > 
> > > 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.
> > 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.
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-08 15:10               ` Sascha Hauer
@ 2012-09-08 17:13                 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-08 17:13 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 17:10 Sat 08 Sep     , Sascha Hauer wrote:
> On Sat, Sep 08, 2012 at 04:42:03PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > 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.
> > 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
> 
> 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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-08 15:09         ` Sascha Hauer
@ 2012-09-08 17:14           ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-08 18:12             ` Sascha Hauer
  0 siblings, 1 reply; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-08 17:14 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 17:09 Sat 08 Sep     , Sascha Hauer wrote:
> On Sat, Sep 08, 2012 at 04:37:13PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 15:56 Sat 08 Sep     , Sascha Hauer wrote:
> > > On Fri, Sep 07, 2012 at 02:13:35PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > > ---
> > > >  defaultenv-2/base/boot/net |   35 ++++++++++++++++++++++++++++++++++-
> > > >  1 file changed, 34 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/defaultenv-2/base/boot/net b/defaultenv-2/base/boot/net
> > > > index 922bef1..ff05077 100644
> > > > --- a/defaultenv-2/base/boot/net
> > > > +++ b/defaultenv-2/base/boot/net
> > > > @@ -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?
> > 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.
> 
> > > 
> > > > +
> > > >  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}"
> > > 
> > > That's exactly the path that's already mounted to /mnt/tftp. Why are you
> > > doing this?
> > 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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-08 17:12                 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-08 17:22                   ` Sascha Hauer
  2012-09-08 17:35                     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 36+ messages in thread
From: Sascha Hauer @ 2012-09-08 17:22 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sat, Sep 08, 2012 at 07:12:29PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > 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.
> 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


-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-08 17:22                   ` Sascha Hauer
@ 2012-09-08 17:35                     ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-08 18:11                       ` Sascha Hauer
  0 siblings, 1 reply; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-08 17:35 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 19:22 Sat 08 Sep     , Sascha Hauer wrote:
> On Sat, Sep 08, 2012 at 07:12:29PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > 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.
> > 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
> 
> 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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-08 17:35                     ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-08 18:11                       ` Sascha Hauer
  0 siblings, 0 replies; 36+ messages in thread
From: Sascha Hauer @ 2012-09-08 18:11 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sat, Sep 08, 2012 at 07:35:24PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 19:22 Sat 08 Sep     , Sascha Hauer wrote:
> > On Sat, Sep 08, 2012 at 07:12:29PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > 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.
> > > 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.

> > 
> > 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

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/11] defaultenv-2: boot/net add bootp support
  2012-09-08 17:14           ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-08 18:12             ` Sascha Hauer
  0 siblings, 0 replies; 36+ messages in thread
From: Sascha Hauer @ 2012-09-08 18:12 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sat, Sep 08, 2012 at 07:14:40PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > > -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}"
> > > > 
> > > > That's exactly the path that's already mounted to /mnt/tftp. Why are you
> > > > doing this?
> > > evenif the ip is changed?
> > 
> > The ip won't change when you drop the ifdown/ifup above.
> the IP may change balance tftp

??

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2012-09-08 18:12 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-07 12:07 [PATCH 00/11 v2] defaultenv-2: add bootp support Jean-Christophe PLAGNIOL-VILLARD
2012-09-07 12:13 ` [PATCH 01/11] defaultenv: enable glovalvar support Jean-Christophe PLAGNIOL-VILLARD
2012-09-07 12:13   ` [PATCH 02/11] defaultenv: switch hostname to global.hostname Jean-Christophe PLAGNIOL-VILLARD
2012-09-07 12:13   ` [PATCH 03/11] dhcp: switch to global var support Jean-Christophe PLAGNIOL-VILLARD
2012-09-07 12:13   ` [PATCH 04/11] dhcp: add copy_only_if_valid support Jean-Christophe PLAGNIOL-VILLARD
2012-09-07 12:13   ` [PATCH 05/11] dhcp: add retries limit support Jean-Christophe PLAGNIOL-VILLARD
2012-09-07 12:13   ` [PATCH 06/11] defaultenv-2: eth0 add default global.dhcp.vendor_id Jean-Christophe PLAGNIOL-VILLARD
2012-09-07 12:13   ` [PATCH 07/11] defaultenv-2/ip: add dhcp-barebox support Jean-Christophe PLAGNIOL-VILLARD
2012-09-08 14:04     ` Sascha Hauer
2012-09-08 14:23       ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-07 12:13   ` [PATCH 08/11] defaultenv-2: add ifdown support Jean-Christophe PLAGNIOL-VILLARD
2012-09-07 12:13   ` [PATCH 09/11] defaultenv-2: boot/net add bootp support Jean-Christophe PLAGNIOL-VILLARD
2012-09-07 18:21     ` Sascha Hauer
2012-09-08  5:40       ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-08  6:17         ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-08 13:47           ` Sascha Hauer
2012-09-08 14:42             ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-08 14:48               ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-08 15:10               ` Sascha Hauer
2012-09-08 17:13                 ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-08 14:51             ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-08 15:27               ` Sascha Hauer
2012-09-08 17:12                 ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-08 17:22                   ` Sascha Hauer
2012-09-08 17:35                     ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-08 18:11                       ` Sascha Hauer
2012-09-08 13:56     ` Sascha Hauer
2012-09-08 14:37       ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-08 15:09         ` Sascha Hauer
2012-09-08 17:14           ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-08 18:12             ` Sascha Hauer
2012-09-07 12:13   ` [PATCH 10/11] defaultenv-2: add net boot support with kernel and oftree via nfs Jean-Christophe PLAGNIOL-VILLARD
2012-09-07 12:13   ` [PATCH 11/11] defaultenv-2: add symbolic link support to boot/nfs Jean-Christophe PLAGNIOL-VILLARD
2012-09-08 13:49     ` Sascha Hauer
2012-09-08 14:47       ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-08 17:09         ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox