Commit 3074fbf88b1b654026608574b94fdd58426ae493
1 parent
28c6cbec7f
Exists in
smarc-8m-android-10.0.0_2.6.0
and in
1 other branch
MA-18087-3 Add snapshot-update command
Add support for 'fastboot snapshot-update cancel', it cancels the snapshot update process so erase/update partitions can proceed. Test: run 'fastboot snapshot-update cancel'. Signed-off-by: Ji Luo <ji.luo@nxp.com> Change-Id: Ic1dfaf09a27fecf6e14b7149aeb5e0a9a1d220c9
Showing 2 changed files with 38 additions and 0 deletions Side-by-side Diff
drivers/fastboot/fb_fsl/fb_fsl_command.c
... | ... | @@ -948,6 +948,35 @@ |
948 | 948 | } |
949 | 949 | #endif |
950 | 950 | |
951 | +#ifdef CONFIG_VIRTUAL_AB_SUPPORT | |
952 | +static void snapshot_update(char *cmd_parameter, char *response) | |
953 | +{ | |
954 | + if (endswith(cmd_parameter, "cancel")) { | |
955 | + FbLockState status; | |
956 | + status = fastboot_get_lock_stat(); | |
957 | + if ((status == FASTBOOT_LOCK) || (status == FASTBOOT_LOCK_ERROR)) { | |
958 | + printf("Can not cancel snapshot update when the device is locked!\n"); | |
959 | + fastboot_fail("device is locked!", response); | |
960 | + } else if (virtual_ab_update_is_merging() || virtual_ab_update_is_snapshoted()) { | |
961 | + if (virtual_ab_cancel_update() != -1) | |
962 | + fastboot_okay(NULL, response); | |
963 | + else | |
964 | + fastboot_fail("Can't cancel snapshot update!", response); | |
965 | + } else { | |
966 | + printf("Device is not in 'merging' or 'snapshotted' state, do nothing...\n"); | |
967 | + fastboot_okay(NULL, response); | |
968 | + } | |
969 | + | |
970 | + return; | |
971 | + } else { | |
972 | + printf("Error! Only 'cancel' is supported!"); | |
973 | + strcpy(response, "FAILInternal error!"); | |
974 | + } | |
975 | + | |
976 | + return; | |
977 | +} | |
978 | +#endif | |
979 | + | |
951 | 980 | static const struct { |
952 | 981 | const char *command; |
953 | 982 | void (*dispatch)(char *cmd_parameter, char *response); |
... | ... | @@ -1030,6 +1059,12 @@ |
1030 | 1059 | [FASTBOOT_COMMAND_RECOVERY_FASTBOOT] = { |
1031 | 1060 | .command = "reboot-fastboot", |
1032 | 1061 | .dispatch = reboot_fastboot, |
1062 | + }, | |
1063 | +#endif | |
1064 | +#ifdef CONFIG_VIRTUAL_AB_SUPPORT | |
1065 | + [FASTBOOT_COMMAND_SNAPSHOT_UPDATE] = { | |
1066 | + .command = "snapshot-update", | |
1067 | + .dispatch = snapshot_update, | |
1033 | 1068 | }, |
1034 | 1069 | #endif |
1035 | 1070 | }; |
include/fastboot.h