X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/rsbs2/blobdiff_plain/c8b1eccb76b5f4141da32b74c68468eaa87c7972..6fc57dcd5431aa5e19febfadb242de1e80f16c8f:/firmware.c diff --git a/firmware.c b/firmware.c index f8584c1..67f1f0a 100644 --- a/firmware.c +++ b/firmware.c @@ -8,38 +8,6 @@ #include #include "rsb-crc.h" -struct fw_header { - unsigned int unknown[8]; - unsigned int len; - char ident[4]; - unsigned int offset; - char desc[128]; -}; - -void parse_fw(unsigned char *fw, unsigned int off) { - struct fw_header *header = (struct fw_header*)(fw + off); - static unsigned int last_off; - int i; - - printf("Address in file: 0x%08x, Difference to last: %u\n", off, off-last_off); - printf("Unknown: "); - for (i = 0; i < 8; i++) - printf("0x%08x ", header->unknown[i]); - - printf("\n"); - - printf("Length: %u, possible next entry at: 0x%08x\n", header->len, off + header->len + 22); - - printf("Identifier: %.4s\n", header->ident); - - printf("Offset: 0x%08x\n", header->offset); - - printf("Descriptiom: %s\n", header->desc); - - printf("\n"); - last_off = off; -} - int main(int argc, char **argv) { struct stat statbuf; @@ -47,7 +15,7 @@ int main(int argc, char **argv) int fd; int remaining; int ret; - unsigned int crc; + unsigned int crc, oldcrc; if (argc != 2) { fprintf(stderr,"Syntax: %s firmware.bin\n", argv[0]); @@ -81,15 +49,10 @@ int main(int argc, char **argv) remaining -= ret; } -#if 0 - parse_fw(fw, 0x0); - parse_fw(fw, 0x555c0); - parse_fw(fw, 0x5940e); -#endif - - crc = rsb_crc(0, fw, statbuf.st_size-4); + ret = rsb_crc2(fw, statbuf.st_size, 0x55335053, &crc); + oldcrc = (unsigned int)*((unsigned int*)(fw + statbuf.st_size - 4)); - printf("Length: %ld, Checksum: 0x%08x\n", statbuf.st_size-4, crc); + printf("Checksum: 0x%08x, should be: 0x%08x\n", crc, oldcrc); exit(0); }