You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

331 lines
10 KiB

#!/bin/bash
# exit script immediately if a command fails
set -e
ANDROOT=$PWD
OFFLINE=$SODP_WORK_OFFLINE
RESOLVED_REPO_PATH="$ANDROOT/$(dirname $(readlink $0))"
PATCHES_PATH=$RESOLVED_REPO_PATH/patches
pushd () {
command pushd "$@" > /dev/null
}
popd () {
command popd "$@" > /dev/null
}
commit_exists() {
_sha1=$1
git rev-parse --quiet --verify $_sha1^{commit}
}
apply_commit() {
_commit=$1
if commit_exists $_commit
then
git cherry-pick $_commit
else
git fetch $LINK $_commit && git cherry-pick $_commit
fi
}
apply_gerrit_cl_commit() {
_cl=$1
_commit=$2
if commit_exists $_commit
then
git cherry-pick $_commit
else
git fetch $LINK $_cl && git cherry-pick FETCH_HEAD
fi
}
apply_pull_commit() {
_pull=$1
_commit=$2
if commit_exists $_commit
then
git cherry-pick $_commit
else
git fetch $LINK pull/$_pull/head && git cherry-pick $_commit
fi
}
do_if_online() {
if [[ ! $OFFLINE = true ]]
then
$@
fi
}
echo ""
echo " d8b 888888888"
echo " Y8P 888"
echo " 888"
echo " 888 888 888 8888888b."
echo " 888 ´Y8bd8P´ ´Y88b"
echo " 888 X88K 888"
echo " 888 .d8´´8b. Y88b d88P"
echo " 888 888 888 ´Y8888P´"
echo ""
echo ""
echo " applying ix5 patches..."
echo ""
pushd $ANDROOT/kernel/sony/msm-4.14/kernel
#LINK="https://github.com/sonyxperiadev/kernel"
# TEMP: Build-able makefile for Q and 4.14
#git am < $PATCHES_PATH/q-kernel-4.14-makefile.patch
popd
pushd $ANDROOT/kernel/sony/msm-4.9/kernel
# Enable wakeup_gesture in dtsi table
# You need to discard vendor-sony-kernel or the build system will use
# precompiled dtb files, thus rendering this patch useless
#git am < $PATCHES_PATH/kernel-dtsi-wakeup.patch
# tone: panel: set min brightness to 1.2mA
# Merged upstream
#git am < $PATCHES_PATH/panel-minimum-brightness.patch
# dts: tone: Kill verity
git am < $PATCHES_PATH/dtsi-tone-kill-verity.patch
# Update makefiles for Android Q and clang
#git am < $PATCHES_PATH/q-kernel-4.9-makefile.patch
popd
pushd $ANDROOT/build/make
# releasetools: Allow flashing downgrades
git am < $PATCHES_PATH/build-releasetools-allow-flashing-downgrades.patch
# handheld_product: Remove Browser2, QuickSearchBox
git am < $PATCHES_PATH/q-build-make-remove-browser2-quicksearchbox.patch
popd
pushd $ANDROOT/build/soong
LINK="https://android.googlesource.com/platform/build/soong"
# Android.bp: Fake Windows libwinpthread deps
git am < $PATCHES_PATH/q-build-soong-fake-libwinpthread.patch
# Give Blueprint modules access to all namespaces
apply_gerrit_cl_commit refs/changes/43/984643/1 cd84b4e36b04055e6c413020d053f0f958cbced1
popd
pushd $ANDROOT/packages/apps/Bluetooth
# Disable email module for BluetoothInstrumentionTest
git am < $PATCHES_PATH/q-bluetooth-disable-email-test.patch
popd
pushd $ANDROOT/packages/apps/Launcher3
# Launcher3QuickStep: Remove useless QuickSearchbar
git am < $PATCHES_PATH/q-launcher3quickstep-remove-quicksearchbar.patch
popd
pushd $ANDROOT/frameworks/base
# Enable development settings by default
git am < $PATCHES_PATH/q-enable-development-settings-by-default.patch
# core: Add support for MicroG
git am < $PATCHES_PATH/q-fwb-core-Add-support-for-MicroG.patch
popd
pushd $ANDROOT/hardware/interfaces
# FIXME: compatibility: Allow radio@1.1
git am < $PATCHES_PATH/q-hardware-interfaces-allow-radio-1-1-.patch
popd
pushd $ANDROOT/packages/modules/NetworkStack
# tests: net: Remove libapf deps
git am < $PATCHES_PATH/q-networkstack-remove-libapf.patch
popd
pushd $ANDROOT/device/sony/sepolicy
LINK="https://git.ix5.org/felix/device-sony-sepolicy"
(git remote --verbose | grep -q $LINK) || git remote add ix5 $LINK
do_if_online git fetch ix5
# git checkout 'gatekeeper-4.9-qti-compat'
# TEMP: gatekeeper: Add 4.9 QTI compat
apply_commit ca356bc5abfa6a45ff5b82e8d5c8dc43eff0865d
LINK="https://github.com/sonyxperiadev/device-sony-sepolicy"
# https://github.com/sonyxperiadev/device-sony-sepolicy/pull/534
# firmware_file GSI compat
apply_pull_commit 534 00b1e34df8ba47b797a8da22dd8f292093eb8724
popd
pushd $ANDROOT/device/sony/common
LINK="https://git.ix5.org/felix/device-sony-common"
(git remote --verbose | grep -q $LINK) || git remote add ix5 $LINK
do_if_online git fetch ix5
# TODO: Unused as of now
# git checkout 'selinux-enforcing'
# Switch selinux to enforcing
#apply_commit 1fc8e752c33ae07fe8c8f6d48abb2d1324b64536
#set +e
#if [ $(git tag -l "selinux-enforcing-temp-tag") ]; then
# git tag -d selinux-enforcing-temp-tag
#fi
#set -e
#git tag selinux-enforcing-temp-tag
# git checkout 'add-vendor-ix5-2'
# Include vendor-ix5 via common.mk
apply_commit 6206e8d57adf6dbc87ad785a8e1c5eac1141e44a
# git checkout 'init-remove-verity'
# init: Remove verity statements
apply_commit 6c33a4a8f5fe4615235df9d7abcfe3644f299672
LINK="https://github.com/sonyxperiadev/device-sony-common"
# TODO: Remove me once merged into master
# https://github.com/sonyxperiadev/device-sony-common/pull/616
# power: No subsystem stats in user builds
apply_pull_commit 616 76fc5c2fb36a3f1bfe24d51daa04caeb5ce14fdb
# git checkout 'k4.9-guard-12'
# https://github.com/sonyxperiadev/device-sony-common/pull/666
# TEMP: Kernel 4.9 backward compat
apply_pull_commit 666 a52f85d2a9a30f8edf985160c07355177e31535c
# https://github.com/sonyxperiadev/device-sony-common/pull/683
# rootdir: Drop mediaextractor seccomp policy
apply_pull_commit 683 84ebf78ffc6702cd021e183dfcf118dac8f11794
LINK="https://git.ix5.org/felix/device-sony-common"
# git checkout 'treble-odm-4'
# Use oem as /vendor and add treble quirks
apply_commit dc74eda759434c49b602514b43ceb1cb42b53d03
# git checkout 'k4.9-re-add-qt-km-gatekeeper'
# common: Add 4.9 gatekeeper/keymaster compat
apply_commit f12d93b221a1ce312e8db1589fd925aa04d51244
# git checkout 'qcom-interfaces-rework-3'
# hardware: Make more qcom dirs customizable
apply_commit e4185144b58dccf258ed867cdea2aa7500e84b8f
# git checkout 'overlay-move-sta-ap'
# overlay: Move STA-AP configs to platforms
apply_commit 6a67a1a7f89d87dba1419c70c2abd08c1a35816f
# git checkout 'wifi-hidl-revert-dual-sta-ap'
# CommonConfig: Move dual STA-AP to platforms
apply_commit 929c7057c22c520439320a8928e7538c0734697b
popd
pushd $ANDROOT/device/sony/tone
LINK="https://git.ix5.org/felix/device-sony-tone"
(git remote --verbose | grep -q $LINK) || git remote add ix5 $LINK
do_if_online git fetch ix5
# git checkout 'disable-verity-no-forceencrypt'
# Change forceencrypt to encryptable for userdata
apply_commit af592265685fddf24100cbc1fdcdcb5bfd2260c1
# Disable dm-verity
apply_commit b611c8d91a374f246be393d89f20bbf3fc2ab9f7
# git checkout 'treble-odm-3'
# Use oem as /vendor
apply_commit 796ff85b93d28a301cce7bd6b3e0852a35180e04
# git checkout 'cpu-variant-generic'
# TEMP: PlatformConfig: Use generic arch
apply_commit dc64506b6ed86ae625fd13965c7af33cf1fc3d25
LINK="https://github.com/sonyxperiadev/device-sony-tone"
# https://github.com/sonyxperiadev/device-sony-tone/pull/179/commits
# msm_irqbalance: Correct IGNORED_IRQ list
apply_pull_commit 179 e0191d28e6e5bd8386ff61530db79450607414a4
# msm_irqbalance: Don't balance MDSS or kgsl-3d0 IRQs
apply_pull_commit 179 e1c94fb119d678cbb0c656b255e7b5d7d6d14332
# https://github.com/sonyxperiadev/device-sony-tone/pull/177
# RQBalance-config: Keep all cores on
apply_pull_commit 177 4c48172c43f4506a7a544ec7e18dded1438d956c
popd
pushd $ANDROOT/device/sony/tama
LINK="https://git.ix5.org/felix/device-sony-tama"
(git remote --verbose | grep -q $LINK) || git remote add ix5 $LINK
do_if_online git fetch ix5
# git checkout 'avb-allow-disable-verity'
# PlatformConfig: Allow unverified images
apply_commit 28915c56a25f9965aa22487366ba69ed8e78574b
# git checkout 'overlay-sta-ap'
# overlay: Move STA-AP configs from common
# TODO: FIXME rebase
#apply_commit 253c5ddfa055e31e6d7d067a965f72f3e233c0d7
# CommonConfig: Move dual STA-AP from common
apply_commit de5c440244a3fe78b92a4a24e36bdbc6ed20390a
# git checkout 'cpu-variant-generic'
# TEMP: PlatformConfig: Use generic arch
apply_commit ca8fb740c80056d988b4ef603d03884e5f680ead
popd
pushd $ANDROOT/device/sony/kagura
LINK="https://git.ix5.org/felix/device-sony-kagura"
(git remote --verbose | grep -q $LINK) || git remote add ix5 $LINK
do_if_online git fetch ix5
# git checkout 'dt2w'
# Re-enable tap to wake
#apply_commit 90a80f6e42bfd2feca40fbdc8e2b046ff654032a
# Turn dt2w off by default in settings
#apply_commit bc9df19ac1561281f2b10238d9007a803cfaaa06
# git checkout 'rgbcir'
# Add preliminary RGBCIR calibration file
#apply_commit a0253f3de75c52bccb9275ee7eda6cd2f9db539c
popd
pushd $ANDROOT/system/sepolicy
LINK="https://android.googlesource.com/platform/system/sepolicy"
# Disabled for now
#git am < $PATCHES_PATH/q-sepolicy-app-neverallow-exception-matlog.patch
popd
pushd $ANDROOT/system/core
# property_service: Also read /odm/build.prop
git am < $PATCHES_PATH/q-system-core-propertyservice-read-odm-buildprop.patch
popd
pushd $ANDROOT/vendor/qcom/opensource/core-utils
LINK="https://github.com/sonyxperiadev/vendor-qcom-opensource-core-utils"
# https://github.com/sonyxperiadev/vendor-qcom-opensource-core-utils/pull/3/commits
# fwk-detect: Drop libnativehelper includes
apply_pull_commit 3 0918f28102609638f05fa399ef1711b6f998d54c
popd
pushd $ANDROOT/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9
# aarch64: Drop sleep constructor
git am < $PATCHES_PATH/q-gcc-sleep-constructor-aarch64.patch
popd
pushd $ANDROOT/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9
# arm: Drop sleep constructor
git am < $PATCHES_PATH/q-gcc-sleep-constructor-arm.patch
popd
# because "set -e" is used above, when we get to this point, we know
# all patches were applied successfully.
echo ""
echo " d8b 888888888"
echo " Y8P 888"
echo " 888"
echo " 888 888 888 8888888b."
echo " 888 ´Y8bd8P´ ´Y88b"
echo " 888 X88K 888"
echo " 888 .d8´´8b. Y88b d88P"
echo " 888 888 888 ´Y8888P´"
echo ""
echo ""
echo " all ix5 patches applied successfully!"
echo ""
set +e