All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] list files on tftp / large kernel-image
@ 2018-11-14 15:24 Frank Wunderlich
  2018-11-14 15:34 ` Simon Goldschmidt
  0 siblings, 1 reply; 16+ messages in thread
From: Frank Wunderlich @ 2018-11-14 15:24 UTC (permalink / raw)
  To: u-boot

Hi,

is it possible to list files on tftp so i can write a script to let user select kernel-image to load?

have anybody tried to load a kernelimage larger than 20MB?

i use dnsmasq as tftp and uboot 2014-version (because 2018-11 für mt7623 currently has no ethernetdriver). 
If kernelimage is larger than ~20MB loading file hangs...tried setting blocksize, but it's the same behaviour, only more/less #-symbols. I don't know how much data is loaded, because there is loadedbytes-counter (i only can count the # and multiply with blocksize if i know it). do i have any chance to debug that or is this already known/fixed?

regards Frank

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] list files on tftp / large kernel-image
  2018-11-14 15:24 [U-Boot] list files on tftp / large kernel-image Frank Wunderlich
@ 2018-11-14 15:34 ` Simon Goldschmidt
  2018-11-14 15:52   ` Frank Wunderlich
  0 siblings, 1 reply; 16+ messages in thread
From: Simon Goldschmidt @ 2018-11-14 15:34 UTC (permalink / raw)
  To: u-boot

On 14.11.2018 16:24, Frank Wunderlich wrote:
> Hi,
>
> is it possible to list files on tftp so i can write a script to let user select kernel-image to load?

Unless I'm mistaken, the tftp protocol does not support file listing.

> have anybody tried to load a kernelimage larger than 20MB?

We are successfully loading FIT images of > ~26 MByte via tftp 
(containing Kernel, FPGA and Initrd) without problems.

> i use dnsmasq as tftp and uboot 2014-version (because 2018-11 für mt7623 currently has no ethernetdriver).

I'm using current mainline, of course. Things might have changed in the 
last 4 years... ;-)

Simon

> If kernelimage is larger than ~20MB loading file hangs...tried setting blocksize, but it's the same behaviour, only more/less #-symbols. I don't know how much data is loaded, because there is loadedbytes-counter (i only can count the # and multiply with blocksize if i know it). do i have any chance to debug that or is this already known/fixed?
>
> regards Frank
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] list files on tftp / large kernel-image
  2018-11-14 15:34 ` Simon Goldschmidt
@ 2018-11-14 15:52   ` Frank Wunderlich
  2018-11-19 11:29     ` Simon Goldschmidt
  0 siblings, 1 reply; 16+ messages in thread
From: Frank Wunderlich @ 2018-11-14 15:52 UTC (permalink / raw)
  To: u-boot

Hi Simon,
thanks for fast answer

i hope mediatek release ethernet soon (i know it's a more complex driver for r2 than the other 18 patches ), than i can drop the old uboot ;)

for list tftp, it seems to be a protocol limitation.
here https://unix.stackexchange.com/questions/76400/download-directory-structure-from-a-tftp-server the server creates a textfile...this can be a workaround

can i download (to memory) and display it (without writing it)? i only have loaded kernel and executed it's address. I don't know how to print a "Textfile" (if it's in memory i need to know it's size and print this "data block"). maybe there is a way to load the data directly to an env-var

regards Frank


> Gesendet: Mittwoch, 14. November 2018 um 16:34 Uhr
> Von: "Simon Goldschmidt" <simon.k.r.goldschmidt@gmail.com>
> An: "Frank Wunderlich" <frank-w@public-files.de>, u-boot at lists.denx.de
> Betreff: Re: [U-Boot] list files on tftp / large kernel-image

> > is it possible to list files on tftp so i can write a script to let user select kernel-image to load?
> 
> Unless I'm mistaken, the tftp protocol does not support file listing.
> 
> > have anybody tried to load a kernelimage larger than 20MB?
> 
> We are successfully loading FIT images of > ~26 MByte via tftp 
> (containing Kernel, FPGA and Initrd) without problems.
> 
> > i use dnsmasq as tftp and uboot 2014-version (because 2018-11 für mt7623 currently has no ethernetdriver).
> 
> I'm using current mainline, of course. Things might have changed in the 
> last 4 years... ;-)
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] list files on tftp / large kernel-image
  2018-11-14 15:52   ` Frank Wunderlich
@ 2018-11-19 11:29     ` Simon Goldschmidt
  2018-12-02  9:33       ` Frank Wunderlich
  0 siblings, 1 reply; 16+ messages in thread
From: Simon Goldschmidt @ 2018-11-19 11:29 UTC (permalink / raw)
  To: u-boot

On Wed, Nov 14, 2018 at 4:52 PM Frank Wunderlich
<frank-w@public-files.de> wrote:
>
> Hi Simon,
> thanks for fast answer
>
> i hope mediatek release ethernet soon (i know it's a more complex driver for r2 than the other 18 patches ), than i can drop the old uboot ;)
>
> for list tftp, it seems to be a protocol limitation.
> here https://unix.stackexchange.com/questions/76400/download-directory-structure-from-a-tftp-server the server creates a textfile...this can be a workaround
>
> can i download (to memory) and display it (without writing it)? i only have loaded kernel and executed it's address. I don't know how to print a "Textfile" (if it's in memory i need to know it's size and print this "data block"). maybe there is a way to load the data directly to an env-var

Have you tried the 'strings' command? Is that enough?

Simon

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] list files on tftp / large kernel-image
  2018-11-19 11:29     ` Simon Goldschmidt
