xref: /openbmc/u-boot/doc/README.dfutftp (revision 5bf4475f1d7726541edec0060c6461fbb37db02d)
1*5bf4475fSLukasz Majewski#
2*5bf4475fSLukasz Majewski#  Copyright (C) 2015
3*5bf4475fSLukasz Majewski#
4*5bf4475fSLukasz Majewski#  Lukasz Majewski <l.majewski@majess.pl>
5*5bf4475fSLukasz Majewski#
6*5bf4475fSLukasz Majewski#
7*5bf4475fSLukasz Majewski# SPDX-License-Identifier:	GPL-2.0+
8*5bf4475fSLukasz Majewski
95a608727SLukasz MajewskiDevice Firmware Upgrade (DFU) - extension to use TFTP
105a608727SLukasz Majewski=====================================================
115a608727SLukasz Majewski
125a608727SLukasz MajewskiWhy?
135a608727SLukasz Majewski----
145a608727SLukasz Majewski
155a608727SLukasz Majewski* Update TFTP (CONFIG_UPDATE_TFTP) only supports writing
165a608727SLukasz Majewskicode to NAND memory via TFTP.
175a608727SLukasz Majewski* DFU supports writing data to the variety of mediums (NAND,
185a608727SLukasz MajewskieMMC, SD, partitions, RAM, etc) via USB.
195a608727SLukasz Majewski
205a608727SLukasz MajewskiCombination of both solves their shortcomings!
215a608727SLukasz Majewski
225a608727SLukasz Majewski
235a608727SLukasz MajewskiOverview
245a608727SLukasz Majewski--------
255a608727SLukasz Majewski
265a608727SLukasz MajewskiThis document briefly describes how to use DFU for
275a608727SLukasz Majewskiupgrading firmware (e.g. kernel, u-boot, rootfs, etc.)
285a608727SLukasz Majewskivia TFTP protocol.
295a608727SLukasz Majewski
305a608727SLukasz MajewskiBy using Ethernet (TFTP protocol to be precise) it is
315a608727SLukasz Majewskipossible to overcome the major problem of USB based DFU -
325a608727SLukasz Majewskithe relatively low transfer speed for large files.
335a608727SLukasz MajewskiThis was caused by DFU standard, which imposed utilization
345a608727SLukasz Majewskiof only EP0 for transfer. By using Ethernet we can circumvent
355a608727SLukasz Majewskithis shortcoming.
365a608727SLukasz Majewski
375a608727SLukasz MajewskiBeagle Bone Black rev. C (BBB) powered by TI's am335x CPU has
385a608727SLukasz Majewskibeen used as a demo board.
395a608727SLukasz Majewski
405a608727SLukasz MajewskiTo utilize this feature, one needs to first enable support
415a608727SLukasz Majewskifor USB based DFU (CONFIG_DFU_*) and DFU TFTP update
425a608727SLukasz Majewski(CONFIG_DFU_TFTP) described in ./doc/README.update.
435a608727SLukasz Majewski
445a608727SLukasz MajewskiThe "dfu" command has been extended to support transfer via TFTP - one
455a608727SLukasz Majewskineeds to type for example "dfu tftp 0 mmc 0"
465a608727SLukasz Majewski
475a608727SLukasz MajewskiThis feature does not depend on "fitupd" command enabled.
485a608727SLukasz Majewski
495a608727SLukasz MajewskiAs of this writing (SHA1:8d77576371381ade83de475bb639949b44941e8c v2015.10-rc2)
505a608727SLukasz Majewskithe update.c code is not enabled (CONFIG_UPDATE_TFTP) by any board in the
515a608727SLukasz Majewskicontemporary u-boot tree.
525a608727SLukasz Majewski
535a608727SLukasz Majewski
545a608727SLukasz MajewskiEnvironment variables
555a608727SLukasz Majewski---------------------
565a608727SLukasz Majewski
575a608727SLukasz MajewskiThe "dfu tftp" command can be used in the "preboot" environment variable
585a608727SLukasz Majewski(when it is enabled by defining CONFIG_PREBOOT).
595a608727SLukasz MajewskiThis is the preferable way of using this command in the early boot stage
605a608727SLukasz Majewskias opposed to legacy update_tftp() function invocation.
615a608727SLukasz Majewski
625a608727SLukasz Majewski
635a608727SLukasz MajewskiBeagle Bone Black (BBB) setup
645a608727SLukasz Majewski-----------------------------
655a608727SLukasz Majewski
665a608727SLukasz Majewski1. Setup tftp env variables:
675a608727SLukasz Majewski   *  select desired eth device - 'ethact' variable ["ethact=cpsw"]
685a608727SLukasz Majewski      (use "bdinfo" to check current setting)
695a608727SLukasz Majewski   *  setup "serverip" and "ipaddr" variables
705a608727SLukasz Majewski   *  set "loadaddr" as a fixed buffer where incoming data is placed
715a608727SLukasz Majewski      ["loadaddr=0x81000000"]
725a608727SLukasz Majewski
735a608727SLukasz Majewski#########
745a608727SLukasz Majewski# BONUS #
755a608727SLukasz Majewski#########
765a608727SLukasz MajewskiIt is possible to use USB interface to emulate ETH connection by setting
775a608727SLukasz Majewski"ethact=usb_ether". In this way one can have very fast DFU transfer via USB.
785a608727SLukasz Majewski
795a608727SLukasz MajewskiFor 33MiB test image the transfer rate was 1MiB/s for ETH over USB and 200KiB/s
805a608727SLukasz Majewskifor pure DFU USB transfer.
815a608727SLukasz Majewski
825a608727SLukasz Majewski2. Setup update_tftp variables:
835a608727SLukasz Majewski   *  set "updatefile" - the file name to be downloaded via TFTP (stored on
845a608727SLukasz Majewski      the HOST at e.g. /srv/tftp)
855a608727SLukasz Majewski
865a608727SLukasz Majewski3. If required, to update firmware on boot, put the "dfu tftp 0 mmc 0" in the
875a608727SLukasz Majewski    "preboot" env variable. Otherwise use this command from u-boot prompt.
885a608727SLukasz Majewski
895a608727SLukasz Majewski4. Inspect "dfu" specific variables:
905a608727SLukasz Majewski   * "dfu_alt_info" - information about available DFU entities
915a608727SLukasz Majewski   * "dfu_bufsiz"   - variable to set buffer size [in bytes] - when it is not
925a608727SLukasz Majewski		    possible to set large enough default buffer (8 MiB @ BBB)
935a608727SLukasz Majewski
945a608727SLukasz Majewski
955a608727SLukasz Majewski
965a608727SLukasz MajewskiFIT image format for download
975a608727SLukasz Majewski-----------------------------
985a608727SLukasz Majewski
995a608727SLukasz MajewskiTo create FIT image for download one should follow the update tftp README file
1005a608727SLukasz Majewski(./doc/README.update) with one notable difference:
1015a608727SLukasz Majewski
1025a608727SLukasz MajewskiThe original snippet of ./doc/uImage.FIT/update_uboot.its
1035a608727SLukasz Majewski
1045a608727SLukasz Majewski	images {
1055a608727SLukasz Majewski		update@1 {
1065a608727SLukasz Majewski			description = "U-Boot binary";
1075a608727SLukasz Majewski
1085a608727SLukasz Majewskishould look like
1095a608727SLukasz Majewski
1105a608727SLukasz Majewski	images {
1115a608727SLukasz Majewski		u-boot.bin@1 {
1125a608727SLukasz Majewski			description = "U-Boot binary";
1135a608727SLukasz Majewski
1145a608727SLukasz Majewskiwhere "u-boot.bin" is the DFU entity name to be stored.
1155a608727SLukasz Majewski
1165a608727SLukasz Majewski
1175a608727SLukasz Majewski
1185a608727SLukasz MajewskiTo do
1195a608727SLukasz Majewski-----
1205a608727SLukasz Majewski
1215a608727SLukasz Majewski* Extend dfu-util command to support TFTP based transfers
1225a608727SLukasz Majewski* Upload support (via TFTP)
123