Add support for Virtual A/B
For Virtual A/B OTA feature, change to
* add intial support for feature.
* parse misc partition for virtual a/b merge status.
* publish snapshot merge status in fastboot variables.
Change-Id: I454972cc2be673054c50e5de6de5b3abafbdf2fd
Signed-off-by: Rahul Shahare <rshaha@codeaurora.org>
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 690e606..cc7a90b 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -2,7 +2,7 @@
* Copyright (c) 2009, Google Inc.
* All rights reserved.
*
- * Copyright (c) 2009-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2009-2021, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -285,6 +285,13 @@
"devinfo",
"partition"};
+static const char *VabSnapshotMergeStatus[] = {
+ "none",
+ "unknown",
+ "snapshotted",
+ "merging",
+ "cancelled"};
+
struct atag_ptbl_entry
{
char name[16];
@@ -340,6 +347,7 @@
char panel_display_mode[MAX_RSP_SIZE];
char soc_version_str[MAX_RSP_SIZE];
char block_size_string[MAX_RSP_SIZE];
+static char SnapshotMergeState[MAX_RSP_SIZE];
#if PRODUCT_IOT
/* For IOT we are using custom version */
@@ -5013,6 +5021,7 @@
{
int i;
char hw_platform_buf[MAX_RSP_SIZE];
+ VirtualAbMergeStatus SnapshotMergeStatus;
struct fastboot_cmd_desc cmd_list[] = {
/* By default the enabled list is empty. */
@@ -5133,6 +5142,27 @@
#endif
if (target_dynamic_partition_supported())
fastboot_publish("is-userspace", "no");
+
+ if (target_virtual_ab_supported()) {
+ SnapshotMergeStatus = GetSnapshotMergeStatus ();
+
+ switch (SnapshotMergeStatus) {
+ case SNAPSHOTTED:
+ SnapshotMergeStatus = SNAPSHOTTED;
+ break;
+ case MERGING:
+ SnapshotMergeStatus = MERGING;
+ break;
+ default:
+ SnapshotMergeStatus = NONE_MERGE_STATUS;
+ break;
+ }
+
+ snprintf(SnapshotMergeState,
+ strlen(VabSnapshotMergeStatus[SnapshotMergeStatus]) + 1,
+ "%s", VabSnapshotMergeStatus[SnapshotMergeStatus]);
+ fastboot_publish("snapshot-update-state", SnapshotMergeState);
+ }
}
void aboot_init(const struct app_descriptor *app)