xref: /openbmc/u-boot/doc/README.dfutftp (revision 5a6087277c271773248e30c53ba494e328a7d476)
1*5a608727SLukasz MajewskiDevice Firmware Upgrade (DFU) - extension to use TFTP
2*5a608727SLukasz Majewski=====================================================
3*5a608727SLukasz Majewski
4*5a608727SLukasz MajewskiWhy?
5*5a608727SLukasz Majewski----
6*5a608727SLukasz Majewski
7*5a608727SLukasz Majewski* Update TFTP (CONFIG_UPDATE_TFTP) only supports writing
8*5a608727SLukasz Majewskicode to NAND memory via TFTP.
9*5a608727SLukasz Majewski* DFU supports writing data to the variety of mediums (NAND,
10*5a608727SLukasz MajewskieMMC, SD, partitions, RAM, etc) via USB.
11*5a608727SLukasz Majewski
12*5a608727SLukasz MajewskiCombination of both solves their shortcomings!
13*5a608727SLukasz Majewski
14*5a608727SLukasz Majewski
15*5a608727SLukasz MajewskiOverview
16*5a608727SLukasz Majewski--------
17*5a608727SLukasz Majewski
18*5a608727SLukasz MajewskiThis document briefly describes how to use DFU for
19*5a608727SLukasz Majewskiupgrading firmware (e.g. kernel, u-boot, rootfs, etc.)
20*5a608727SLukasz Majewskivia TFTP protocol.
21*5a608727SLukasz Majewski
22*5a608727SLukasz MajewskiBy using Ethernet (TFTP protocol to be precise) it is
23*5a608727SLukasz Majewskipossible to overcome the major problem of USB based DFU -
24*5a608727SLukasz Majewskithe relatively low transfer speed for large files.
25*5a608727SLukasz MajewskiThis was caused by DFU standard, which imposed utilization
26*5a608727SLukasz Majewskiof only EP0 for transfer. By using Ethernet we can circumvent
27*5a608727SLukasz Majewskithis shortcoming.
28*5a608727SLukasz Majewski
29*5a608727SLukasz MajewskiBeagle Bone Black rev. C (BBB) powered by TI's am335x CPU has
30*5a608727SLukasz Majewskibeen used as a demo board.
31*5a608727SLukasz Majewski
32*5a608727SLukasz MajewskiTo utilize this feature, one needs to first enable support
33*5a608727SLukasz Majewskifor USB based DFU (CONFIG_DFU_*) and DFU TFTP update
34*5a608727SLukasz Majewski(CONFIG_DFU_TFTP) described in ./doc/README.update.
35*5a608727SLukasz Majewski
36*5a608727SLukasz MajewskiThe "dfu" command has been extended to support transfer via TFTP - one
37*5a608727SLukasz Majewskineeds to type for example "dfu tftp 0 mmc 0"
38*5a608727SLukasz Majewski
39*5a608727SLukasz MajewskiThis feature does not depend on "fitupd" command enabled.
40*5a608727SLukasz Majewski
41*5a608727SLukasz MajewskiAs of this writing (SHA1:8d77576371381ade83de475bb639949b44941e8c v2015.10-rc2)
42*5a608727SLukasz Majewskithe update.c code is not enabled (CONFIG_UPDATE_TFTP) by any board in the
43*5a608727SLukasz Majewskicontemporary u-boot tree.
44*5a608727SLukasz Majewski
45*5a608727SLukasz Majewski
46*5a608727SLukasz MajewskiEnvironment variables
47*5a608727SLukasz Majewski---------------------
48*5a608727SLukasz Majewski
49*5a608727SLukasz MajewskiThe "dfu tftp" command can be used in the "preboot" environment variable
50*5a608727SLukasz Majewski(when it is enabled by defining CONFIG_PREBOOT).
51*5a608727SLukasz MajewskiThis is the preferable way of using this command in the early boot stage
52*5a608727SLukasz Majewskias opposed to legacy update_tftp() function invocation.
53*5a608727SLukasz Majewski
54*5a608727SLukasz Majewski
55*5a608727SLukasz MajewskiBeagle Bone Black (BBB) setup
56*5a608727SLukasz Majewski-----------------------------
57*5a608727SLukasz Majewski
58*5a608727SLukasz Majewski1. Setup tftp env variables:
59*5a608727SLukasz Majewski   *  select desired eth device - 'ethact' variable ["ethact=cpsw"]
60*5a608727SLukasz Majewski      (use "bdinfo" to check current setting)
61*5a608727SLukasz Majewski   *  setup "serverip" and "ipaddr" variables
62*5a608727SLukasz Majewski   *  set "loadaddr" as a fixed buffer where incoming data is placed
63*5a608727SLukasz Majewski      ["loadaddr=0x81000000"]
64*5a608727SLukasz Majewski
65*5a608727SLukasz Majewski#########
66*5a608727SLukasz Majewski# BONUS #
67*5a608727SLukasz Majewski#########
68*5a608727SLukasz MajewskiIt is possible to use USB interface to emulate ETH connection by setting
69*5a608727SLukasz Majewski"ethact=usb_ether". In this way one can have very fast DFU transfer via USB.
70*5a608727SLukasz Majewski
71*5a608727SLukasz MajewskiFor 33MiB test image the transfer rate was 1MiB/s for ETH over USB and 200KiB/s
72*5a608727SLukasz Majewskifor pure DFU USB transfer.
73*5a608727SLukasz Majewski
74*5a608727SLukasz Majewski2. Setup update_tftp variables:
75*5a608727SLukasz Majewski   *  set "updatefile" - the file name to be downloaded via TFTP (stored on
76*5a608727SLukasz Majewski      the HOST at e.g. /srv/tftp)
77*5a608727SLukasz Majewski
78*5a608727SLukasz Majewski3. If required, to update firmware on boot, put the "dfu tftp 0 mmc 0" in the
79*5a608727SLukasz Majewski    "preboot" env variable. Otherwise use this command from u-boot prompt.
80*5a608727SLukasz Majewski
81*5a608727SLukasz Majewski4. Inspect "dfu" specific variables:
82*5a608727SLukasz Majewski   * "dfu_alt_info" - information about available DFU entities
83*5a608727SLukasz Majewski   * "dfu_bufsiz"   - variable to set buffer size [in bytes] - when it is not
84*5a608727SLukasz Majewski		    possible to set large enough default buffer (8 MiB @ BBB)
85*5a608727SLukasz Majewski
86*5a608727SLukasz Majewski
87*5a608727SLukasz Majewski
88*5a608727SLukasz MajewskiFIT image format for download
89*5a608727SLukasz Majewski-----------------------------
90*5a608727SLukasz Majewski
91*5a608727SLukasz MajewskiTo create FIT image for download one should follow the update tftp README file
92*5a608727SLukasz Majewski(./doc/README.update) with one notable difference:
93*5a608727SLukasz Majewski
94*5a608727SLukasz MajewskiThe original snippet of ./doc/uImage.FIT/update_uboot.its
95*5a608727SLukasz Majewski
96*5a608727SLukasz Majewski	images {
97*5a608727SLukasz Majewski		update@1 {
98*5a608727SLukasz Majewski			description = "U-Boot binary";
99*5a608727SLukasz Majewski
100*5a608727SLukasz Majewskishould look like
101*5a608727SLukasz Majewski
102*5a608727SLukasz Majewski	images {
103*5a608727SLukasz Majewski		u-boot.bin@1 {
104*5a608727SLukasz Majewski			description = "U-Boot binary";
105*5a608727SLukasz Majewski
106*5a608727SLukasz Majewskiwhere "u-boot.bin" is the DFU entity name to be stored.
107*5a608727SLukasz Majewski
108*5a608727SLukasz Majewski
109*5a608727SLukasz Majewski
110*5a608727SLukasz MajewskiTo do
111*5a608727SLukasz Majewski-----
112*5a608727SLukasz Majewski
113*5a608727SLukasz Majewski* Extend dfu-util command to support TFTP based transfers
114*5a608727SLukasz Majewski* Upload support (via TFTP)
115