From ab18e055839d4b8e773b198a167a6fca2d52a78e Mon Sep 17 00:00:00 2001 From: Arthur She Date: Wed, 20 Jan 2016 20:18:42 -0800 Subject: To store needed values in build_config.json and publish it to snapshots along with other build artifacts. Change-Id: I6f7089a29fb7dd277c590a17280fc889be3291c6 --- build-scripts/build-android | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/build-scripts/build-android b/build-scripts/build-android index 28076e1..ff9110c 100644 --- a/build-scripts/build-android +++ b/build-scripts/build-android @@ -236,4 +236,41 @@ 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_remote=`echo ${kernel_proj_str} | grep -o "remote[^ ]*" | cut -d"\"" -f2` + kernel_repo_path=`echo ${kernel_proj_str} | grep -o "name[^ ]*" | cut -d"\"" -f2` + kernel_remote_str=`grep "remote .* name=\"${kernel_remote}\"" out/pinned-manifest.xml` + kernel_repo=`echo ${kernel_remote_str} | grep -o "fetch[^ ]*" | cut -d"\"" -f2`${kernel_repo_path}".git" +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` +cd out/target/product/${TARGET_OUT_DIR}/boot/ +dtbfs="" +for f in *.dtb; +do + dtbfs="\"$f\", $dtbfs" +done +cd - +dtb="[${dtbfs%,*}]" +cat > out/build_config.json <