@ 2018-12-02  9:33       ` Frank Wunderlich
  2018-12-02 10:32         ` Frank Wunderlich
  2018-12-02 10:34         ` Simon Goldschmidt
  0 siblings, 2 replies; 16+ messages in thread
From: Frank Wunderlich @ 2018-12-02  9:33 UTC (permalink / raw)
  To: u-boot

can you give me an example how to download and display it, seems i only have tftpboot which runs kernel directly?

also found no strings-command in https://www.denx.de/wiki/DULG/Manual

Frank

> Gesendet: Montag, 19. November 2018 um 12:29 Uhr
> Von: "Simon Goldschmidt" <simon.k.r.goldschmidt@gmail.com>
> An: "Frank Wunderlich" <frank-w@public-files.de>
> Cc: "U-Boot Mailing List" <u-boot@lists.denx.de>
> Betreff: Re: Re: [U-Boot] list files on tftp / large kernel-image
>
> On Wed, Nov 14, 2018 at 4:52 PM Frank Wunderlich
> <frank-w@public-files.de> wrote:
> >
> > Hi Simon,
> > thanks for fast answer
> >
> > i hope mediatek release ethernet soon (i know it's a more complex driver for r2 than the other 18 patches ), than i can drop the old uboot ;)
> >
> > for list tftp, it seems to be a protocol limitation.
> > here https://unix.stackexchange.com/questions/76400/download-directory-structure-from-a-tftp-server the server creates a textfile...this can be a workaround
> >
> > can i download (to memory) and display it (without writing it)? i only have loaded kernel and executed it's address. I don't know how to print a "Textfile" (if it's in memory i need to know it's size and print this "data block"). maybe there is a way to load the data directly to an env-var
> 
> Have you tried the 'strings' command? Is that enough?
> 
> Simon
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] list files on tftp / large kernel-image
  2018-12-02  9:33       ` Frank Wunderlich
@ 2018-12-02 10:32         ` Frank Wunderlich
  2018-12-02 10:34         ` Simon Goldschmidt
  1 sibling, 0 replies; 16+ messages in thread
From: Frank Wunderlich @ 2018-12-02 10:32 UTC (permalink / raw)
  To: u-boot

i've walked through code and it seems i've found it in cmd/strings.c

strings
	display strings
	<addr> [byte count]
	    - display strings at <addr> for at least [byte count] or first double NUL

does tftp add the "double NUL" if i do this:

tftp 0x80200000 filelist.txt
strings 0x80200000

or do i need to add ${filesize} to strings-command (if this is set via tftp)

regards Frank

> Gesendet: Sonntag, 02. Dezember 2018 um 10:33 Uhr
> Von: "Frank Wunderlich" <frank-w@public-files.de>
> An: "Simon Goldschmidt" <simon.k.r.goldschmidt@gmail.com>
> Cc: u-boot at lists.denx.de
> Betreff: Re: [U-Boot] list files on tftp / large kernel-image
>
> can you give me an example how to download and display it, seems i only have tftpboot which runs kernel directly?
> 
> also found no strings-command in https://www.denx.de/wiki/DULG/Manual
> 
> Frank
> 
> > Gesendet: Montag, 19. November 2018 um 12:29 Uhr
> > Von: "Simon Goldschmidt" <simon.k.r.goldschmidt@gmail.com>
> > An: "Frank Wunderlich" <frank-w@public-files.de>
> > Cc: "U-Boot Mailing List" <u-boot@lists.denx.de>
> > Betreff: Re: Re: [U-Boot] list files on tftp / large kernel-image
> >
> > On Wed, Nov 14, 2018 at 4:52 PM Frank Wunderlich
> > <frank-w@public-files.de> wrote:
> > >
> > > Hi Simon,
> > > thanks for fast answer
> > >
> > > i hope mediatek release ethernet soon (i know it's a more complex driver for r2 than the other 18 patches ), than i can drop the old uboot ;)
> > >
> > > for list tftp, it seems to be a protocol limitation.
> > > here https://unix.stackexchange.com/questions/76400/download-directory-structure-from-a-tftp-server the server creates a textfile...this can be a workaround
> > >
> > > can i download (to memory) and display it (without writing it)? i only have loaded kernel and executed it's address. I don't know how to print a "Textfile" (if it's in memory i need to know it's size and print this "data block"). maybe there is a way to load the data directly to an env-var
> > 
> > Have you tried the 'strings' command? Is that enough?
> > 
> > Simon
> > 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] list files on tftp / large kernel-image
  2018-12-02  9:33       ` Frank Wunderlich
  2018-12-02 10:32         ` Frank Wunderlich
@ 2018-12-02 10:34         ` Simon Goldschmidt
  2018-12-02 16:26           ` Frank Wunderlich
  1 sibling, 1 reply; 16+ messages in thread
From: Simon Goldschmidt @ 2018-12-02 10:34 UTC (permalink / raw)
  To: u-boot

Am 02.12.2018 um 10:33 schrieb Frank Wunderlich:
> can you give me an example how to download and display it, seems i only have tftpboot which runs kernel directly?
> 
> also found no strings-command in https://www.denx.de/wiki/DULG/Manual

=> tftp ${loadaddr} 192.168.1.1:list.txt
Speed: 100, full duplex
Using ethernet at ff702000 device
TFTP from server 192.168.1.1; our IP address is 192.168.1.101
Filename 'list.txt'.
Load address: 0x1000000
Loading: #
          12.7 KiB/s
