From patchwork Sun Jul 12 15:30:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 494149 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 CEB771402B3 for ; Mon, 13 Jul 2015 02:28:30 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5B2444B632; Sun, 12 Jul 2015 18:28:01 +0200 (CEST) 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 K5gGv_CJrzSJ; Sun, 12 Jul 2015 18:28:01 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 70A094B65B; Sun, 12 Jul 2015 18:27:17 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8D7014B616 for ; Sun, 12 Jul 2015 18:01:08 +0200 (CEST) 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 XTIzj3BTEsym for ; Sun, 12 Jul 2015 18:01:08 +0200 (CEST) X-Greylist: delayed 1438 seconds by postgrey-1.34 at theia; Sun, 12 Jul 2015 18:01:03 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 16.mo4.mail-out.ovh.net (16.mo4.mail-out.ovh.net [188.165.55.104]) by theia.denx.de (Postfix) with ESMTPS id B04464B615 for ; Sun, 12 Jul 2015 18:01:02 +0200 (CEST) Received: from mail631.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo4.mail-out.ovh.net (Postfix) with SMTP id 836D5FFAD6F for ; Sun, 12 Jul 2015 17:43:08 +0200 (CEST) Received: from localhost (HELO queueout) (127.0.0.1) by localhost with SMTP; 12 Jul 2015 17:43:07 +0200 Received: from 109241105088.warszawa.vectranet.pl (HELO localhost.localdomain) (l.majewski%majess.pl@109.241.105.88) by ns0.ovh.net with SMTP; 12 Jul 2015 17:43:07 +0200 From: Lukasz Majewski To: u-boot@lists.denx.de, Tom Rini Date: Sun, 12 Jul 2015 17:30:43 +0200 Message-Id: <1436715044-18706-8-git-send-email-l.majewski@majess.pl> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1436715044-18706-1-git-send-email-l.majewski@majess.pl> References: <1436715044-18706-1-git-send-email-l.majewski@majess.pl> X-Ovh-Tracer-Id: 9993487574495314465 X-Ovh-Remote: 109.241.105.88 (109241105088.warszawa.vectranet.pl) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-OVH-SPAMSTATE: OK X-OVH-SPAMSCORE: -100 X-OVH-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeekvddrheefucetufdoteggucfrrhhofhhilhgvmecuqfggjfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeekvddrheefucetufdoteggucfrrhhofhhilhgvmecuqfggjfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm X-Mailman-Approved-At: Sun, 12 Jul 2015 18:26:41 +0200 Cc: Marek Vasut , Steve Rae , Stephen Warren , Egli Samuel , Pantelis Antoniou , Rafal Czubak , Joe Hershberger , Bartlomiej Sieka , Przemyslaw Marczak , Tormod Volden Subject: [U-Boot] [PATCH 7/8] dfu: command: Provide support for 'dfutftp' command to handle receiving data via TFTP X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The new 'dfutftp' command has syntax similar to 'dfu' command. This new command however, requires some extra env variables to allow update_tftp() code to work properly. For more explanation, please consult ./doc/README.dfutftp Signed-off-by: Lukasz Majewski --- common/Makefile | 1 + common/cmd_dfutftp.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 common/cmd_dfutftp.c diff --git a/common/Makefile b/common/Makefile index d6c1d48..483905c 100644 --- a/common/Makefile +++ b/common/Makefile @@ -211,6 +211,7 @@ obj-$(CONFIG_UPDATE_TFTP) += update.o obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o obj-$(CONFIG_CMD_DFU) += cmd_dfu.o obj-$(CONFIG_CMD_GPT) += cmd_gpt.o +obj-$(CONFIG_CMD_DFUTFTP) += cmd_dfutftp.o # Power obj-$(CONFIG_CMD_PMIC) += cmd_pmic.o diff --git a/common/cmd_dfutftp.c b/common/cmd_dfutftp.c new file mode 100644 index 0000000..2b75a09 --- /dev/null +++ b/common/cmd_dfutftp.c @@ -0,0 +1,43 @@ +/* + * cmd_dfutftp.c -- dfutftp command + * + * Copyright (C) 2015 + * Lukasz Majewski + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include + +static +int do_dfutftp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + unsigned long addr = 0; + + if (argc < 4 || argc > 5) + return CMD_RET_USAGE; + + char *interface = argv[2]; + char *devstring = argv[3]; + + if (argc == 5) + addr = simple_strtoul(argv[4], NULL, 0); + + /* Below env variables are descibed in detail at ./doc/README.dfutftp */ + setenv("update_tftp_exec_at_boot", "true"); + setenv("update_tftp_dfu", "true"); + setenv("update_tftp_dfu_interface", interface); + setenv("update_tftp_dfu_devstring", devstring); + + return update_tftp(addr); +} + +U_BOOT_CMD(dfutftp, CONFIG_SYS_MAXARGS, 1, do_dfutftp, + "Device Firmware Upgrade via TFTP", + " \n" + " - device firmware upgrade via \n" + " using TFTP protocol on device , attached\n" + " to interface \n" + " [addr] - address where FIT image has been stored\n" +);