mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* defenv-2 updates
@ 2012-06-07 20:37 Sascha Hauer
  2012-06-07 20:37 ` [PATCH 1/3] defaultenv-2 ifup: Always overwrite eth0.serverip Sascha Hauer
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sascha Hauer @ 2012-06-07 20:37 UTC (permalink / raw)
  To: barebox

Some updatess for the defaultenv-2 template

----------------------------------------------------------------
Sascha Hauer (3):
      defaultenv-2 ifup: Always overwrite eth0.serverip
      defaultenv-2: mount tftp server specified in $eth0.serverip
      defaultenv-2: remove global.tftp.path

 defaultenv-2/base/bin/ifup       |    7 ++++++-
 defaultenv-2/base/bin/init       |    2 --
 defaultenv-2/base/boot/initrd    |    5 +++--
 defaultenv-2/base/boot/net       |    6 ++++--
 defaultenv-2/base/init/automount |   11 +++--------
 defaultenv-2/base/init/general   |    3 ---
 6 files changed, 16 insertions(+), 18 deletions(-)

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

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

* [PATCH 1/3] defaultenv-2 ifup: Always overwrite eth0.serverip
  2012-06-07 20:37 defenv-2 updates Sascha Hauer
@ 2012-06-07 20:37 ` Sascha Hauer
  2012-06-07 20:37 ` [PATCH 2/3] defaultenv-2: mount tftp server specified in $eth0.serverip Sascha Hauer
  2012-06-07 20:37 ` [PATCH 3/3] defaultenv-2: remove global.tftp.path Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2012-06-07 20:37 UTC (permalink / raw)
  To: barebox

if serverip is specified, also overwrite eth0.serverip in dhcp
case. This makes it possible to specify a different serverip
when the dhcp server returns the wrong ip (because the DHCP
might be a DSL router which does not provide tftp).

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 defaultenv-2/base/bin/ifup |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/defaultenv-2/base/bin/ifup b/defaultenv-2/base/bin/ifup
index 9f6fd6b..ed33b06 100644
--- a/defaultenv-2/base/bin/ifup
+++ b/defaultenv-2/base/bin/ifup
@@ -53,7 +53,12 @@ if [ "$ip" = static ]; then
 	${interface}.gateway=$gateway
 elif [ "$ip" = dhcp ]; then
 	dhcp
-	exit $?
+	ret=$?
+	if [ $ret = 0 -a -n "$serverip" ]; then
+		${interface}.serverip=$serverip
+	fi
+
+	exit $ret
 fi
 
 echo -o /tmp/network/$interface up
-- 
1.7.10


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

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

