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");
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;
case 'b':
patch_bd = 1;
break;
+ case 'e':
+ extract = 1;
+ break;
case 't':
case 'f':
case 'w':
if (showall) {
show_properties(fw, statbuf.st_size - 4);
handle_boarddescription(fw, statbuf.st_size -4, 0);
+ }
+
+ if (extract) {
search_lz_sections(fw, statbuf.st_size - 4);
}
#include <stdio.h>
+#include <stdlib.h>
+#include <strings.h>
+#include <string.h>
+#include <errno.h>
#include "rsb-lz.h"
/* TODO: IMPLEMET THIS! */
* 59b80: 46335053 undefined
*/
+void fn_59560(unsigned int arg1)
+{
+}
+
+void fn_59578(unsigned int arg1, unsigned int arg2, unsigned int arg3, unsigned int arg4)
+{
+}
+
+void fn_59788()
+{
+ fprintf(stderr,"error extracting...\n");
+ exit(1);
+}
+
+struct s_59b78 {
+ unsigned char *start;
+ unsigned char *stop;
+ unsigned char y; /* 8 */
+ unsigned char x; /* 9 */
+};
+
+void fn_5993c(struct s_59b78 *data, unsigned int mem[])
+{
+}
+
+void extract_lz_file(unsigned char *buf, unsigned char *name)
+{
+ unsigned int r0;
+ unsigned int r1;
+ unsigned int r2;
+ unsigned char *r3;
+ unsigned int r4;
+ unsigned int r5;
+ unsigned int r6;
+ unsigned char *r7 = NULL; /* Arg1, mem start */
+ unsigned int r8;
+ unsigned int r9;
+ unsigned char *r10 = NULL; /* Arg2, mem end */
+ unsigned char *r11 = buf; /* Arg3 */
+ unsigned int r12;
+ unsigned int r13;
+ struct s_59b78 struct1;
+ unsigned int arr_59b7c[1024];
+
+ r7 = malloc(1024*1024*1024);
+ r10 = r7 + (1024*1024*1024);
+
+ if (r7 == NULL) {
+ perror("malloc");
+ exit(1);
+ }
+
+ fn_59578(0, 0, 0x3f, 0x33);
+ fn_59578(4, 0x10000000, 0x33, 0x366);
+ fn_59578(5, 0x14000000, 0x1b, 0x733);
+ fn_59578(7, 0xc0000000, 0x3b, 0x33);
+ fn_59560(0x1005);
+
+ if (*((unsigned int*)r11) != LZ_MAGIC)
+ fn_59788();
+ r3 = r11 + 4;
+ r5 = *((unsigned int*)r3);
+ printf(", Length: %d\n", r5);
+
+ r3 = r7 + r5;
+ if (r3 > r10)
+ fn_59788();
+
+ struct1.start = r11 + 8;
+ struct1.stop = r5 + r11;
+ struct1.x = 0;
+ struct1.y = 0x80;
+
+ arr_59b7c[0] = (unsigned int)r7;
+ arr_59b7c[1] = (unsigned int)(r5 + r7);
+
+ fn_5993c(&struct1, arr_59b7c);
+
+ free(r7);
+}
+
void search_lz_sections(unsigned char *fw, int len)
{
int i;
while (j > fw) {
if (*j == 0x00) {
printf("%s", j+1);
+ extract_lz_file(fw + i, j+1);
break;
}
j--;