From a09a673d2e02cd784b9edd7abcadac9b0501bd14 Mon Sep 17 00:00:00 2001 From: Carlo Dandan <115797725+cd-Spidey@users.noreply.github.com> Date: Mon, 24 Oct 2022 21:44:47 +0800 Subject: [PATCH] Import from: https://gitlab.com/OrangeFox/sync --- sync/README.md | 60 +++ sync/legacy/build_fox.sh | 93 ++++ sync/legacy/get_fox_10.sh | 257 +++++++++++ sync/legacy/update_fox_10.sh | 121 ++++++ sync/orangefox_sync.sh | 502 ++++++++++++++++++++++ sync/patches/patch-manifest-fox_10.0.diff | 168 ++++++++ sync/patches/patch-manifest-fox_11.0.diff | 184 ++++++++ sync/patches/patch-manifest-fox_12.1.diff | 184 ++++++++ sync/patches/patch-manifest-fox_6.0.diff | 168 ++++++++ sync/patches/patch-manifest-fox_7.1.diff | 179 ++++++++ sync/patches/patch-manifest-fox_8.1.diff | 126 ++++++ sync/patches/patch-manifest-fox_9.0.diff | 96 +++++ sync/patches/usage.txt | 17 + sync/update_fox.sh | 114 +++++ 14 files changed, 2269 insertions(+) create mode 100644 sync/README.md create mode 100644 sync/legacy/build_fox.sh create mode 100644 sync/legacy/get_fox_10.sh create mode 100644 sync/legacy/update_fox_10.sh create mode 100644 sync/orangefox_sync.sh create mode 100644 sync/patches/patch-manifest-fox_10.0.diff create mode 100644 sync/patches/patch-manifest-fox_11.0.diff create mode 100644 sync/patches/patch-manifest-fox_12.1.diff create mode 100644 sync/patches/patch-manifest-fox_6.0.diff create mode 100644 sync/patches/patch-manifest-fox_7.1.diff create mode 100644 sync/patches/patch-manifest-fox_8.1.diff create mode 100644 sync/patches/patch-manifest-fox_9.0.diff create mode 100644 sync/patches/usage.txt create mode 100644 sync/update_fox.sh diff --git a/sync/README.md b/sync/README.md new file mode 100644 index 0000000..a8513ca --- /dev/null +++ b/sync/README.md @@ -0,0 +1,60 @@ +# Sync a twrp minimal manifest, patch it for building OrangeFox, and sync the OrangeFox sources + +## To fetch the manifest for the first time, follow these steps: ## +------------------------------------ + +### 1. Fetch these sync tools ### + mkdir ~/OrangeFox_sync + cd ~/OrangeFox_sync + git clone https://gitlab.com/OrangeFox/sync.git # (or, using ssh, "git clone git@gitlab.com:OrangeFox/sync.git") + +### 2. Do the syncing (this can take up to 1 hour, and can use up to 40GB of disk space) - below is an example, for 11.0 (amend as required for other branches) ## + cd ~/OrangeFox_sync/sync/ + ./orangefox_sync.sh --branch 11.0 --path ~/fox_11.0 +Notes: +- You *MUST* supply an *ABSOLUTE* path name for the "--path" switch +- If the sync process gets stuck, you might need to terminate it with Ctrl-C and then run the script again +- If you want to use ssh for cloning the OrangeFox sources and vendor tree, export "USE_SSH=1" before starting, or supply "--ssh 1" on the command line +- After the initial sync process, you must then clone your device trees, before you can build for your device + +## These manifest branches are supported by the orangefox_sync.sh script: ## +---------------------------------- + 12.1 + 11.0 + 10.0 + 9.0 + 8.1 + 7.1 + 6.0 + +## To update the manifest, and the recovery sources, and the vendor trees (given the example of the 11.0 branch above), follow these steps: ## +---------------------------------- + cd ~/fox_11.0/ + repo sync # (ignore all errors and suggestions relating to "android_bootable_recovery") + cd ~/fox_11.0/bootable/recovery/ + git pull --recurse-submodules + git submodule foreach --recursive git pull origin master + cd ~/fox_11.0/vendor/recovery/ + git pull + +## To update only the recovery sources (given the example of the 11.0 branch above), follow these steps: ## +---------------------------------- + cd ~/fox_11.0/bootable/recovery/ + git pull --recurse-submodules + git submodule foreach --recursive git pull origin master + +## To update only the vendor tree (given the example of the 11.0 branch above) follow these steps: ## +---------------------------------- + cd ~/fox_11.0/vendor/recovery/ + git pull + +## To update only the manifest (given the example of the 11.0 branch above), follow these steps: ## +---------------------------------- + cd ~/fox_11.0/ + repo sync # (ignore all errors and suggestions relating to "android_bootable_recovery") + +## To see the syntax of the orangefox_sync.sh script, follow these steps: ## +---------------------------------- + cd ~/OrangeFox_sync/sync/ + ./orangefox_sync.sh --help + diff --git a/sync/legacy/build_fox.sh b/sync/legacy/build_fox.sh new file mode 100644 index 0000000..78a3e14 --- /dev/null +++ b/sync/legacy/build_fox.sh @@ -0,0 +1,93 @@ +#!/bin/bash +# +# Sample trivial build script +# + +# the branches we will be dealing with +FOX_BRANCH="fox_10.0" + +# quit with a message +abort() { + echo "$@" + exit 1 +} + +# help +show_help() { + echo "Sample script for building OrangeFox with the $FOX_BRANCH build system" + echo "Usage = $0 [-c]" + echo "Arguments:" + echo " device_codename (required)" + echo " -c (make a clean build) (optional)" + echo "Example = $0 miatoll" + exit 0 +} + +if [ "$1" = "-h" -o "$1" = "--help" ]; then + show_help; +fi + +# Our starting point (Fox base dir) +BASE_DIR="$PWD" + +# the saved location of the manifest directory upon successful sync and patch +SYNC_LOG="$BASE_DIR"/"$FOX_BRANCH"_"manifest.sav" +if [ -f $SYNC_LOG ]; then + source $SYNC_LOG +fi + +# default directory for the new manifest (amend this to match your situation) +[ -z "$MANIFEST_DIR" ] && MANIFEST_DIR="$BASE_DIR/$FOX_BRANCH" + +# check for the manifest directory +[ ! -d "$MANIFEST_DIR" ] && abort "Invalid manifest directory: \"$MANIFEST_DIR\"" + +# device codename (must be the first argument) +device="$1" +[ -z "$device" ] && show_help + +# check for the device tree +F=$(find "$MANIFEST_DIR/device" -name "$device") +if [ -z "$F" ]; then + abort "There is no device tree for \"$device\"" +else + echo "Device tree for $device: \"$F\"" +fi + +# exports +export OUT_DIR=$BASE_DIR/BUILDS/"$device" +export ALLOW_MISSING_DEPENDENCIES=true +export FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER=1 +export LC_ALL="C" +export FOX_BUILD_DEVICE="$device" +export FOX_BUILD_LOG_FILE=$BASE_DIR/"$device"_"build.log" + +cd $MANIFEST_DIR + +# clean build? +if [ "$2" = "-c" -o "$2" = "--clean" ]; then + make clean + [ -d $OUT_DIR ] && rm -rf $OUT_DIR +fi + +# use ccache? +export USE_CCACHE=1 +export CCACHE_EXEC=/usr/bin/ccache +ccache -M 20G; # 20GB cache + +# prepare to build +mkdir -p $OUT_DIR + +# start building +START=$(date) +. build/envsetup.sh +lunch omni_"$device"-eng +mka recoveryimage +STOP=$(date) + +# report +cd $BASE_DIR +echo "Start time=$START" +echo "End time =$STOP" +exit 0 +# --- # diff --git a/sync/legacy/get_fox_10.sh b/sync/legacy/get_fox_10.sh new file mode 100644 index 0000000..330745d --- /dev/null +++ b/sync/legacy/get_fox_10.sh @@ -0,0 +1,257 @@ +#!/bin/bash -x +# *************************************************************************************** +# - Script to set up things for building OrangeFox with the Android-10.0 build system +# - Syncs the twrp-10.0 minimal manifest, and patches it for building OrangeFox +# - Pulls in the OrangeFox recovery sources and vendor tree +# - Author: DarthJabba9 +# - Version: fox_10.0:006 +# - Date: 06 November 2021 +# *************************************************************************************** + +# the branches we will be dealing with +FOX_BRANCH="fox_10.0"; +TWRP_BRANCH="twrp-10.0"; +DEVICE_BRANCH="android-10"; + +# the base version of the current OrangeFox +FOX_BASE_VERSION="R11.1"; + +# Our starting point (Fox base dir) +BASE_DIR="$PWD"; + +# default directory for the new manifest +MANIFEST_DIR="$BASE_DIR/$FOX_BRANCH"; + +# where to log the location of the manifest directory upon successful sync and patch +SYNC_LOG="$BASE_DIR"/"$FOX_BRANCH"_"manifest.sav"; + +# help +if [ "$1" = "-h" -o "$1" = "--help" -o "$1" = "help" ]; then + echo "Script to set up things for building OrangeFox with the $DEVICE_BRANCH build system" + echo "Usage = $0 [new_manifest_directory]" + echo "The default new manifest directory is \"$MANIFEST_DIR\"" + exit 0 +fi + +# You can supply a path for the new manifest to override the default +[ -n "$1" ] && MANIFEST_DIR="$1"; + +# by default, don't use SSH for the "git clone" commands; to use SSH, export USE_SSH=1 before starting +[ -z "$USE_SSH" ] && USE_SSH="0"; + +# the "diff" file that will be used to patch the original manifest +PATCH_FILE="$BASE_DIR/patch-manifest-$FOX_BRANCH.diff"; + +# the directory in which the patch of the manifest will be executed +MANIFEST_BUILD_DIR="$MANIFEST_DIR/build"; + +# the device whose tree we can clone for compiling a test build +test_build_device="miatoll"; + +# print message and quit +abort() { + echo "$@" + exit +} + +# init the script, ensure we have the patch file, and create the manifest directory +init_script() { + echo "-- Starting the script ..." + [ ! -f "$PATCH_FILE" ] && abort "-- I cannot find the patch file: $PATCH_FILE - quitting!" + + echo "-- The new build system will be located in \"$MANIFEST_DIR\"" + mkdir -p $MANIFEST_DIR + [ "$?" != "0" -a ! -d $MANIFEST_DIR ] && { + abort "-- Invalid directory: \"$MANIFEST_DIR\". Quitting." + } +} + +# repo init and repo sync +get_twrp_minimal_manifest() { + local MIN_MANIFEST="git://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git" + cd $MANIFEST_DIR + echo "-- Initialising the $TWRP_BRANCH minimal manifest repo ..." + repo init --depth=1 -u $MIN_MANIFEST -b $TWRP_BRANCH + [ "$?" != "0" ] && { + abort "-- Failed to initialise the minimal manifest repo. Quitting." + } + echo "-- Done." + + echo "-- Syncing the $TWRP_BRANCH minimal manifest repo ..." + repo sync + [ "$?" != "0" ] && { + abort "-- Failed to Sync the minimal manifest repo. Quitting." + } + echo "-- Done." +} + +# patch the build system for OrangeFox +patch_minimal_manifest() { + echo "-- Patching the $TWRP_BRANCH minimal manifest for building OrangeFox for dynamic partition devices ..." + cd $MANIFEST_BUILD_DIR + patch -p1 < $PATCH_FILE + [ "$?" = "0" ] && echo "-- The $TWRP_BRANCH minimal manifest has been patched successfully" || abort "-- Failed to patch the $TWRP_BRANCH minimal manifest! Quitting." + + # save location of manifest dir + echo "#" &> $SYNC_LOG + echo "MANIFEST_DIR=$MANIFEST_DIR" >> $SYNC_LOG + echo "#" >> $SYNC_LOG +} + +# get the qcom/twrp common stuff +clone_common() { +local URL + cd $MANIFEST_DIR/ + + if [ ! -d "device/qcom/common" ]; then + echo "-- Cloning qcom common ..." + git clone https://github.com/TeamWin/android_device_qcom_common -b $DEVICE_BRANCH device/qcom/common + fi + + if [ ! -d "device/qcom/twrp-common" ]; then + echo "-- Cloning twrp-common ..." + git clone https://github.com/TeamWin/android_device_qcom_twrp-common -b $DEVICE_BRANCH device/qcom/twrp-common + fi +} + +# get the OrangeFox recovery sources +clone_fox_recovery() { +local URL="" + if [ "$USE_SSH" = "0" ]; then + URL="https://gitlab.com/OrangeFox/bootable/Recovery.git" + else + URL="git@gitlab.com:OrangeFox/bootable/Recovery.git" + fi + + mkdir -p $MANIFEST_DIR/bootable + [ ! -d $MANIFEST_DIR/bootable ] && { + echo "-- Invalid directory: $MANIFEST_DIR/bootable" + return + } + + cd $MANIFEST_DIR/bootable/ + [ -d recovery/ ] && { + echo "-- Moving the TWRP recovery sources to /tmp" + rm -rf /tmp/recovery + mv recovery /tmp + } + + echo "-- Pulling the OrangeFox recovery sources ..." + git clone --recurse-submodules $URL -b $FOX_BRANCH recovery + [ "$?" = "0" ] && echo "-- The OrangeFox sources have been cloned successfully" || echo "-- Failed to clone the OrangeFox sources!" + + # check that the themes are correctly downloaded + if [ ! -f recovery/gui/theme/portrait_hdpi/ui.xml ]; then + echo "-- Themes not found! Trying again to pull the themes ..." + if [ "$USE_SSH" = "0" ]; then + URL="https://gitlab.com/OrangeFox/misc/theme.git" + else + URL="git@gitlab.com:OrangeFox/misc/theme.git" + fi + [ -d recovery/gui/theme ] && rm -rf recovery/gui/theme + git clone $URL recovery/gui/theme + [ "$?" = "0" ] && echo "-- The themes have been cloned successfully" || echo "-- Failed to clone the themes!" + fi + + # cleanup /tmp/recovery/ + echo "-- Cleaning up the TWRP recovery sources from /tmp" + rm -rf /tmp/recovery + + # create the directory for Xiaomi device trees + mkdir -p $MANIFEST_DIR/device/xiaomi +} + +# get the OrangeFox vendor +clone_fox_vendor() { +local URL + if [ "$USE_SSH" = "0" ]; then + URL="https://gitlab.com/OrangeFox/vendor/recovery.git" + else + URL="git@gitlab.com:OrangeFox/vendor/recovery.git" + fi + + echo "-- Preparing for cloning the OrangeFox vendor tree ..." + rm -rf $MANIFEST_DIR/vendor/recovery + mkdir -p $MANIFEST_DIR/vendor + [ ! -d $MANIFEST_DIR/vendor ] && { + echo "-- Invalid directory: $MANIFEST_DIR/vendor" + return + } + + cd $MANIFEST_DIR/vendor + echo "-- Pulling the OrangeFox vendor tree ..." + git clone $URL -b $FOX_BRANCH recovery + [ "$?" = "0" ] && echo "-- The OrangeFox vendor tree has been cloned successfully" || echo "-- Failed to clone the OrangeFox vendor tree!" +} + +# get device trees +get_device_tree() { +local DIR=$MANIFEST_DIR/device/xiaomi + mkdir -p $DIR + cd $DIR + [ "$?" != "0" ] && { + abort "-- get_device_tree() - Invalid directory: $DIR" + } + + # test device + local URL=git@gitlab.com:OrangeFox/device/"$test_build_device".git + [ "$USE_SSH" = "0" ] && URL=https://gitlab.com/OrangeFox/device/"$test_build_device".git + echo "-- Pulling the $test_build_device device tree ..." + git clone $URL -b $FOX_BRANCH"_test" "$test_build_device" + + # done + if [ -d "$test_build_device" -a -d "$test_build_device/recovery" ]; then + echo "-- Finished fetching the OrangeFox $test_build_device device tree." + else + abort "-- get_device_tree() - could not fetch the OrangeFox $test_build_device device tree." + fi +} + +# test build +test_build() { + # clone the device tree + get_device_tree + + # proceed with the test build + export FOX_VERSION="$FOX_BASE_VERSION"_"$FOX_BRANCH" + export FOX_BUILD_TYPE="Alpha" + export ALLOW_MISSING_DEPENDENCIES=true + export FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER=1 + export LC_ALL="C" + export FOX_BUILD_DEVICE="$test_build_device" + + echo "-- Compiling a test build for device \"$test_build_device\". This will take a *VERY* long time ..." + echo "-- Start compiling: " + export OUT_DIR=$BASE_DIR/BUILDS/"$test_build_device" + cd $BASE_DIR/ + mkdir -p $OUT_DIR + cd $MANIFEST_DIR/ + + . build/envsetup.sh + lunch omni_"$test_build_device"-eng + mka recoveryimage + + # any results? + ls -all $(find "$OUT_DIR" -name "OrangeFox-*") +} + +# do all the work! +WorkNow() { + local START=$(date); + init_script; + get_twrp_minimal_manifest; + patch_minimal_manifest; + clone_common; + clone_fox_recovery; + clone_fox_vendor; + # test_build; # comment this out - don't do a test build + local STOP=$(date); + echo "- Stop time =$STOP"; + echo "- Start time=$START"; + echo "- Now, clone your device trees to the correct locations!"; + exit 0; +} + +# --- main() --- +WorkNow; +# --- end main() --- diff --git a/sync/legacy/update_fox_10.sh b/sync/legacy/update_fox_10.sh new file mode 100644 index 0000000..b5ab2d5 --- /dev/null +++ b/sync/legacy/update_fox_10.sh @@ -0,0 +1,121 @@ +#!/bin/bash +# *************************************************************************************** +# Script to update the Android 10 minimal manifest (with "repo sync") +# - Author: DarthJabba9 +# - Version: 006 +# - Date: 02 November 2021 +# *************************************************************************************** + +# the branches we will be dealing with +FOX_BRANCH="fox_10.0" +DEVICE_BRANCH="android-10" + +# print message and quit +abort() { + echo "$@" + exit +} + +# Our starting point (Fox base dir) +BASE_DIR="$PWD" + +# the saved location of the manifest directory upon successful sync and patch +SYNC_LOG="$BASE_DIR"/"$FOX_BRANCH"_"manifest.sav" +if [ -f $SYNC_LOG ]; then + source $SYNC_LOG +fi + +[ -z "$MANIFEST_DIR" ] && MANIFEST_DIR="$BASE_DIR/$FOX_BRANCH" + +# help +if [ "$1" = "-h" -o "$1" = "--help" -o "$1" = "help" ]; then + echo "Script to update the $FOX_BRANCH build system" + echo "Usage = $0 [$FOX_BRANCH-manifest_directory]" + echo "The default manifest directory is \"$MANIFEST_DIR\"" + exit 0 +fi + +# is the fox_10 manifest directory supplied from the command line? +if [ -n "$1" ]; then + MANIFEST_DIR="$1" + [ "$1" = "." ] && MANIFEST_DIR="$PWD" +fi + +# test whether it is valid +if [ ! -d $MANIFEST_DIR ]; then + echo "- Invalid directory: \"$MANIFEST_DIR\"" + abort "Syntax = $0 <$FOX_BRANCH-manifest_directory>" +fi + +cd $MANIFEST_DIR +[ "$?" != "0" ] && abort "- Invalid directory: $MANIFEST_DIR" + +# some more rudimentary checks +echo "- Checking the directory ($MANIFEST_DIR) for validity" +if [ ! -d bootable/ -o ! -d external/ -o ! -d bionic/ -o ! -d system/ -o ! -d toolchain/ ]; then + abort "- Invalid manifest directory: $MANIFEST_DIR" +fi +LOC="$PWD" +echo "- Done." + +echo "- The build system to be updated is: \"$MANIFEST_DIR\"" + +# move the OrangeFox "bootable" directory +echo "- Backing up the OrangeFox recovery sources" +BOOTABLE_BACKUP="fox_bootable" +[ -d $BOOTABLE_BACKUP ] && rm -rf $BOOTABLE_BACKUP + +mv bootable/ $BOOTABLE_BACKUP +[ "$?" != "0" ] && abort "- Error backing up the OrangeFox recovery sources" +echo "- Done." + +# move the OrangeFox "device" trees +echo "- Backing up the OrangeFox device trees" +DEVICE_BACKUP="fox_devices" +[ -d $DEVICE_BACKUP ] && rm -rf $DEVICE_BACKUP + +mv device/ $DEVICE_BACKUP +[ "$?" != "0" ] && { + echo "- Restoring the OrangeFox recovery sources ..." + rm -rf bootable/ + mv $BOOTABLE_BACKUP bootable/ + abort "- Error backing up the OrangeFox device trees" +} +echo "- Done." + +# sync the twrp manifest +echo "- Updating the minimal manifest ..." +repo sync +echo "- Done." + +echo "- Restoring the OrangeFox recovery sources ..." +# remove the TWRP bootable/ directory +rm -rf bootable/ + +# restore the OrangeFox bootable directory +mv $BOOTABLE_BACKUP bootable/ +echo "- Done." + +echo "- Restoring the OrangeFox device trees ..." +# remove the TWRP device/ directory +rm -rf device/ + +# restore the OrangeFox device directory +mv $DEVICE_BACKUP device/ +echo "- Done." + +# Update OrangeFox sources +echo "- Updating the OrangeFox recovery sources ..." +cd $LOC/bootable/recovery +git pull --recurse-submodules +echo "- Done." + +# Update OrangeFox vendor tree +echo "- Updating the OrangeFox vendor tree ..." +cd $LOC/vendor/recovery +git pull +echo "- Done." + +# Finished +echo "- Finished! You need to update your device tree(s) manually." +# diff --git a/sync/orangefox_sync.sh b/sync/orangefox_sync.sh new file mode 100644 index 0000000..c2b75ac --- /dev/null +++ b/sync/orangefox_sync.sh @@ -0,0 +1,502 @@ +#!/bin/bash +# *************************************************************************************** +# - Script to set up things for building OrangeFox with a minimal build system +# - Syncs the relevant twrp minimal manifest, and patches it for building OrangeFox +# - Pulls in the OrangeFox recovery sources and vendor tree +# - Author: DarthJabba9 +# - Version: generic:014 +# - Date: 08 September 2022 +# +# * Changes for v007 (20220430) - make it clear that fox_12.1 is not ready +# * Changes for v008 (20220708) - fox_12.1 is now ready +# * Changes for v009 (20220708A) - try to cherry-pick the system vold stuff from gerrit +# * Changes for v010 (20220708B) - move the cherry-pick call +# * Changes for v011 (20220731) - update the system vold patchset number to 10 +# * Changes for v012 (20220806) - update the system vold patchset number to 12 +# * Changes for v013 (20220803) - try to ensure that the submodules are updated +# * Changes for v014 (20220908) - don't apply the system vold patch: it is no longer needed +# +# *************************************************************************************** + +# the version number of this script +SCRIPT_VERSION="20220908"; + +# the base version of the current OrangeFox +FOX_BASE_VERSION="R11.1"; + +# Our starting point (Fox base dir) +BASE_DIR="$PWD"; + +# default directory for the new manifest +MANIFEST_DIR=""; + +# functions to set up things for each supported manifest branch +do_fox_121() { + BASE_VER=12; + FOX_BRANCH="fox_12.1"; + FOX_DEF_BRANCH="fox_12.1"; + TWRP_BRANCH="twrp-12.1"; + DEVICE_BRANCH="android-12.1"; + test_build_device="miatoll"; # the device whose tree we can clone for compiling a test build + MIN_MANIFEST="https://github.com/minimal-manifest-twrp/platform_manifest_twrp_aosp.git"; + [ -z "$MANIFEST_DIR" ] && MANIFEST_DIR="$BASE_DIR/$FOX_DEF_BRANCH"; + echo "-- NOTE: the \"$FOX_BRANCH\" branch is still work-in-progress, and will stay for some time at the Beta stage. Treat it as such."; +} + +do_fox_110() { + BASE_VER=11; + FOX_BRANCH="fox_11.0"; + FOX_DEF_BRANCH="fox_11.0"; + TWRP_BRANCH="twrp-11"; + DEVICE_BRANCH="android-11"; + test_build_device="vayu"; # the device whose tree we can clone for compiling a test build + MIN_MANIFEST="https://github.com/minimal-manifest-twrp/platform_manifest_twrp_aosp.git"; + [ -z "$MANIFEST_DIR" ] && MANIFEST_DIR="$BASE_DIR/$FOX_DEF_BRANCH"; + echo "-- NOTE: the \"$FOX_BRANCH\" branch is still BETA as far as Virtual A/B (\"VAB\") devices are concerned. Treat it as such."; +} + +do_fox_100() { + BASE_VER=10; + FOX_BRANCH="fox_10.0"; + FOX_DEF_BRANCH="fox_10.0"; + TWRP_BRANCH="twrp-10.0-deprecated"; + DEVICE_BRANCH="android-10"; + test_build_device="miatoll"; + MIN_MANIFEST="https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git"; + [ -z "$MANIFEST_DIR" ] && MANIFEST_DIR="$BASE_DIR/$FOX_DEF_BRANCH"; +} + +do_fox_90() { + BASE_VER=9; + FOX_BRANCH="fox_9.0"; + FOX_DEF_BRANCH="fox_9.0"; + TWRP_BRANCH="twrp-9.0"; + DEVICE_BRANCH="android-9.0"; + test_build_device="mido"; + MIN_MANIFEST="https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git"; + [ -z "$MANIFEST_DIR" ] && MANIFEST_DIR="$BASE_DIR/$FOX_DEF_BRANCH"; +} + +do_fox_81() { + BASE_VER=8; + FOX_BRANCH="fox_9.0"; + FOX_DEF_BRANCH="fox_8.1"; + TWRP_BRANCH="twrp-8.1"; + DEVICE_BRANCH="android-8.1"; + test_build_device="kenzo"; + MIN_MANIFEST="https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git"; + [ -z "$MANIFEST_DIR" ] && MANIFEST_DIR="$BASE_DIR/$FOX_DEF_BRANCH"; +} + +do_fox_71() { + BASE_VER=6; + FOX_BRANCH="fox_9.0"; + FOX_DEF_BRANCH="fox_7.1"; + TWRP_BRANCH="twrp-7.1"; + DEVICE_BRANCH="android-7.1"; + test_build_device="hermes"; + MIN_MANIFEST="https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git"; + [ -z "$MANIFEST_DIR" ] && MANIFEST_DIR="$BASE_DIR/$FOX_DEF_BRANCH"; +} + +do_fox_60() { + BASE_VER=6; + FOX_BRANCH="fox_9.0"; + FOX_DEF_BRANCH="fox_6.0"; + TWRP_BRANCH="twrp-6.0"; + DEVICE_BRANCH="android-6.0"; + test_build_device="klte"; + MIN_MANIFEST="https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git"; + [ -z "$MANIFEST_DIR" ] && MANIFEST_DIR="$BASE_DIR/$FOX_DEF_BRANCH"; +} + +# help +help_screen() { + echo "Script to set up things for building OrangeFox with a twrp minimal manifest"; + echo "Usage = $0 "; + echo "Arguments:"; + echo " -h, -H, --help print this help screen and quit"; + echo " -d, -D, --debug debug mode: print each command being executed"; + echo " -s, -S, --ssh <'0' or '1'> set 'USE_SSH' to '0' or '1'"; + echo " -p, -P, --path sync the minimal manifest into the directory ''"; + echo " -b, -B, --branch get the minimal manifest for ''"; + echo " '' must be one of the following branches:"; + echo " 12.1"; + echo " 11.0"; + echo " 10.0"; + echo " 9.0"; + echo " 8.1"; + echo " 7.1"; + echo " 6.0"; + echo "Examples:"; + echo " $0 --branch 12.1 --path ~/OrangeFox_12.1"; + echo " $0 --branch 11.0 --path ~/OrangeFox_11.0"; + echo " $0 --branch 10.0 --path ~/OrangeFox_10 --ssh 1"; + echo " $0 --branch 9.0 --path ~/OrangeFox/9.0 --debug"; + echo ""; + echo "- You *MUST* supply an *ABSOLUTE* path for the '--path' switch"; + exit 0; +} + +####################################################################### +# test the command line arguments +Process_CMD_Line() { + if [ -z "$1" ]; then + help_screen; + fi + + while (( "$#" )); do + + case "$1" in + # debug mode - show some verbose outputs + -d | -D | --debug) + set -o xtrace; + ;; + # help + -h | -H | --help) + help_screen; + ;; + # ssh + -s | -S | --ssh) + shift; + [ "$1" = "0" -o "$1" = "1" ] && USE_SSH=$1 || USE_SSH=0; + ;; + # path + -p | -P | --path) + shift; + [ -n "$1" ] && MANIFEST_DIR=$1; + ;; + # branch + -b | -B | --branch) + shift; + if [ "$1" = "12.1" ]; then do_fox_121; + elif [ "$1" = "11.0" ]; then do_fox_110; + elif [ "$1" = "10.0" ]; then do_fox_100; + elif [ "$1" = "9.0" ]; then do_fox_90; + elif [ "$1" = "8.1" ]; then do_fox_81; + elif [ "$1" = "7.1" ]; then do_fox_71; + elif [ "$1" = "6.0" ]; then do_fox_60; + else + echo "Invalid branch \"$1\". Read the help screen below."; + echo ""; + help_screen; + fi + ;; + + esac + shift + done + + # do we have all the necessary branch information? + if [ -z "$FOX_BRANCH" -o -z "$TWRP_BRANCH" -o -z "$DEVICE_BRANCH" -o -z "$FOX_DEF_BRANCH" ]; then + echo "No branch has been specified. Read the help screen below."; + echo ""; + help_screen; + fi + + # do we have a manifest directory? + if [ -z "$MANIFEST_DIR" ]; then + echo "No path has been specified for the manifest. Read the help screen below."; + echo ""; + help_screen; + fi +} +####################################################################### + +# print message and quit +abort() { + echo "$@"; + exit 1; +} + +# update the environment after processing the command line +update_environment() { + # where to log the location of the manifest directory upon successful sync and patch + SYNC_LOG="$BASE_DIR"/"$FOX_DEF_BRANCH"_"manifest.sav"; + + # by default, don't use SSH for the "git clone" commands; to use SSH, you can also export USE_SSH=1 before starting + [ -z "$USE_SSH" ] && USE_SSH="0"; + + # the "diff" file that will be used to patch the original manifest + PATCH_FILE="$BASE_DIR/patches/patch-manifest-$FOX_DEF_BRANCH.diff"; + + # the directory in which the patch of the manifest will be executed + MANIFEST_BUILD_DIR="$MANIFEST_DIR/build"; +} + +# init the script, ensure we have the patch file, and create the manifest directory +init_script() { + echo "-- Starting the script ..."; + [ ! -f "$PATCH_FILE" ] && abort "-- I cannot find the patch file: $PATCH_FILE - quitting!"; + + echo "-- The new build system will be located in \"$MANIFEST_DIR\""; + mkdir -p $MANIFEST_DIR; + [ "$?" != "0" -a ! -d $MANIFEST_DIR ] && { + abort "-- Invalid directory: \"$MANIFEST_DIR\". Quitting."; + } +} + +# repo init and repo sync +get_twrp_minimal_manifest() { + cd $MANIFEST_DIR; + echo "-- Initialising the $TWRP_BRANCH minimal manifest repo ..."; + repo init --depth=1 -u $MIN_MANIFEST -b $TWRP_BRANCH; + [ "$?" != "0" ] && { + abort "-- Failed to initialise the minimal manifest repo. Quitting."; + } + echo "-- Done."; + + echo "-- Syncing the $TWRP_BRANCH minimal manifest repo ..."; + repo sync; + [ "$?" != "0" ] && { + abort "-- Failed to Sync the minimal manifest repo. Quitting."; + } + echo "-- Done."; +} + +# patch the build system for OrangeFox +patch_minimal_manifest() { + echo "-- Patching the $TWRP_BRANCH minimal manifest for building OrangeFox for native $DEVICE_BRANCH devices ..."; + cd $MANIFEST_BUILD_DIR; + patch -p1 < $PATCH_FILE; + [ "$?" = "0" ] && echo "-- The $TWRP_BRANCH minimal manifest has been patched successfully" || abort "-- Failed to patch the $TWRP_BRANCH minimal manifest! Quitting."; + + # save location of manifest dir + echo "#" &> $SYNC_LOG; + echo "MANIFEST_DIR=$MANIFEST_DIR" >> $SYNC_LOG; + echo "#" >> $SYNC_LOG; +} + +# get the qcom/twrp common stuff +clone_common() { + cd $MANIFEST_DIR/; + + if [ ! -d "device/qcom/common" ]; then + echo "-- Cloning qcom common ..."; + git clone https://github.com/TeamWin/android_device_qcom_common -b $DEVICE_BRANCH device/qcom/common; + fi + + if [ ! -d "device/qcom/twrp-common" ]; then + echo "-- Cloning twrp-common ..."; + git clone https://github.com/TeamWin/android_device_qcom_twrp-common -b $DEVICE_BRANCH device/qcom/twrp-common; + fi +} + +# get the OrangeFox recovery sources +clone_fox_recovery() { +local URL=""; +local BRANCH=$FOX_BRANCH; + if [ "$USE_SSH" = "0" ]; then + URL="https://gitlab.com/OrangeFox/bootable/Recovery.git"; + else + URL="git@gitlab.com:OrangeFox/bootable/Recovery.git"; + fi + + mkdir -p $MANIFEST_DIR/bootable; + [ ! -d $MANIFEST_DIR/bootable ] && { + echo "-- Invalid directory: $MANIFEST_DIR/bootable"; + return; + } + + cd $MANIFEST_DIR/bootable/; + [ -d recovery/ ] && { + echo "-- Moving the TWRP recovery sources to /tmp"; + rm -rf /tmp/recovery; + mv recovery /tmp; + } + + echo "-- Pulling the OrangeFox recovery sources ..."; + git clone --recurse-submodules $URL -b $BRANCH recovery; + [ "$?" = "0" ] && echo "-- The OrangeFox sources have been cloned successfully" || echo "-- Failed to clone the OrangeFox sources!"; + + # check that the themes are correctly downloaded + if [ ! -f recovery/gui/theme/portrait_hdpi/ui.xml ]; then + echo "-- Themes not found! Trying again to pull the themes ..."; + if [ "$USE_SSH" = "0" ]; then + URL="https://gitlab.com/OrangeFox/misc/theme.git"; + else + URL="git@gitlab.com:OrangeFox/misc/theme.git"; + fi + [ -d recovery/gui/theme ] && rm -rf recovery/gui/theme; + git clone $URL recovery/gui/theme; + [ "$?" = "0" ] && echo "-- The themes have been cloned successfully" || echo "-- Failed to clone the themes!"; + fi + + # ensure that the submodules are updated + if [ -d $MANIFEST_DIR/bootable/recovery/gui/theme ]; then + cd $MANIFEST_DIR/bootable/recovery/; + git submodule foreach --recursive git pull origin master; + cd $MANIFEST_DIR/bootable/; + fi + + # cleanup /tmp/recovery/ + echo "-- Cleaning up the TWRP recovery sources from /tmp"; + rm -rf /tmp/recovery; + + # create the directory for Xiaomi device trees + mkdir -p $MANIFEST_DIR/device/xiaomi; +} + +# get the OrangeFox vendor +clone_fox_vendor() { +local URL=""; +local BRANCH=$FOX_BRANCH; + [ "$BASE_VER" -lt 10 ] && BRANCH="master"; # less than fox_10.0 use the "master" branch + + if [ "$USE_SSH" = "0" ]; then + URL="https://gitlab.com/OrangeFox/vendor/recovery.git"; + else + URL="git@gitlab.com:OrangeFox/vendor/recovery.git"; + fi + + echo "-- Preparing for cloning the OrangeFox vendor tree ..."; + rm -rf $MANIFEST_DIR/vendor/recovery; + mkdir -p $MANIFEST_DIR/vendor; + [ ! -d $MANIFEST_DIR/vendor ] && { + echo "-- Invalid directory: $MANIFEST_DIR/vendor"; + return; + } + + cd $MANIFEST_DIR/vendor; + echo "-- Pulling the OrangeFox vendor tree ..."; + git clone $URL -b $BRANCH recovery; + [ "$?" = "0" ] && echo "-- The OrangeFox vendor tree has been cloned successfully" || echo "-- Failed to clone the OrangeFox vendor tree!"; +} + +# get the OrangeFox busybox sources +clone_fox_busybox() { +local URL=""; +local BRANCH="android-9.0"; + [ "$BASE_VER" != "9" ] && return; # only clone busybox for 9.0 + + if [ "$USE_SSH" = "0" ]; then + URL="https://gitlab.com/OrangeFox/external/busybox.git"; + else + URL="git@gitlab.com:OrangeFox/external/busybox.git"; + fi + + echo "-- Preparing for cloning the OrangeFox busybox sources ..."; + cd $MANIFEST_DIR/external; + echo "-- Pulling the OrangeFox busybox sources ..."; + git clone $URL -b $BRANCH busybox; + [ "$?" = "0" ] && echo "-- The OrangeFox busybox sources have been cloned successfully" || echo "-- Failed to clone the OrangeFox busybox sources!"; +} + +# get device trees +get_device_tree() { +local DIR=$MANIFEST_DIR/device/xiaomi; + mkdir -p $DIR; + cd $DIR; + [ "$?" != "0" ] && { + abort "-- get_device_tree() - Invalid directory: $DIR"; + } + + # test device + local URL=git@gitlab.com:OrangeFox/device/"$test_build_device".git; + [ "$USE_SSH" = "0" ] && URL=https://gitlab.com/OrangeFox/device/"$test_build_device".git; + echo "-- Pulling the $test_build_device device tree ..."; + git clone $URL -b "$FOX_DEF_BRANCH" "$test_build_device"; + + # done + if [ -d "$test_build_device" -a -d "$test_build_device/recovery" ]; then + echo "-- Finished fetching the OrangeFox $test_build_device device tree."; + else + abort "-- get_device_tree() - could not fetch the OrangeFox $test_build_device device tree."; + fi +} + +# [temporary fix - WiP] cherry-pick system/vold stuff from the twrp gerrit; +# will require amending if the patch set changes on gerrit (which will definitely happen sooner or later) +cherry_picks() { + [ "$BASE_VER" != "12" ] && return; # this is for fox_12.1 only + + echo "You need to cherry-pick this commit into system/vold/: https://gerrit.twrp.me/c/android_system_vold/+/5540"; + echo "I will try to do so now. If any errors occur, then you should abort the cherry-pick and then do it manually."; + + local patchset=12; # the current patch set number + cd $MANIFEST_DIR/system/vold/; + git fetch https://gerrit.twrp.me/android_system_vold refs/changes/40/5540/$patchset && git cherry-pick FETCH_HEAD; + + echo "" + echo "Every time you run 'repo sync', you must also cherry-pick this commit into system/vold/: https://gerrit.twrp.me/c/android_system_vold/+/5540"; +} + +# test build +test_build() { + # clone the device tree + get_device_tree; + + # proceed with the test build + export FOX_VERSION="$FOX_BASE_VERSION"_"$FOX_DEF_BRANCH"; + export LC_ALL="C"; + export FOX_BUILD_TYPE="Alpha"; + export ALLOW_MISSING_DEPENDENCIES=true; + export FOX_BUILD_DEVICE="$test_build_device"; + export OUT_DIR=$BASE_DIR/BUILDS/"$test_build_device"; + + cd $BASE_DIR/; + mkdir -p $OUT_DIR; + + cd $MANIFEST_DIR/; + echo "-- Compiling a test build for device \"$test_build_device\". This will take a *VERY* long time ..."; + echo "-- Start compiling: "; + . build/envsetup.sh; + + # what are we lunching (AOSP or Omni)> + if [ "$BASE_VER" -gt 10 ]; then + lunch twrp_"$test_build_device"-eng; + else + lunch omni_"$test_build_device"-eng; + fi + + # build for the device + # are we building for a virtual A/B (VAB) device? (default is "no") + local FOX_VAB_DEVICE=0; + if [ "$FOX_VAB_DEVICE" = "1" ]; then + mka adbd bootimage; + else + mka adbd recoveryimage; + fi + + # any results? + ls -all $(find "$OUT_DIR" -name "OrangeFox-*"); +} + +# do all the work! +WorkNow() { + echo "$0, v$SCRIPT_VERSION"; + + local START=$(date); + + Process_CMD_Line "$@"; + + update_environment; + + init_script; + + get_twrp_minimal_manifest; + + patch_minimal_manifest; + + clone_common; + + clone_fox_recovery; + + clone_fox_vendor; + + clone_fox_busybox; + + # cherry_picks; # 20220908 - comment this out: no longer needed + + # test_build; # comment this out - don't do a test build by default + + local STOP=$(date); + echo "-- Stop time =$STOP"; + echo "-- Start time=$START"; + echo "-- Now, clone your device trees to the correct locations!"; + exit 0; +} + +# --- main() --- +WorkNow "$@"; +# --- end main() --- diff --git a/sync/patches/patch-manifest-fox_10.0.diff b/sync/patches/patch-manifest-fox_10.0.diff new file mode 100644 index 0000000..22ba1a3 --- /dev/null +++ b/sync/patches/patch-manifest-fox_10.0.diff @@ -0,0 +1,168 @@ +diff --git a/core/Makefile b/core/Makefile +--- a/core/Makefile ++++ b/core/Makefile +@@ -1932,7 +1932,33 @@ define build-recoveryramdisk + # Copying baseline ramdisk... + # Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac. + $(hide) rsync -a --exclude=sdcard $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT) ++ + # Modifying ramdisk contents... ++ ++# Darth9 ++#ifneq ($(NOT_ORANGEFOX),1) ++ $(if $(filter 1,$(FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER)), \ ++ $(hide) $(FOX_VENDOR) \ ++ FOX_VENDOR_CMD="Fox_Before_Recovery_Image" \ ++ FOX_MANIFEST_VER="10.0" \ ++ TARGET_ARCH="$(TARGET_ARCH)" \ ++ TARGET_RECOVERY_ROOT_OUT="$(TARGET_RECOVERY_ROOT_OUT)" \ ++ MKBOOTIMG="$(MKBOOTIMG)" \ ++ MKBOOTFS="$(MKBOOTFS)" \ ++ INTERNAL_RECOVERYIMAGE_ARGS='"$(INTERNAL_RECOVERYIMAGE_ARGS)"' \ ++ INTERNAL_MKBOOTIMG_VERSION_ARGS="$(INTERNAL_MKBOOTIMG_VERSION_ARGS)" \ ++ BOARD_MKBOOTIMG_ARGS='"$(BOARD_MKBOOTIMG_ARGS)"' \ ++ TARGET_OUT="$(TARGET_OUT)" \ ++ RECOVERY_RAMDISK_COMPRESSOR="$(RECOVERY_RAMDISK_COMPRESSOR)" \ ++ INSTALLED_RECOVERYIMAGE_TARGET="$(INSTALLED_RECOVERYIMAGE_TARGET)" \ ++ BOARD_BOOTIMAGE_PARTITION_SIZE=$(BOARD_BOOTIMAGE_PARTITION_SIZE) \ ++ BOARD_RECOVERYIMAGE_PARTITION_SIZE=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE) \ ++ INTERNAL_KERNEL_CMDLINE="$(INTERNAL_KERNEL_CMDLINE)" \ ++ recovery_ramdisk="$(recovery_ramdisk)" \ ++ recovery_uncompressed_ramdisk="$(recovery_uncompressed_ramdisk)") ++#endif ++# Darth9 ++ + $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),, \ + $(hide) ln -sf /system/bin/init $(TARGET_RECOVERY_ROOT_OUT)/init) + $(if $(BOARD_RECOVERY_KERNEL_MODULES), \ +@@ -2024,6 +2050,31 @@ $(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \ + $(call build-recoveryramdisk) + $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(RECOVERY_RAMDISK_COMPRESSOR) > $(recovery_ramdisk) + $(call build-recoveryimage-target, $@) ++ ++# Darth9 ++ifneq ($(NOT_ORANGEFOX),1) ++ $(BASH) $(FOX_VENDOR) FOX_VENDOR_CMD="Fox_After_Recovery_Image" \ ++ FOX_MANIFEST_VER="10.0" \ ++ BOARD_BOOT_HEADER_VERSION="$(BOARD_BOOT_HEADER_VERSION)" \ ++ TARGET_ARCH="$(TARGET_ARCH)" \ ++ TARGET_RECOVERY_ROOT_OUT="$(TARGET_RECOVERY_ROOT_OUT)" \ ++ MKBOOTIMG="$(MKBOOTIMG)" \ ++ MKBOOTFS="$(MKBOOTFS)" \ ++ INTERNAL_RECOVERYIMAGE_ARGS='"$(INTERNAL_RECOVERYIMAGE_ARGS)"' \ ++ INTERNAL_MKBOOTIMG_VERSION_ARGS="$(INTERNAL_MKBOOTIMG_VERSION_ARGS)" \ ++ BOARD_MKBOOTIMG_ARGS='"$(BOARD_MKBOOTIMG_ARGS)"' \ ++ TARGET_OUT="$(TARGET_OUT)" \ ++ RECOVERY_RAMDISK_COMPRESSOR="$(RECOVERY_RAMDISK_COMPRESSOR)" \ ++ INSTALLED_RECOVERYIMAGE_TARGET="$(INSTALLED_RECOVERYIMAGE_TARGET)" \ ++ INSTALLED_BOOTIMAGE_TARGET="$(INSTALLED_BOOTIMAGE_TARGET)" \ ++ BOARD_BOOTIMAGE_PARTITION_SIZE=$(BOARD_BOOTIMAGE_PARTITION_SIZE) \ ++ BOARD_RECOVERYIMAGE_PARTITION_SIZE=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE) \ ++ BOARD_USES_RECOVERY_AS_BOOT=$(BOARD_USES_RECOVERY_AS_BOOT) \ ++ INTERNAL_KERNEL_CMDLINE="$(INTERNAL_KERNEL_CMDLINE)" \ ++ recovery_ramdisk="$(recovery_ramdisk)" ++endif ++# Darth9 ++ + endif # BOARD_USES_RECOVERY_AS_BOOT + + ifdef BOARD_INCLUDE_RECOVERY_DTBO +@@ -2090,6 +2141,22 @@ endif + .PHONY: recoveryimage + recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP) + ++# Darth9 # FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER ++ifneq ($(NOT_ORANGEFOX),1) ++ ifeq ($(FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER),1) ++ $(BASH) $(FOX_VENDOR) FOX_VENDOR_CMD="Fox_After_Recovery_Image" \ ++ FOX_MANIFEST_VER="10.0" \ ++ INSTALLED_RECOVERYIMAGE_TARGET="$(INSTALLED_RECOVERYIMAGE_TARGET)" \ ++ TARGET_ARCH="$(TARGET_ARCH)" \ ++ TARGET_RECOVERY_ROOT_OUT="$(TARGET_RECOVERY_ROOT_OUT)" \ ++ MKBOOTIMG="$(MKBOOTIMG)" \ ++ MKBOOTFS="$(MKBOOTFS)" ++ #else ++ #$(BASH) $(FOX_VENDOR) ++ endif ++endif ++# Darth9 ++ + ifneq ($(BOARD_NAND_PAGE_SIZE),) + $(error MTD device is no longer supported and thus BOARD_NAND_PAGE_SIZE is deprecated.) + endif +@@ -3222,6 +3289,10 @@ endif + + # Appends os version and security patch level as a AVB property descriptor + ++BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS += \ ++ --prop com.android.build.boot.os_version:$(PLATFORM_VERSION) \ ++ --prop com.android.build.boot.security_patch:$(PLATFORM_SECURITY_PATCH) ++ + BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += \ + --prop com.android.build.system.os_version:$(PLATFORM_VERSION) \ + --prop com.android.build.system.security_patch:$(PLATFORM_SECURITY_PATCH) +diff --git a/core/board_config.mk b/core/board_config.mk +--- a/core/board_config.mk ++++ b/core/board_config.mk +@@ -177,8 +177,10 @@ endif + # Sanity check to warn about likely cryptic errors later in the build. + ifeq ($(TARGET_IS_64_BIT),true) + ifeq (,$(filter true false,$(TARGET_SUPPORTS_64_BIT_APPS))) +- $(warning Building a 32-bit-app-only product on a 64-bit device. \ +- If this is intentional, set TARGET_SUPPORTS_64_BIT_APPS := false) ++# --- Darth9: this spues out a nonsensical warning; so, stop the spamming ++# $(warning Building a 32-bit-app-only product on a 64-bit device. \ ++# If this is intentional, set TARGET_SUPPORTS_64_BIT_APPS := false) ++# --- Darth9 + endif + endif + +diff --git a/core/config.mk b/core/config.mk +--- a/core/config.mk ++++ b/core/config.mk +@@ -637,6 +637,19 @@ else + MD5SUM:=md5sum + endif + ++# Darth9 ++# OrangeFox post script ++FOX_CURRENT_DEV_STR := $(shell git -C bootable/recovery log -1 --format='%ad (%h)' --date=short) ++ifdef NOT_ORANGEFOX ++ FOX_VENDOR := ++ BASH := ++else ++ FOX_VENDOR := vendor/recovery/OrangeFox.sh ++ BASH := bash ++ FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER := 1 ++endif ++# Darth9 ++ + APICHECK_COMMAND := $(JAVA) -Xmx4g -jar $(APICHECK) --no-banner --compatible-output=yes + + # Boolean variable determining if the whitelist for compatible properties is enabled +@@ -898,7 +911,7 @@ $(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \ + ) + + # BOARD_*_PARTITION_LIST: a list of the following tokens +-valid_super_partition_list := system vendor product product_services odm ++valid_super_partition_list := system vendor product system_ext product_services odm + $(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \ + $(if $(filter-out $(valid_super_partition_list),$(BOARD_$(group)_PARTITION_LIST)), \ + $(error BOARD_$(group)_PARTITION_LIST contains invalid partition name \ +diff --git a/core/main.mk b/core/main.mk +--- a/core/main.mk ++++ b/core/main.mk +@@ -285,11 +285,11 @@ enable_target_debugging := true + tags_to_install := + ifneq (,$(user_variant)) + # Target is secure in user builds. +- ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1 ++ ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0 + ADDITIONAL_DEFAULT_PROPERTIES += security.perf_harden=1 + + ifeq ($(user_variant),user) +- ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=1 ++ ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=0 + endif + + ifeq ($(user_variant),userdebug) diff --git a/sync/patches/patch-manifest-fox_11.0.diff b/sync/patches/patch-manifest-fox_11.0.diff new file mode 100644 index 0000000..8ab4643 --- /dev/null +++ b/sync/patches/patch-manifest-fox_11.0.diff @@ -0,0 +1,184 @@ +diff --git a/core/Makefile b/core/Makefile +--- a/core/Makefile ++++ b/core/Makefile +@@ -2224,6 +2224,30 @@ $(recovery_uncompressed_ramdisk): $(MKBOOTFS) \ + # Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac. + rsync -a --exclude=sdcard $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT) + # Modifying ramdisk contents... ++ ++# Darth9 ++ifneq ($(NOT_ORANGEFOX),1) ++ $(BASH) $(FOX_VENDOR) FOX_VENDOR_CMD="Fox_Before_Recovery_Image" \ ++ FOX_MANIFEST_VER="11.0" \ ++ BOARD_BOOT_HEADER_VERSION="$(BOARD_BOOT_HEADER_VERSION)" \ ++ TARGET_ARCH="$(TARGET_ARCH)" \ ++ TARGET_RECOVERY_ROOT_OUT="$(TARGET_RECOVERY_ROOT_OUT)" \ ++ MKBOOTIMG="$(MKBOOTIMG)" \ ++ MKBOOTFS="$(MKBOOTFS)" \ ++ INTERNAL_RECOVERYIMAGE_ARGS='"$(INTERNAL_RECOVERYIMAGE_ARGS)"' \ ++ INTERNAL_MKBOOTIMG_VERSION_ARGS="$(INTERNAL_MKBOOTIMG_VERSION_ARGS)" \ ++ BOARD_MKBOOTIMG_ARGS='"$(BOARD_MKBOOTIMG_ARGS)"' \ ++ TARGET_OUT="$(TARGET_OUT)" \ ++ RECOVERY_RAMDISK_COMPRESSOR="$(RECOVERY_RAMDISK_COMPRESSOR)" \ ++ INSTALLED_RECOVERYIMAGE_TARGET="$(INSTALLED_RECOVERYIMAGE_TARGET)" \ ++ BOARD_BOOTIMAGE_PARTITION_SIZE=$(BOARD_BOOTIMAGE_PARTITION_SIZE) \ ++ BOARD_RECOVERYIMAGE_PARTITION_SIZE=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE) \ ++ BOARD_USES_RECOVERY_AS_BOOT=$(BOARD_USES_RECOVERY_AS_BOOT) \ ++ INTERNAL_KERNEL_CMDLINE="$(INTERNAL_KERNEL_CMDLINE)" \ ++ recovery_ramdisk="$(recovery_ramdisk)" ++endif ++# Darth9 ++ + $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),, \ + ln -sf /system/bin/init $(TARGET_RECOVERY_ROOT_OUT)/init) + # Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc. +@@ -2310,6 +2334,31 @@ ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) + $(INSTALLED_BOOTIMAGE_TARGET): $(recoveryimage-deps) + $(call pretty,"Target boot image from recovery: $@") + $(call build-recoveryimage-target, $@, $(PRODUCT_OUT)/$(subst .img,,$(subst boot,kernel,$(notdir $@)))) ++ ++# Darth9 ++ifneq ($(NOT_ORANGEFOX),1) ++ $(BASH) $(FOX_VENDOR) FOX_VENDOR_CMD="Fox_After_Recovery_Image" \ ++ FOX_MANIFEST_VER="11.0" \ ++ BOARD_BOOT_HEADER_VERSION="$(BOARD_BOOT_HEADER_VERSION)" \ ++ TARGET_ARCH="$(TARGET_ARCH)" \ ++ TARGET_RECOVERY_ROOT_OUT="$(TARGET_RECOVERY_ROOT_OUT)" \ ++ MKBOOTIMG="$(MKBOOTIMG)" \ ++ MKBOOTFS="$(MKBOOTFS)" \ ++ INTERNAL_RECOVERYIMAGE_ARGS='"$(INTERNAL_RECOVERYIMAGE_ARGS)"' \ ++ INTERNAL_MKBOOTIMG_VERSION_ARGS="$(INTERNAL_MKBOOTIMG_VERSION_ARGS)" \ ++ BOARD_MKBOOTIMG_ARGS='"$(BOARD_MKBOOTIMG_ARGS)"' \ ++ TARGET_OUT="$(TARGET_OUT)" \ ++ RECOVERY_RAMDISK_COMPRESSOR="$(RECOVERY_RAMDISK_COMPRESSOR)" \ ++ INSTALLED_RECOVERYIMAGE_TARGET="$(INSTALLED_RECOVERYIMAGE_TARGET)" \ ++ INSTALLED_BOOTIMAGE_TARGET="$(INSTALLED_BOOTIMAGE_TARGET)" \ ++ BOARD_BOOTIMAGE_PARTITION_SIZE=$(BOARD_BOOTIMAGE_PARTITION_SIZE) \ ++ BOARD_RECOVERYIMAGE_PARTITION_SIZE=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE) \ ++ BOARD_USES_RECOVERY_AS_BOOT=$(BOARD_USES_RECOVERY_AS_BOOT) \ ++ INTERNAL_KERNEL_CMDLINE="$(INTERNAL_KERNEL_CMDLINE)" \ ++ recovery_ramdisk="$(recovery_ramdisk)" ++endif ++# Darth9 ++ + endif # BOARD_USES_RECOVERY_AS_BOOT + + ifndef BOARD_CUSTOM_BOOTIMG_MK +@@ -2338,6 +2387,32 @@ endif # BUILDING_RECOVERY_IMAGE + .PHONY: recoveryimage + recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP) + ++# Darth9 ++ifneq ($(NOT_ORANGEFOX),1) ++ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true) ++ $(BASH) $(FOX_VENDOR) FOX_VENDOR_CMD="Fox_After_Recovery_Image" \ ++ FOX_MANIFEST_VER="11.0" \ ++ BOARD_BOOT_HEADER_VERSION="$(BOARD_BOOT_HEADER_VERSION)" \ ++ TARGET_ARCH="$(TARGET_ARCH)" \ ++ TARGET_RECOVERY_ROOT_OUT="$(TARGET_RECOVERY_ROOT_OUT)" \ ++ MKBOOTIMG="$(MKBOOTIMG)" \ ++ MKBOOTFS="$(MKBOOTFS)" \ ++ INTERNAL_RECOVERYIMAGE_ARGS='"$(INTERNAL_RECOVERYIMAGE_ARGS)"' \ ++ INTERNAL_MKBOOTIMG_VERSION_ARGS="$(INTERNAL_MKBOOTIMG_VERSION_ARGS)" \ ++ BOARD_MKBOOTIMG_ARGS='"$(BOARD_MKBOOTIMG_ARGS)"' \ ++ TARGET_OUT="$(TARGET_OUT)" \ ++ RECOVERY_RAMDISK_COMPRESSOR="$(RECOVERY_RAMDISK_COMPRESSOR)" \ ++ INSTALLED_RECOVERYIMAGE_TARGET="$(INSTALLED_RECOVERYIMAGE_TARGET)" \ ++ INSTALLED_BOOTIMAGE_TARGET="$(INSTALLED_BOOTIMAGE_TARGET)" \ ++ BOARD_BOOTIMAGE_PARTITION_SIZE=$(BOARD_BOOTIMAGE_PARTITION_SIZE) \ ++ BOARD_RECOVERYIMAGE_PARTITION_SIZE=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE) \ ++ BOARD_USES_RECOVERY_AS_BOOT=$(BOARD_USES_RECOVERY_AS_BOOT) \ ++ INTERNAL_KERNEL_CMDLINE="$(INTERNAL_KERNEL_CMDLINE)" \ ++ recovery_ramdisk="$(recovery_ramdisk)" ++endif ++endif ++# Darth9 ++ + ifneq ($(BOARD_NAND_PAGE_SIZE),) + $(error MTD device is no longer supported and thus BOARD_NAND_PAGE_SIZE is deprecated.) + endif +diff --git a/core/config.mk b/core/config.mk +--- a/core/config.mk ++++ b/core/config.mk +@@ -670,6 +670,18 @@ EXTRACT_KERNEL := build/make/tools/extract_kernel.py + # Path to tools.jar + HOST_JDK_TOOLS_JAR := $(ANDROID_JAVA8_HOME)/lib/tools.jar + ++# Darth9 ++# OrangeFox post script ++FOX_CURRENT_DEV_STR := $(shell git -C bootable/recovery log -1 --format='%ad (%h)' --date=short) ++ifdef NOT_ORANGEFOX ++ FOX_VENDOR := ++ BASH := ++else ++ FOX_VENDOR := vendor/recovery/OrangeFox_A11.sh ++ BASH := bash ++endif ++# Darth9 ++ + APICHECK_COMMAND := $(JAVA) -Xmx4g -jar $(APICHECK) --no-banner --compatible-output=yes + + # Boolean variable determining if the allow list for compatible properties is enabled +diff --git a/make/envsetup.sh b/make/envsetup.sh +--- a/make/envsetup.sh ++++ b/make/envsetup.sh +@@ -327,6 +327,14 @@ function printconfig() + return + fi + get_build_var report_config ++ ++ # Darth9 ++ if [ "$NOT_ORANGEFOX" != "1" ]; then ++ local DEVICE=$(cut -d'_' -f2 <<<$TARGET_PRODUCT) ++ mkdir -p /tmp/$DEVICE ++ export > /tmp/$DEVICE/fox_env.sh ++ fi ++ # Darth9 + } + + function set_stuff_for_environment() +@@ -1629,3 +1637,44 @@ addcompletions + export ANDROID_BUILD_TOP=$(gettop) + + . $ANDROID_BUILD_TOP/vendor/twrp/build/envsetup.sh ++ ++# Darth9 ++# prepare environment variables for importing to OrangeFox_A11.sh ++function orangefox_envsetup() { ++ ++ export FOX_MANIFEST_ROOT=$(gettop) ++ ++ if [ -z "$NOT_ORANGEFOX" ]; then ++ if [ ! -f $FOX_MANIFEST_ROOT/bootable/recovery/orangefox_defaults.go -a ! -f $FOX_MANIFEST_ROOT/bootable/recovery/orangefox.mk ]; then ++ export NOT_ORANGEFOX=1 ++ fi ++ fi ++ ++ if [ "$NOT_ORANGEFOX" = "1" ]; then ++ echo "- Not OrangeFox! ..." ++ return ++ fi ++ ++ unset NOT_ORANGEFOX ++ export ALLOW_MISSING_DEPENDENCIES=true ++ ++ if [ -z "$OUT_DIR" ]; then ++ if [ -n "$OUT" ]; then ++ export OUT_DIR="$OUT" ++ else ++ export OUT_DIR="$FOX_MANIFEST_ROOT/out" ++ export OUT="$OUT_DIR" ++ fi ++ else ++ if [ -z "$OUT" ]; then ++ export OUT="$OUT_DIR" ++ fi ++ fi ++ # export OF_MANUAL_COPY_TWRES=1 ++ [ -s $FOX_MANIFEST_ROOT/frameworks/base/services/core/xsd/vts/Android.mk ] && echo -n "" > $FOX_MANIFEST_ROOT/frameworks/base/services/core/xsd/vts/Android.mk ++} ++ ++orangefox_envsetup ++ ++# Darth9 ++# diff --git a/sync/patches/patch-manifest-fox_12.1.diff b/sync/patches/patch-manifest-fox_12.1.diff new file mode 100644 index 0000000..25fd077 --- /dev/null +++ b/sync/patches/patch-manifest-fox_12.1.diff @@ -0,0 +1,184 @@ +diff --git a/core/Makefile b/core/Makefile +--- a/core/Makefile ++++ b/core/Makefile +@@ -2236,6 +2236,30 @@ $(INTERNAL_RECOVERY_RAMDISK_FILES_TIMESTAMP): $(MKBOOTFS) \ + # Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac. + rsync -a --exclude=sdcard $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT) + # Modifying ramdisk contents... ++ ++# Darth9 ++ifneq ($(NOT_ORANGEFOX),1) ++ $(BASH) $(FOX_VENDOR) FOX_VENDOR_CMD="Fox_Before_Recovery_Image" \ ++ FOX_MANIFEST_VER="12.1" \ ++ BOARD_BOOT_HEADER_VERSION="$(BOARD_BOOT_HEADER_VERSION)" \ ++ TARGET_ARCH="$(TARGET_ARCH)" \ ++ TARGET_RECOVERY_ROOT_OUT="$(TARGET_RECOVERY_ROOT_OUT)" \ ++ MKBOOTIMG="$(MKBOOTIMG)" \ ++ MKBOOTFS="$(MKBOOTFS)" \ ++ INTERNAL_RECOVERYIMAGE_ARGS='"$(INTERNAL_RECOVERYIMAGE_ARGS)"' \ ++ INTERNAL_MKBOOTIMG_VERSION_ARGS="$(INTERNAL_MKBOOTIMG_VERSION_ARGS)" \ ++ BOARD_MKBOOTIMG_ARGS='"$(BOARD_MKBOOTIMG_ARGS)"' \ ++ TARGET_OUT="$(TARGET_OUT)" \ ++ RECOVERY_RAMDISK_COMPRESSOR="$(RECOVERY_RAMDISK_COMPRESSOR)" \ ++ INSTALLED_RECOVERYIMAGE_TARGET="$(INSTALLED_RECOVERYIMAGE_TARGET)" \ ++ BOARD_BOOTIMAGE_PARTITION_SIZE=$(BOARD_BOOTIMAGE_PARTITION_SIZE) \ ++ BOARD_RECOVERYIMAGE_PARTITION_SIZE=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE) \ ++ BOARD_USES_RECOVERY_AS_BOOT=$(BOARD_USES_RECOVERY_AS_BOOT) \ ++ INTERNAL_KERNEL_CMDLINE="$(INTERNAL_KERNEL_CMDLINE)" \ ++ recovery_ramdisk="$(recovery_ramdisk)" ++endif ++# Darth9 ++ + $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),, \ + ln -sf /system/bin/init $(TARGET_RECOVERY_ROOT_OUT)/init) + # Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc. +@@ -2330,6 +2354,31 @@ $(foreach b,$(INSTALLED_BOOTIMAGE_TARGET), $(eval $(call add-dependency,$(b),$(c + $(INSTALLED_BOOTIMAGE_TARGET): $(recoveryimage-deps) + $(call pretty,"Target boot image from recovery: $@") + $(call build-recoveryimage-target, $@, $(PRODUCT_OUT)/$(subst .img,,$(subst boot,kernel,$(notdir $@)))) ++ ++# Darth9 ++ifneq ($(NOT_ORANGEFOX),1) ++ $(BASH) $(FOX_VENDOR) FOX_VENDOR_CMD="Fox_After_Recovery_Image" \ ++ FOX_MANIFEST_VER="12.1" \ ++ BOARD_BOOT_HEADER_VERSION="$(BOARD_BOOT_HEADER_VERSION)" \ ++ TARGET_ARCH="$(TARGET_ARCH)" \ ++ TARGET_RECOVERY_ROOT_OUT="$(TARGET_RECOVERY_ROOT_OUT)" \ ++ MKBOOTIMG="$(MKBOOTIMG)" \ ++ MKBOOTFS="$(MKBOOTFS)" \ ++ INTERNAL_RECOVERYIMAGE_ARGS='"$(INTERNAL_RECOVERYIMAGE_ARGS)"' \ ++ INTERNAL_MKBOOTIMG_VERSION_ARGS="$(INTERNAL_MKBOOTIMG_VERSION_ARGS)" \ ++ BOARD_MKBOOTIMG_ARGS='"$(BOARD_MKBOOTIMG_ARGS)"' \ ++ TARGET_OUT="$(TARGET_OUT)" \ ++ RECOVERY_RAMDISK_COMPRESSOR="$(RECOVERY_RAMDISK_COMPRESSOR)" \ ++ INSTALLED_RECOVERYIMAGE_TARGET="$(INSTALLED_RECOVERYIMAGE_TARGET)" \ ++ INSTALLED_BOOTIMAGE_TARGET="$(INSTALLED_BOOTIMAGE_TARGET)" \ ++ BOARD_BOOTIMAGE_PARTITION_SIZE=$(BOARD_BOOTIMAGE_PARTITION_SIZE) \ ++ BOARD_RECOVERYIMAGE_PARTITION_SIZE=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE) \ ++ BOARD_USES_RECOVERY_AS_BOOT=$(BOARD_USES_RECOVERY_AS_BOOT) \ ++ INTERNAL_KERNEL_CMDLINE="$(INTERNAL_KERNEL_CMDLINE)" \ ++ recovery_ramdisk="$(recovery_ramdisk)" ++endif ++# Darth9 ++ + endif # BOARD_USES_RECOVERY_AS_BOOT + + ifndef BOARD_CUSTOM_BOOTIMG_MK +@@ -2360,6 +2409,32 @@ endif # BUILDING_RECOVERY_IMAGE + .PHONY: recoveryimage + recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP) + ++# Darth9 ++ifneq ($(NOT_ORANGEFOX),1) ++ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true) ++ $(BASH) $(FOX_VENDOR) FOX_VENDOR_CMD="Fox_After_Recovery_Image" \ ++ FOX_MANIFEST_VER="12.1" \ ++ BOARD_BOOT_HEADER_VERSION="$(BOARD_BOOT_HEADER_VERSION)" \ ++ TARGET_ARCH="$(TARGET_ARCH)" \ ++ TARGET_RECOVERY_ROOT_OUT="$(TARGET_RECOVERY_ROOT_OUT)" \ ++ MKBOOTIMG="$(MKBOOTIMG)" \ ++ MKBOOTFS="$(MKBOOTFS)" \ ++ INTERNAL_RECOVERYIMAGE_ARGS='"$(INTERNAL_RECOVERYIMAGE_ARGS)"' \ ++ INTERNAL_MKBOOTIMG_VERSION_ARGS="$(INTERNAL_MKBOOTIMG_VERSION_ARGS)" \ ++ BOARD_MKBOOTIMG_ARGS='"$(BOARD_MKBOOTIMG_ARGS)"' \ ++ TARGET_OUT="$(TARGET_OUT)" \ ++ RECOVERY_RAMDISK_COMPRESSOR="$(RECOVERY_RAMDISK_COMPRESSOR)" \ ++ INSTALLED_RECOVERYIMAGE_TARGET="$(INSTALLED_RECOVERYIMAGE_TARGET)" \ ++ INSTALLED_BOOTIMAGE_TARGET="$(INSTALLED_BOOTIMAGE_TARGET)" \ ++ BOARD_BOOTIMAGE_PARTITION_SIZE=$(BOARD_BOOTIMAGE_PARTITION_SIZE) \ ++ BOARD_RECOVERYIMAGE_PARTITION_SIZE=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE) \ ++ BOARD_USES_RECOVERY_AS_BOOT=$(BOARD_USES_RECOVERY_AS_BOOT) \ ++ INTERNAL_KERNEL_CMDLINE="$(INTERNAL_KERNEL_CMDLINE)" \ ++ recovery_ramdisk="$(recovery_ramdisk)" ++endif ++endif ++# Darth9 ++ + ifneq ($(BOARD_NAND_PAGE_SIZE),) + $(error MTD device is no longer supported and thus BOARD_NAND_PAGE_SIZE is deprecated.) + endif +diff --git a/core/config.mk b/core/config.mk +--- a/core/config.mk ++++ b/core/config.mk +@@ -606,6 +606,18 @@ EXTRACT_KERNEL := build/make/tools/extract_kernel.py + # Path to tools.jar + HOST_JDK_TOOLS_JAR := $(ANDROID_JAVA8_HOME)/lib/tools.jar + ++# Darth9 ++# OrangeFox post script ++FOX_CURRENT_DEV_STR := $(shell git -C bootable/recovery log -1 --format='%ad (%h)' --date=short) ++ifdef NOT_ORANGEFOX ++ FOX_VENDOR := ++ BASH := ++else ++ FOX_VENDOR := vendor/recovery/OrangeFox_A12.sh ++ BASH := bash ++endif ++# Darth9 ++ + APICHECK_COMMAND := $(JAVA) -Xmx4g -jar $(APICHECK) --no-banner --compatible-output=no + + # Boolean variable determining if the allow list for compatible properties is enabled +diff --git a/make/envsetup.sh b/make/envsetup.sh +--- a/make/envsetup.sh ++++ b/make/envsetup.sh +@@ -353,6 +353,14 @@ function printconfig() + return + fi + get_build_var report_config ++ ++ # Darth9 ++ if [ "$NOT_ORANGEFOX" != "1" ]; then ++ local DEVICE=$(cut -d'_' -f2 <<<$TARGET_PRODUCT) ++ mkdir -p /tmp/$DEVICE ++ export > /tmp/$DEVICE/fox_env.sh ++ fi ++ # Darth9 + } + + function set_stuff_for_environment() +@@ -1873,3 +1881,44 @@ addcompletions + export ANDROID_BUILD_TOP=$(gettop) + + . $ANDROID_BUILD_TOP/vendor/twrp/build/envsetup.sh ++ ++# Darth9 ++# prepare environment variables for importing to OrangeFox_A12.sh ++function orangefox_envsetup() { ++ ++ export FOX_MANIFEST_ROOT=$(gettop) ++ ++ if [ -z "$NOT_ORANGEFOX" ]; then ++ if [ ! -f $FOX_MANIFEST_ROOT/bootable/recovery/orangefox_defaults.go -a ! -f $FOX_MANIFEST_ROOT/bootable/recovery/orangefox.mk ]; then ++ export NOT_ORANGEFOX=1 ++ fi ++ fi ++ ++ if [ "$NOT_ORANGEFOX" = "1" ]; then ++ echo "- Not OrangeFox! ..." ++ return ++ fi ++ ++ unset NOT_ORANGEFOX ++ export ALLOW_MISSING_DEPENDENCIES=true ++ ++ if [ -z "$OUT_DIR" ]; then ++ if [ -n "$OUT" ]; then ++ export OUT_DIR="$OUT" ++ else ++ export OUT_DIR="$FOX_MANIFEST_ROOT/out" ++ export OUT="$OUT_DIR" ++ fi ++ else ++ if [ -z "$OUT" ]; then ++ export OUT="$OUT_DIR" ++ fi ++ fi ++ # export OF_MANUAL_COPY_TWRES=1 ++ [ -s $FOX_MANIFEST_ROOT/frameworks/base/services/core/xsd/vts/Android.mk ] && echo -n "" > $FOX_MANIFEST_ROOT/frameworks/base/services/core/xsd/vts/Android.mk ++} ++ ++orangefox_envsetup ++ ++# Darth9 ++# diff --git a/sync/patches/patch-manifest-fox_6.0.diff b/sync/patches/patch-manifest-fox_6.0.diff new file mode 100644 index 0000000..c796f20 --- /dev/null +++ b/sync/patches/patch-manifest-fox_6.0.diff @@ -0,0 +1,168 @@ +diff --git a/core/Makefile b/core/Makefile +--- a/core/Makefile ++++ b/core/Makefile +@@ -119,7 +119,7 @@ $(INSTALLED_DEFAULT_PROP_TARGET): $(intermediate_system_build_prop) + echo "#" >> $@; + $(hide) echo ro.bootimage.build.date=`date`>>$@ + $(hide) echo ro.bootimage.build.date.utc=`date +%s`>>$@ +- $(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT)">>$@ ++# Darth9 $(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT)">>$@ + $(hide) build/tools/post_process_props.py $@ + + # ----------------------------------------------------------------- +@@ -154,20 +154,22 @@ BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS))) + build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER) $(BUILD_VERSION_TAGS) + $(intermediate_system_build_prop): PRIVATE_BUILD_DESC := $(build_desc) + ++# Darth9 + # The string used to uniquely identify the combined build and product; used by the OTA server. +-ifeq (,$(strip $(BUILD_FINGERPRINT))) +- ifneq ($(filter eng.%,$(BUILD_NUMBER)),) +- # Trim down BUILD_FINGERPRINT: the default BUILD_NUMBER makes it easily exceed +- # the Android system property length limit (PROPERTY_VALUE_MAX=92). +- BF_BUILD_NUMBER := $(USER)$(shell date +%m%d%H%M) +- else +- BF_BUILD_NUMBER := $(BUILD_NUMBER) +- endif +- BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS) +-endif +-ifneq ($(words $(BUILD_FINGERPRINT)),1) +- $(error BUILD_FINGERPRINT cannot contain spaces: "$(BUILD_FINGERPRINT)") +-endif ++#ifeq (,$(strip $(BUILD_FINGERPRINT))) ++# ifneq ($(filter eng.%,$(BUILD_NUMBER)),) ++# # Trim down BUILD_FINGERPRINT: the default BUILD_NUMBER makes it easily exceed ++# # the Android system property length limit (PROPERTY_VALUE_MAX=92). ++# BF_BUILD_NUMBER := $(USER)$(shell date +%m%d%H%M) ++# else ++# BF_BUILD_NUMBER := $(BUILD_NUMBER) ++# endif ++# BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS) ++#endif ++#ifneq ($(words $(BUILD_FINGERPRINT)),1) ++# $(error BUILD_FINGERPRINT cannot contain spaces: "$(BUILD_FINGERPRINT)") ++#endif ++# Darth9 + + # The string used to uniquely identify the system build; used by the OTA server. + # This purposefully excludes any product-specific variables. +@@ -250,7 +252,7 @@ endif + PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \ + BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \ + TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \ +- BUILD_FINGERPRINT="$(BUILD_FINGERPRINT)" \ ++# Darth9 BUILD_FINGERPRINT="$(BUILD_FINGERPRINT)" \ + $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT)") \ + TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \ + TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \ +@@ -309,7 +311,7 @@ $(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET) + $(hide) echo > $@ + $(hide) echo ro.vendor.build.date=`date`>>$@ + $(hide) echo ro.vendor.build.date.utc=`date +%s`>>$@ +- $(hide) echo ro.vendor.build.fingerprint="$(BUILD_FINGERPRINT)">>$@ ++# Darth9 $(hide) echo ro.vendor.build.fingerprint="$(BUILD_FINGERPRINT)">>$@ + endif + + # ---------------------------------------------------------------- +@@ -934,6 +936,31 @@ define build-recoveryramdisk + @echo -e ${PRT_IMG}"Copying baseline ramdisk..."${CL_RST} + $(hide) rsync -a $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT) # "cp -Rf" fails to overwrite broken symlinks on Mac. + @echo -e ${PRT_IMG}"Modifying ramdisk contents..."${CL_RST} ++ ++ ++# Darth9 ++#ifneq ($(NOT_ORANGEFOX),1) ++ $(if $(filter 1,$(FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER)), \ ++ $(hide) $(FOX_VENDOR) \ ++ FOX_VENDOR_CMD="Fox_Before_Recovery_Image" \ ++ TARGET_ARCH="$(TARGET_ARCH)" \ ++ TARGET_RECOVERY_ROOT_OUT="$(TARGET_RECOVERY_ROOT_OUT)" \ ++ MKBOOTIMG="$(MKBOOTIMG)" \ ++ MKBOOTFS="$(MKBOOTFS)" \ ++ INTERNAL_RECOVERYIMAGE_ARGS='"$(INTERNAL_RECOVERYIMAGE_ARGS)"' \ ++ INTERNAL_MKBOOTIMG_VERSION_ARGS="$(INTERNAL_MKBOOTIMG_VERSION_ARGS)" \ ++ BOARD_MKBOOTIMG_ARGS="$(BOARD_MKBOOTIMG_ARGS)" \ ++ TARGET_OUT="$(TARGET_OUT)" \ ++ RECOVERY_RAMDISK_COMPRESSOR="$(RECOVERY_RAMDISK_COMPRESSOR)" \ ++ INSTALLED_RECOVERYIMAGE_TARGET="$(INSTALLED_RECOVERYIMAGE_TARGET)" \ ++ BOARD_BOOTIMAGE_PARTITION_SIZE=$(BOARD_BOOTIMAGE_PARTITION_SIZE) \ ++ BOARD_RECOVERYIMAGE_PARTITION_SIZE=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE) \ ++ INTERNAL_KERNEL_CMDLINE="$(INTERNAL_KERNEL_CMDLINE)" \ ++ recovery_ramdisk="$(recovery_ramdisk)" \ ++ recovery_uncompressed_ramdisk="$(recovery_uncompressed_ramdisk)") ++#endif ++# Darth9 ++ + $(hide) rm -f $(TARGET_RECOVERY_ROOT_OUT)/init*.rc + $(hide) cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/ + $(hide) rm -f $(TARGET_RECOVERY_ROOT_OUT)/sepolicy +@@ -1010,6 +1037,21 @@ endif + .PHONY: recoveryimage + recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP) + ++# Darth9 # FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER ++ifneq ($(NOT_ORANGEFOX),1) ++ ifeq ($(FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER),1) ++ $(BASH) $(FOX_VENDOR) FOX_VENDOR_CMD="Fox_After_Recovery_Image" \ ++ INSTALLED_RECOVERYIMAGE_TARGET="$(INSTALLED_RECOVERYIMAGE_TARGET)" \ ++ TARGET_ARCH="$(TARGET_ARCH)" \ ++ TARGET_RECOVERY_ROOT_OUT="$(TARGET_RECOVERY_ROOT_OUT)" \ ++ MKBOOTIMG="$(MKBOOTIMG)" \ ++ MKBOOTFS="$(MKBOOTFS)" ++ else ++ $(BASH) $(FOX_VENDOR) ++ endif ++endif ++# Darth9 ++ + ifeq ($(BOARD_NAND_PAGE_SIZE),) + BOARD_NAND_PAGE_SIZE := 2048 + endif +diff --git a/core/config.mk b/core/config.mk +--- a/core/config.mk ++++ b/core/config.mk +@@ -524,6 +524,19 @@ else + MD5SUM:=md5sum + endif + ++# Darth9 ++# OrangeFox post script ++ FOX_CURRENT_DEV_STR := $(shell git -C bootable/recovery log -1 --format='%ad (%h)' --date=short) ++ifdef NOT_ORANGEFOX ++ FOX_VENDOR := ++ BASH := ++else ++ export FOX_VENDOR=vendor/recovery/OrangeFox.sh ++ export BASH=bash ++ export FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER=1 ++endif ++# Darth9 ++ + # In-place sed is done different in linux than OS X + ifeq ($(HOST_OS),darwin) + GSED:=$(shell which gsed) +diff --git a/core/main.mk b/core/main.mk +--- a/core/main.mk ++++ b/core/main.mk +@@ -278,7 +278,7 @@ enable_target_debugging := true + tags_to_install := + ifneq (,$(user_variant)) + # Target is secure in user builds. +- ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1 ++ ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0 + ADDITIONAL_DEFAULT_PROPERTIES += security.perf_harden=1 + + ifeq ($(user_variant),userdebug) +diff --git a/tools/buildinfo.sh b/tools/buildinfo.sh +--- a/tools/buildinfo.sh ++++ b/tools/buildinfo.sh +@@ -50,7 +50,7 @@ if [ "$TARGET_UNIFIED_DEVICE" == "" ] ; then + echo "ro.product.device=$TARGET_DEVICE" + echo "# Do not try to parse description, fingerprint, or thumbprint" + echo "ro.build.description=$PRIVATE_BUILD_DESC" +- echo "ro.build.fingerprint=$BUILD_FINGERPRINT" ++# Darth9 echo "ro.build.fingerprint=$BUILD_FINGERPRINT" + if [ -n "$BUILD_THUMBPRINT" ] ; then + echo "ro.build.thumbprint=$BUILD_THUMBPRINT" + fi + diff --git a/sync/patches/patch-manifest-fox_7.1.diff b/sync/patches/patch-manifest-fox_7.1.diff new file mode 100644 index 0000000..d790f7d --- /dev/null +++ b/sync/patches/patch-manifest-fox_7.1.diff @@ -0,0 +1,179 @@ +diff --git a/core/Makefile b/core/Makefile +--- a/core/Makefile ++++ b/core/Makefile +@@ -95,7 +95,7 @@ $(INSTALLED_DEFAULT_PROP_TARGET): $(intermediate_system_build_prop) + echo "#" >> $@; + $(hide) echo ro.bootimage.build.date=`$(DATE_FROM_FILE)`>>$@ + $(hide) echo ro.bootimage.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@ +- $(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@ ++# Darth9 $(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@ + $(hide) build/tools/post_process_props.py $@ + + # ----------------------------------------------------------------- +@@ -130,23 +130,26 @@ BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS))) + build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS) + $(intermediate_system_build_prop): PRIVATE_BUILD_DESC := $(build_desc) + +-# The string used to uniquely identify the combined build and product; used by the OTA server. +-ifeq (,$(strip $(BUILD_FINGERPRINT))) +- ifneq ($(filter eng.%,$(BUILD_NUMBER)),) +- # Trim down BUILD_FINGERPRINT: the default BUILD_NUMBER makes it easily exceed +- # the Android system property length limit (PROPERTY_VALUE_MAX=92). +- BF_BUILD_NUMBER := $(shell echo $${USER:0:6})$(shell $(DATE) +%m%d%H%M) +- else +- BF_BUILD_NUMBER := $(BUILD_NUMBER) +- endif +- BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS) +-endif +-ifneq ($(words $(BUILD_FINGERPRINT)),1) +- $(error BUILD_FINGERPRINT cannot contain spaces: "$(BUILD_FINGERPRINT)") +-endif +- +-$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) > $(PRODUCT_OUT)/build_fingerprint.txt) +-BUILD_FINGERPRINT_FROM_FILE := $$(cat $(PRODUCT_OUT)/build_fingerprint.txt) ++# Darth9 ++## The string used to uniquely identify the combined build and product; used by the OTA server. ++#ifeq (,$(strip $(BUILD_FINGERPRINT))) ++# ifneq ($(filter eng.%,$(BUILD_NUMBER)),) ++# # Trim down BUILD_FINGERPRINT: the default BUILD_NUMBER makes it easily exceed ++# # the Android system property length limit (PROPERTY_VALUE_MAX=92). ++# BF_BUILD_NUMBER := $(shell echo $${USER:0:6})$(shell $(DATE) +%m%d%H%M) ++# else ++# BF_BUILD_NUMBER := $(BUILD_NUMBER) ++# endif ++# BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS) ++#endif ++# ++#ifneq ($(words $(BUILD_FINGERPRINT)),1) ++# $(error BUILD_FINGERPRINT cannot contain spaces: "$(BUILD_FINGERPRINT)") ++#endif ++# ++#$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) > $(PRODUCT_OUT)/build_fingerprint.txt) ++#BUILD_FINGERPRINT_FROM_FILE := $$(cat $(PRODUCT_OUT)/build_fingerprint.txt) ++# Darth9 + + # The string used to uniquely identify the system build; used by the OTA server. + # This purposefully excludes any product-specific variables. +@@ -238,7 +241,7 @@ endif + PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \ + BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \ + TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \ +- BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \ ++# Darth9 BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \ + $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT)") \ + TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \ + TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \ +@@ -296,7 +299,7 @@ $(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET) + $(hide) echo > $@ + $(hide) echo ro.vendor.build.date=`$(DATE_FROM_FILE)`>>$@ + $(hide) echo ro.vendor.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@ +- $(hide) echo ro.vendor.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@ ++# Darth9 $(hide) echo ro.vendor.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@ + endif + + # ---------------------------------------------------------------- +@@ -543,6 +546,8 @@ INSTALLED_DTIMAGE_TARGET := $(PRODUCT_OUT)/dt.img + ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true) + INTERNAL_BOOTIMAGE_ARGS += --dt $(INSTALLED_DTIMAGE_TARGET) + BOOTIMAGE_EXTRA_DEPS := $(INSTALLED_DTIMAGE_TARGET) ++else ++ INSTALLED_DTIMAGE_TARGET := + endif + + INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img +@@ -1014,6 +1019,29 @@ define build-recoveryramdisk + @echo Copying baseline ramdisk... + $(hide) rsync -a --exclude=etc --exclude=sdcard --exclude=vendor $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT) # "cp -Rf" fails to overwrite broken symlinks on Mac. + @echo Modifying ramdisk contents... ++ ++# Darth9 ++# OrangeFox (FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER) ++ $(if $(filter 1,$(FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER)), \ ++ $(hide) $(FOX_VENDOR) \ ++ FOX_VENDOR_CMD="Fox_Before_Recovery_Image" \ ++ TARGET_ARCH="$(TARGET_ARCH)" \ ++ TARGET_RECOVERY_ROOT_OUT="$(TARGET_RECOVERY_ROOT_OUT)" \ ++ MKBOOTIMG="$(MKBOOTIMG)" \ ++ MKBOOTFS="$(MKBOOTFS)" \ ++ INTERNAL_RECOVERYIMAGE_ARGS='"$(INTERNAL_RECOVERYIMAGE_ARGS)"' \ ++ INTERNAL_MKBOOTIMG_VERSION_ARGS="$(INTERNAL_MKBOOTIMG_VERSION_ARGS)" \ ++ BOARD_MKBOOTIMG_ARGS="$(BOARD_MKBOOTIMG_ARGS)" \ ++ TARGET_OUT="$(TARGET_OUT)" \ ++ RECOVERY_RAMDISK_COMPRESSOR="$(RECOVERY_RAMDISK_COMPRESSOR)" \ ++ INSTALLED_RECOVERYIMAGE_TARGET="$(INSTALLED_RECOVERYIMAGE_TARGET)" \ ++ BOARD_BOOTIMAGE_PARTITION_SIZE=$(BOARD_BOOTIMAGE_PARTITION_SIZE) \ ++ BOARD_RECOVERYIMAGE_PARTITION_SIZE=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE) \ ++ INTERNAL_KERNEL_CMDLINE="$(INTERNAL_KERNEL_CMDLINE)" \ ++ recovery_ramdisk="$(recovery_ramdisk)" \ ++ recovery_uncompressed_ramdisk="$(recovery_uncompressed_ramdisk)") ++# Darth9 ++ + $(hide) rm -f $(TARGET_RECOVERY_ROOT_OUT)/init*.rc + $(hide) cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/ + $(hide) rm -f $(TARGET_RECOVERY_ROOT_OUT)/sepolicy +@@ -1147,6 +1175,22 @@ endif + .PHONY: recoveryimage + recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP) + ++# Darth9 ++# OrangeFox (FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER) ++ifneq ($(NOT_ORANGEFOX),1) ++ ifeq ($(FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER),1) ++ $(BASH) $(FOX_VENDOR) FOX_VENDOR_CMD="Fox_After_Recovery_Image" \ ++ INSTALLED_RECOVERYIMAGE_TARGET="$(INSTALLED_RECOVERYIMAGE_TARGET)" \ ++ TARGET_ARCH="$(TARGET_ARCH)" \ ++ TARGET_RECOVERY_ROOT_OUT="$(TARGET_RECOVERY_ROOT_OUT)" \ ++ MKBOOTIMG="$(MKBOOTIMG)" \ ++ MKBOOTFS="$(MKBOOTFS)" ++ else ++ $(BASH) $(FOX_VENDOR) ++ endif ++endif ++# Darth9 ++ + ifeq ($(BOARD_NAND_PAGE_SIZE),) + BOARD_NAND_PAGE_SIZE := 2048 + endif +diff --git a/core/config.mk b/core/config.mk +--- a/core/config.mk ++++ b/core/config.mk +@@ -620,6 +620,20 @@ else + MD5SUM:=md5sum + endif + ++# Darth9 ++# OrangeFox post script ++ifdef NOT_ORANGEFOX ++ FOX_VENDOR := ++ BASH := ++ FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER := ++else ++ FOX_CURRENT_DEV_STR := $(shell git -C bootable/recovery log -1 --format='%ad (%h)' --date=short) ++ export FOX_VENDOR=vendor/recovery/OrangeFox.sh ++ export BASH=bash ++ export FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER=1 ++endif ++# Darth9 ++ + # In-place sed is done different in linux than OS X + ifeq ($(HOST_OS),darwin) + GSED:=$(shell which gsed) +diff --git a/core/main.mk b/core/main.mk +--- a/core/main.mk ++++ b/core/main.mk +@@ -393,11 +393,13 @@ enable_target_debugging := true + tags_to_install := + ifneq (,$(user_variant)) + # Target is secure in user builds. +- ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1 ++# Darth9 - change 1 to 0 on the next line ++ ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0 + ADDITIONAL_DEFAULT_PROPERTIES += security.perf_harden=1 + + ifeq ($(user_variant),user) +- ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=1 ++# Darth9 - change 1 to 0 on the next line ++ ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=0 + endif + + ifeq ($(user_variant),userdebug) diff --git a/sync/patches/patch-manifest-fox_8.1.diff b/sync/patches/patch-manifest-fox_8.1.diff new file mode 100644 index 0000000..3113e91 --- /dev/null +++ b/sync/patches/patch-manifest-fox_8.1.diff @@ -0,0 +1,126 @@ +diff --git a/core/Makefile b/core/Makefile +--- a/core/Makefile ++++ b/core/Makefile +@@ -115,7 +115,6 @@ $(INSTALLED_DEFAULT_PROP_TARGET): $(intermediate_system_build_prop) + echo "#" >> $@; + $(hide) echo ro.bootimage.build.date=`$(DATE_FROM_FILE)`>>$@ + $(hide) echo ro.bootimage.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@ +- $(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@ + $(hide) build/tools/post_process_props.py $@ + ifdef property_overrides_split_enabled + $(hide) mkdir -p $(TARGET_ROOT_OUT) +@@ -178,21 +177,6 @@ BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS))) + build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS) + $(intermediate_system_build_prop): PRIVATE_BUILD_DESC := $(build_desc) + +-# The string used to uniquely identify the combined build and product; used by the OTA server. +-ifeq (,$(strip $(BUILD_FINGERPRINT))) +- ifneq ($(filter eng.%,$(BUILD_NUMBER)),) +- # Trim down BUILD_FINGERPRINT: the default BUILD_NUMBER makes it easily exceed +- # the Android system property length limit (PROPERTY_VALUE_MAX=92). +- BF_BUILD_NUMBER := $(shell echo $${USER:0:6})$(shell $(DATE) +%m%d%H%M) +- else +- BF_BUILD_NUMBER := $(BUILD_NUMBER) +- endif +- BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS) +-endif +-ifneq ($(words $(BUILD_FINGERPRINT)),1) +- $(error BUILD_FINGERPRINT cannot contain spaces: "$(BUILD_FINGERPRINT)") +-endif +- + $(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) > $(PRODUCT_OUT)/build_fingerprint.txt) + BUILD_FINGERPRINT_FROM_FILE := $$(cat $(PRODUCT_OUT)/build_fingerprint.txt) + +@@ -291,7 +275,6 @@ endif + PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \ + PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \ + BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \ +- BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \ + $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT)") \ + TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \ + TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \ +@@ -371,7 +354,6 @@ $(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(VENDOR_BUILDINFO_SH) $(intermediate_sys + $(hide) grep 'ro.product.first_api_level' $(intermediate_system_build_prop) >> $@ || true + $(hide) echo ro.vendor.build.date=`$(DATE_FROM_FILE)`>>$@ + $(hide) echo ro.vendor.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@ +- $(hide) echo ro.vendor.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@ + ifdef property_overrides_split_enabled + $(hide) TARGET_DEVICE="$(TARGET_DEVICE)" \ + PRODUCT_NAME="$(TARGET_PRODUCT)" \ +@@ -1268,6 +1250,29 @@ define build-recoveryramdisk + # Copy adbd from system/bin to recovery/root/sbin + $(hide) cp -f $(TARGET_OUT_EXECUTABLES)/adbd $(TARGET_RECOVERY_ROOT_OUT)/sbin/adbd + @echo Modifying ramdisk contents... ++ ++# Darth9 ++$(if $(filter 1,$(FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER)), \ ++ $(hide) $(FOX_VENDOR) \ ++ FOX_VENDOR_CMD="Fox_Before_Recovery_Image" \ ++ FOX_MANIFEST_VER="8.1" \ ++ TARGET_ARCH="$(TARGET_ARCH)" \ ++ TARGET_RECOVERY_ROOT_OUT="$(TARGET_RECOVERY_ROOT_OUT)" \ ++ MKBOOTIMG="$(MKBOOTIMG)" \ ++ MKBOOTFS="$(MKBOOTFS)" \ ++ INTERNAL_RECOVERYIMAGE_ARGS='"$(INTERNAL_RECOVERYIMAGE_ARGS)"' \ ++ INTERNAL_MKBOOTIMG_VERSION_ARGS="$(INTERNAL_MKBOOTIMG_VERSION_ARGS)" \ ++ BOARD_MKBOOTIMG_ARGS="$(BOARD_MKBOOTIMG_ARGS)" \ ++ TARGET_OUT="$(TARGET_OUT)" \ ++ RECOVERY_RAMDISK_COMPRESSOR="$(RECOVERY_RAMDISK_COMPRESSOR)" \ ++ INSTALLED_RECOVERYIMAGE_TARGET="$(INSTALLED_RECOVERYIMAGE_TARGET)" \ ++ BOARD_BOOTIMAGE_PARTITION_SIZE=$(BOARD_BOOTIMAGE_PARTITION_SIZE) \ ++ BOARD_RECOVERYIMAGE_PARTITION_SIZE=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE) \ ++ INTERNAL_KERNEL_CMDLINE="$(INTERNAL_KERNEL_CMDLINE)" \ ++ recovery_ramdisk="$(recovery_ramdisk)" \ ++ recovery_uncompressed_ramdisk="$(recovery_uncompressed_ramdisk)") ++# Darth9 ++ + $(if $(BOARD_RECOVERY_KERNEL_MODULES), \ + $(call build-image-kernel-modules,$(BOARD_RECOVERY_KERNEL_MODULES),$(TARGET_RECOVERY_ROOT_OUT),,$(call intermediates-dir-for,PACKAGING,depmod_recovery))) + $(hide) rm -f $(TARGET_RECOVERY_ROOT_OUT)/init*.rc +@@ -1407,6 +1412,23 @@ endif + .PHONY: recoveryimage + recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP) + ++# Darth9 ++# OrangeFox (FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER) ++ifneq ($(NOT_ORANGEFOX),1) ++ ifeq ($(FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER),1) ++ $(BASH) $(FOX_VENDOR) FOX_VENDOR_CMD="Fox_After_Recovery_Image" \ ++ FOX_MANIFEST_VER="8.1" \ ++ INSTALLED_RECOVERYIMAGE_TARGET="$(INSTALLED_RECOVERYIMAGE_TARGET)" \ ++ TARGET_ARCH="$(TARGET_ARCH)" \ ++ TARGET_RECOVERY_ROOT_OUT="$(TARGET_RECOVERY_ROOT_OUT)" \ ++ MKBOOTIMG="$(MKBOOTIMG)" \ ++ MKBOOTFS="$(MKBOOTFS)" ++ else ++ $(BASH) $(FOX_VENDOR) ++ endif ++endif ++# Darth9 ++ + ifeq ($(BOARD_NAND_PAGE_SIZE),) + BOARD_NAND_PAGE_SIZE := 2048 + endif +diff --git a/core/config.mk b/core/config.mk +--- a/core/config.mk ++++ b/core/config.mk +@@ -725,6 +725,19 @@ APICHECK_CLASSPATH := $(subst $(space),:,$(strip $(APICHECK_CLASSPATH_ENTRIES))) + + APICHECK_COMMAND := $(APICHECK) -JXmx1024m -J"classpath $(APICHECK_CLASSPATH)" + ++# Darth9 ++# OrangeFox post script ++FOX_CURRENT_DEV_STR := $(shell git -C bootable/recovery log -1 --format='%ad (%h)' --date=short) ++ifdef NOT_ORANGEFOX ++ FOX_VENDOR := ++ BASH := ++else ++ FOX_VENDOR := vendor/recovery/OrangeFox.sh ++ BASH := bash ++ FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER := 1 ++endif ++# Darth9 ++ + # Boolean variable determining if Treble is fully enabled + PRODUCT_FULL_TREBLE := false + ifneq ($(PRODUCT_FULL_TREBLE_OVERRIDE),) diff --git a/sync/patches/patch-manifest-fox_9.0.diff b/sync/patches/patch-manifest-fox_9.0.diff new file mode 100644 index 0000000..f2e9ff9 --- /dev/null +++ b/sync/patches/patch-manifest-fox_9.0.diff @@ -0,0 +1,96 @@ +diff --git a/core/Makefile b/core/Makefile +--- a/core/Makefile ++++ b/core/Makefile +@@ -1415,6 +1415,29 @@ define build-recoveryramdisk + # Copy adbd from system/bin to recovery/root/sbin + $(hide) cp -f $(TARGET_OUT_EXECUTABLES)/adbd $(TARGET_RECOVERY_ROOT_OUT)/sbin/adbd + # Modifying ramdisk contents... ++ ++ # Darth9 # ++ $(if $(filter 1,$(FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER)), \ ++ $(hide) $(FOX_VENDOR) \ ++ FOX_VENDOR_CMD="Fox_Before_Recovery_Image" \ ++ FOX_MANIFEST_VER="9.0" \ ++ TARGET_ARCH="$(TARGET_ARCH)" \ ++ TARGET_RECOVERY_ROOT_OUT="$(TARGET_RECOVERY_ROOT_OUT)" \ ++ MKBOOTIMG="$(MKBOOTIMG)" \ ++ MKBOOTFS="$(MKBOOTFS)" \ ++ INTERNAL_RECOVERYIMAGE_ARGS='"$(INTERNAL_RECOVERYIMAGE_ARGS)"' \ ++ INTERNAL_MKBOOTIMG_VERSION_ARGS="$(INTERNAL_MKBOOTIMG_VERSION_ARGS)" \ ++ BOARD_MKBOOTIMG_ARGS="$(BOARD_MKBOOTIMG_ARGS)" \ ++ TARGET_OUT="$(TARGET_OUT)" \ ++ RECOVERY_RAMDISK_COMPRESSOR="$(RECOVERY_RAMDISK_COMPRESSOR)" \ ++ INSTALLED_RECOVERYIMAGE_TARGET="$(INSTALLED_RECOVERYIMAGE_TARGET)" \ ++ BOARD_BOOTIMAGE_PARTITION_SIZE=$(BOARD_BOOTIMAGE_PARTITION_SIZE) \ ++ BOARD_RECOVERYIMAGE_PARTITION_SIZE=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE) \ ++ INTERNAL_KERNEL_CMDLINE="$(INTERNAL_KERNEL_CMDLINE)" \ ++ recovery_ramdisk="$(recovery_ramdisk)" \ ++ recovery_uncompressed_ramdisk="$(recovery_uncompressed_ramdisk)") ++ # Darth9 # ++ + $(if $(BOARD_RECOVERY_KERNEL_MODULES), \ + $(call build-image-kernel-modules,$(BOARD_RECOVERY_KERNEL_MODULES),$(TARGET_RECOVERY_ROOT_OUT),,$(call intermediates-dir-for,PACKAGING,depmod_recovery))) + # Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc. +@@ -1550,6 +1573,22 @@ endif + .PHONY: recoveryimage + recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP) + ++# Darth9 # FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER ++ifneq ($(NOT_ORANGEFOX),1) ++ ifeq ($(FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER),1) ++ $(BASH) $(FOX_VENDOR) FOX_VENDOR_CMD="Fox_After_Recovery_Image" \ ++ FOX_MANIFEST_VER="9.0" \ ++ INSTALLED_RECOVERYIMAGE_TARGET="$(INSTALLED_RECOVERYIMAGE_TARGET)" \ ++ TARGET_ARCH="$(TARGET_ARCH)" \ ++ TARGET_RECOVERY_ROOT_OUT="$(TARGET_RECOVERY_ROOT_OUT)" \ ++ MKBOOTIMG="$(MKBOOTIMG)" \ ++ MKBOOTFS="$(MKBOOTFS)" ++ else ++ $(BASH) $(FOX_VENDOR) ++ endif ++endif ++# Darth9 ++ + ifneq ($(BOARD_NAND_PAGE_SIZE),) + $(error MTD device is no longer supported and thus BOARD_NAND_PAGE_SIZE is deprecated.) + endif +diff --git a/core/config.mk b/core/config.mk +--- a/core/config.mk ++++ b/core/config.mk +@@ -755,6 +755,19 @@ else + MD5SUM:=md5sum + endif + ++# Darth9 ++# OrangeFox post script ++FOX_CURRENT_DEV_STR := $(shell git -C bootable/recovery log -1 --format='%ad (%h)' --date=short) ++ifdef NOT_ORANGEFOX ++ FOX_VENDOR := ++ BASH := ++else ++ FOX_VENDOR := vendor/recovery/OrangeFox.sh ++ BASH := bash ++ FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER := 1 ++endif ++# Darth9 ++ + APICHECK_CLASSPATH_ENTRIES := \ + $(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX) \ + $(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX) \ +diff --git a/core/main.mk b/core/main.mk +--- a/core/main.mk ++++ b/core/main.mk +@@ -272,11 +272,11 @@ enable_target_debugging := true + tags_to_install := + ifneq (,$(user_variant)) + # Target is secure in user builds. +- ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1 ++ ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0 + ADDITIONAL_DEFAULT_PROPERTIES += security.perf_harden=1 + + ifeq ($(user_variant),user) +- ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=1 ++ ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=0 + endif + + ifeq ($(user_variant),userdebug) diff --git a/sync/patches/usage.txt b/sync/patches/usage.txt new file mode 100644 index 0000000..ac4293b --- /dev/null +++ b/sync/patches/usage.txt @@ -0,0 +1,17 @@ +**NOTES**: +The patches in this directory are for my own personal use, and are *unsupported*. +No questions will be answered about them. Use entirely at your own risk. + + +Using these patch files to patch a twrp minimal manifest for building OrangeFox: + +1. Sync the relevant twrp minimal manifest, with the correct branch +2. Change to the manifest's "build" subdirectory +3. Run the command: patch -p1 < patch-manifest-fox_"X".diff ("X" = the branch version: eg, 9.0, 7.1, 6.0, etc) +4. Change to the manifest's "bootable" subdirectory +5. Remove the "recovery" subdirectory, and clone the OrangeFox sources into a new "recovery" subdirectory +6. Change to the manifest's "vendor" subdirectory +7. Clone the OrangeFox vendor tree into a new "recovery" subdirectory + +** It would be much easier to just run the orangefox_sync.sh script in the parent directory. + diff --git a/sync/update_fox.sh b/sync/update_fox.sh new file mode 100644 index 0000000..5adaf0e --- /dev/null +++ b/sync/update_fox.sh @@ -0,0 +1,114 @@ +#!/bin/bash +# *************************************************************************************** +# - Example script to sync updates to the minimal build system and OrangeFox sources +# - There is very little error checking +# - Author: DarthJabba9 +# - Version: generic:002 +# - Date: 13 December 2021 +# *************************************************************************************** + +# the version number of this script +SCRIPT_VERSION="20211213"; + +# Our starting point (Fox base dir) +BASE_DIR="$PWD"; + +# manifest directory +MANIFEST_DIR=""; + +# print a message and terminate with errorcode 1 +abort() { + echo "$@"; + exit 1; +} + +# help +help_screen() { + echo "Example script to sync updates to the minimal build system and OrangeFox sources"; + echo "Usage = $0 "; + echo "Arguments:"; + echo " -h, -H, --help print this help screen and quit"; + echo " -d, -D, --debug debug mode: print each command being executed"; + echo " -p, -P, --path root of the minimal manifest"; + echo ""; + echo "Examples:"; + echo " $0 --path ~/OrangeFox_11"; + echo " $0 --path ~/OrangeFox/9.0 --debug"; + echo ""; + echo "- You must supply an *absolute* path for the '--path' switch"; + exit 0; +} + +# process the command line arguments +Process_CMD_Line() { + echo "$0, v$SCRIPT_VERSION"; + + if [ -z "$1" ]; then + help_screen; + fi + + echo "- Example script to sync updates to the minimal build system and OrangeFox sources"; + + while (( "$#" )); do + case "$1" in + # debug mode - show some verbose outputs + -d | -D | --debug) + set -o xtrace; + ;; + # help + -h | -H | --help) + help_screen; + ;; + # path + -p | -P | --path) + shift; + [ -n "$1" ] && MANIFEST_DIR=$1; + ;; + *) + help_screen; + ;; + esac + shift + done + + [ -z "$MANIFEST_DIR" ] && help_screen; + [ ! -d "$MANIFEST_DIR/bootable/" -o ! -d "$MANIFEST_DIR/build/" -o ! -d "$MANIFEST_DIR/external/" ] && abort "- Invalid manifest directory: \"$MANIFEST_DIR\""; + + echo "- Starting the script ..."; + echo "- The working directory is: \"$BASE_DIR\""; + echo "- The manifest root directory is: \"$MANIFEST_DIR\""; +} + +# Execute the update +DoUpdate() { +local recovery=$MANIFEST_DIR/bootable/recovery; +local vendor=$MANIFEST_DIR/vendor/recovery; + + if [ ! -d "$recovery" ]; then + abort "- Invalid recovery directory: \"$recovery\". Quitting." + elif [ ! -d "$vendor" ]; then + abort "- Invalid vendor directory: \"$vendor\". Quitting." + fi + + # manifest + echo "- Updating the build manifest..."; + echo "- You can ignore all errors relating to \"android_bootable_recovery\" or \"bootable/recovery\", etc ..."; + cd $MANIFEST_DIR && repo sync; + + # recovery sources + cd $recovery && git pull --recurse-submodules; + + # vendor tree + echo "- Updating the OrangeFox vendor tree ..."; + cd $vendor && git pull; + + # finish + echo "- Finished."; + cd $BASE_DIR; + exit 0; +} + +# main() +Process_CMD_Line "$@"; +DoUpdate; +#