* [PATCH 2/3] defaultenv-2: mount tftp server specified in $eth0.serverip
  2012-06-07 20:37 defenv-2 updates Sascha Hauer
  2012-06-07 20:37 ` [PATCH 1/3] defaultenv-2 ifup: Always overwrite eth0.serverip Sascha Hauer
@ 2012-06-07 20:37 ` Sascha Hauer
  2012-06-07 20:37 ` [PATCH 3/3] defaultenv-2: remove global.tftp.path Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2012-06-07 20:37 UTC (permalink / raw)
  To: barebox

This is always the tftp server specified in /env/network/eth0,
this could be either the one returned from a dhcp request or
a manually specified one, but in the end it's always the right
one.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 defaultenv-2/base/init/automount |   11 +++--------
 defaultenv-2/base/init/general   |    2 +-
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/defaultenv-2/base/init/automount b/defaultenv-2/base/init/automount
index 63099f9..7b53309 100644
--- a/defaultenv-2/base/init/automount
+++ b/defaultenv-2/base/init/automount
@@ -5,10 +5,10 @@ if [ "$1" = menu ]; then
 	exit
 fi
 
-# automount server returned from dhcp server
+# automount tftp server based on $eth0.serverip
 
-mkdir -p /mnt/tftp-dhcp
-automount /mnt/tftp-dhcp 'ifup eth0 && mount $eth0.serverip tftp /mnt/tftp-dhcp'
+mkdir -p /mnt/tftp
+automount /mnt/tftp 'ifup eth0 && mount $eth0.serverip tftp /mnt/tftp'
 
 # automount nfs server example
 
@@ -16,11 +16,6 @@ automount /mnt/tftp-dhcp 'ifup eth0 && mount $eth0.serverip tftp /mnt/tftp-dhcp'
 #mkdir -p /mnt/${nfshost}
 #automount /mnt/$nfshost "ifup eth0 && mount ${nfshost}:/tftpboot nfs /mnt/${nfshost}"
 
-# static tftp server example
-
-#mkdir -p /mnt/tftp
-#automount -d /mnt/tftp 'ifup eth0 && mount $serverip tftp /mnt/tftp'
-
 # FAT on usb disk example
 
 #mkdir -p /mnt/fat
diff --git a/defaultenv-2/base/init/general b/defaultenv-2/base/init/general
index ad6c860..2fea03d 100644
--- a/defaultenv-2/base/init/general
+++ b/defaultenv-2/base/init/general
@@ -15,4 +15,4 @@ global.autoboot_timeout=3
 global.boot.default=net
 
 # default tftp path
-global.tftp.path=/mnt/tftp-dhcp
+global.tftp.path=/mnt/tftp
-- 
1.7.10


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

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

* [PATCH 3/3] defaultenv-2: remove global.tftp.path
  2012-06-07 20:37 defenv-2 updates Sascha Hauer
  2012-06-07 20:37 ` [PATCH 1/3] defaultenv-2 ifup: Always overwrite eth0.serverip Sascha Hauer
  2012-06-07 20:37 ` [PATCH 2/3] defaultenv-2: mount tftp server specified in $eth0.serverip Sascha Hauer
@ 2012-06-07 20:37 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2012-06-07 20:37 UTC (permalink / raw)
  To: barebox

This variable is set in /env/init/general and then used
in /env/boot/* which is a bit confusing. Also it does not
necessarily have to be a tftp path (could be nfs aswell).
Use a local variable in the scripts using it instead to make
the meaning a bit more clear.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 defaultenv-2/base/bin/init     |    2 --
 defaultenv-2/base/boot/initrd  |    5 +++--
 defaultenv-2/base/boot/net     |    6 ++++--
 defaultenv-2/base/init/general |    3 ---
 4 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/defaultenv-2/base/bin/init b/defaultenv-2/base/bin/init
index e293c62..9d7eb2e 100644
--- a/defaultenv-2/base/bin/init
+++ b/defaultenv-2/base/bin/init
@@ -4,8 +4,6 @@ export PATH=/env/bin
 
 global hostname=generic
 global user=none
-global tftp.server
-global tftp.path=/mnt/tftp-dhcp
 global autoboot_timeout=3
 global boot.default=net
 global allow_color=true
diff --git a/defaultenv-2/base/boot/initrd b/defaultenv-2/base/boot/initrd
index 1a1e629..79a353a 100644
--- a/defaultenv-2/base/boot/initrd
+++ b/defaultenv-2/base/boot/initrd
@@ -5,8 +5,9 @@ if [ "$1" = menu ]; then
 	exit
 fi
 
-global.bootm.image="${global.tftp.path}/${global.user}-linux-${global.hostname}"
-global.bootm.initrd="${global.tftp.path}/initramfs"
+path="/mnt/tftp"
+global.bootm.image="${path}/${global.user}-linux-${global.hostname}"
+global.bootm.initrd="${path}/initramfs"
 bootargs-root-initrd
 #global.bootm.oftree=<path to oftree>
 
diff --git a/defaultenv-2/base/boot/net b/defaultenv-2/base/boot/net
index 2684c20..922bef1 100644
--- a/defaultenv-2/base/boot/net
+++ b/defaultenv-2/base/boot/net
@@ -5,8 +5,10 @@ if [ "$1" = menu ]; then
 	exit
 fi
 
-global.bootm.image="${global.tftp.path}/${global.user}-linux-${global.hostname}"
-#global.bootm.oftree="${global.tftp.path}/${global.user}-oftree-${global.hostname}"
+path="/mnt/tftp"
+
+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}"
 bootargs-ip
 bootargs-root-nfs -n "$nfsroot"
diff --git a/defaultenv-2/base/init/general b/defaultenv-2/base/init/general
index 2fea03d..98a92d1 100644
--- a/defaultenv-2/base/init/general
+++ b/defaultenv-2/base/init/general
@@ -13,6 +13,3 @@ global.autoboot_timeout=3
 
 # default boot entry (one of /env/boot/*)
 global.boot.default=net
-
-# default tftp path
-global.tftp.path=/mnt/tftp
-- 
1.7.10


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

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

end of thread, other threads:[~2012-06-07 20:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-07 20:37 defenv-2 updates Sascha Hauer
2012-06-07 20:37 ` [PATCH 1/3] defaultenv-2 ifup: Always overwrite eth0.serverip Sascha Hauer
2012-06-07 20:37 ` [PATCH 2/3] defaultenv-2: mount tftp server specified in $eth0.serverip Sascha Hauer
2012-06-07 20:37 ` [PATCH 3/3] defaultenv-2: remove global.tftp.path Sascha Hauer

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