fastbootd: exporting CPU ABI info

CPU ABI info, e.g., arm64-v8a, can be useful to determine image
compatibility, prior to flash. Adding this info in fastbootd.

Bug: 74445765
Test: fastboot getvar cpu-abi # arm64-v8a
Change-Id: Ied494b646c551320295956b7890c0102fdb88382
This commit is contained in:
Bowgo Tsai 2019-11-13 17:13:49 +08:00
parent 563a73e7f7
commit 33da5c9493
4 changed files with 10 additions and 1 deletions

View File

@ -68,3 +68,4 @@
#define FB_VAR_BATTERY_SOC_OK "battery-soc-ok"
#define FB_VAR_SUPER_PARTITION_NAME "super-partition-name"
#define FB_VAR_SNAPSHOT_UPDATE_STATUS "snapshot-update-status"
#define FB_VAR_CPU_ABI "cpu-abi"

View File

@ -105,7 +105,8 @@ bool GetVarHandler(FastbootDevice* device, const std::vector<std::string>& args)
{FB_VAR_BATTERY_SOC_OK, {GetBatterySoCOk, nullptr}},
{FB_VAR_HW_REVISION, {GetHardwareRevision, nullptr}},
{FB_VAR_SUPER_PARTITION_NAME, {GetSuperPartitionName, nullptr}},
{FB_VAR_SNAPSHOT_UPDATE_STATUS, {GetSnapshotUpdateStatus, nullptr}}};
{FB_VAR_SNAPSHOT_UPDATE_STATUS, {GetSnapshotUpdateStatus, nullptr}},
{FB_VAR_CPU_ABI, {GetCpuAbi, nullptr}}};
if (args.size() < 2) {
return device->WriteFail("Missing argument");

View File

@ -458,3 +458,9 @@ bool GetSnapshotUpdateStatus(FastbootDevice* device, const std::vector<std::stri
}
return true;
}
bool GetCpuAbi(FastbootDevice* /* device */, const std::vector<std::string>& /* args */,
std::string* message) {
*message = android::base::GetProperty("ro.product.cpu.abi", "");
return true;
}

View File

@ -63,6 +63,7 @@ bool GetSuperPartitionName(FastbootDevice* device, const std::vector<std::string
std::string* message);
bool GetSnapshotUpdateStatus(FastbootDevice* device, const std::vector<std::string>& args,
std::string* message);
bool GetCpuAbi(FastbootDevice* device, const std::vector<std::string>& args, std::string* message);
// Helpers for getvar all.
std::vector<std::vector<std::string>> GetAllPartitionArgsWithSlot(FastbootDevice* device);