From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by canuck.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1P4C3C-00036i-Gq for barebox@lists.infradead.org; Fri, 08 Oct 2010 12:27:51 +0000 Date: Fri, 8 Oct 2010 14:27:48 +0200 From: Sascha Hauer Message-ID: <20101008122747.GN28242@pengutronix.de> References: <1286469458-11362-1-git-send-email-plagnioj@jcrosoft.com> <1286469458-11362-3-git-send-email-plagnioj@jcrosoft.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1286469458-11362-3-git-send-email-plagnioj@jcrosoft.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH 3/5] defaultenv: add xmodem support for update To: Jean-Christophe PLAGNIOL-VILLARD Cc: barebox@lists.infradead.org On Thu, Oct 07, 2010 at 06:37:36PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote: > this is add as last parameter to do not change the default behavior > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD > --- > 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 [] to update kernel into flash" > - echo "type update_rootfs nand|nor [] to update rootfs into flash" > + echo "default mode is net" > + echo "type update_kernel nand|nor [] [net|xmodem] to update kernel into flash" > + echo "type update_rootfs nand|nor [] [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]" I'm not really happy with this patch. We have 3 positional parameters now and with xmodem it makes no sense to supply an image name, nontheless we have to supply it because otherwise we do not have three arguments. I just posted a patch adding a getopt command to hush. Maybe this could improve the situation here? 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