Initial unified commit for Android 13, with "light" GSI target

This commit is contained in:
Andy CrossGate Yan 2022-09-28 15:46:33 +00:00
commit 050bdbac47
4 changed files with 216 additions and 0 deletions

27
README.md Normal file
View File

@ -0,0 +1,27 @@
## Building "generic" LineageOS GSIs ##
Set up your environment by referring to [LineageOS Wiki](https://wiki.lineageos.org/devices/TP1803/build) (mainly "Install the build packages" and "Install the repo command").
Create a new working directory for your LineageOS build and navigate to it:
mkdir lineage-20-build-gsi; cd lineage-20-build-gsi
Initialize your LineageOS workspace:
repo init -u https://github.com/LineageOS/android.git -b lineage-20.0
Clone both this and the patches repos:
git clone https://github.com/AndyCGYan/lineage_build_unified lineage_build_unified -b lineage-20-light
git clone https://github.com/AndyCGYan/lineage_patches_unified lineage_patches_unified -b lineage-20-light
Finally, start the build script - for example, to build for all supported archs:
bash lineage_build_unified/buildbot_unified.sh treble 64VN 64VS
Be sure to update the cloned repos from time to time!
---
This script is also used to make device-specific and/or personal builds. To do so, understand the script, and try the `device` and `personal` keywords.

32
apply_patches.sh Normal file
View File

@ -0,0 +1,32 @@
#!/bin/bash
set -e
patches="$(readlink -f -- $1)"
shopt -s nullglob
for project in $(cd $patches; echo *);do
p="$(tr _ / <<<$project |sed -e 's;platform/;;g')"
[ "$p" == build ] && p=build/make
[ "$p" == frameworks/proto/logging ] && p=frameworks/proto_logging
[ "$p" == vendor/hardware/overlay ] && p=vendor/hardware_overlay
[ "$p" == vendor/partner/gms ] && p=vendor/partner_gms
pushd $p
git clean -fdx; git reset --hard
for patch in $patches/$project/*.patch;do
if git apply --check $patch;then
git am $patch
elif patch -f -p1 --dry-run < $patch > /dev/null;then
#This will fail
git am $patch || true
patch -f -p1 < $patch
git add -u
git am --continue
else
echo "Failed applying $patch"
exit 1
fi
done
popd
done

150
buildbot_unified.sh Executable file
View File

@ -0,0 +1,150 @@
#!/bin/bash
echo ""
echo "LineageOS 20 Unified Buildbot"
echo "Executing in 5 seconds - CTRL-C to exit"
echo ""
sleep 5
if [ $# -lt 2 ]
then
echo "Not enough arguments - exiting"
echo ""
exit 1
fi
MODE=${1}
if [ ${MODE} != "device" ] && [ ${MODE} != "treble" ]
then
echo "Invalid mode - exiting"
echo ""
exit 1
fi
NOSYNC=false
PERSONAL=false
for var in "${@:2}"
do
if [ ${var} == "nosync" ]
then
NOSYNC=true
fi
if [ ${var} == "personal" ]
then
PERSONAL=true
fi
done
# Abort early on error
set -eE
trap '(\
echo;\
echo \!\!\! An error happened during script execution;\
echo \!\!\! Please check console output for bad sync,;\
echo \!\!\! failed patch application, etc.;\
echo\
)' ERR
START=`date +%s`
BUILD_DATE="$(date +%Y%m%d)"
prep_build() {
echo "Preparing local manifests"
mkdir -p .repo/local_manifests
cp ./lineage_build_unified/local_manifests_${MODE}/*.xml .repo/local_manifests
echo ""
echo "Syncing repos"
repo sync -c --force-sync --no-clone-bundle --no-tags -j$(nproc --all)
echo ""
echo "Setting up build environment"
source build/envsetup.sh &> /dev/null
mkdir -p ~/build-output
echo ""
repopick 321337 -f # Deprioritize important developer notifications
repopick 321338 -f # Allow disabling important developer notifications
repopick 321339 -f # Allow disabling USB notifications
repopick 331534 -f # SystemUI: Add support to add/remove QS tiles with one tap
}
apply_patches() {
echo "Applying patch group ${1}"
bash ./lineage_build_unified/apply_patches.sh ./lineage_patches_unified/${1}
}
prep_device() {
:
}
prep_treble() {
:
}
finalize_device() {
:
}
finalize_treble() {
:
}
build_device() {
brunch ${1}
mv $OUT/lineage-*.zip ~/build-output/lineage-20.0-$BUILD_DATE-UNOFFICIAL-${1}$($PERSONAL && echo "-personal" || echo "").zip
}
build_treble() {
case "${1}" in
("64VN") TARGET=gsi_arm64_vN;;
("64VS") TARGET=gsi_arm64_vS;;
(*) echo "Invalid target - exiting"; exit 1;;
esac
lunch lineage_${TARGET}-userdebug
make -j$(nproc --all) systemimage
mv $OUT/system.img ~/build-output/lineage-20.0-$BUILD_DATE-UNOFFICIAL-${TARGET}$(${PERSONAL} && echo "-personal" || echo "").img
}
if ${NOSYNC}
then
echo "ATTENTION: syncing/patching skipped!"
echo ""
echo "Setting up build environment"
source build/envsetup.sh &> /dev/null
echo ""
else
prep_build
echo "Applying patches"
prep_${MODE}
apply_patches patches_platform
apply_patches patches_${MODE}
if ${PERSONAL}
then
apply_patches patches_platform_personal
apply_patches patches_${MODE}_personal
fi
finalize_${MODE}
echo ""
fi
for var in "${@:2}"
do
if [ ${var} == "nosync" ] || [ ${var} == "personal" ]
then
continue
fi
echo "Starting $(${PERSONAL} && echo "personal " || echo "")build for ${MODE} ${var}"
build_${MODE} ${var}
done
ls ~/build-output | grep 'lineage' || true
if [ ${MODE} == "treble" ]
then
echo $START > ~/build-output/ota-timestamp.txt
fi
END=`date +%s`
ELAPSEDM=$(($(($END-$START))/60))
ELAPSEDS=$(($(($END-$START))-$ELAPSEDM*60))
echo "Buildbot completed in $ELAPSEDM minutes and $ELAPSEDS seconds"
echo ""

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="AndyCGYan/android_device_lineage_gsi" path="device/lineage/gsi" remote="github" revision="lineage-20" />
<project name="AndyCGYan/android_packages_apps_QcRilAm" path="packages/apps/QcRilAm" remote="github" revision="master" />
<project name="phhusson/vendor_hardware_overlay" path="vendor/hardware_overlay" remote="github" revision="pie" />
<remove-project name="LineageOS/android_packages_apps_Camera2" />
</manifest>