meizu_dfu: supports a single argument to run some code from RAM
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26708 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
592324e68d
commit
811c35957d
2 changed files with 60 additions and 47 deletions
|
@ -1,10 +1,9 @@
|
|||
|
||||
Meizu DFU tool for Linux
|
||||
|
||||
This tool can restore the firmware on M3, M6 SP, M6 TP and M6 SL.
|
||||
It can also run a single provided file from RAM.
|
||||
|
||||
Notes:
|
||||
1. SST39VF800.dfu is taken from the official dfu tool provided by Meizu.
|
||||
2. updateNAND_BE_070831.dfu is taken from the unofficial dfu tool for M6 SL.
|
||||
3. To compile, just run `make'.
|
||||
|
||||
|
|
|
@ -43,9 +43,9 @@
|
|||
|
||||
void usage()
|
||||
{
|
||||
fprintf(stderr, "usage: meizu_dfu m3 <SST39VF800.dfu> <M3.EBN>\n");
|
||||
fprintf(stderr, " meizu_dfu m6 <SST39VF800.dfu> <M6.EBN>\n");
|
||||
fprintf(stderr, " meizu_dfu m6sl <updateNAND_BE_070831.dfu> <M6SL.EBN>\n");
|
||||
fprintf(stderr, "usage: meizu_dfu m3 [SST39VF800.dfu] <M3.EBN>\n");
|
||||
fprintf(stderr, " meizu_dfu m6 [SST39VF800.dfu] <M6.EBN>\n");
|
||||
fprintf(stderr, " meizu_dfu m6sl [updateNAND_BE_070831.dfu] <M6SL.EBN>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -328,6 +328,9 @@ void dfu_m3_m6(char *file1, char *file2)
|
|||
memcpy(attr1.suf_sig, "RON", 3);
|
||||
attr1.suf_len = 0x10;
|
||||
|
||||
init_img(&img1, file1, &attr1);
|
||||
|
||||
if (file2) {
|
||||
attr2.delay = 1000;
|
||||
attr2.pre_off = 0x20;
|
||||
attr2.pre_sig = 0x44465543;
|
||||
|
@ -338,8 +341,8 @@ void dfu_m3_m6(char *file1, char *file2)
|
|||
memcpy(attr2.suf_sig, "UFD", 3);
|
||||
attr2.suf_len = 0x10;
|
||||
|
||||
init_img(&img1, file1, &attr1);
|
||||
init_img(&img2, file2, &attr2);
|
||||
}
|
||||
|
||||
device = usb_dev_open(USB_VID_SAMSUNG, USB_PID_M3_M6);
|
||||
// usb_mimic_windows();
|
||||
|
@ -347,6 +350,7 @@ void dfu_m3_m6(char *file1, char *file2)
|
|||
get_cpu(device);
|
||||
send_file(device, &img1);
|
||||
|
||||
if (file2) {
|
||||
printf("Wait a sec (literally)...");
|
||||
sleep(1);
|
||||
printf(" OK\n");
|
||||
|
@ -355,6 +359,8 @@ void dfu_m3_m6(char *file1, char *file2)
|
|||
get_cpu(device);
|
||||
send_file(device, &img2);
|
||||
dfu_detach(device);
|
||||
}
|
||||
|
||||
usb_dev_close(device);
|
||||
}
|
||||
|
||||
|
@ -374,6 +380,9 @@ void dfu_m6sl(char *file1, char *file2)
|
|||
memcpy(attr1.suf_sig, "UFD", 3);
|
||||
attr1.suf_len = 0x10;
|
||||
|
||||
init_img(&img1, file1, &attr1);
|
||||
|
||||
if (file2) {
|
||||
attr2.delay = 1000;
|
||||
attr2.pre_off = 0x20;
|
||||
attr2.pre_sig = 0x44465543;
|
||||
|
@ -384,14 +393,15 @@ void dfu_m6sl(char *file1, char *file2)
|
|||
memcpy(attr2.suf_sig, "UFD", 3);
|
||||
attr2.suf_len = 0x10;
|
||||
|
||||
init_img(&img1, file1, &attr1);
|
||||
init_img(&img2, file2, &attr2);
|
||||
}
|
||||
|
||||
device = usb_dev_open(USB_VID_SAMSUNG, USB_PID_M6SL);
|
||||
get_cpu(device);
|
||||
get_cpu(device);
|
||||
send_file(device, &img1);
|
||||
|
||||
if (file2) {
|
||||
printf("Wait a sec (literally)...");
|
||||
sleep(1);
|
||||
printf(" OK\n");
|
||||
|
@ -402,23 +412,27 @@ void dfu_m6sl(char *file1, char *file2)
|
|||
get_cpu(device);
|
||||
send_file(device, &img2);
|
||||
dfu_detach(device);
|
||||
}
|
||||
|
||||
usb_dev_close(device);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc != 4)
|
||||
if (argc < 3 || argc > 4)
|
||||
usage();
|
||||
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
|
||||
char *second_file = (argc == 4) ? argv[3] : NULL;
|
||||
|
||||
if (!strcmp(argv[1], "m3"))
|
||||
dfu_m3_m6(argv[2], argv[3]);
|
||||
dfu_m3_m6(argv[2], second_file);
|
||||
else if (!strcmp(argv[1], "m6"))
|
||||
dfu_m3_m6(argv[2], argv[3]);
|
||||
dfu_m3_m6(argv[2], second_file);
|
||||
else if (!strcmp(argv[1], "m6sl"))
|
||||
dfu_m6sl(argv[2], argv[3]);
|
||||
dfu_m6sl(argv[2], second_file);
|
||||
else
|
||||
usage();
|
||||
|
||||
|
|
Loading…
Reference in a new issue