[U-Boot-Users] [patch #6/11] New option for crc32 command

Hello
The following patch add a -v (verify) flag to the crc32 command.
Regards
Pantelis
cmd_mem.c | 40 ++++++++++++++++++++++++++++++++-------- 1 files changed, 32 insertions(+), 8 deletions(-)
diff -ruNb u-boot-original/common/cmd_mem.c u-boot-mem/common/cmd_mem.c --- u-boot-original/common/cmd_mem.c 2004-03-30 14:37:28.663931328 +0300 +++ u-boot-mem/common/cmd_mem.c 2004-03-30 15:37:08.092775432 +0300 @@ -968,28 +968,52 @@ ulong addr, length; ulong crc; ulong *ptr; + ulong vcrc; + int verify; + int ac; + char **av;
if (argc < 3) { + usage: printf ("Usage:\n%s\n", cmdtp->usage); return 1; }
- addr = simple_strtoul (argv[1], NULL, 16); - addr += base_address; + av = argv + 1; + ac = argc - 1; + if (strcmp(*av, "-v") == 0) { + verify = 1; + av++; + ac--; + if (ac < 3) + goto usage; + } else + verify = 0;
- length = simple_strtoul (argv[2], NULL, 16); + addr = simple_strtoul(*av++, NULL, 16); + addr += base_address; + length = simple_strtoul(*av++, NULL, 16);
- crc = crc32 (0, (const uchar *) addr, length); + crc = crc32(0, (const uchar *) addr, length);
+ if (!verify) { printf ("CRC32 for %08lx ... %08lx ==> %08lx\n", addr, addr + length - 1, crc); - - if (argc > 3) { - ptr = (ulong *) simple_strtoul (argv[3], NULL, 16); + if (ac > 2) { + ptr = (ulong *) simple_strtoul (*av++, NULL, 16); *ptr = crc; } + } else { + vcrc = simple_strtoul(*av++, NULL, 16); + if (vcrc != crc) { + printf ("CRC32 for %08lx ... %08lx ==> %08lx != %08lx ** ERROR **\n", + addr, addr + length - 1, crc, vcrc); + return 1; + } + }
return 0; + }
/**************************************************/ @@ -1033,7 +1057,7 @@ );
U_BOOT_CMD( - crc32, 4, 1, do_mem_crc, + crc32, 5, 1, do_mem_crc, "crc32 - checksum calculation\n", "address count [addr]\n - compute CRC32 checksum [save at addr]\n" );

Dear Pantelis,
in message 406988C2.70704@intracom.gr you wrote:
The following patch add a -v (verify) flag to the crc32 command.
Rejected in this form. Please resubmit this patch.
Please make the new feature optional, so that the memory footprint for small devices does not suffer. Also, please update the help message to reflect the new option.
Best regards,
Wolfgang Denk
participants (2)
-
Pantelis Antoniou
-
Wolfgang Denk