From patchwork Sat Oct 22 04:51:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 121138 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 37E451007D3 for ; Sat, 22 Oct 2011 15:52:44 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B92A829780; Sat, 22 Oct 2011 06:52:42 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uCWGW-WIj9Au; Sat, 22 Oct 2011 06:52:42 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CAD5C2974D; Sat, 22 Oct 2011 06:52:35 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9BADE29457 for ; Sat, 22 Oct 2011 06:52:19 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7k1obmZEiE35 for ; Sat, 22 Oct 2011 06:52:19 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtp-out.google.com (smtp-out.google.com [216.239.44.51]) by theia.denx.de (Postfix) with ESMTPS id A53332945F for ; Sat, 22 Oct 2011 06:52:18 +0200 (CEST) Received: from wpaz37.hot.corp.google.com (wpaz37.hot.corp.google.com [172.24.198.101]) by smtp-out.google.com with ESMTP id p9M4qGwR013379; Fri, 21 Oct 2011 21:52:16 -0700 Received: from glucid-laptop-imager.hot.corp.google.com ([172.19.240.38]) by wpaz37.hot.corp.google.com with ESMTP id p9M4qEOW027062; Fri, 21 Oct 2011 21:52:15 -0700 Received: by glucid-laptop-imager.hot.corp.google.com (Postfix, from userid 121222) id C339634E8B9; Fri, 21 Oct 2011 21:52:13 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 21 Oct 2011 21:51:40 -0700 Message-Id: <1319259100-11376-9-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: <1319259100-11376-1-git-send-email-sjg@chromium.org> References: <1319259100-11376-1-git-send-email-sjg@chromium.org> X-System-Of-Record: true Subject: [U-Boot] [PATCH 8/8] tftpput: add tftpput command X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This adds a command to start a tftp put transfer. Signed-off-by: Simon Glass --- common/cmd_net.c | 23 +++++++++++++++++++++++ include/config_cmd_all.h | 1 + 2 files changed, 24 insertions(+), 0 deletions(-) diff --git a/common/cmd_net.c b/common/cmd_net.c index f610385..f89a24b 100644 --- a/common/cmd_net.c +++ b/common/cmd_net.c @@ -52,6 +52,22 @@ U_BOOT_CMD( "[loadAddress] [[hostIPaddr:]bootfilename]" ); +#ifdef CONFIG_CMD_TFTPPUT +int do_tftpput(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + int ret; + + ret = netboot_common(TFTPPUT, cmdtp, argc, argv); + return ret; +} + +U_BOOT_CMD( + tftpput, 4, 1, do_tftpput, + "TFTP put command, for uploading files to a server", + "Address Size [[hostIPaddr:]filename]" +); +#endif + #ifdef CONFIG_CMD_TFTPSRV static int do_tftpsrv(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) { @@ -203,6 +219,13 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc, break; +#ifdef CONFIG_CMD_TFTPPUT + case 4: + save_addr = strict_strtoul(argv[1], NULL, 16); + save_size = strict_strtoul(argv[2], NULL, 16); + copy_filename(BootFile, argv[3], sizeof(BootFile)); + break; +#endif default: show_boot_progress (-80); return cmd_usage(cmdtp); diff --git a/include/config_cmd_all.h b/include/config_cmd_all.h index 9716f9c..7fa8661 100644 --- a/include/config_cmd_all.h +++ b/include/config_cmd_all.h @@ -82,6 +82,7 @@ #define CONFIG_CMD_SOURCE /* "source" command support */ #define CONFIG_CMD_SPI /* SPI utility */ #define CONFIG_CMD_TERMINAL /* built-in Serial Terminal */ +#define CONFIG_CMD_TFTPPUT /* TFTP upload */ #define CONFIG_CMD_UBI /* UBI Support */ #define CONFIG_CMD_UBIFS /* UBIFS Support */ #define CONFIG_CMD_UNIVERSE /* Tundra Universe Support */