Skip to content

Commit

Permalink
build.sh: add repo meta information to kbuild build version
Browse files Browse the repository at this point in the history
If this was built out of a repo tree (which is usually the case for the
prebuilt kernel images), compute KBUILD_BUILD_VERSION out of repo's
current manifest branch.

This creates an entry that can be inspected by `uname -v` at runtime or
can be derived from the kernel binary:

  $ zgrep -a 'Linux version' Image.gz
    Linux version 5.4.0 .... #1 repo:common-android-mainline SMP PREEMPT ..

Bug: 143359504
Change-Id: Ib6c2ce1f96e9a4003a74d448751750d61e97d584
Signed-off-by: Matthias Maennich <[email protected]>
  • Loading branch information
metti committed Oct 28, 2019
1 parent 5e39cad commit c3c82f0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions _setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ export COMMON_OUT_DIR=$(readlink -m ${OUT_DIR:-${ROOT_DIR}/out/${BRANCH}})
export OUT_DIR=$(readlink -m ${COMMON_OUT_DIR}/${KERNEL_DIR})
export DIST_DIR=$(readlink -m ${DIST_DIR:-${COMMON_OUT_DIR}/dist})

if which repo > /dev/null; then
# extract the repo branch name (e.g. common-android-mainline)
repo_branch=$(repo --color=never info -o | grep -E "Manifest merge branch" |
sed "s|.*refs/heads/\(.*\)|\1|")
export KBUILD_BUILD_VERSION="1 repo:$repo_branch"
fi

echo "========================================================"
echo "= build config: ${ROOT_DIR}/${BUILD_CONFIG}"
cat ${ROOT_DIR}/${BUILD_CONFIG}
Expand Down

0 comments on commit c3c82f0

Please sign in to comment.