aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur She <arthur.she@linaro.org>2016-01-20 20:18:42 -0800
committerArthur She <arthur.she@linaro.org>2016-02-24 10:20:59 +0800
commitab18e055839d4b8e773b198a167a6fca2d52a78e (patch)
tree41f3128758c815dce16777eb0a6456c0d327d364
parent6e9befaccddb1529be8312f5b5a3bc4ee91c37a9 (diff)
downloadlinaro-android-build-tools-ab18e055839d4b8e773b198a167a6fca2d52a78e.tar.gz
To store needed values in build_config.json and publish it to snapshots
along with other build artifacts. Change-Id: I6f7089a29fb7dd277c590a17280fc889be3291c6
-rw-r--r--build-scripts/build-android37
1 files changed, 37 insertions, 0 deletions
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 <<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
+
flatten_artifacts