Merge "app: aboot: add new boot iamge header v2 support"
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index c175208..55a145a 100755
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -4452,7 +4452,7 @@
if (current_slot_suffix &&
!strncmp(p, current_slot_suffix, strlen(current_slot_suffix)))
{
- partition_switch_slots(current_active_slot, i);
+ partition_switch_slots(current_active_slot, i, true);
publish_getvar_multislot_vars();
fastboot_okay("");
return;
@@ -5058,8 +5058,14 @@
publish_getvar_multislot_vars();
/* Max download size supported */
+#if !VERIFIED_BOOT_2
snprintf(max_download_size, MAX_RSP_SIZE, "\t0x%x",
target_get_max_flash_size());
+#else
+ snprintf(max_download_size, MAX_RSP_SIZE, "\t0x%x",
+ SUB_SALT_BUFF_OFFSET(target_get_max_flash_size()));
+#endif
+
fastboot_publish("max-download-size", (const char *) max_download_size);
/* Is the charger screen check enabled */
snprintf(charger_screen_enabled, MAX_RSP_SIZE, "%d",
diff --git a/platform/msm_shared/ab_partition_parser.c b/platform/msm_shared/ab_partition_parser.c
index 7cee1a8..53a671c 100644
--- a/platform/msm_shared/ab_partition_parser.c
+++ b/platform/msm_shared/ab_partition_parser.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2019, 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:
@@ -236,7 +236,7 @@
/*
Function: Switch active partitions.
*/
-void partition_switch_slots(int old_slot, int new_slot)
+void partition_switch_slots(int old_slot, int new_slot, boolean reset_success_bit)
{
#ifdef AB_DEBUG
dprintf(INFO, "Switching slots %s to %s\n",
@@ -255,9 +255,15 @@
((PART_ATT_PRIORITY_VAL |
PART_ATT_ACTIVE_VAL |
PART_ATT_MAX_RETRY_COUNT_VAL));
+
partition_entries[new_slot_index].attribute_flag &=
- (~PART_ATT_SUCCESSFUL_VAL
- & ~PART_ATT_UNBOOTABLE_VAL);
+ (~PART_ATT_UNBOOTABLE_VAL);
+ if (reset_success_bit &&
+ (partition_entries[new_slot_index].attribute_flag &
+ PART_ATT_SUCCESSFUL_VAL)) {
+ partition_entries[new_slot_index].attribute_flag &=
+ (~PART_ATT_SUCCESSFUL_VAL);
+ }
if (!attributes_updated)
attributes_updated = true;
@@ -395,7 +401,7 @@
next_slot = next_active_bootable_slot(partition_entries);
if (next_slot != INVALID)
{
- partition_switch_slots(boot_slot, next_slot);
+ partition_switch_slots(boot_slot, next_slot, false);
reboot_device(0);
}
else
diff --git a/platform/msm_shared/include/ab_partition_parser.h b/platform/msm_shared/include/ab_partition_parser.h
index 607a412..2001b7f 100644
--- a/platform/msm_shared/include/ab_partition_parser.h
+++ b/platform/msm_shared/include/ab_partition_parser.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017, 2019, 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:
@@ -69,7 +69,7 @@
void partition_mark_active_slot(); /* Marking slot active */
void partition_reset_attributes(); /* Resetting slot attr. */
void partition_fill_slot_meta(); /* Fill slot meta infomation */
-void partition_switch_slots(); /* Switching slots */
+void partition_switch_slots(int old_slot, int new_slot, boolean reset_success_bit); /* Switching slots */
void partition_deactivate_slot(int slot); /* Mark slot unbootable and reset other attributes*/
void partition_activate_slot(int slot); /* Mark slot bootable and set other attributes*/
int partition_find_boot_slot(); /* Find bootable partition */