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.
 
 

386 lines
13 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 " ███╗ ███╗ █████╗ ███████╗████████╗███████╗██████╗"
echo " ████╗ ████║██╔══██╗██╔════╝╚══██╔══╝██╔════╝██╔══██"
echo " ██╔████╔██║███████║███████╗ ██║ █████╗ ██████╔"
echo " ██║╚██╔╝██║██╔══██║╚════██║ ██║ ██╔══╝ ██╔══██"
echo " ██║ ╚═╝ ██║██║ ██║███████║ ██║ ███████╗██║ ██"
echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚══════╝╚═╝ ╚═"
echo ""
echo ""
echo " applying master 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/master-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
# Android.bp: Fake Windows libwinpthread deps
git am < $PATCHES_PATH/master-build-soong-Android.bp-Fake-Windows-libwinpthread-deps.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
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/master-networkstack-tests-net-Remove-libapf-deps.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
# TODO: new private zygote stuff
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-16'
# https://github.com/sonyxperiadev/device-sony-common/pull/666
# TEMP: Kernel 4.9 backward compat
apply_pull_commit 666 362aa3e8ae050eea1a48b6fd0b557f2569595495
# git checkout 'protobuf-compat'
# https://github.com/sonyxperiadev/device-sony-common/pull/717
# [R] packages: Add protobuf vendorcompat lib
apply_pull_commit 717 0387e59769c29a2026089e6861bc216d1a80b786
LINK="https://git.ix5.org/felix/device-sony-common"
# git checkout 'treble-odm-6'
# Use oem as /vendor and add treble quirks
apply_commit d23f01b05efdc693875a59e9c3854b5d66131c4a
# git checkout 'k4.9-re-add-qt-km-gatekeeper'
# common: Add 4.9 gatekeeper/keymaster compat
# TODO: Should not be needed any more, passthrough should be safe
#apply_commit f12d93b221a1ce312e8db1589fd925aa04d51244
# git checkout 'qcom-interfaces-rework-4'
# hardware: Make more qcom dirs customizable
apply_commit 7072645bcbd2662bb09a69186420d96cc6d0dfe8
# 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
# git checkout 'gps-conf-align'
# rootdir: gps.conf: Align with coral
apply_commit ed811de44f40b860424d19773c5d4990bf8f5647
# git checkout 'health-storage-stats-3'
# health: Add support for storage stats and health
apply_commit 58f9f64d4c21866fe7f659ac10927a0fe5447e6b
# git checkout 'overlay-pinner-2'
# overlay: Align PinnerService files with coral
apply_commit 72de95065a12bf33e4488f00131831c4e644fa9f
# git checkout 'prop-hwui-bufferage'
# common-prop: Set use_buffer_age=true
apply_commit ad340a8ad74dc852e9d049084209d96a6fe41811
# git checkout 'overlay-camera-button-launch-2'
# overlay: Enable system-wide camera button launch
# TODO: Pick me once this is actually through, and also for master runs
#apply_commit 437c22b3a658c07aa1154d5c93d0688b5c8d7deb
# git checkout 'r-vintf-remove-usb'
# [R] vintf: Remove usb, already defined
apply_commit 972b18770ce411bd843bf147a2560a5febc62313
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
# git checkout 'fwb-ble'
# overlay: Advertise BLE peripheral mode support
apply_commit feb599b4a7620425d7e5dd7462eb81d17be426e8
# git checkout 'supplicant-conf-2'
# Update supplicant conf from marlin/wahoo/crosshatch
apply_commit 3440bfdeb32e7b82550b548a19d117f35d1eb792
# p2p_supplicant: Remove p2p_no_go_freq
apply_commit 5040a8f550e95a3474e5e3f3d9ee03d983575c54
# Add wifi_concurrency
apply_commit 105dd7313f351e623023683060379006ce5845a2
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
# https://github.com/sonyxperiadev/device-sony-tone/pull/196
# platform: Relax inheritance on broadcom wlan repo
apply_pull_commit 196 c9f546c545ccbddac85f63e1dfa6272dbf823003
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
# git checkout 'use-qcrild'
# PlatformConfig: enable TARGET_USE_QCRILD
apply_commit f5c66a4bef136e7487e93e255cecba193ce29a10
# TODO: Try f2fs for userdata?
LINK="https://github.com/sonyxperiadev/device-sony-tama"
# https://github.com/sonyxperiadev/device-sony-tama/pull/60
# QCNSS_qcom_cfg: Enable RX thread to receive packet
apply_pull_commit 60 04a47c30154c14d9d6fb5dc291e189f4f7b80290
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-daniel'
# device: Add RGBC-IR CASH calibration
apply_commit 4c60700e9556796b6ff57e1f060793a50cf9fad9
# git checkout 'bcmd-cal-ccode-XT-DE'
# rootdir: bcmdhd.cal: Set wifi ccode to DE
apply_commit 86cb200b75df69147dfb1d737615735a2ea067c0
# TODO
# Set hotspot 5ghz to disabled in overlay
# git checkout 'bcmd-fw-blob'
# rootdir: Add brcmfmac4359-pcie.clm_blob
# TODO: Disable for now, seems to kill 5ghz
#apply_commit 42344f3533b7ef4848204901fb815c64ae555587
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
# TODO: Get rid of gcc entirely
#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
## Things dropped from upstream repo_update because of removal of legacy media HAL
#pushd $ANDROOT/hardware/qcom/media
#LINK=$HTTP && LINK+="://android.googlesource.com/platform/hardware/qcom/media"
## msm8998: vdec: Add missing ifdefs for UBWC on DPB buffer decision
## Change-Id: I76131db5272b97016679c5bc0bf6ae099167cd03
#apply_gerrit_cl_commit refs/changes/39/728339/1 b641243647a7cd3f382dd2be43b74f9d6b7f9310
## msm8998: mm-video-v4l2: enable compilation for both 3.18 kernel and 4.9 kernel
## Change-Id: If1eb2575dd80a1e6684c84e573baf78ae698bb20
#apply_gerrit_cl_commit refs/changes/54/813054/1 01062d8acaae88b141893d69358d6c13e3495377
## msm8998: mm-video-v4l2: Renaming the AU-Delimiter params/extens
## Change-Id: I3feccfbb06e4e237a601a355ab2f2573a165ed3b
#apply_gerrit_cl_commit refs/changes/55/813055/1 cb97584647999d7ea8df858f2c3f4bf04f408f34
#popd
# because "set -e" is used above, when we get to this point, we know
# all patches were applied successfully.
echo ""
echo " ███╗ ███╗ █████╗ ███████╗████████╗███████╗██████╗"
echo " ████╗ ████║██╔══██╗██╔════╝╚══██╔══╝██╔════╝██╔══██"
echo " ██╔████╔██║███████║███████╗ ██║ █████╗ ██████╔"
echo " ██║╚██╔╝██║██╔══██║╚════██║ ██║ ██╔══╝ ██╔══██"
echo " ██║ ╚═╝ ██║██║ ██║███████║ ██║ ███████╗██║ ██"
echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚══════╝╚═╝ ╚═"
echo ""
echo ""
echo " all master patches applied successfully!"
echo ""
set +e