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 5/6] defaultenv: add xmodem support for update
Date: Mon, 11 Oct 2010 16:34:43 +0200	[thread overview]
Message-ID: <1286807684-17355-5-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20101011135329.GA7412@game.jcrosoft.org>

the default mode is tftp to do not change the default behavior

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 defaultenv/bin/_update      |   26 +++++++++++++++++---------
 defaultenv/bin/_update_help |   21 +++++++++++----------
 defaultenv/bin/update       |   11 ++++++++++-
 3 files changed, 38 insertions(+), 20 deletions(-)
 rewrite defaultenv/bin/_update_help (65%)

diff --git a/defaultenv/bin/_update b/defaultenv/bin/_update
index 6f2ebd3..87e6922 100644
--- a/defaultenv/bin/_update
+++ b/defaultenv/bin/_update
@@ -10,14 +10,16 @@ if [ ! -e "$part" ]; then
 	exit 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 = xtftp ]; 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
@@ -30,6 +32,12 @@ erase $part
 echo
 echo "flashing $image to $part"
 echo
-tftp $image $part
+
+if [ x$mode = xtftp ]; then
+	tftp $image $part
+else
+	loadb -f $image -c
+	cp $image $part
+fi
 
 protect $part
diff --git a/defaultenv/bin/_update_help b/defaultenv/bin/_update_help
dissimilarity index 65%
index a23f00f..1d9b28e 100644
--- a/defaultenv/bin/_update_help
+++ b/defaultenv/bin/_update_help
@@ -1,10 +1,11 @@
-#!/bin/sh
-
-echo "usage: $0 -t <kernel|rootfs> -d <nor|nand> [-f imagename] -c"
-echo "update tools."
-echo ""
-echo "options"
-echo " -c     to check the crc32 for the image and flashed one"
-echo ""
-echo "type update -t kernel -d <nor|nand> [-f imagename] to update kernel into flash"
-echo "type update -t rootfs -d <nor|nand> [-f imagename] to update rootfs into flash"
+#!/bin/sh
+
+echo "usage: $0 -t <kernel|rootfs> -d <nor|nand> [-m tftp|xmodem] [-f imagename] -c"
+echo "update tools."
+echo ""
+echo "options"
+echo " -c     to check the crc32 for the image and flashed one"
+echo ""
+echo "default mode is tftp"
+echo "type update -t kernel -d <nor|nand> [-m tftp|xmodem] [-f imagename] to update kernel into flash"
+echo "type update -t rootfs -d <nor|nand> [-m tftp|xmodem] [-f imagename] to update rootfs into flash"
diff --git a/defaultenv/bin/update b/defaultenv/bin/update
index 504bff6..032f340 100644
--- a/defaultenv/bin/update
+++ b/defaultenv/bin/update
@@ -5,8 +5,9 @@
 type=""
 device_type=""
 check=n
+mode=tftp
 
-while getopt "ht:d:f:c" Option
+while getopt "ht:d:f:m:c" Option
 do
 if [ ${Option} = t ]; then
 	type=${OPTARG}
@@ -16,6 +17,8 @@ elif [ ${Option} = f ]; then
 	imagename=${OPTARG}
 elif [ ${Option} = c ]; then
 	check=y
+elif [ ${Option} = m ]; then
+	mode=${OPTARG}
 else
 	. /env/bin/_update_help
 	exit 0
@@ -45,6 +48,12 @@ else
 	exit 1
 fi
 
+if [ x${mode} != xtftp ] && [ x${mode} != xxmodem ] ; then
+	echo "unsupported mode ${mode}."
+	. /env/bin/_update_help
+	exit 1
+fi
+
 . /env/bin/_update
 if [ x${check} = xy ]; then
 	crc32 -f $image -F $part
-- 
1.7.1


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

  parent reply	other threads:[~2010-10-11 14:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-11 13:53 defaultv env update v2 Jean-Christophe PLAGNIOL-VILLARD
2010-10-11 14:34 ` [PATCH 1/6] defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it Jean-Christophe PLAGNIOL-VILLARD
2010-10-11 14:34 ` [PATCH 2/6] commands/crc32: add compare 2 files crc Jean-Christophe PLAGNIOL-VILLARD
2010-10-11 14:34 ` [PATCH 3/6] defaultenv/update: merge update_rootfs and update_kernel Jean-Christophe PLAGNIOL-VILLARD
2010-10-11 14:34 ` [PATCH 4/6] defaultenv/update: add check crc32 options Jean-Christophe PLAGNIOL-VILLARD
2010-10-11 14:34 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2010-10-11 14:34 ` [PATCH 6/6] defaultenv: add update_barebox to update barebox easly via tftp or xmodem Jean-Christophe PLAGNIOL-VILLARD
2010-10-12  8:13 ` [PATCH] nhk8815: use defaultenv 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=1286807684-17355-5-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