From patchwork Sun Jul 12 15:30:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 494146 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 4F0CA1402B3 for ; Mon, 13 Jul 2015 02:28:00 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CE8A24B624; Sun, 12 Jul 2015 18:27:35 +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 1haNmUwS6vqb; Sun, 12 Jul 2015 18:27:35 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0C74E4B6C6; Sun, 12 Jul 2015 18:27:03 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A539C4B616 for ; Sun, 12 Jul 2015 17:50:58 +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 7LK5z7aL1-cR for ; Sun, 12 Jul 2015 17:50:58 +0200 (CEST) X-Greylist: delayed 592 seconds by postgrey-1.34 at theia; Sun, 12 Jul 2015 17:50:53 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 17.mo4.mail-out.ovh.net (17.mo4.mail-out.ovh.net [46.105.41.16]) by theia.denx.de (Postfix) with ESMTPS id 570CD4B615 for ; Sun, 12 Jul 2015 17:50:53 +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 41429FFAE24 for ; Sun, 12 Jul 2015 17:34:00 +0200 (CEST) Received: from localhost (HELO queueout) (127.0.0.1) by localhost with SMTP; 12 Jul 2015 17:34:00 +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:33:59 +0200 From: Lukasz Majewski To: u-boot@lists.denx.de, Tom Rini Date: Sun, 12 Jul 2015 17:30:37 +0200 Message-Id: <1436715044-18706-2-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: 9839239287257874971 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 1/8] doc: dfu: tftp: README entry for TFTP extension of DFU 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" Documentation file for DFU extension. With this functionality it is now possible to transfer FIT images with firmware updates via TFTP and use DFU backend for storing them. Signed-off-by: Lukasz Majewski --- doc/README.dfutftp | 153 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 doc/README.dfutftp diff --git a/doc/README.dfutftp b/doc/README.dfutftp new file mode 100644 index 0000000..4636321 --- /dev/null +++ b/doc/README.dfutftp @@ -0,0 +1,153 @@ +Device Firmware Upgrade (DFU) - extension to use TFTP +===================================================== + +Why? +---- + +* Update TFTP (CONFIG_UPDATE_TFTP) only supports writing +code to NAND memory via TFTP. +* DFU supports writing data to variety of mediums (NAND, +eMMC, SD, partitions, RAM, etc) via USB. + +Combination of both solves their shortcomings! + + +Overview +-------- + +This document briefly describes how to use BF for +upgrading firmware (e.g. kernel, u-boot, rootfs, etc.) +via TFTP protocol. + +By using Ethernet (TFTP protocol to be precise) it was +possible to overcome the major problem of USB based DFU - +the relatively low transfer speed for large files. +This was caused by DFU standard, which imposed utilization +of only EP0 for transfer. By using Ethernet we can circumvent +this shortcoming. + +Beagle Bone Black (BBB) powered by TI's am335x CPU has been used +as a demo board. + +To utilize this feature, one needs to first enable support +for USB based DFU (CONFIG_DFU_*) and TFTP update +(CONFIG_UPDATE_TFTP) described in ./doc/README.update. + +New "dfutftp" command has been introduced to comply with present +USB related commands' syntax. + +This code works without "fitupd" command enabled. + +As of this writing (SHA1:241746e618fa725491e9ff689710c5f73ffd9139) the +update.c code is not enabled (CONFIG_UPDATE_TFTP) by any board in the +contemporary u-boot tree. + + +Environment variables +--------------------- + +To preserve legacy behavior of TFTP update (./common/update.c) +code following new environment variables had been introduced: + +* "update_tftp_exec_at_boot" ["true"|"false"] + + New usage of update_tftp allows setting the + "update_tftp_exec_at_boot" env variable to allow it running + at boot time. + In this way update_tftp will not be executed at startup and reduce + boot time. + + To preserve backward compatibility for legacy boards this variable + should be set to "true". + + BBB note: + When update tftp is not working after boot one need to + increase values of following two configs: + CONFIG_UPDATE_TFTP_MSEC_MAX and CONFIG_UPDATE_TFTP_CNT_MAX. + Values of namely 1000 and 5 solve the issue for BBB. + +* "update_tftp_dfu" ["true"|"false"] + + By "update_tftp_dfu" env variable we inform update_tftp that + it should use dfu for writing data - in this way support for + legacy usage is preserved. + +* "update_tftp_dfu_interface" ["mmc"] +* "update_tftp_dfu_devstring" ["1"] + + Both variables - namely "update_tftp_dfu_{interface|devstring}" are + only taken into account when "update_tftp_dfu" is defined. + They store information about interface (e.g. "mmc") and device number + string (e.g. "1"). + + In the "dfutftp" command they are explicitly overridden. + It is done deliberately, since in this command we may use arbitrary values. + + Default values, when available during boot, are used by update_tftp + (when dfu support is enabled) to properly setup medium device + (e.g. mmc 1). + + + +Beagle Bone Black (BBB) setup +----------------------------- + +1. Setup tftp env variables: + * select desired eth device - 'ethact' variable ["ethact=cpsw"] + (use "bdinfo" to check current setting) + * setup "serverip" and "ipaddr" variables + * set "loadaddr" as a fixed buffer where incoming data is placed + ["loadaddr=0x81000000"] + +######### +# BONUS # +######### +It is possible to use USB interface to emulate ETH connection by setting +"ethact=usb_ether". In this way one can have very fast DFU transfer via USB. + +For 33MiB test image the transfer rate is 1MiB/s + +2. Setup update_tftp variables: + * set "updatefile" - the file name to be downloaded via TFTP (stored on + the HOST at e.g. /srv/tftp) + +3. Setup dfutftp specific variables (as explained in "Environment Variables") + * "update_tftp_exec_at_boot=true" + * "update_tftp_dfu=true" + +4. Inspect "dfu" specific variables: + * "dfu_alt_info" - information about available DFU entities + * "dfu_bufsiz" - variable to set buffer size [in bytes] - when it is not + possible to set large enough default buffer (8 MiB @ BBB) + + + +FIT image format for download +----------------------------- + +To create FIT image for download one should follow the update tftp README file +(./doc/README.update) with one notable difference: + +The original snippet of ./doc/uImage.FIT/update_uboot.its + + images { + update@1 { + description = "U-Boot binary"; + +should look like + + images { + u-boot.bin@1 { + description = "U-Boot binary"; + +where "u-boot.bin" is the DFU entity name to be stored. + + + +To do +----- + +* Extend dfu-util command (or write new one - e.g. dfueth-util) to support + TFTP based transfers + +* Upload support (via TFTP) \ No newline at end of file