From d18babde5a6fdaf757c88d676e4fbd021bb078a7 Mon Sep 17 00:00:00 2001 From: Andy CrossGate Yan Date: Sat, 30 Oct 2021 02:34:03 +0000 Subject: [PATCH] Initial unified commit for Android 12 --- README.md | 35 +++++++ buildbot_unified.sh | 140 ++++++++++++++++++++++++++++ local_manifests_treble/manifest.xml | 10 ++ 3 files changed, 185 insertions(+) create mode 100644 README.md create mode 100755 buildbot_unified.sh create mode 100644 local_manifests_treble/manifest.xml diff --git a/README.md b/README.md new file mode 100644 index 0000000..d654d91 --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ + +## Building PHH-based LineageOS GSIs ## + +To get started with building LineageOS GSI, you'll need to get familiar with [Git and Repo](https://source.android.com/source/using-repo.html), and set up your environment by referring to [LineageOS Wiki](https://wiki.lineageos.org/devices/redfin/build) (mainly "Install the build packages") and [How to build a GSI](https://github.com/phhusson/treble_experimentations/wiki/How-to-build-a-GSI%3F). + +First, open a new Terminal window, which defaults to your home directory. Clone the modified treble_experimentations repo there: + + git clone https://github.com/AndyCGYan/treble_experimentations + +Create a new working directory for your LineageOS build and navigate to it: + + mkdir lineage-18.x-build-gsi; cd lineage-18.x-build-gsi + +Initialize your LineageOS workspace: + + repo init -u https://github.com/LineageOS/android.git -b lineage-18.1 + +Clone both this and the patches repos: + + git clone https://github.com/AndyCGYan/lineage_build_unified lineage_build_unified -b lineage-18.1 + git clone https://github.com/AndyCGYan/lineage_patches_unified lineage_patches_unified -b lineage-18.1 + +Finally, start the build script - for example, to build for all supported archs: + + bash lineage_build_unified/buildbot_unified.sh treble 32B A64B 64B + +Be sure to update the cloned repos from time to time! + +--- + +Note: A-only and VNDKLite targets are generated from AB images instead of source-built - refer to [sas-creator](https://github.com/AndyCGYan/sas-creator). + +--- + +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. diff --git a/buildbot_unified.sh b/buildbot_unified.sh new file mode 100755 index 0000000..cc7e010 --- /dev/null +++ b/buildbot_unified.sh @@ -0,0 +1,140 @@ +#!/bin/bash +echo "" +echo "LineageOS 19.x Unified Buildbot" +echo "ATTENTION: this script syncs repo on each run" +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 + +PERSONAL=false +if [ ${!#} == "personal" ] +then + PERSONAL=true +fi + +# 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)" +WITHOUT_CHECK_API=true +WITH_SU=true + +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 "" + +./vendor/lineage/build/tools/repopick.py -t twelve-monet +./vendor/lineage/build/tools/repopick.py 317119 # Unset BOARD_EXT4_SHARE_DUP_BLOCKS +./vendor/lineage/build/tools/repopick.py 317574 -f # ThemePicker: Grant missing wallpaper permissions +./vendor/lineage/build/tools/repopick.py 317602 # Keyguard: don't use large clock on landscape +./vendor/lineage/build/tools/repopick.py 317606 # LineageParts: Temporary hax +./vendor/lineage/build/tools/repopick.py 317608 # Support for device specific key handlers +./vendor/lineage/build/tools/repopick.py 317609 # Allow adjusting progress on touch events. +./vendor/lineage/build/tools/repopick.py 318037 # Statusbar: show vibration icon in collapsed statusbar + +echo "Setting up build environment" +source build/envsetup.sh &> /dev/null +mkdir -p ~/build-output +echo "" + +apply_patches() { + echo "Applying patch group ${1}" + bash ~/treble_experimentations/apply-patches.sh ./lineage_patches_unified/${1} +} + +prep_device() { + : +} + +prep_treble() { + apply_patches patches_treble_prerequisite + apply_patches patches_treble_phh +} + +finalize_device() { + : +} + +finalize_treble() { + rm -f device/*/sepolicy/common/private/genfs_contexts + cd device/phh/treble + git clean -fdx + bash generate.sh lineage + cd ../../.. +} + +build_device() { + brunch ${1} + mv $OUT/lineage-*.zip ~/build-output/lineage-19.0-$BUILD_DATE-UNOFFICIAL-${1}$($PERSONAL && echo "-personal" || echo "").zip +} + +build_treble() { + case "${1}" in + #("32B") TARGET=treble_arm_bvS;; + ("A64B") TARGET=treble_a64_bvS;; + ("64B") TARGET=treble_arm64_bvS;; + (*) echo "Invalid target - exiting"; exit 1;; + esac + lunch ${TARGET}-userdebug + make installclean + make -j$(nproc --all) systemimage + mv $OUT/system.img ~/build-output/lineage-19.0-$BUILD_DATE-UNOFFICIAL-${TARGET}$(${PERSONAL} && echo "-personal" || echo "").img + make vndk-test-sepolicy +} + +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 "" + +for var in "${@:2}" +do + if [ ${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 + +END=`date +%s` +ELAPSEDM=$(($(($END-$START))/60)) +ELAPSEDS=$(($(($END-$START))-$ELAPSEDM*60)) +echo "Buildbot completed in $ELAPSEDM minutes and $ELAPSEDS seconds" +echo "" diff --git a/local_manifests_treble/manifest.xml b/local_manifests_treble/manifest.xml new file mode 100644 index 0000000..fe6a9e1 --- /dev/null +++ b/local_manifests_treble/manifest.xml @@ -0,0 +1,10 @@ + + + + + + + + + +