]>
git.zerfleddert.de Git - rsbs2/blob - firmware.c
7e5e112018e5c8d05c560f16deeb3372a45d0e99
11 int main(int argc
, char **argv
)
18 unsigned int crc
, oldcrc
;
21 fprintf(stderr
,"Syntax: %s firmware.bin\n", argv
[0]);
25 if (stat(argv
[1], &statbuf
) == -1) {
30 if ((fd
= open(argv
[1], O_RDONLY
)) == -1) {
35 if ((fw
= malloc(statbuf
.st_size
)) == NULL
) {
40 bzero(fw
, statbuf
.st_size
);
42 remaining
= statbuf
.st_size
;
45 if ((ret
= read(fd
, fw
+ (statbuf
.st_size
- remaining
), remaining
)) == -1) {
52 ret
= rsb_crc2(fw
, statbuf
.st_size
, 0x55335053, &crc
);
53 oldcrc
= (unsigned int)*((unsigned int*)(fw
+ statbuf
.st_size
- 4));
55 printf("Checksum: 0x%08x (%s), should be: 0x%08x\n",
57 (ret
? "NOT OK" : "OK"),