TWRP Build Instructions - maxrd2/android_device_htc_a50cmg_dwg GitHub Wiki
Steps to build TWRP recovery for HTC Desire 728G Dual Sim (a50cmg_dwg) on Arch Linux.
pacaur -S aosp-devel
See detailed instructions on Arch Android Wiki
mkdir twrp-5.1 && cd twrp-5.1
repo init --depth=1 -u git://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git -b twrp-5.1
Create .repo/local_manifests/a50cmg_dwg.xml
and add:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="maxrd2/android_device_htc_a50cmg_dwg" path="device/htc/a50cmg_dwg" remote="github" revision="android-5.1" />
</manifest>
repo sync -j4 -c
. build/envsetup.sh
virtualenv --python /usr/bin/python2 --system-site-packages venv
. venv/bin/activate
export LC_ALL=C # without this compilation will fail
export ANDROID_JAVA_HOME=/usr/lib/jvm/java-8-openjdk
export PATH="$ANDROID_JAVA_HOME/bin:$PATH"
Here are patches for compilation errors I've encountered. You might not need these since upstream code keeps changing and your build system might be different than mine. Also they might fail if upstream code changes much.
You can apply some of these if/when build below fails.
url=https://raw.githubusercontent.com/wiki/maxrd2/android_device_htc_a50cmg_dwg/patches/twrp-5.1
# Fix buffer overruns and compilation errors/warnings
curl -s $url/system.core-fix-gcc8-compile.diff | patch -d system/core -p 1
curl -s $url/external.sepolicy-fix-gcc8-compile.diff | patch -d external/sepolicy -p 1
# Fix checkpolicy build error
curl -s $url/external.checkpolicy.fix-fno-common.diff | patch -d external/checkpolicy -p 1
# Fix static libs link errors (GNU ar 2.35)
curl -s $url/build.omnirom-fix-host-static-libs.diff | patch -d build -p 1
# Fix static libs link errors (GNU ar 2.39)
curl -s $url/0001-Fix-build-of-host-static-libraries.patch | git -C build am
lunch omni_a50cmg_dwg-eng
make -j$(nproc) installclean
make -j$(nproc) recoveryimage
Successfull build will produce TWRP image: out/target/product/a50cmg_dwg/recovery.img
which can be flashed with:
fastboot flash recovery out/target/product/a50cmg_dwg/recovery.img