X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/rsbs2/blobdiff_plain/129b46186378c66abe3dc580545c876c79a4fbae..af1fed3a35f5616b5803f9a168a5170e5a7f85ca:/firmware.c diff --git a/firmware.c b/firmware.c index 84b4e92..2c9960f 100644 --- a/firmware.c +++ b/firmware.c @@ -8,6 +8,7 @@ #include #include #include "rsb-crc.h" +#include "rsb-lz.h" #define FINDSTR(addr, str) (!strncmp((char*)addr, str, strlen(str))) @@ -236,11 +237,8 @@ void handle_boarddescription(unsigned char *fw, int len, int patch) } if (patch) { - /* Enable ATX and relay power switching */ - BD_SET(pos, PWRATX); + /* Enable relay power switching */ BD_SET(pos, PWRRELAY); - /* ATX standby */ - BD_SET(pos, STANDBY); } printf("0x%08x: BOARD_DESCRIPTION: ", pos-fw); print_boarddescription(pos); @@ -257,6 +255,7 @@ void syntax(char *name) fprintf(stderr,"\t-d\t\tdisplay all properties of the image\n"); fprintf(stderr,"\t-u\t\tupdate checksum of the image\n"); fprintf(stderr,"\t-b\t\tmodify BOARD_DESCRIPTION for more power-switch options\n"); + fprintf(stderr,"\t-e\t\textract files in firmware\n"); fprintf(stderr,"\t-t property\tset 'property' to true\n"); fprintf(stderr,"\t-f property\tset 'property' to false\n"); fprintf(stderr,"\t-w property\tallow read-write access to 'property'\n"); @@ -354,11 +353,12 @@ int main(int argc, char **argv) int update_crc = 0; int patch_bd = 0; int patch_fw = 0; + int extract = 0; if (argc < 2) syntax(argv[0]); - while ((opt = getopt(argc, argv, "dubt:f:w:r:")) != -1) { + while ((opt = getopt(argc, argv, "dubet:f:w:r:")) != -1) { switch(opt) { case 'd': showall = 1; @@ -369,6 +369,9 @@ int main(int argc, char **argv) case 'b': patch_bd = 1; break; + case 'e': + extract = 1; + break; case 't': case 'f': case 'w': @@ -457,6 +460,10 @@ int main(int argc, char **argv) handle_boarddescription(fw, statbuf.st_size -4, 0); } + if (extract) { + search_lz_sections(fw, statbuf.st_size - 4); + } + if (update_crc || patch_fw || patch_bd) { ret = rsb_crc2(fw, statbuf.st_size, 0x55335053, &crc); if (ret == 4) {