done
Bytes transferred = 158 (9e hex)
=> strings ${loadaddr} 9e
dhcppkgstyle.xsl
dhcpstyle.xsl
favicon.ico
index.html
ldlinux.c32
list.txt
mini.iso
netboot.tar.gz
pxelinux.0
pxelinux.cfg
RJ45_5.JPG
RJ45_52.JPG
  ã(Ðå
=>

The 'strings' command has to be enabled under "Command line interface" 
-> "Memory commands". It helps to show the contents, but not really for 
scripting...

Simon

> 
> Frank
> 
>> Gesendet: Montag, 19. November 2018 um 12:29 Uhr
>> Von: "Simon Goldschmidt" <simon.k.r.goldschmidt@gmail.com>
>> An: "Frank Wunderlich" <frank-w@public-files.de>
>> Cc: "U-Boot Mailing List" <u-boot@lists.denx.de>
>> Betreff: Re: Re: [U-Boot] list files on tftp / large kernel-image
>>
>> On Wed, Nov 14, 2018 at 4:52 PM Frank Wunderlich
>> <frank-w@public-files.de> wrote:
>>>
>>> Hi Simon,
>>> thanks for fast answer
>>>
>>> i hope mediatek release ethernet soon (i know it's a more complex driver for r2 than the other 18 patches ), than i can drop the old uboot ;)
>>>
>>> for list tftp, it seems to be a protocol limitation.
>>> here https://unix.stackexchange.com/questions/76400/download-directory-structure-from-a-tftp-server the server creates a textfile...this can be a workaround
>>>
>>> can i download (to memory) and display it (without writing it)? i only have loaded kernel and executed it's address. I don't know how to print a "Textfile" (if it's in memory i need to know it's size and print this "data block"). maybe there is a way to load the data directly to an env-var
>>
>> Have you tried the 'strings' command? Is that enough?
>>
>> Simon
>>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] list files on tftp / large kernel-image
  2018-12-02 10:34         ` Simon Goldschmidt
@ 2018-12-02 16:26           ` Frank Wunderlich
  2018-12-20 16:33             ` Frank Wunderlich
  0 siblings, 1 reply; 16+ messages in thread
From: Frank Wunderlich @ 2018-12-02 16:26 UTC (permalink / raw)
  To: u-boot

seems like strings breaks my (older 2014-04) uboot:

BPI-IoT> tftp ${loadaddr} 192.168.0.10:files.lst
Using mtk_eth device
TFTP from server 192.168.0.10; our IP address is 192.168.0.11
Filename 'files.lst'.
Load address: 0x84000000
Loading: #
         43 KiB/s
done
Bytes transferred = 89 (59 hex)
BPI-IoT> echo ${filesize}                       
59
BPI-IoT> strings ${loadaddr} ${filesize}
lߟA����������������\x7f�c���\x19_���=����\x16���������w������\x1c�{ߟ��w\x7fo�W\x1d�������������y�_
BPI-IoT> Minicom2.7Minicom2.7�߅_k�|UZ��\x7f\x7f�߿����������0�\x1c������\x7fŻ��{�������     �

also tested with bytecount 20 instead of filesize-var, same result

cannot use here new uboot till ethernet-driver is not ready

regards Frank


> Gesendet: Sonntag, 02. Dezember 2018 um 11:34 Uhr
> Von: "Simon Goldschmidt" <simon.k.r.goldschmidt@gmail.com>
> An: "Frank Wunderlich" <frank-w@public-files.de>
> Cc: u-boot at lists.denx.de
> Betreff: Re: [U-Boot] list files on tftp / large kernel-image
>
> Am 02.12.2018 um 10:33 schrieb Frank Wunderlich:
> > can you give me an example how to download and display it, seems i only have tftpboot which runs kernel directly?
> > 
> > also found no strings-command in https://www.denx.de/wiki/DULG/Manual
> 
> => tftp ${loadaddr} 192.168.1.1:list.txt
> Speed: 100, full duplex
> Using ethernet at ff702000 device
> TFTP from server 192.168.1.1; our IP address is 192.168.1.101
> Filename 'list.txt'.
> Load address: 0x1000000
> Loading: #
>           12.7 KiB/s
> done
> Bytes transferred = 158 (9e hex)
> => strings ${loadaddr} 9e
> dhcppkgstyle.xsl
> dhcpstyle.xsl
> favicon.ico
> index.html
> ldlinux.c32
> list.txt
> mini.iso
> netboot.tar.gz
> pxelinux.0
> pxelinux.cfg
> RJ45_5.JPG
> RJ45_52.JPG
>   ã(Ðå
> =>
> 
> The 'strings' command has to be enabled under "Command line interface" 
> -> "Memory commands". It helps to show the contents, but not really for 
> scripting...
> 
> Simon
> 
> > 
> > Frank
> > 
> >> Gesendet: Montag, 19. November 2018 um 12:29 Uhr
> >> Von: "Simon Goldschmidt" <simon.k.r.goldschmidt@gmail.com>
> >> An: "Frank Wunderlich" <frank-w@public-files.de>
> >> Cc: "U-Boot Mailing List" <u-boot@lists.denx.de>
> >> Betreff: Re: Re: [U-Boot] list files on tftp / large kernel-image
> >>
> >> On Wed, Nov 14, 2018 at 4:52 PM Frank Wunderlich
> >> <frank-w@public-files.de> wrote:
> >>>
> >>> Hi Simon,
> >>> thanks for fast answer
> >>>
> >>> i hope mediatek release ethernet soon (i know it's a more complex driver for r2 than the other 18 patches ), than i can drop the old uboot ;)
> >>>
> >>> for list tftp, it seems to be a protocol limitation.
> >>> here https://unix.stackexchange.com/questions/76400/download-directory-structure-from-a-tftp-server the server creates a textfile...this can be a workaround
> >>>
> >>> can i download (to memory) and display it (without writing it)? i only have loaded kernel and executed it's address. I don't know how to print a "Textfile" (if it's in memory i need to know it's size and print this "data block"). maybe there is a way to load the data directly to an env-var
> >>
> >> Have you tried the 'strings' command? Is that enough?
> >>
> >> Simon
> >>
> 
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] list files on tftp / large kernel-image
  2018-12-02 16:26           ` Frank Wunderlich
@ 2018-12-20 16:33             ` Frank Wunderlich
  2018-12-20 17:43               ` Frank Wunderlich
  0 siblings, 1 reply; 16+ messages in thread
From: Frank Wunderlich @ 2018-12-20 16:33 UTC (permalink / raw)
  To: u-boot

Hi,

after mt7623 ethernet-driver is available for uboot-upstream i tested this again with it and this happens:

U-Boot> tftp ${loadaddr} 192.168.0.10:files.lst 
Using ethernet at 1b100000 device
TFTP from server 192.168.0.10; our IP address is 192.168.0.11
Filename 'files.lst'.
Load address: 0x80200000
Loading: #
         43 KiB/s
done
Bytes transferred = 89 (59 hex)
U-Boot> echo ${filesize}                       
59
U-Boot> strings ${loadaddr} ${filesize}
uImage_4.14.73
uImage_4.14-rd
uImage_4.18.11
uImage_4.19.0-main
uImage_4.19.0-rc1-hdmiv5
����������������o�������W���������������~�����移�����e���޳�9�w���������߿���������ںmr����m�\��������������������鯿��ϯV��������������������������������c��_����������....

[16:58] frank at bpi-r2-e:/var/lib/tftp$ cat files.lst
uImage_4.14.73
uImage_4.14-rd
uImage_4.18.11
uImage_4.19.0-main
uImage_4.19.0-rc1-hdmiv5
[16:58] frank at bpi-r2-e:/var/lib/tftp$ ls -lh files.lst
-rw-r--r-- 1 frank frank 89 Dez  2 16:18 files.lst

so it seems strings does not stop after bytes-parameter

U-Boot> help strings
strings - display strings

Usage:
strings <addr> [byte count]
    - display strings at <addr> for at least [byte count] or first double NUL
U-Boot> 

so it should stop after 0x59 bytes...but it does not :( looks like a bug for me.

i do not fully understand cmd/strings.c

http://git.denx.de/?p=u-boot.git;a=blob;f=cmd/strings.c

especially flag CMD_FLAG_REPEAT
last_addr is treated as hex of argv[2] this seems correct, but it is used as address and not as count

tried to fix it this way:

last_addr = (char *)(start_addr + simple_strtoul(argv[2], NULL, 16)-1);

but same

added a printf for checking calculation:

printf("%p - %p",start_addr,last_addr);

prints correctly
80200000 - 80200058

so it looks like the bug is inside the loop...

http://www.cplusplus.com/reference/cstdio/puts/

says puts waits prints till \0 so i guess this is missing in my case so i did a memory display:

U-Boot> md 0x80200000
80200000: 616d4975 345f6567 2e34312e 750a3337    uImage_4.14.73.u
80200010: 67616d49 2e345f65 722d3431 49750a64    Image_4.14-rd.uI
80200020: 6567616d 312e345f 31312e38 6d49750a    mage_4.18.11.uIm
80200030: 5f656761 39312e34 6d2d302e 0a6e6961    age_4.19.0-main.
80200040: 616d4975 345f6567 2e39312e 63722d30    uImage_4.19.0-rc
80200050: 64682d31 3576696d ffffff0a fcffbff7    1-hdmiv5........

memory at "fileend" is ff instead of 00

i tried setting this to 0

U-Boot> mw 0x80200059 00

but this resets my board...any idea?

regards Frank

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] list files on tftp / large kernel-image
  2018-12-20 16:33             ` Frank Wunderlich
@ 2018-12-20 17:43               ` Frank Wunderlich
  2018-12-20 18:42                 ` Simon Goldschmidt
  0 siblings, 1 reply; 16+ messages in thread
From: Frank Wunderlich @ 2018-12-20 17:43 UTC (permalink / raw)
  To: u-boot

Hi,

fixed now this way (maybe not the best way...because now stringlists (multiple strings divided by \0) cannot displayed):

index 41b1665926..780c3d67b0 100644
--- a/cmd/strings.c
+++ b/cmd/strings.c
@@ -20,18 +20,28 @@ int do_strings(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        if ((flag & CMD_FLAG_REPEAT) == 0) {
                start_addr = (char *)simple_strtoul(argv[1], NULL, 16);
                if (argc > 2)
-                       last_addr = (char *)simple_strtoul(argv[2], NULL, 16);
+                       last_addr = (char *)(start_addr + simple_strtoul(argv[2], NULL, 16)-1);
                else
                        last_addr = (char *)-1;
+               printf("%p - %p",start_addr,last_addr);
        }
 
        char *addr = start_addr;
-       do {
-               puts(addr);
-               puts("\n");
-               addr += strlen(addr) + 1;
-       } while (addr[0] && addr < last_addr);
 
+       if (argc>2)
+       {
+               do {
+                       putc((int)addr[0]);
+                       addr++;
+               } while (addr[0] && addr < last_addr);
+       }else {
+               do {
+                       puts(addr);
+                       puts("\n");
+                       addr += strlen(addr) + 1;
+               } while (addr[0] && addr < last_addr);
+       }
+       puts("\n");
        last_addr = addr + (last_addr - start_addr);
        start_addr = addr;

results in:

U-Boot> tftp ${loadaddr} 192.168.0.10:files.lst
Using ethernet at 1b100000 device
TFTP from server 192.168.0.10; our IP address is 192.168.0.11
Filename 'files.lst'.
Load address: 0x80200000
Loading: #
         86.9 KiB/s
done
Bytes transferred = 89 (59 hex)
U-Boot> strings ${loadaddr} ${filesize}
80200000 - 80200058uImage_4.14.73
uImage_4.14-rd
uImage_4.18.11
uImage_4.19.0-main
uImage_4.19.0-rc1-hdmiv5
U-Boot> 

maybe you have a better idea

regards Frank


> Gesendet: Donnerstag, 20. Dezember 2018 um 17:33 Uhr
> Von: "Frank Wunderlich" <frank-w@public-files.de>
> An: "Simon Goldschmidt" <simon.k.r.goldschmidt@gmail.com>
> Cc: u-boot at lists.denx.de
> Betreff: Re: [U-Boot] list files on tftp / large kernel-image
>
> Hi,
> 
> after mt7623 ethernet-driver is available for uboot-upstream i tested this again with it and this happens:
> 
> U-Boot> tftp ${loadaddr} 192.168.0.10:files.lst 
> Using ethernet at 1b100000 device
> TFTP from server 192.168.0.10; our IP address is 192.168.0.11
> Filename 'files.lst'.
> Load address: 0x80200000
> Loading: #
>          43 KiB/s
> done
> Bytes transferred = 89 (59 hex)
> U-Boot> echo ${filesize}                       
> 59
> U-Boot> strings ${loadaddr} ${filesize}
> uImage_4.14.73
> uImage_4.14-rd
> uImage_4.18.11
> uImage_4.19.0-main
> uImage_4.19.0-rc1-hdmiv5
> ����������������o�������W���������������~�����移�����e���޳�9�w���������߿���������ںmr����m�\��������������������鯿��ϯV��������������������������������c��_����������....
> 
> [16:58] frank at bpi-r2-e:/var/lib/tftp$ cat files.lst
> uImage_4.14.73
> uImage_4.14-rd
> uImage_4.18.11
> uImage_4.19.0-main
> uImage_4.19.0-rc1-hdmiv5
> [16:58] frank at bpi-r2-e:/var/lib/tftp$ ls -lh files.lst
> -rw-r--r-- 1 frank frank 89 Dez  2 16:18 files.lst
> 
> so it seems strings does not stop after bytes-parameter
> 
> U-Boot> help strings
> strings - display strings
> 
> Usage:
> strings <addr> [byte count]
>     - display strings at <addr> for at least [byte count] or first double NUL
> U-Boot> 
> 
> so it should stop after 0x59 bytes...but it does not :( looks like a bug for me.
> 
> i do not fully understand cmd/strings.c
> 
> http://git.denx.de/?p=u-boot.git;a=blob;f=cmd/strings.c
> 
> especially flag CMD_FLAG_REPEAT
> last_addr is treated as hex of argv[2] this seems correct, but it is used as address and not as count
> 
> tried to fix it this way:
> 
> last_addr = (char *)(start_addr + simple_strtoul(argv[2], NULL, 16)-1);
> 
> but same
> 
> added a printf for checking calculation:
> 
> printf("%p - %p",start_addr,last_addr);
> 
> prints correctly
> 80200000 - 80200058
> 
> so it looks like the bug is inside the loop...
> 
> http://www.cplusplus.com/reference/cstdio/puts/
> 
> says puts waits prints till \0 so i guess this is missing in my case so i did a memory display:
> 
> U-Boot> md 0x80200000
> 80200000: 616d4975 345f6567 2e34312e 750a3337    uImage_4.14.73.u
> 80200010: 67616d49 2e345f65 722d3431 49750a64    Image_4.14-rd.uI
> 80200020: 6567616d 312e345f 31312e38 6d49750a    mage_4.18.11.uIm
> 80200030: 5f656761 39312e34 6d2d302e 0a6e6961    age_4.19.0-main.
> 80200040: 616d4975 345f6567 2e39312e 63722d30    uImage_4.19.0-rc
> 80200050: 64682d31 3576696d ffffff0a fcffbff7    1-hdmiv5........
> 
> memory at "fileend" is ff instead of 00
> 
> i tried setting this to 0
> 
> U-Boot> mw 0x80200059 00
> 
> but this resets my board...any idea?
> 
> regards Frank
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot
>

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] list files on tftp / large kernel-image
  2018-12-20 17:43               ` Frank Wunderlich
@ 2018-12-20 18:42                 ` Simon Goldschmidt
  2018-12-21  6:41                   ` Frank Wunderlich
  2018-12-21  9:28                   ` Frank Wunderlich
  0 siblings, 2 replies; 16+ messages in thread
From: Simon Goldschmidt @ 2018-12-20 18:42 UTC (permalink / raw)
  To: u-boot

Am 20.12.2018 um 18:43 schrieb Frank Wunderlich:
> Hi,
> 
> fixed now this way (maybe not the best way...because now stringlists (multiple strings divided by \0) cannot displayed):

Your patch might work for you but it changes the existing behaviour. The 
help for command 'strings' says:
"for at least [byte count] or first double NUL".

Now I do think this could be improved (a maximum range is always good), 
but you see here the limitation of implementing commands by argument 
index instead of by argument string: your patch might break usage of 
'strings' for others.

Also, if we touched this command, would it make sense to only output 
strings of printable characters? 'puts' just prints everything until '\0'...

Regards,
Simon

> 
> index 41b1665926..780c3d67b0 100644
> --- a/cmd/strings.c
> +++ b/cmd/strings.c
> @@ -20,18 +20,28 @@ int do_strings(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>          if ((flag & CMD_FLAG_REPEAT) == 0) {
>                  start_addr = (char *)simple_strtoul(argv[1], NULL, 16);
>                  if (argc > 2)
> -                       last_addr = (char *)simple_strtoul(argv[2], NULL, 16);
> +                       last_addr = (char *)(start_addr + simple_strtoul(argv[2], NULL, 16)-1);
>                  else
>                          last_addr = (char *)-1;
> +               printf("%p - %p",start_addr,last_addr);
>          }
>   
>          char *addr = start_addr;
> -       do {
> -               puts(addr);
> -               puts("\n");
> -               addr += strlen(addr) + 1;
> -       } while (addr[0] && addr < last_addr);
>   
> +       if (argc>2)
> +       {
> +               do {
> +                       putc((int)addr[0]);
> +                       addr++;
> +               } while (addr[0] && addr < last_addr);
> +       }else {
> +               do {
> +                       puts(addr);
> +                       puts("\n");
> +                       addr += strlen(addr) + 1;
> +               } while (addr[0] && addr < last_addr);
> +       }
> +       puts("\n");
>          last_addr = addr + (last_addr - start_addr);
>          start_addr = addr;
> 
> results in:
> 
> U-Boot> tftp ${loadaddr} 192.168.0.10:files.lst
> Using ethernet at 1b100000 device
> TFTP from server 192.168.0.10; our IP address is 192.168.0.11
> Filename 'files.lst'.
> Load address: 0x80200000
> Loading: #
>           86.9 KiB/s
> done
> Bytes transferred = 89 (59 hex)
> U-Boot> strings ${loadaddr} ${filesize}
> 80200000 - 80200058uImage_4.14.73
> uImage_4.14-rd
> uImage_4.18.11
> uImage_4.19.0-main
> uImage_4.19.0-rc1-hdmiv5
> U-Boot>
> 
> maybe you have a better idea
> 
> regards Frank
> 
> 
>> Gesendet: Donnerstag, 20. Dezember 2018 um 17:33 Uhr
>> Von: "Frank Wunderlich" <frank-w@public-files.de>
>> An: "Simon Goldschmidt" <simon.k.r.goldschmidt@gmail.com>
>> Cc: u-boot at lists.denx.de
>> Betreff: Re: [U-Boot] list files on tftp / large kernel-image
>>
>> Hi,
>>
>> after mt7623 ethernet-driver is available for uboot-upstream i tested this again with it and this happens:
>>
>> U-Boot> tftp ${loadaddr} 192.168.0.10:files.lst
>> Using ethernet at 1b100000 device
>> TFTP from server 192.168.0.10; our IP address is 192.168.0.11
>> Filename 'files.lst'.
>> Load address: 0x80200000
>> Loading: #
>>           43 KiB/s
>> done
>> Bytes transferred = 89 (59 hex)
>> U-Boot> echo ${filesize}
>> 59
>> U-Boot> strings ${loadaddr} ${filesize}
>> uImage_4.14.73
>> uImage_4.14-rd
>> uImage_4.18.11
>> uImage_4.19.0-main
>> uImage_4.19.0-rc1-hdmiv5
>> ����������������o�������W���������������~�����移�����e���޳�9�w���������߿���������ںmr����m�\��������������������鯿��ϯV��������������������������������c��_����������....
>>
>> [16:58] frank at bpi-r2-e:/var/lib/tftp$ cat files.lst
>> uImage_4.14.73
>> uImage_4.14-rd
>> uImage_4.18.11
>> uImage_4.19.0-main
>> uImage_4.19.0-rc1-hdmiv5
>> [16:58] frank at bpi-r2-e:/var/lib/tftp$ ls -lh files.lst
>> -rw-r--r-- 1 frank frank 89 Dez  2 16:18 files.lst
>>
>> so it seems strings does not stop after bytes-parameter
>>
>> U-Boot> help strings
>> strings - display strings
>>
>> Usage:
>> strings <addr> [byte count]
>>      - display strings at <addr> for at least [byte count] or first double NUL
>> U-Boot>
>>
>> so it should stop after 0x59 bytes...but it does not :( looks like a bug for me.
>>
>> i do not fully understand cmd/strings.c
>>
>> http://git.denx.de/?p=u-boot.git;a=blob;f=cmd/strings.c
>>
>> especially flag CMD_FLAG_REPEAT
>> last_addr is treated as hex of argv[2] this seems correct, but it is used as address and not as count
>>
>> tried to fix it this way:
>>
>> last_addr = (char *)(start_addr + simple_strtoul(argv[2], NULL, 16)-1);
>>
>> but same
>>
>> added a printf for checking calculation:
>>
>> printf("%p - %p",start_addr,last_addr);
>>
>> prints correctly
>> 80200000 - 80200058
>>
>> so it looks like the bug is inside the loop...
>>
>> http://www.cplusplus.com/reference/cstdio/puts/
>>
>> says puts waits prints till \0 so i guess this is missing in my case so i did a memory display:
>>
>> U-Boot> md 0x80200000
>> 80200000: 616d4975 345f6567 2e34312e 750a3337    uImage_4.14.73.u
>> 80200010: 67616d49 2e345f65 722d3431 49750a64    Image_4.14-rd.uI
>> 80200020: 6567616d 312e345f 31312e38 6d49750a    mage_4.18.11.uIm
>> 80200030: 5f656761 39312e34 6d2d302e 0a6e6961    age_4.19.0-main.
>> 80200040: 616d4975 345f6567 2e39312e 63722d30    uImage_4.19.0-rc
>> 80200050: 64682d31 3576696d ffffff0a fcffbff7    1-hdmiv5........
>>
>> memory at "fileend" is ff instead of 00
>>
>> i tried setting this to 0
>>
>> U-Boot> mw 0x80200059 00
>>
>> but this resets my board...any idea?
>>
>> regards Frank
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> https://lists.denx.de/listinfo/u-boot
>>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] list files on tftp / large kernel-image
  2018-12-20 18:42                 ` Simon Goldschmidt
@ 2018-12-21  6:41                   ` Frank Wunderlich
  2018-12-21  9:28                   ` Frank Wunderlich
  1 sibling, 0 replies; 16+ messages in thread
From: Frank Wunderlich @ 2018-12-21  6:41 UTC (permalink / raw)
  To: u-boot

Your right, i don't want to send it as Patch. Only show how i got working. A small bug is there: after strings done and i press only return (normally recall previous command) i also get non-printable chars. Maybe it is because last 3 lines (adress calculation) which i left untouched.

The best way currently should be adding 0-byte after my downloaded content (to make puts stop),but it seems i do something wrong with mw-command because it resets my board. I load kernels at same address so 1 0byte at this position should not be a problem.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] list files on tftp / large kernel-image
  2018-12-20 18:42                 ` Simon Goldschmidt
  2018-12-21  6:41                   ` Frank Wunderlich
@ 2018-12-21  9:28                   ` Frank Wunderlich
  2018-12-21 10:09                     ` Lothar Waßmann
  1 sibling, 1 reply; 16+ messages in thread
From: Frank Wunderlich @ 2018-12-21  9:28 UTC (permalink / raw)
  To: u-boot

Hi,

mw is also strange in my eyes, maybe you can explain me

U-Boot> md 80200000 18 
80200000: 616d4975 345f6567 2e34312e 750a3337    uImage_4.14.73.u
80200010: 67616d49 2e345f65 722d3431 49750a64    Image_4.14-rd.uI
80200020: 6567616d 312e345f 31312e38 6d49750a    mage_4.18.11.uIm
80200030: 5f656761 39312e34 6d2d302e 0a6e6961    age_4.19.0-main.
80200040: 616d4975 345f6567 2e39312e 63722d30    uImage_4.19.0-rc
80200050: 64682d31 0076696d ffff0000 fcffbdf7    1-hdmiv.........

U-Boot> mw.b 8020005a 0
U-Boot> md 80200000 18 
80200000: 616d4975 345f6567 2e34312e 750a3337    uImage_4.14.73.u
80200010: 67616d49 2e345f65 722d3431 49750a64    Image_4.14-rd.uI
80200020: 6567616d 312e345f 31312e38 6d49750a    mage_4.18.11.uIm
80200030: 5f656761 39312e34 6d2d302e 0a6e6961    age_4.19.0-main.
80200040: 616d4975 345f6567 2e39312e 63722d30    uImage_4.19.0-rc
80200050: 64682d31 0076696d ff000000 fcffbdf7    1-hdmiv.........

seems to set 59 (00 after ff)

U-Boot> mw.b 8020005b 0
U-Boot> md 80200000 18 
80200000: 616d4975 345f6567 2e34312e 750a3337    uImage_4.14.73.u
80200010: 67616d49 2e345f65 722d3431 49750a64    Image_4.14-rd.uI
80200020: 6567616d 312e345f 31312e38 6d49750a    mage_4.18.11.uIm
80200030: 5f656761 39312e34 6d2d302e 0a6e6961    age_4.19.0-main.
80200040: 616d4975 345f6567 2e39312e 63722d30    uImage_4.19.0-rc
80200050: 64682d31 0076696d 00000000 fcffbdf7    1-hdmiv.........

seems to set 58 (was ff before)

any idea why higher address counts backwards?

U-Boot> mw.b 8020005c 0 
U-Boot> md 80200000 18 
80200000: 616d4975 345f6567 2e34312e 750a3337    uImage_4.14.73.u
80200010: 67616d49 2e345f65 722d3431 49750a64    Image_4.14-rd.uI
80200020: 6567616d 312e345f 31312e38 6d49750a    mage_4.18.11.uIm
80200030: 5f656761 39312e34 6d2d302e 0a6e6961    age_4.19.0-main.
80200040: 616d4975 345f6567 2e39312e 63722d30    uImage_4.19.0-rc
80200050: 64682d31 0076696d 00000000 fcffbd00    1-hdmiv.........

it seems it gets first the dword at address and then sets the byte x in this dword...not as expected by me

is there a way to calculate the address (loadaddr+filesize) to pass to mw? this way works to display my textfile with strings, but calculation is a bit tricky and have to be done manually at the moment

regards Frank

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] list files on tftp / large kernel-image
  2018-12-21  9:28                   ` Frank Wunderlich
@ 2018-12-21 10:09                     ` Lothar Waßmann
  2018-12-21 11:02                       ` Frank Wunderlich
  0 siblings, 1 reply; 16+ messages in thread
From: Lothar Waßmann @ 2018-12-21 10:09 UTC (permalink / raw)
  To: u-boot

Hi,

On Fri, 21 Dec 2018 10:28:40 +0100 Frank Wunderlich wrote:
> Hi,
> 
> mw is also strange in my eyes, maybe you can explain me
> 
> U-Boot> md 80200000 18 
> 80200000: 616d4975 345f6567 2e34312e 750a3337    uImage_4.14.73.u
> 80200010: 67616d49 2e345f65 722d3431 49750a64    Image_4.14-rd.uI
> 80200020: 6567616d 312e345f 31312e38 6d49750a    mage_4.18.11.uIm
> 80200030: 5f656761 39312e34 6d2d302e 0a6e6961    age_4.19.0-main.
> 80200040: 616d4975 345f6567 2e39312e 63722d30    uImage_4.19.0-rc
> 80200050: 64682d31 0076696d ffff0000 fcffbdf7    1-hdmiv.........
> 
> U-Boot> mw.b 8020005a 0
> U-Boot> md 80200000 18 
> 80200000: 616d4975 345f6567 2e34312e 750a3337    uImage_4.14.73.u
> 80200010: 67616d49 2e345f65 722d3431 49750a64    Image_4.14-rd.uI
> 80200020: 6567616d 312e345f 31312e38 6d49750a    mage_4.18.11.uIm
> 80200030: 5f656761 39312e34 6d2d302e 0a6e6961    age_4.19.0-main.
> 80200040: 616d4975 345f6567 2e39312e 63722d30    uImage_4.19.0-rc
> 80200050: 64682d31 0076696d ff000000 fcffbdf7    1-hdmiv.........
> 
> seems to set 59 (00 after ff)
> 
> U-Boot> mw.b 8020005b 0
> U-Boot> md 80200000 18 
> 80200000: 616d4975 345f6567 2e34312e 750a3337    uImage_4.14.73.u
> 80200010: 67616d49 2e345f65 722d3431 49750a64    Image_4.14-rd.uI
> 80200020: 6567616d 312e345f 31312e38 6d49750a    mage_4.18.11.uIm
> 80200030: 5f656761 39312e34 6d2d302e 0a6e6961    age_4.19.0-main.
> 80200040: 616d4975 345f6567 2e39312e 63722d30    uImage_4.19.0-rc
> 80200050: 64682d31 0076696d 00000000 fcffbdf7    1-hdmiv.........
> 
> seems to set 58 (was ff before)
> 
> any idea why higher address counts backwards?
> 
little endian integer representation!
Try 'md.b' instead of 'md'.


Lothar Waßmann

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] list files on tftp / large kernel-image
  2018-12-21 10:09                     ` Lothar Waßmann
@ 2018-12-21 11:02                       ` Frank Wunderlich
  2018-12-21 11:48                         ` Frank Wunderlich
  0 siblings, 1 reply; 16+ messages in thread
From: Frank Wunderlich @ 2018-12-21 11:02 UTC (permalink / raw)
  To: u-boot

Thank you Lothar for clarification, now it works like expected

U-Boot> mw.b 80200059 00
U-Boot> md.b 80200000 60
80200000: 75 49 6d 61 67 65 5f 34 2e 31 34 2e 37 33 0a 75    uImage_4.14.73.u
80200010: 49 6d 61 67 65 5f 34 2e 31 34 2d 72 64 0a 75 49    Image_4.14-rd.uI
80200020: 6d 61 67 65 5f 34 2e 31 38 2e 31 31 0a 75 49 6d    mage_4.18.11.uIm
80200030: 61 67 65 5f 34 2e 31 39 2e 30 2d 6d 61 69 6e 0a    age_4.19.0-main.
80200040: 75 49 6d 61 67 65 5f 34 2e 31 39 2e 30 2d 72 63    uImage_4.19.0-rc
80200050: 31 2d 68 64 6d 69 76 35 0a 00 ff ff ff bf ff fc    1-hdmiv5........

can i do this calculation (loadaddr+${filesize}) automaticly? so i need additional commands like eval or setexpr?

