mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 3/5] defaultenv: add xmodem support for update
Date: Thu,  7 Oct 2010 18:37:36 +0200	[thread overview]
Message-ID: <1286469458-11362-3-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1286469458-11362-1-git-send-email-plagnioj@jcrosoft.com>

this is add as last parameter to do not change the default behavior

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 defaultenv/bin/_update       |   26 +++++++++++++++++---------
 defaultenv/bin/init          |    5 +++--
 defaultenv/bin/update_kernel |    7 ++++++-
 defaultenv/bin/update_rootfs |    7 ++++++-
 4 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/defaultenv/bin/_update b/defaultenv/bin/_update
index ddd6b84..c60ff88 100644
--- a/defaultenv/bin/_update
+++ b/defaultenv/bin/_update
@@ -14,14 +14,16 @@ if [ $# = 1 ]; then
 	image=$1
 fi
 
-if [ x$ip = xdhcp ]; then
-	dhcp
-fi
-
-ping $eth0.serverip
-if [ $? -ne 0 ] ; then
-	echo "Server did not reply! Update aborted."
-	exit 1
+if [ x$mode = xnet ]; then
+	if [ x$ip = xdhcp ]; then
+		dhcp
+	fi
+
+	ping $eth0.serverip
+	if [ $? -ne 0 ] ; then
+		echo "Server did not reply! Update aborted."
+		exit 1
+	fi
 fi
 
 unprotect $part
@@ -34,6 +36,12 @@ erase $part
 echo
 echo "flashing $image to $part"
 echo
-tftp $image $part
+
+if [ x$mode = xnet ]; then
+	tftp $image $part
+else
+	loadb -f $image -c
+	cp $image $part
+fi
 
 protect $part
diff --git a/defaultenv/bin/init b/defaultenv/bin/init
index a55e8e6..db2b525 100644
--- a/defaultenv/bin/init
+++ b/defaultenv/bin/init
@@ -25,8 +25,9 @@ echo -n "Hit any key to stop autoboot: "
 timeout -a $autoboot_timeout
 if [ $? != 0 ]; then
 	echo
-	echo "type update_kernel nand|nor [<imagename>] to update kernel into flash"
-	echo "type update_rootfs nand|nor [<imagename>] to update rootfs into flash"
+	echo "default mode is net"
+	echo "type update_kernel nand|nor [<imagename>] [net|xmodem] to update kernel into flash"
+	echo "type update_rootfs nand|nor [<imagename>] [net|xmodem] to update rootfs into flash"
 	echo
 	exit
 fi
diff --git a/defaultenv/bin/update_kernel b/defaultenv/bin/update_kernel
index 1d35ed9..b29927f 100644
--- a/defaultenv/bin/update_kernel
+++ b/defaultenv/bin/update_kernel
@@ -2,14 +2,19 @@
 
 . /env/config
 image=$kernelimage
+mode=net
 
 if [ x$1 = xnand ]; then
 	part=/dev/nand0.kernel.bb
 elif [ x$1 = xnor ]; then
 	part=/dev/nor0.kernel
 else
-	echo "usage: $0 nor|nand [imagename]"
+	echo "usage: $0 nor|nand [imagename] [net|xmodem]"
 	exit 1
 fi
 
+if [ x$3 != x ]; then
+	mode=$3
+fi
+
 . /env/bin/_update $2
diff --git a/defaultenv/bin/update_rootfs b/defaultenv/bin/update_rootfs
index 6366315..bac74ca 100644
--- a/defaultenv/bin/update_rootfs
+++ b/defaultenv/bin/update_rootfs
@@ -3,14 +3,19 @@
 . /env/config
 
 image=$rootfsimage
+mode=net
 
 if [ x$1 = xnand ]; then
 	part=/dev/nand0.root.bb
 elif [ x$1 = xnor ]; then
 	part=/dev/nor0.root
 else
-	echo "usage: $0 nor|nand [imagename]"
+	echo "usage: $0 nor|nand [imagename] [net|xmodem]"
 	exit 1
 fi
 
+if [ x$3 != x ]; then
+	mode=$3
+fi
+
 . /env/bin/_update $2
-- 
1.7.1


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

  parent reply	other threads:[~2010-10-07 16:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-07 16:37 [PATCH 1/5] defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it Jean-Christophe PLAGNIOL-VILLARD
2010-10-07 16:37 ` [PATCH 2/5] commands/crc32: add compare 2 files crc Jean-Christophe PLAGNIOL-VILLARD
2010-10-07 16:37 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2010-10-08 12:27   ` [PATCH 3/5] defaultenv: add xmodem support for update Sascha Hauer
2010-10-11  5:11     ` Jean-Christophe PLAGNIOL-VILLARD
2010-10-07 16:37 ` [PATCH 4/5] defaultenv: add update_barebox to update barebox easly for tftp or xmodem Jean-Christophe PLAGNIOL-VILLARD
2010-10-07 16:37 ` [PATCH 5/5] nhk8815: use defaultenv Jean-Christophe PLAGNIOL-VILLARD
2010-10-08  6:59 ` [PATCH 1/5] defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it Sascha Hauer
2010-10-08 12:39   ` Jean-Christophe PLAGNIOL-VILLARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1286469458-11362-3-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox