* Fix rootfs boundaries for a proper dump.
* Replace Y/n for y/N * Implement the command '5' (read error message)
This commit is contained in:
1 parent
ed37b5ee62
commit
1515b7c7c1
2 files changed
+31
-7
No files matched your search
+5
-6
@@ -38,15 +38,15 @@ int rf_extract(char *dev, off_t from, off_t to, char *file)
|
|||||||
if (fs == NULL) { perror(dev); goto __rf_extract_exit; }
|
if (fs == NULL) { perror(dev); goto __rf_extract_exit; }
|
||||||
if (fd == NULL) { perror(file); goto __rf_extract_exit; }
|
if (fd == NULL) { perror(file); goto __rf_extract_exit; }
|
||||||
|
|
||||||
printf("%s: extracting...", file);
|
printf("Extracting %s...\n", file);
|
||||||
fflush(stdout);
|
|
||||||
fseek(fs, from, SEEK_SET);
|
fseek(fs, from, SEEK_SET);
|
||||||
|
|
||||||
for(i=from;i<to;i+=blk) {
|
for(i=from;i<to;i+=blk) {
|
||||||
int ret;
|
int ret;
|
||||||
if (i+blk>to) blk = to-i;
|
if (i+blk>to) blk = to-i;
|
||||||
ret = fread(buf, blk, 1, fs);
|
ret = fread(buf, blk, 1, fs);
|
||||||
if (feof(fs)) break;
|
progressbar(i, to);
|
||||||
|
if (!ret || feof(fs)) break;
|
||||||
fwrite(buf, blk, 1, fd);
|
fwrite(buf, blk, 1, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +57,6 @@ __rf_extract_exit:
|
|||||||
if (fs) fclose(fs);
|
if (fs) fclose(fs);
|
||||||
if (fd) fclose(fd);
|
if (fd) fclose(fd);
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,10 +125,10 @@ int reverse_extract_pieces(char *dir)
|
|||||||
rf_extract("/dev/mtd2", 0x000800, 0x200000, "zImage");
|
rf_extract("/dev/mtd2", 0x000800, 0x200000, "zImage");
|
||||||
rf_extract("/dev/mtd3", 0x000000, 0x1D00000, "initfs.jffs2");
|
rf_extract("/dev/mtd3", 0x000000, 0x1D00000, "initfs.jffs2");
|
||||||
printf("\nWARNING: the rootfs extraction on n800 is known to be buggy! feedback is welcome.\n\n");
|
printf("\nWARNING: the rootfs extraction on n800 is known to be buggy! feedback is welcome.\n\n");
|
||||||
printf("Extract rootfs? (Y/n): "); fflush(stdout);
|
printf("Extract rootfs? (y/N): "); fflush(stdout);
|
||||||
read(0, &reply, 1);
|
read(0, &reply, 1);
|
||||||
if (reply=='y'||reply=='Y')
|
if (reply=='y'||reply=='Y')
|
||||||
rf_extract("/dev/mtd4", 0x000000, 0xffffff, "rootfs.jffs2");
|
rf_extract("/dev/mtd4", 0x000000, 0x6000000, "rootfs.jffs2");
|
||||||
else printf("*** Ignoring rootfs\n");
|
else printf("*** Ignoring rootfs\n");
|
||||||
rf_strip("xloader.bin");
|
rf_strip("xloader.bin");
|
||||||
rf_strip("secondary.bin");
|
rf_strip("secondary.bin");
|
||||||
|
|||||||
+26
-1
@@ -123,8 +123,33 @@ void flash_image(char *filename, char *piece, char *version)
|
|||||||
if (bread != 1)
|
if (bread != 1)
|
||||||
printf("WARNING: Oops wrong read %d vs %d \n", bread, bsize);
|
printf("WARNING: Oops wrong read %d vs %d \n", bread, bsize);
|
||||||
bread = usb_bulk_write(dev, 2, buf, bsize, 5000);
|
bread = usb_bulk_write(dev, 2, buf, bsize, 5000);
|
||||||
|
if (bread == 64) {
|
||||||
|
/* query error message */
|
||||||
|
int len = 0;
|
||||||
|
char nolomsg[2048];
|
||||||
|
memset(nolomsg, '\0', 2048);
|
||||||
|
usb_control_msg(dev, 192, 5, 0, 0, nolomsg, 2048, 2000);
|
||||||
|
nolomsg[2047] = '\0';
|
||||||
|
printf("\nNOLO says:\n");
|
||||||
|
if (nolomsg[0] == '\0') {
|
||||||
|
printf(" (.. silence ..)\n");
|
||||||
|
} else {
|
||||||
|
dump_bytes(nolomsg, 128);
|
||||||
|
do {
|
||||||
|
printf(" - %s\n", nolomsg+len);
|
||||||
|
len+=strlen(nolomsg+len)+1;
|
||||||
|
} while(nolomsg[len]!='\0');
|
||||||
|
}
|
||||||
|
fclose(fd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
progressbar(off, size);
|
progressbar(off, size);
|
||||||
if (bread<0) perror(" -ee- ");
|
if (bread<0) {
|
||||||
|
printf("\n");
|
||||||
|
perror(" -ee- ");
|
||||||
|
fclose(fd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
|
|||||||
Reference in new issue
Block a user