regards Frank

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] list files on tftp / large kernel-image
  2018-12-21 11:02                       ` Frank Wunderlich
@ 2018-12-21 11:48                         ` Frank Wunderlich
  0 siblings, 0 replies; 16+ messages in thread
From: Frank Wunderlich @ 2018-12-21 11:48 UTC (permalink / raw)
  To: u-boot

have done it now this way:

U-Boot> printenv lstftp
lstftp=tftp ${loadaddr} ${serverip}:files.lst;setexpr listend ${loadaddr} + ${filesize};mw.b ${listend} 00 2;md.b ${loadaddr} 60;strings ${loadaddr};

strings-command needs 2 0-bytes to break.

files.lst is a simple textfile on tftp-server which will be created on server by script (ls -1)

thanks to all who helped

regards Frank

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2018-12-21 11:48 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-14 15:24 [U-Boot] list files on tftp / large kernel-image Frank Wunderlich
2018-11-14 15:34 ` Simon Goldschmidt
2018-11-14 15:52   ` Frank Wunderlich
2018-11-19 11:29     ` Simon Goldschmidt
2018-12-02  9:33       ` Frank Wunderlich
2018-12-02 10:32         ` Frank Wunderlich
2018-12-02 10:34         ` Simon Goldschmidt
2018-12-02 16:26           ` Frank Wunderlich
2018-12-20 16:33             ` Frank Wunderlich
2018-12-20 17:43               ` Frank Wunderlich
2018-12-20 18:42                 ` Simon Goldschmidt
2018-12-21  6:41                   ` Frank Wunderlich
2018-12-21  9:28                   ` Frank Wunderlich
2018-12-21 10:09                     ` Lothar Waßmann
2018-12-21 11:02                       ` Frank Wunderlich
2018-12-21 11:48                         ` Frank Wunderlich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.