[U-Boot] list files on tftp / large kernel-image

Frank Wunderlich frank-w at public-files.de
Thu Dec 20 16:33:20 UTC 2018


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


More information about the U-Boot mailing list