]> git.zerfleddert.de Git - rsbs2/commitdiff
search for compressed sections in firmware image
authorMichael Gernoth <michael@gernoth.net>
Fri, 30 Jan 2009 14:48:28 +0000 (15:48 +0100)
committerMichael Gernoth <michael@gernoth.net>
Fri, 30 Jan 2009 14:48:28 +0000 (15:48 +0100)
firmware.c
rsb-lz.c
rsb-lz.h

index 55556fc15a2a1c8ba3c1ef2197e8b5f120c8ad40..706a8336ff09eb07273a29283dc6be4f77380246 100644 (file)
@@ -8,6 +8,7 @@
 #include <string.h>
 #include <strings.h>
 #include "rsb-crc.h"
+#include "rsb-lz.h"
 
 #define FINDSTR(addr, str) (!strncmp((char*)addr, str, strlen(str)))
 
@@ -452,6 +453,7 @@ int main(int argc, char **argv)
        if (showall) {
                show_properties(fw, statbuf.st_size - 4);
                handle_boarddescription(fw, statbuf.st_size -4, 0);
+               search_lz_sections(fw, statbuf.st_size - 4);
        }
 
        if (update_crc || patch_fw || patch_bd) {
index 495d8d855c92a5123bc3d0c7b4b1164ca8f61031..4960fc0b7ee76eb9caf975f2699d597cfea33c91 100644 (file)
--- a/rsb-lz.c
+++ b/rsb-lz.c
@@ -1,3 +1,6 @@
+#include <stdio.h>
+#include "rsb-lz.h"
+
 /* TODO: IMPLEMET THIS! */
 /* Probably very broken lzw implementation by Agilent:
  *
  * 59b7c:      14000410        strne   r0, [r0], #-1040
  * 59b80:      46335053        undefined
  */
+
+void search_lz_sections(unsigned char *fw, int len)
+{
+       int i;
+       unsigned char *j;
+
+       for(i = 0; i < len - 4; i++) {
+               if (*((unsigned int*)(fw+i)) == LZ_MAGIC) {
+                       j = fw + i - 1;
+                       if (*j != 0x00)
+                               continue;
+                       printf("0x%02x: ", i);
+                       j--;
+                       while (j > fw) {
+                               if (*j == 0x00) {
+                                       printf("%s", j+1);
+                                       break;
+                               }
+                               j--;
+                       }
+                       printf("\n");
+               }
+       }
+}
index bab8b6434998d292c0c337dd1b59eb65ee0b762f..5e1fd6dcb58f92d630078cbe095245859625b1f9 100644 (file)
--- a/rsb-lz.h
+++ b/rsb-lz.h
@@ -1 +1,3 @@
 #define LZ_MAGIC 0x6110beef
+
+void search_lz_sections(unsigned char *fw, int len);
Impressum, Datenschutz