aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2019-07-22 23:05:49 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2019-07-22 23:05:49 +0800
commitb8a65ebf947f09dd546423db6a5c289d52567454 (patch)
tree1049b6b95c1b7929a49b91d7c0ba952ade57ecb9
parent8647692a2ea9913e07c58d153125c1e53a030b34 (diff)
build-android-lcr: support to use linaro-build.sh for lcr building
This build-android-lcr script is copied from build-android scirpt. It is used to support the kernel building before running make droidcore for android building. Because with the aosp master now, the kernel modules files must be there already before running make droidcore, otherwise the ko files won't be integrated successfully into the vendor partition Also deleted some settings which in the build-android script, but won't be used for lcr builds now. Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org> Change-Id: I08b1f5426f1827706b66c2b9db8bae9db7e3c260
-rwxr-xr-xbuild-scripts/build-android-lcr167
1 files changed, 167 insertions, 0 deletions
diff --git a/build-scripts/build-android-lcr b/build-scripts/build-android-lcr
new file mode 100755
index 0000000..58ba027
--- /dev/null
+++ b/build-scripts/build-android-lcr
@@ -0,0 +1,167 @@
+###############################################################################
+# Copyright (c) 2019 Linaro
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+
+export PATH=$PATH:~/bin/
+set -o errtrace
+
+git config --global user.email "android-build-bot@fake-email.com"
+git config --global user.name "android-build-bot"
+
+source "${BUILD_SCRIPT_ROOT}"/helpers
+
+trap infrastructure_error ERR
+
+if [ -z "${TARGET_OUT_DIR}" ]; then
+ # only set TARGET_OUT_DIR when it is not set
+ # Set TARGET_OUT_DIR since few TARGET_PRODUCT include "full_" keyword as well
+ export TARGET_OUT_DIR=`echo $TARGET_PRODUCT | sed 's/_/\n/;s/.*\n//'`
+fi
+
+calc_make_jobs
+
+java -version
+
+# Download overlays ASAP for fail-fast approach
+if [ -n "$SOURCE_OVERLAY" ]; then
+ download_overlays "$SOURCE_OVERLAY"
+ unpack_overlays "$SOURCE_OVERLAY"
+fi
+
+# Remove any old local manifest and manifest which can break repo init if
+# duplicate repository are found or forceful manifest update
+rm -rf .repo/local_manifests .repo/manifest*
+
+if [ -n "$REPO_SEED_URL" ]; then
+ repo-sync-from-seed "${1}"
+else
+ repo-sync-from-mirror "${1}"
+fi
+
+if [ -n "$GERRIT_PROJECT" ] && [ $GERRIT_PROJECT != "android-build-configs" ] && [ $GERRIT_EVENT_TYPE == "comment-added" ]; then
+ if [ ${GERRIT_HOST} == "dev-private-review.linaro.org" ]; then
+ GERRIT_URL="ssh://git@${GERRIT_HOST}/${GERRIT_PROJECT}"
+ else
+ GERRIT_URL="http://${GERRIT_HOST}/${GERRIT_PROJECT}"
+ fi
+ if [ "$GERRIT_PROJECT" == "platform/manifest" ] || [ "$GERRIT_PROJECT" == "linaro-art/platform/manifest" ]; then
+ cd .repo/local_manifests;
+ git pull ${GERRIT_URL} $GERRIT_REFSPEC
+ cd -
+ repo sync -j16
+ else
+ cd `grep -rni $GERRIT_PROJECT\" .repo/local_manifests | grep -Po 'path="\K[^"]*'`
+ if git pull ${GERRIT_URL} ${GERRIT_REFSPEC} | grep -q "Automatic merge failed"; then
+ git reset --hard
+ echo "Error: *** Error patch merge failed"
+ exit 1
+ fi
+ cd -
+ fi
+fi
+
+if [ -n "$PATCHSETS" ]; then
+ for i in $PATCHSETS; do
+ sh ./android-patchsets/$i
+ done
+fi
+
+# Generate a Changelog describing additional patches applied to AOSP codebase
+export android_version=`grep -rni "refs/tags" .repo/manifest.xml | sed -e "s/.*tags\///" -e "s/\"//g"`
+repo forall -c 'if git rev-parse $android_version >/dev/null 2>&1
+ then
+ patches=`git log --oneline --no-merges $android_version..HEAD | wc -l`
+ if [ $patches -ne 0 ]; then
+ git_remote=`git remote -v | grep "fetch" | cut -f2 | cut -d " " -f1`
+ echo "====================================================================="
+ echo "Patchsets applied to $git_remote on top of $android_version"
+ git diff --stat $android_version HEAD
+ git log --oneline --no-merges $android_version..HEAD
+ echo ""
+ fi;
+fi' | cat > temp_changelog.txt
+files_changed=`add_changes \`grep -e "file changed" -e "files changed" temp_changelog.txt | cut -d " " -f2\``
+insertions=`add_changes \`grep -e "file changed" -e "files changed" temp_changelog.txt | cut -d " " -f5\``
+deletions=`add_changes \`grep -e "file changed" -e "files changed" temp_changelog.txt | cut -d " " -f7\``
+echo "=====================================================================" > changelog.txt
+echo "=====================================================================" >> changelog.txt
+echo "$files_changed files changed, $insertions insertions(+), $deletions deletions(-)" >> changelog.txt
+echo "=====================================================================" >> changelog.txt
+echo "=====================================================================" >> changelog.txt
+echo "" >> changelog.txt
+cat temp_changelog.txt >> changelog.txt
+
+trap - ERR
+export TIMEFORMAT="TIME: Compilation: %lR"
+if [ -f ./android-build-configs/linaro-build.sh ]; then
+ time ./android-build-configs/linaro-build.sh -c ${BUILD_CONFIG_FILENAME}" -ss
+else
+ source build/envsetup.sh
+ time $MAKE $MAKE_OPTS -j$MAKE_JOBS $MAKE_TARGETS
+fi
+unset TIMEFORMAT
+trap infrastructure_error ERR
+
+# Show remaining disk space to catch early if
+# we're approaching ramdisk limit again
+echo "Remaining disk space after build:"
+df
+
+# Store kernel .config as a build artifact
+if [ -f kernel/.config ]; then
+ cp kernel/.config out/kernel_config
+elif [ -f "out/target/product/$TARGET_OUT_DIR/obj/kernel/.config" ]; then
+ cp "out/target/product/$TARGET_OUT_DIR/obj/kernel/.config" out/kernel_config
+fi
+# Create md5sums file for platform artifacts
+(cd out/target/product/${TARGET_OUT_DIR}/; md5sum *.tar.bz2 *.img *.img.bz2 >MD5SUMS) || true
+
+if [ ! -n "$SKIP_LICENSE_CHECK" ]; then
+ ${BUILD_SCRIPT_ROOT}/license-verification.sh out/pinned-manifest.xml out/target/product/$TARGET_PRODUCT/BUILD-INFO.txt
+fi
+
+if [ -n "$PUBLISH_DESCRIPTIONS" ]; then
+ ${BUILD_SCRIPT_ROOT}/../utils/manifest-descriptions/make.sh out/source-manifest.xml out/pinned-manifest.xml
+fi
+
+# Create build_config.json as a build artifact
+target_kernel_src=`grep '^TARGET_KERNEL_SOURCE' device/linaro/${TARGET_PRODUCT}/BoardConfig.mk|cut -d'=' -f2|tr -d '[[:space:]]'`
+if [ -n "${target_kernel_src}" ]; then
+ kernel_proj_str=`grep "path=\"${target_kernel_src}\"" out/pinned-manifest.xml`
+ kernel_rev=`echo ${kernel_proj_str} | grep -o "revision[^ ]*" | cut -d"\"" -f2`
+ kernel_branch=`echo ${kernel_proj_str} | grep -o "upstream[^ ]*" | cut -d"\"" -f2`
+ kernel_repo_path=`echo ${kernel_proj_str} | grep -o "path[^ ]*" | cut -d"\"" -f2`
+ cd $kernel_repo_path
+ kernel_repo=`git remote -v | grep "fetch" | cut -f2 | cut -d " " -f1`
+ cd -
+fi
+android_ver=`grep "ro\.build\.version\.release" out/target/product/${TARGET_OUT_DIR}/system/build.prop|cut -d"=" -f2`
+toolchain=`echo ${ANDROID_TOOLCHAIN}|awk -F'/' '{print $(NF-1)}'`
+build_arch=`echo ${toolchain} | cut -d"-" -f1`
+compiler=`$(find ${ANDROID_TOOLCHAIN} -name "*-gcc"|head -n1) --version | head -n1`
+dtbs=`find out -iname *.dtb | rev | cut -d"/" -f1 | rev | sort | uniq`
+dtbfs=""
+for f in $dtbs;
+do
+ dtbfs="\"$f\", $dtbfs"
+done
+dtb="[${dtbfs%,*}]"
+cat > out/build_config.json <<EOF
+{
+ "kernel_repo" : "${kernel_repo}",
+ "kernel_commit_id" : "${kernel_rev}",
+ "kernel_branch" : "${kernel_branch}",
+ "android_version" : "${android_ver}",
+ "android_toolchain" : "${toolchain}",
+ "build_arch" : "${build_arch}",
+ "compiler" : "${compiler}",
+ "dtb" : ${dtb}
+}
+EOF
+cp changelog.txt out/
+
+flatten_artifacts