From dda4d679cf85cf281bafe71fa47d40b14d930696 Mon Sep 17 00:00:00 2001 From: Kuba Wojciechowski Date: Wed, 21 Dec 2022 10:01:26 +0530 Subject: [PATCH] RMX3031: Remove oplus 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 Oplus partitions or gracefully fail if it already removed (no assert). Signed-off-by: Kuba Wojciechowski Signed-off-by: Himanshu Tyagi Change-Id: If7051a6b3650d014625c1a4996f14889a7d0aac7 --- Android.mk | 2 ++ releasetools/dynamic-remove-oplus | 26 ++++++++++++++++++++++++++ releasetools/releasetools.py | 6 ++++++ 3 files changed, 34 insertions(+) create mode 100644 releasetools/dynamic-remove-oplus diff --git a/Android.mk b/Android.mk index ad6b799..f71eb0a 100644 --- a/Android.mk +++ b/Android.mk @@ -18,6 +18,8 @@ LOCAL_PATH := $(call my-dir) ifeq ($(TARGET_DEVICE),RMX3031) +$(call add-radio-file,configs/dynamic-remove-oplus) + subdir_makefiles=$(call first-makefiles-under,$(LOCAL_PATH)) $(foreach mk,$(subdir_makefiles),$(info including $(mk) ...)$(eval include $(mk))) diff --git a/releasetools/dynamic-remove-oplus b/releasetools/dynamic-remove-oplus new file mode 100644 index 0000000..3c68258 --- /dev/null +++ b/releasetools/dynamic-remove-oplus @@ -0,0 +1,26 @@ +# 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/releasetools.py b/releasetools/releasetools.py index 5b0886b..be662af 100644 --- a/releasetools/releasetools.py +++ b/releasetools/releasetools.py @@ -17,6 +17,12 @@ import common import re +def FullOTA_InstallBegin(info): + data = info.input_zip.read("RADIO/dynamic-remove-oplus") + common.ZipWriteStr(info.output_zip, "dynamic-remove-oplus", data) + info.script.AppendExtra('update_dynamic_partitions(package_extract_file("dynamic-remove-oplus"));') + return + def FullOTA_InstallEnd(info): OTA_InstallEnd(info) return