]>
git.zerfleddert.de Git - rsbs2/blob - firmware.c
f8584c163caa3ef4aa9aec3250dccc8e37d6cfe8
12 unsigned int unknown
[8];
19 void parse_fw(unsigned char *fw
, unsigned int off
) {
20 struct fw_header
*header
= (struct fw_header
*)(fw
+ off
);
21 static unsigned int last_off
;
24 printf("Address in file: 0x%08x, Difference to last: %u\n", off
, off
-last_off
);
26 for (i
= 0; i
< 8; i
++)
27 printf("0x%08x ", header
->unknown
[i
]);
31 printf("Length: %u, possible next entry at: 0x%08x\n", header
->len
, off
+ header
->len
+ 22);
33 printf("Identifier: %.4s\n", header
->ident
);
35 printf("Offset: 0x%08x\n", header
->offset
);
37 printf("Descriptiom: %s\n", header
->desc
);
43 int main(int argc
, char **argv
)
53 fprintf(stderr
,"Syntax: %s firmware.bin\n", argv
[0]);
57 if (stat(argv
[1], &statbuf
) == -1) {
62 if ((fd
= open(argv
[1], O_RDONLY
)) == -1) {
67 if ((fw
= malloc(statbuf
.st_size
)) == NULL
) {
72 bzero(fw
, statbuf
.st_size
);
74 remaining
= statbuf
.st_size
;
77 if ((ret
= read(fd
, fw
+ (statbuf
.st_size
- remaining
), remaining
)) == -1) {
86 parse_fw(fw
, 0x555c0);
87 parse_fw(fw
, 0x5940e);
90 crc
= rsb_crc(0, fw
, statbuf
.st_size
-4);
92 printf("Length: %ld, Checksum: 0x%08x\n", statbuf
.st_size
-4, crc
);