recovery: fix sideload with larger files

+ 16.0: add a disabled patch to remove backuptool
+ processRelease: add support for copying recovery image to archive
This commit is contained in:
Tad 2020-02-22 18:32:59 -05:00
parent fe54dd26a6
commit 4292bcaa3e
7 changed files with 197 additions and 10 deletions

View File

@ -0,0 +1,173 @@
From db5ded424e8deb8a2a75d86e35b9079992491e85 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Sat, 22 Feb 2020 20:20:24 -0500
Subject: [PATCH] Nuke backuptool
Change-Id: I58d3adf67e20d9c4e49df8cd70769d9304da00c1
---
core/Makefile | 14 ---------
tools/releasetools/edify_generator.py | 9 ------
tools/releasetools/ota_from_target_files.py | 35 +--------------------
3 files changed, 1 insertion(+), 57 deletions(-)
diff --git a/core/Makefile b/core/Makefile
index 404bb5413..48778bfc1 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -2837,9 +2837,6 @@ ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_
$(hide) mkdir -p $(zip_root)/$(PRIVATE_RECOVERY_OUT)
$(hide) $(call package_files-copy-root, \
$(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK)
- @# OTA install helpers
- $(hide) $(call package_files-copy-root, \
- $(PRODUCT_OUT)/install,$(zip_root)/INSTALL)
ifdef INSTALLED_KERNEL_TARGET
$(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/kernel
endif
@@ -3195,16 +3192,6 @@ else
OTA_SCRIPT_OVERRIDE_DEVICE := $(TARGET_OTA_ASSERT_DEVICE)
endif
-ifeq ($(WITH_GMS),true)
- $(INTERNAL_OTA_PACKAGE_TARGET): backuptool := false
-else
-ifneq ($(LINEAGE_BUILD),)
- $(INTERNAL_OTA_PACKAGE_TARGET): backuptool := true
-else
- $(INTERNAL_OTA_PACKAGE_TARGET): backuptool := false
-endif
-endif
-
$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
build/make/tools/releasetools/ota_from_target_files
@echo "Package OTA: $@"
@@ -3214,7 +3201,6 @@ $(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
--extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
-p $(HOST_OUT) \
-k $(KEY_CERT_PAIR) \
- --backup=$(backuptool) \
$(if $(OEM_OTA_CONFIG), -o $(OEM_OTA_CONFIG)) \
$(BUILT_TARGET_FILES_PACKAGE) $@
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index 59f9d8831..040a57b57 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -164,9 +164,6 @@ class EdifyGenerator(object):
");")
self.script.append(self.WordWrap(cmd))
- def RunBackup(self, command):
- self.script.append(('run_program("/tmp/install/bin/backuptool.sh", "%s");' % command))
-
def ShowProgress(self, frac, dur):
"""Update the progress bar, advancing it over 'frac' over the next
'dur' seconds. 'dur' may be zero to advance it via SetProgress
@@ -238,12 +235,6 @@ class EdifyGenerator(object):
p.mount_point, mount_flags))
self.mounts.add(p.mount_point)
- def Unmount(self, mount_point):
- """Unmount the partition with the given mount_point."""
- if mount_point in self.mounts:
- self.mounts.remove(mount_point)
- self.script.append('unmount("%s");' % (mount_point,))
-
def UnpackPackageDir(self, src, dst):
"""Unpack a given directory from the OTA package into the given
destination directory."""
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index 089e776fe..5bc022d0b 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -159,10 +159,6 @@ Usage: ota_from_target_files [flags] input_target_files output_ota_package
--override_device <device>
Override device-specific asserts. Can be a comma-separated list.
-
- --backup <boolean>
- Enable or disable the execution of backuptool.sh.
- Disabled by default.
"""
from __future__ import print_function
@@ -215,12 +211,11 @@ OPTIONS.extracted_input = None
OPTIONS.key_passwords = []
OPTIONS.skip_postinstall = False
OPTIONS.override_device = 'auto'
-OPTIONS.backuptool = False
METADATA_NAME = 'META-INF/com/android/metadata'
POSTINSTALL_CONFIG = 'META/postinstall_config.txt'
-UNZIP_PATTERN = ['IMAGES/*', 'META/*', 'INSTALL/*']
+UNZIP_PATTERN = ['IMAGES/*', 'META/*']
class BuildInfo(object):
@@ -721,15 +716,6 @@ def AddCompatibilityArchiveIfTrebleEnabled(target_zip, output_zip, target_info,
AddCompatibilityArchive(system_updated, vendor_updated)
-def CopyInstallTools(output_zip):
- install_path = os.path.join(OPTIONS.input_tmp, "INSTALL")
- for root, subdirs, files in os.walk(install_path):
- for f in files:
- install_source = os.path.join(root, f)
- install_target = os.path.join("install", os.path.relpath(root, install_path), f)
- output_zip.write(install_source, install_target)
-
-
def WriteFullOTAPackage(input_zip, output_file):
target_info = BuildInfo(OPTIONS.info_dict, OPTIONS.oem_dicts)
@@ -823,16 +809,6 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
script.AppendExtra("ifelse(is_mounted(\"/system\"), unmount(\"/system\"));")
device_specific.FullOTA_InstallBegin()
- CopyInstallTools(output_zip)
- script.UnpackPackageDir("install", "/tmp/install")
- script.SetPermissionsRecursive("/tmp/install", 0, 0, 0755, 0644, None, None)
- script.SetPermissionsRecursive("/tmp/install/bin", 0, 0, 0755, 0755, None, None)
-
- if OPTIONS.backuptool:
- script.Mount("/system")
- script.RunBackup("backup")
- script.Unmount("/system")
-
system_progress = 0.75
if OPTIONS.wipe_user_data:
@@ -874,12 +850,6 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
device_specific.FullOTA_PostValidate()
- if OPTIONS.backuptool:
- script.ShowProgress(0.02, 10)
- script.Mount("/system")
- script.RunBackup("restore")
- script.Unmount("/system")
-
script.ShowProgress(0.05, 5)
script.WriteRawImage("/boot", "boot.img")
@@ -1872,8 +1842,6 @@ def main(argv):
OPTIONS.skip_postinstall = True
elif o in ("--override_device"):
OPTIONS.override_device = a
- elif o in ("--backup"):
- OPTIONS.backuptool = bool(a.lower() == 'true')
else:
return False
return True
@@ -1905,7 +1873,6 @@ def main(argv):
"extracted_input_target_files=",
"skip_postinstall",
"override_device=",
- "backup=",
], extra_option_handler=option_handler)
if len(args) != 2:
--
2.24.1

View File

@ -250,7 +250,7 @@ echo "Deblobbing..."
#IMS (VoLTE/Wi-Fi Calling) [Qualcomm]
if [ "$DOS_DEBLOBBER_REMOVE_IMS" = true ]; then
blobs=$blobs"|lib-imsdpl.so|lib-imscamera.so|libimscamera_jni.so|lib-imsqimf.so|lib-imsSDP.so|lib-imss.so|lib-imsvt.so|lib-imsxml.so|lib-imsvideocodec.so|lib-imsvtextutils.so|lib-imsvtutils.so|libimsmedia_jni.so";
blobs=$blobs"|lib-imsdpl.so|lib-imscamera.so|libimscamera_jni.so|lib-imsqimf.so|lib-imsSDP.so|lib-imss.so|lib-imsvt.so|lib-imsxml.so|lib-imsvideocodec.so|lib-imsvtextutils.so|lib-imsvtutils.so|libimsmedia_jni.so|vendor.qti.hardware.radio.ims.*";
blobs=$blobs"|imscmservice|imsdatadaemon|imsqmidaemon";
blobs=$blobs"|imscm.xml|ims.xml";
blobs=$blobs"|qti_permissions.xml";

View File

@ -222,6 +222,15 @@ processRelease() {
done;
fi;
#Extract signed recovery
unzip -l $OUT_DIR/$PREFIX-target_files.zip | grep -q recovery.img;
if [ "$?" == "0" ]; then
echo -e "\e[0;32mExtracting signed recovery.img\e[0m";
mkdir $OUT_DIR/rec_tmp;
unzip $OUT_DIR/$PREFIX-target_files.zip IMAGES/recovery.img -d $OUT_DIR/rec_tmp;
mv $OUT_DIR/rec_tmp/IMAGES/recovery.img $OUT_DIR/$PREFIX-recovery.img;
fi;
#Copy to archive
if [ "$DOS_AUTO_ARCHIVE_BUILDS" = true ]; then
echo -e "\e[0;32mCopying files to archive\e[0m";
@ -234,6 +243,7 @@ processRelease() {
cp -v $OUT_DIR/$PREFIX-fastboot.zip* $ARCHIVE/fastboot/ || true;
cp -v $OUT_DIR/$PREFIX-ota.zip* $ARCHIVE/;
cp -v $OUT_DIR/$PREFIX-incremental_*.zip* $ARCHIVE/incrementals/ || true;
cp -v $OUT_DIR/$PREFIX-recovery.img $ARCHIVE/ || true;
#Remove to make space for next build
if [ "$DOS_REMOVE_AFTER" = true ]; then
@ -558,8 +568,8 @@ hardenDefconfig() {
fi;
done
#Disable supported options
#Disabled: CONFIG_MSM_SMP2P_TEST, CONFIG_MAGIC_SYSRQ (breaks compile on many kernels), CONFIG_KALLSYMS (breaks boot on select devices)
declare -a optionsNo=("CONFIG_ACPI_APEI_EINJ" "CONFIG_ACPI_CUSTOM_METHOD" "CONFIG_ACPI_TABLE_UPGRADE" "CONFIG_BINFMT_AOUT" "CONFIG_BINFMT_MISC" "CONFIG_CHECKPOINT_RESTORE" "CONFIG_COMPAT_BRK" "CONFIG_COMPAT_VDSO" "CONFIG_CP_ACCESS64" "CONFIG_DEVKMEM" "CONFIG_DEVMEM" "CONFIG_DEVPORT" "CONFIG_EARJACK_DEBUGGER" "CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE" "CONFIG_HARDENED_USERCOPY_FALLBACK" "CONFIG_HIBERNATION" "CONFIG_HWPOISON_INJECT" "CONFIG_IA32_EMULATION" "CONFIG_IKCONFIG" "CONFIG_IOMMU_NON_SECURE" "CONFIG_IP_DCCP" "CONFIG_IP_SCTP" "CONFIG_KEXEC" "CONFIG_KEXEC_FILE" "CONFIG_KSM" "CONFIG_LDISC_AUTOLOAD" "CONFIG_LEGACY_PTYS" "CONFIG_LIVEPATCH" "CONFIG_MEM_SOFT_DIRTY" "CONFIG_MMIOTRACE" "CONFIG_MMIOTRACE_TEST" "CONFIG_MODIFY_LDT_SYSCALL" "CONFIG_MSM_BUSPM_DEV" "CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG" "CONFIG_NOTIFIER_ERROR_INJECTION" "CONFIG_OABI_COMPAT" "CONFIG_PAGE_OWNER" "CONFIG_PROC_KCORE" "CONFIG_PROC_PAGE_MONITOR" "CONFIG_PROC_VMCORE" "CONFIG_RDS" "CONFIG_RDS_TCP" "CONFIG_SECURITY_SELINUX_DISABLE" "CONFIG_SLAB_MERGE_DEFAULT" "CONFIG_TIMER_STATS" "CONFIG_TSC" "CONFIG_TSPP2" "CONFIG_UKSM" "CONFIG_UPROBES" "CONFIG_USELIB" "CONFIG_USERFAULTFD" "CONFIG_WLAN_FEATURE_MEMDUMP" "CONFIG_X86_PTDUMP" "CONFIG_X86_VSYSCALL_EMULATION" "CONFIG_ZSMALLOC_STAT");
#Disabled: CONFIG_MSM_SMP2P_TEST, CONFIG_MAGIC_SYSRQ (breaks compile on many kernels), CONFIG_KALLSYMS (breaks boot on select devices), CONFIG_IKCONFIG (breaks recovery)
declare -a optionsNo=("CONFIG_ACPI_APEI_EINJ" "CONFIG_ACPI_CUSTOM_METHOD" "CONFIG_ACPI_TABLE_UPGRADE" "CONFIG_BINFMT_AOUT" "CONFIG_BINFMT_MISC" "CONFIG_CHECKPOINT_RESTORE" "CONFIG_COMPAT_BRK" "CONFIG_COMPAT_VDSO" "CONFIG_CP_ACCESS64" "CONFIG_DEVKMEM" "CONFIG_DEVMEM" "CONFIG_DEVPORT" "CONFIG_EARJACK_DEBUGGER" "CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE" "CONFIG_HARDENED_USERCOPY_FALLBACK" "CONFIG_HIBERNATION" "CONFIG_HWPOISON_INJECT" "CONFIG_IA32_EMULATION" "CONFIG_IOMMU_NON_SECURE" "CONFIG_IP_DCCP" "CONFIG_IP_SCTP" "CONFIG_KEXEC" "CONFIG_KEXEC_FILE" "CONFIG_KSM" "CONFIG_LDISC_AUTOLOAD" "CONFIG_LEGACY_PTYS" "CONFIG_LIVEPATCH" "CONFIG_MEM_SOFT_DIRTY" "CONFIG_MMIOTRACE" "CONFIG_MMIOTRACE_TEST" "CONFIG_MODIFY_LDT_SYSCALL" "CONFIG_MSM_BUSPM_DEV" "CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG" "CONFIG_NOTIFIER_ERROR_INJECTION" "CONFIG_OABI_COMPAT" "CONFIG_PAGE_OWNER" "CONFIG_PROC_KCORE" "CONFIG_PROC_PAGE_MONITOR" "CONFIG_PROC_VMCORE" "CONFIG_RDS" "CONFIG_RDS_TCP" "CONFIG_SECURITY_SELINUX_DISABLE" "CONFIG_SLAB_MERGE_DEFAULT" "CONFIG_TIMER_STATS" "CONFIG_TSC" "CONFIG_TSPP2" "CONFIG_UKSM" "CONFIG_UPROBES" "CONFIG_USELIB" "CONFIG_USERFAULTFD" "CONFIG_WLAN_FEATURE_MEMDUMP" "CONFIG_X86_PTDUMP" "CONFIG_X86_VSYSCALL_EMULATION" "CONFIG_ZSMALLOC_STAT");
if [[ "$1" != *"kernel/htc/msm8994"* ]] && [[ "$1" != *"kernel/samsung/smdk4412"* ]] && [[ "$1" != *"kernel/htc/flounder"* ]] && [[ "$1" != *"kernel/amazon/hdx-common"* ]] && [[ "$1" != *"msm899"* ]]; then
optionsNo+=("CONFIG_DIAG_CHAR" "CONFIG_DIAG_OVER_USB" "CONFIG_USB_QCOM_DIAG_BRIDGE" "CONFIG_DIAGFWD_BRIDGE_CODE" "CONFIG_DIAG_SDIO_PIPE" "CONFIG_DIAG_HSIC_PIPE" "CONFIG_INET_DIAG");
fi;

View File

@ -63,6 +63,7 @@ enterAndClear "bionic";
if [ "$DOS_GRAPHENE_MALLOC" = true ]; then patch -p1 < "$DOS_PATCHES/android_bionic/0001-HM-Use_HM.patch"; fi; #(GrapheneOS)
enterAndClear "bootable/recovery";
git revert --no-edit 3c0d796b79c7a1ee904e0cef7c0f2e20bf84c237; #remove sideload cache, breaks with large files
patch -p1 < "$DOS_PATCHES/android_bootable_recovery/0001-Squash_Menus.patch"; #What's a back button?
enterAndClear "build";

View File

@ -64,6 +64,7 @@ enterAndClear "bionic";
if [ "$DOS_GRAPHENE_MALLOC" = true ]; then patch -p1 < "$DOS_PATCHES/android_bionic/0001-HM-Use_HM.patch"; fi; #(GrapheneOS)
enterAndClear "bootable/recovery";
git revert --no-edit eb98fde70a6e54a25408eb8c626caecf7841c5df; #remove sideload cache, breaks with large files
git revert --no-edit ac258a4f4c4b4b91640cc477ad1ac125f206db02; #Resurrect dm-verity
sed -i 's/!= 2048/< 2048/' tools/dumpkey/DumpPublicKey.java; #Allow 4096-bit keys

View File

@ -84,7 +84,7 @@ buildAll() {
#SD615
buildDevice kipper;
#SD820
buildDevice oneplus3;
buildDevice oneplus3 verity;
buildDevice griffin;
buildDevice z2_plus verity; #broken
#SD821
@ -93,8 +93,8 @@ buildAll() {
#SD625
buildDevice zenfone3; #needs manual patching - fwb xml: fused: dangling tag
#SD835
buildDevice cheeseburger; #needs manual patching - vendor common makefile
buildDevice dumpling;
buildDevice cheeseburger verity; #needs manual patching - vendor common makefile
buildDevice dumpling verity;
buildDevice cheryl;
buildDevice mata verity;
buildDevice taimen avb;

View File

@ -64,7 +64,8 @@ enterAndClear "bionic";
if [ "$DOS_GRAPHENE_MALLOC" = true ]; then patch -p1 < "$DOS_PATCHES/android_bionic/0001-HM-Use_HM.patch"; fi; #(GrapheneOS)
enterAndClear "bootable/recovery";
#git revert --no-edit 4d361ff13b5bd61d5a6a5e95063b24b8a37a24ab; #always enforcing
git revert --no-edit 4d361ff13b5bd61d5a6a5e95063b24b8a37a24ab; #Always enforcing
git revert --no-edit 865c6c770816f6e8099d6d93e04aeea35091a9d6; #Remove sideload cache, breaks with large files
#git revert --no-edit 37d729bf; #fix sideload
git revert --no-edit fe2901b144c515c5a90b547198aed37c209b5a82; #Resurrect dm-verity
sed -i 's/!= 2048/< 2048/' tools/dumpkey/DumpPublicKey.java; #Allow 4096-bit keys
@ -74,9 +75,8 @@ git revert --no-edit 271f6ffa045064abcac066e97f2cb53ccb3e5126 61f7ee9386be426fd4
patch -p1 < "$DOS_PATCHES_COMMON/android_build/0001-OTA_Keys.patch"; #add correct keys to recovery for OTA verification
awk -i inplace '!/PRODUCT_EXTRA_RECOVERY_KEYS/' core/product.mk;
sed -i '74i$(my_res_package): PRIVATE_AAPT_FLAGS += --auto-add-overlay' core/aapt2.mk;
#enterAndClear "device/lineage/sepolicy";
#echo "recovery_only('allow init rootfs:file create;')" >> common/private/init.te; #Fix sideload in recovery (alternative)
#git revert --no-edit 47a0539fcce53cdcab3ee00afd6810acab26950b 3836ed2b2a7c2da6c9eae66700c7c6fabc0c5b9c ab0b2ca6a0d0d24131bcb779f1eb882bf97afd3c; #remove backuptool
#patch -p1 < "$DOS_PATCHES/android_build/0001-rm_backuptool.patch";
enterAndClear "device/qcom/sepolicy-legacy";
patch -p1 < "$DOS_PATCHES/android_device_qcom_sepolicy-legacy/0001-Camera_Fix.patch"; #Fix camera on -user builds XXX: REMOVE THIS TRASH
@ -177,11 +177,13 @@ enterAndClear "vendor/lineage";
rm build/target/product/security/lineage.x509.pem;
rm -rf overlay/common/lineage-sdk/packages/LineageSettingsProvider/res/values/defaults.xml; #Remove analytics
rm -rf verity_tool; #Resurrect dm-verity
rm -rf addonsu;
rm -rf overlay/common/frameworks/base/core/res/res/drawable-*/default_wallpaper.png;
if [ "$DOS_HOSTS_BLOCKING" = true ]; then awk -i inplace '!/50-lineage.sh/' config/common.mk; fi; #Make sure our hosts is always used
awk -i inplace '!/PRODUCT_EXTRA_RECOVERY_KEYS/' config/common.mk; #Remove extra keys
awk -i inplace '!/security\/lineage/' config/common.mk; #Remove extra keys
awk -i inplace '!/WeatherProvider/' config/common.mk;
#awk -i inplace '!/backuptool/' config/common.mk; #remove backuptool
awk -i inplace '!/def_backup_transport/' overlay/common/frameworks/base/packages/SettingsProvider/res/values/defaults.xml;
if [ "$DOS_DEBLOBBER_REMOVE_AUDIOFX" = true ]; then awk -i inplace '!/AudioFX/' config/common.mk; fi;
if [ "$DOS_MICROG_INCLUDED" = "NLP" ]; then sed -i '/Google provider/!b;n;s/com.google.android.gms/org.microg.nlp/' overlay/common/frameworks/base/core/res/res/values/config.xml; fi;