80 lines
2.5 KiB
Bash
Executable File
80 lines
2.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build LineageOS 14.1 for the Samsung Galaxy Tab Active SM-T365 (rubenslte,
|
|
# msm8226) inside the nix-shell FHS environment (shell_los.nix).
|
|
#
|
|
# The LOS 14.1 source tree is a cm-14.1 repo manifest with local manifests
|
|
# (device/vendor/kernel from git.cfpi-fpsi.eu, millet forks for shared trees);
|
|
# see los-build/.repo/local_manifests/rubenslte.xml and README.md.
|
|
#
|
|
# Usage:
|
|
# ./build_los.sh build boot.img (kernel + dt.img + ramdisk, fast gate)
|
|
# ./build_los.sh bacon full build -> lineage_rubenslte-*.zip
|
|
# ./build_los.sh clean mka clean (no jack --config clean: no server)
|
|
# ./build_los.sh env interactive shell inside the build env
|
|
#
|
|
# Also honors RB_CMD=<cmd> as an override (used by relaunch helpers).
|
|
set -euo pipefail
|
|
|
|
SCRIPT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$SCRIPT"
|
|
|
|
source lib/common.sh
|
|
|
|
CMD="${RB_CMD:-${1:-bootimage}}"
|
|
[ $# -gt 1 ] && echo "warning: ignoring extra args: $*"
|
|
|
|
reenter_build_env \
|
|
"$SCRIPT/shell_los.nix" \
|
|
RUBENSLTE_LOS_IN_ENV \
|
|
"export RB_CMD='$CMD'"
|
|
|
|
export LC_ALL=C LANG=C
|
|
|
|
# ccache (prebuilt from the tree) to speed up rebuild cycles.
|
|
export USE_CCACHE=1
|
|
export CCACHE_DIR="$SCRIPT/.ccache"
|
|
|
|
# Jack compile, as the LOS 14.1 javac fallback leaves dangling with-local
|
|
# intermediates (build/core/java.mk) and cannot build bacon.
|
|
# The jack-admin TLS is broken here (curl TLS1.3 vs Java 8 server), so
|
|
# JACK_SERVER=false disables jack_server_setup.mk's mandatory server-start
|
|
# ninja edge (its "update jack ... || exit 47" aborts ninja), and
|
|
# JACK_NO_SERVER=1 runs Jack in-process for the actual compile.
|
|
export JACK_SERVER=false
|
|
export JACK_NO_SERVER=1
|
|
export JACK_REPOSITORY="$SCRIPT/.jack-repository"
|
|
seed_jack_repository "$JACK_REPOSITORY" "$SCRIPT/los-build/prebuilts/sdk/tools/jacks"
|
|
|
|
cd "$SCRIPT/los-build"
|
|
|
|
# Re-apply any source-tree patches lost on repo sync (idempotent).
|
|
apply_patches patches/kernel
|
|
apply_patches patches/los
|
|
|
|
export TOP="$PWD"
|
|
export ANDROID_BUILD_TOP="$TOP"
|
|
|
|
set +eu
|
|
source build/envsetup.sh >/dev/null 2>&1
|
|
lunch lineage_rubenslte-userdebug >/dev/null 2>&1
|
|
set -e
|
|
|
|
if [ -z "${TARGET_PRODUCT:-}" ]; then
|
|
echo "[!] lunch failed - TARGET_PRODUCT not set"
|
|
exit 1
|
|
fi
|
|
|
|
case "$CMD" in
|
|
clean) mka clean ;;
|
|
env) exec bash ;;
|
|
*) mka "$CMD" ;;
|
|
esac
|
|
RC=$?
|
|
|
|
# Samsung bootloaders require the SEANDROIDENFORCE trailer on boot images.
|
|
BOOT_IMG="$SCRIPT/los-build/out/target/product/rubenslte/boot.img"
|
|
if [ "$RC" -eq 0 ] && [ "$CMD" != "clean" ]; then
|
|
append_seandroidenforce "$BOOT_IMG"
|
|
fi
|
|
|
|
exit "$RC" |