From 7ccd7cd4adbbe3cb32dee78c6b6c049493af112b Mon Sep 17 00:00:00 2001 From: Kuba Wojciechowski Date: Tue, 3 May 2022 18:19:47 +0100 Subject: [PATCH] nemo: Remove oppo logical partitions when necessary Usually when building full OTAs for dynamic partition devices the whole partition table is removed and recreated, but in vendorless cases lineageos (and basically any other custom rom) has a patch to disable that functionality and instead just resize the partitions. This, however, breaks the flashing if a new partition is added, because that partition is tried to be resized and, since it doesn't exist, the assert fails. This patch adds another dynamic patch list to remove Oppo partitions or gracefully fail if it already removed (no assert). Signed-off-by: Kuba Wojciechowski Change-Id: I1f316c9f16b20324674b55b29f69dfc8c0d642a5 --- Android.mk | 1 + dynamic-remove-oppo | 27 +++++++++++++++++++++++++++ releasetools.py | 6 ++++++ 3 files changed, 34 insertions(+) create mode 100644 dynamic-remove-oppo diff --git a/Android.mk b/Android.mk index 74b9ba4..03e3e74 100644 --- a/Android.mk +++ b/Android.mk @@ -8,6 +8,7 @@ LOCAL_PATH := $(call my-dir) ifeq ($(TARGET_DEVICE),nemo) subdir_makefiles=$(call first-makefiles-under,$(LOCAL_PATH)) + $(call add-radio-file,dynamic-remove-oppo) $(foreach mk,$(subdir_makefiles),$(info including $(mk) ...)$(eval include $(mk))) include $(CLEAR_VARS) diff --git a/dynamic-remove-oppo b/dynamic-remove-oppo new file mode 100644 index 0000000..97f8f6c --- /dev/null +++ b/dynamic-remove-oppo @@ -0,0 +1,27 @@ +# Remove my_product since it might be there and we're not building super or rewriting it +remove my_product + +# Remove my_engineering since it might be there and we're not building super or rewriting it +remove my_engineering + +# Remove my_company since it might be there and we're not building super or rewriting it +remove my_company + +# Remove my_carrier since it might be there and we're not building super or rewriting it +remove my_carrier + +# Remove my_region since it might be there and we're not building super or rewriting it +remove my_region + +# Remove my_heytap since it might be there and we're not building super or rewriting it +remove my_heytap + +# Remove my_stock since it might be there and we're not building super or rewriting it +remove my_stock + +# Remove my_preload since it might be there and we're not building super or rewriting it +remove my_preload + +# Remove my_manifest since it might be there and we're not building super or rewriting it +remove my_manifest + diff --git a/releasetools.py b/releasetools.py index b49a366..16e5c9d 100644 --- a/releasetools.py +++ b/releasetools.py @@ -6,6 +6,12 @@ import common +def FullOTA_InstallBegin(info): + data = info.input_zip.read("RADIO/dynamic-remove-oppo") + common.ZipWriteStr(info.output_zip, "dynamic-remove-oppo", data) + info.script.AppendExtra('update_dynamic_partitions(package_extract_file("dynamic-remove-oppo"));') + return + def FullOTA_InstallEnd(info): OTA_InstallEnd(info, False)