[U-Boot] [PATCH 0/8] Add tftpput command for uploading files over network

Simon Glass sjg at chromium.org
Tue Oct 25 06:13:56 CEST 2011


Hi Albert,

On Sun, Oct 23, 2011 at 9:28 PM, Simon Glass <sjg at chromium.org> wrote:
> Hi Albert,
>
> On Sat, Oct 22, 2011 at 9:15 AM, Simon Glass <sjg at chromium.org> wrote:
>> Hi Albert,
>>
>> On Sat, Oct 22, 2011 at 1:21 AM, Albert ARIBAUD
>> <albert.u.boot at aribaud.net> wrote:
>>> Le 22/10/2011 06:51, Simon Glass a écrit :
>>>>
>>>> The tftpboot command permits reading of files over a network interface
>>>> using the Trivial FTP protocol. This patch series adds the ability to
>>>> transfer files the other way.
>>>>
>>>> Why is this useful?
>>>>
>>>> - Uploading boot time data to a server
>>>> - Uploading profiling information
>>>> - Uploading large mounts of data for comparison / checking on a host
>>>>     (e.g. use tftpput and ghex2 instead of the 'md' command)
>>>
>>> Especially I find it interesting for backing up things like MTD and small
>>> disk files (not partitions, though). Most of my work currently is trying to
>>> bring mainline U-Boot support to existing boards with bad U-Boot
>>> implementations, and being able to backup things from U-Boot (as opposed to
>>> having to set up NFS root and Linux boot) would definitely be a plus.
>>>
>>>> Mostly the existing code can be re-used and I have tried to avoid too
>>>> much refactoring or cleaning up.
>>>
>>> :)
>>>
>>>> The feature is activated by the CONFIG_CMD_TFTPPUT option.
>>>>
>>>> This has been very lightly tested on a Seaboard with a USB network
>>>> adaptor. I don't think it handles block number overflow.
>>>
>>> What size does this limit transfers to?
>>
>> I think about 1468 * 65535 - around 95MB - it's fairly easy to fix
>> just by copying out the existing tftp get wrap code. I put it in the
>> commit message so it wouldn't get lost.

I have fixed this in v2 and tested that it can wrap around many times
without trouble. There is a small issue that some servers wrap around
to 0 and others to 1. For tftpd-hpa at least it is 0, although the
write part seems broken anyway.

Unfortunately this involves a little more refactoring, since I didn't
want to duplicate code, and some of the functions are awfully long.

>>
>>>
>>>> Simon Glass (8):
>>>>   Move simple_itoa to vsprintf
>>>>   Add setenv_uint() and setenv_addr()
>>>>   tftpput: Rename TFTP to TFTPGET
>>>>   tftpput: move common code into separate functions
>>>>   tftpput: support selecting get/put for tftp
>>>>   tftpput: add save_addr and save_size global variables
>>>>   tftpput: implement tftp logic
>>>>   tftpput: add tftpput command
>>>
>>> Many U-Boot environments use 'tftp' as a shorthand to tftpboot. Did you
>>> verify that this is not broken by the introduction of 'tftpput'?

I forgot to answer this. No this will break 'tftp' as 'tftpserver'
does. I vaguely remember a discussion that this was correct, since
tftp is only an abbreviation and should not be used in scripts.

>>>
>>> Also, I'd be happy to test this if a branch exists that already holds these
>>> commits.
>>
>> I will see if I can organise one at Denx.
>
> Thanks to Wolfgang I have something you can try:
>
> git clone git://git.denx.de/u-boot-simonglass
> git checkout us-tftp

Try git checkout us-tftp2 for the new version.

Regards,
SImon

>>> Amicalement,
>>> --
>>> Albert.
>>>
>>
>


More information about the U-Boot mailing list