diff options
author | Ricardo Cerqueira <ricardo@cyngn.com> | 2015-11-05 01:04:40 +0000 |
---|---|---|
committer | Ricardo Cerqueira <ricardo@cyngn.com> | 2015-11-05 18:26:36 +0000 |
commit | 31756a19f79d62b71fa87c4e656e00bfbb9a5385 (patch) | |
tree | d459d9f2147f52cc1a55d586686cea8603763e3e /fastboot/fastboot.cpp | |
parent | 22fffcc3d469176f9a7d52d7c6fe68186e9592ab (diff) | |
parent | f7f765fd62bf5db1271e0c0f51e9fb4df609dc6a (diff) | |
download | system_core-31756a19f79d62b71fa87c4e656e00bfbb9a5385.zip system_core-31756a19f79d62b71fa87c4e656e00bfbb9a5385.tar.gz system_core-31756a19f79d62b71fa87c4e656e00bfbb9a5385.tar.bz2 |
Merge tag 'android-6.0.0_r26' into cm-13.0
Android 6.0.0 release 26
Change-Id: I93d1e3767cbacab2b18cff360065c91b9eaf1d96
Diffstat (limited to 'fastboot/fastboot.cpp')
-rw-r--r-- | fastboot/fastboot.cpp | 56 |
1 files changed, 44 insertions, 12 deletions
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp index 4730d70..4b3758a 100644 --- a/fastboot/fastboot.cpp +++ b/fastboot/fastboot.cpp @@ -282,17 +282,22 @@ void usage(void) " flashall flash boot, system, vendor and if found,\n" " recovery\n" " flash <partition> [ <filename> ] write a file to a flash partition\n" - " flashing lock locks the device. Prevents flashing" + " flashing lock locks the device. Prevents flashing\n" " partitions\n" - " flashing unlock unlocks the device. Allows user to" - " flash any partition except the ones" + " flashing unlock unlocks the device. Allows user to\n" + " flash any partition except the ones\n" " that are related to bootloader\n" - " flashing lock_critical Prevents flashing bootloader related" + " flashing lock_critical Prevents flashing bootloader related\n" " partitions\n" - " flashing unlock_critical Enables flashing bootloader related" + " flashing unlock_critical Enables flashing bootloader related\n" " partitions\n" - " flashing get_unlock_ability Queries bootloader to see if the" + " flashing get_unlock_ability Queries bootloader to see if the\n" " device is unlocked\n" + " flashing get_unlock_bootloader_nonce Queries the bootloader to get the\n" + " unlock nonce\n" + " flashing unlock_bootloader <request> Issue unlock bootloader using request\n" + " flashing lock_bootloader Locks the bootloader to prevent\n" + " bootloader version rollback\n" " erase <partition> erase a flash partition\n" " format[:[<fs type>][:[<size>]] <partition> format a flash partition.\n" " Can override the fs type and/or\n" @@ -834,6 +839,27 @@ void do_flashall(usb_handle *usb, int erase_first) #define skip(n) do { argc -= (n); argv += (n); } while (0) #define require(n) do { if (argc < (n)) {usage(); exit(1);}} while (0) +int do_bypass_unlock_command(int argc, char **argv) +{ + unsigned sz; + void *data; + + if (argc <= 2) return 0; + skip(2); + + /* + * Process unlock_bootloader, we have to load the message file + * and send that to the remote device. + */ + require(1); + data = load_file(*argv, &sz); + if (data == 0) die("could not load '%s': %s", *argv, strerror(errno)); + fb_queue_download("unlock_message", data, sz); + fb_queue_command("flashing unlock_bootloader", "unlocking bootloader"); + skip(1); + return 0; +} + int do_oem_command(int argc, char **argv) { char command[256]; @@ -1233,12 +1259,18 @@ int main(int argc, char **argv) wants_reboot = 1; } else if(!strcmp(*argv, "oem")) { argc = do_oem_command(argc, argv); - } else if(!strcmp(*argv, "flashing") && argc == 2) { - if(!strcmp(*(argv+1), "unlock") || !strcmp(*(argv+1), "lock") - || !strcmp(*(argv+1), "unlock_critical") - || !strcmp(*(argv+1), "lock_critical") - || !strcmp(*(argv+1), "get_unlock_ability")) { - argc = do_oem_command(argc, argv); + } else if(!strcmp(*argv, "flashing")) { + if (argc == 2 && (!strcmp(*(argv+1), "unlock") || + !strcmp(*(argv+1), "lock") || + !strcmp(*(argv+1), "unlock_critical") || + !strcmp(*(argv+1), "lock_critical") || + !strcmp(*(argv+1), "get_unlock_ability") || + !strcmp(*(argv+1), "get_unlock_bootloader_nonce") || + !strcmp(*(argv+1), "lock_bootloader"))) { + argc = do_oem_command(argc, argv); + } else + if (argc == 3 && !strcmp(*(argv+1), "unlock_bootloader")) { + argc = do_bypass_unlock_command(argc, argv); } else { usage(); return 1; |