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