
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@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@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@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@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@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@lists.denx.de https://lists.denx.de/listinfo/u-boot