Merge "fastboot: Add "--slot other""
This commit is contained in:
commit
6bb8f752ec
1 changed files with 22 additions and 5 deletions
|
|
@ -318,9 +318,10 @@ static void usage() {
|
||||||
" device supports slots. This will be\n"
|
" device supports slots. This will be\n"
|
||||||
" added to all partition names that use\n"
|
" added to all partition names that use\n"
|
||||||
" slots. 'all' can be given to refer\n"
|
" slots. 'all' can be given to refer\n"
|
||||||
" to all slots. If this is not given,\n"
|
" to all slots. 'other' can be given to\n"
|
||||||
" slotted partitions will default to\n"
|
" refer to a non-current slot. If this\n"
|
||||||
" the current active slot.\n"
|
" flag is not used, slotted partitions\n"
|
||||||
|
" will default to the current active slot.\n"
|
||||||
" -a, --set-active[=<suffix>] Sets the active slot. If no suffix is\n"
|
" -a, --set-active[=<suffix>] Sets the active slot. If no suffix is\n"
|
||||||
" provided, this will default to the value\n"
|
" provided, this will default to the value\n"
|
||||||
" given by --slot. If slots are not\n"
|
" given by --slot. If slots are not\n"
|
||||||
|
|
@ -737,12 +738,28 @@ static std::string verify_slot(Transport* transport, const char *slot, bool allo
|
||||||
if (!suffixes.empty()) {
|
if (!suffixes.empty()) {
|
||||||
return suffixes[0];
|
return suffixes[0];
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "No known slots.\n");
|
die("No known slots.");
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> suffixes = get_suffixes(transport);
|
std::vector<std::string> suffixes = get_suffixes(transport);
|
||||||
|
|
||||||
|
if (strcmp(slot, "other") == 0) {
|
||||||
|
std::string current_slot;
|
||||||
|
if (!fb_getvar(transport, "current-slot", ¤t_slot)) {
|
||||||
|
die("Failed to identify current slot.");
|
||||||
|
}
|
||||||
|
if (!suffixes.empty()) {
|
||||||
|
for (size_t i = 0; i < suffixes.size(); i++) {
|
||||||
|
if (current_slot == suffixes[i])
|
||||||
|
return suffixes[(i+1)%suffixes.size()];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
die("No known slots.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (const std::string &suffix : suffixes) {
|
for (const std::string &suffix : suffixes) {
|
||||||
if (suffix == slot)
|
if (suffix == slot)
|
||||||
return slot;
|
return slot;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue