LeOS-GSI/LeOS/build-u.sh

195 lines
5.6 KiB
Bash
Raw Normal View History

2023-12-13 10:41:07 +01:00
#!/bin/bash
2023-12-13 10:51:45 +01:00
MONTH="date +%B"
2023-12-13 10:41:07 +01:00
echo
echo "--------------------------------------"
echo " LeOS-U Buildbot "
echo " by "
echo " harvey186 "
echo "--------------------------------------"
echo
git clone https://github.com/ponces/treble_aosp -b android-14.0
2023-12-13 10:51:45 +01:00
git clone https://github.com/ponces/vendor_ponces.git -b android-14.0 vendor/ponces
2023-12-19 13:19:06 +01:00
cp LeOS/patch.sh treble_aosp
2023-12-13 10:41:07 +01:00
set -e
initRepos() {
if [ ! -d .repo ]; then
echo "--> Initializing workspace"
repo init -u https://android.googlesource.com/platform/manifest -b android-14.0.0_r17 --git-lfs
echo
echo "--> Preparing local manifest"
mkdir -p .repo/local_manifests
2023-12-13 10:51:45 +01:00
cp treble_aosp/build/manifest.xml .repo/local_manifests/aosp.xml
2023-12-13 10:41:07 +01:00
cp LeOS/leos.xml .repo/local_manifests/leos.xml
cp LeOS/removeAOSP.xml .repo/local_manifests/remove.xml
echo
fi
}
syncRepos() {
echo "--> Syncing repos"
repo sync -c --force-sync --no-clone-bundle --no-tags -j$(nproc --all)
echo
}
2023-12-13 10:51:45 +01:00
applyPatches() {
echo "--> Applying TrebleDroid patches"
bash treble_aosp/patch.sh treble_aosp trebledroid
echo
echo "--> Applying ponces personal patches"
rm treble_aosp/patches/personal/platform_frameworks_base/0001-gmscompat-Change-attestation-and-instrumentation-to-.patch
rm treble_aosp/patches/personal/platform_frameworks_base/0002-gmscompat-Spoof-Pixel-XL-for-Google-Photos.patch
rm treble_aosp/patches/personal/platform_frameworks_base/0007-permissions-Pre-grant-google-restore-permissions.patch
rm -R treble_aosp/patches/personal/platform_frameworks_base/0008-feat-Add-Lockscreen-Weather-with-OmniJaws-1-2.patch
rm -R treble_aosp/patches/personal/platform_packages_apps_Settings/0001-feat-Add-Lockscreen-Weather-with-OmniJaws-2-2.patch
rm treble_aosp/patches/personal/platform_build/0001-Remove-su-from-vanilla-builds.patch
bash treble_aosp/patch.sh treble_aosp personal
echo
echo "--> Applying LeOS patches"
mv patches/leos treble_aosp/patches/leos
bash treble_aosp/patch.sh treble_aosp leos
cp LeOS/instrumentation_test_list.mk plattform_testing/build/tasks/tests/
cp LeOS/platform_test_list.mk plattform_testing/build/tasks/tests/
echo
2023-12-19 13:19:06 +01:00
echo "creatings host file"
cp LeOS/hosts system/core/rootdir/etc/
2023-12-13 10:51:45 +01:00
echo "--> Generating makefiles"
cd device/phh/treble
cp treble_aosp/build/aosp.mk device/phh/treble/
bash generate.sh aosp
cd ../../..
echo
}
setupEnv() {
echo "--> Setting up build environment"
source build/envsetup.sh &>/dev/null
mkdir -p $BD
echo
}
buildTrebleApp() {
echo "--> Building treble_app"
cd treble_app
bash build.sh release
cp TrebleApp.apk ../vendor/hardware_overlay/TrebleApp/app.apk
cd ..
echo
}
buildVanillaVariant() {
echo "--> Building treble_arm64_bvS"
export WITHOUT_CHECK_API=true
export USE_CCACHE=1
export CCACHE_SIZE=50G
export WITH_SU=true
lunch leos_arm64_bvS-userdebug
#make installclean
make -j12 RELAX_USES_LIBRARY_CHECK=true systemimage
2023-12-19 13:19:06 +01:00
2023-12-13 10:51:45 +01:00
echo
echo "--> Building LeOS-U-VNDKLITE-arm64-bvS.img"
cd treble_adapter
sudo bash lite-adapter.sh 64 ../out/target/product/leos_arm64_ab/system.img
mv s.img LeOS-U-VNDKLITE-arm64-bvS.img
sudo rm -rf d tmp
2023-12-19 13:19:06 +01:00
cd prebuilts/prebuiltapks/foss_nano/
bash update.sh
cd ../../..
echo "--> Building treble_arm64_bvN"
export WITHOUT_CHECK_API=true
export USE_CCACHE=1
export CCACHE_SIZE=50G
export WITH_SU=true
lunch leos_arm64_bvN-userdebug
#make installclean
make -j12 RELAX_USES_LIBRARY_CHECK=true systemimage
cp out/target/product/leos_arm64_ab/system.img treble_adapter/LeOS-U-VNDK-arm64_bvN.img
2023-12-13 10:51:45 +01:00
echo "--> Building LeOS-U-VNDKLITE-arm64-bvN"
sudo bash lite-adapterN.sh 64 ../out/target/product/leos_arm64_ab/system.img
mv s.img LeOS-U-VNDKLITE-arm64-bvN.img
sudo rm -rf d tmp
cd ..
echo
2023-12-19 13:19:06 +01:00
echo
echo "--> Building treble_a64_bvN"
export WITHOUT_CHECK_API=true
export USE_CCACHE=1
export CCACHE_SIZE=50G
export WITH_SU=true
lunch leos_a64_bvN-userdebug
#make installclean
make -j12 RELAX_USES_LIBRARY_CHECK=true systemimage
cp out/target/product/leos_a64_ab/system.img treble_adapter/LeOS-U-VNDK-a64-bvN.img
2023-12-13 10:51:45 +01:00
echo "--> Building LeOS-U-VNDKLITE-a64-bvN"
sudo bash lite-adapterNa64.sh 32 ../out/target/product/leos_a64_ab/system.img
mv s.img LeOS-U-VNDKLITE-a64-bvN.img
sudo rm -rf d tmp
cd ..
echo
cd prebuilts/prebuiltapks/foss_nano/
bash update.sh
cd ../../..
2023-12-19 13:19:06 +01:00
echo "--> Building treble_a64_bvS"
2023-12-13 10:51:45 +01:00
export WITHOUT_CHECK_API=true
export USE_CCACHE=1
export CCACHE_SIZE=50G
export WITH_SU=true
2023-12-19 13:19:06 +01:00
lunch leos_a64_bvS-userdebug
2023-12-13 10:51:45 +01:00
#make installclean
make -j12 RELAX_USES_LIBRARY_CHECK=true systemimage
2023-12-19 13:19:06 +01:00
echo "--> Building LeOS-U-VNDKLITE-a64-bvS.img"
cd treble_adapter
sudo bash lite-adapterSa64.sh 32 ../out/target/product/leos_a64_ab/system.img
mv s.img LeOS-U-VNDKLITE-a64-bvS.img
sudo rm -rf d tmp
2023-12-13 10:51:45 +01:00
}
2023-12-13 10:41:07 +01:00
2023-12-13 10:51:45 +01:00
generatePackages() {
2023-12-19 13:19:06 +01:00
echo "--> Generating packages"
2023-12-13 10:51:45 +01:00
cd treble_adapter
xz -vT0 *.img
cp *.img.xz /media/ich/exSSD2/leos-cloud/LeOS-Files/LeOS-U/$MONTH/
echo
}
echo "READY"
START=$(date +%s)
initRepos
syncRepos
applyPatches
setupEnv
buildTrebleApp
buildVanillaVariant
generatePackages
END=$(date +%s)
ELAPSEDM=$(($(($END-$START))/60))
ELAPSEDS=$(($(($END-$START))-$ELAPSEDM*60))
echo "--> Buildbot completed in $ELAPSEDM minutes and $ELAPSEDS seconds"
echo