summaryrefslogtreecommitdiff
path: root/meta-phosphor/classes/obmc-phosphor-kernel-version.bbclass
diff options
context:
space:
mode:
authorLei YU <mine260309@gmail.com>2019-05-16 02:52:10 +0300
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2019-05-21 03:43:56 +0300
commitb5a2c26b248ab6cfb47a346fcec542f2297d297b (patch)
tree9d8fa9f5c66cc457e9c6a71a4d8e11f14153b155 /meta-phosphor/classes/obmc-phosphor-kernel-version.bbclass
parenta4029ea5335ae9cd61f810456b8c7c1edab43402 (diff)
downloadopenbmc-b5a2c26b248ab6cfb47a346fcec542f2297d297b.tar.xz
meta-phosphor: Improve kernel version string
The kernel version string by yocto by default is <tag>-<revision>, e.g. 5.0.7-b1b37a25644213428f4bab4c427581dd923e35da Where the revision is the version specified by SRCREV, no matter if there are additional pathces applied or not. This commit improves it by * If there are no yocto patches, keep the current version but use a shorter revision, e.g. 5.0.7-b1b37a2 * If there are yocto patches, append -dirty-<new-short-revision> to the version string, e.g. 5.0.7-b1b37a2-dirty-84fa553 Resolves openbmc/openbmc#1289 Tested: Verify the kernel version string is changed as above depending on if there are yocto patches. (From meta-phosphor rev: fcfd10d7380309bc274c4f5a8355ecaeb60ce439) Change-Id: I4210227a981721a6b322d640984ea58c57802cb1 Signed-off-by: Lei YU <mine260309@gmail.com> Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'meta-phosphor/classes/obmc-phosphor-kernel-version.bbclass')
-rw-r--r--meta-phosphor/classes/obmc-phosphor-kernel-version.bbclass17
1 files changed, 17 insertions, 0 deletions
diff --git a/meta-phosphor/classes/obmc-phosphor-kernel-version.bbclass b/meta-phosphor/classes/obmc-phosphor-kernel-version.bbclass
new file mode 100644
index 0000000000..8fa8947e5e
--- /dev/null
+++ b/meta-phosphor/classes/obmc-phosphor-kernel-version.bbclass
@@ -0,0 +1,17 @@
+do_kernel_configme_append() {
+ # Remove previous CONFIG_LOCALVERSION
+ sed -i '/CONFIG_LOCALVERSION/d' ${B}/.config
+
+ # Latest version after yocto patched (if any)
+ latestVersion="-$(git rev-parse --verify HEAD)"
+ shortLatestVersion="$(echo ${latestVersion} | cut -c1-8)"
+
+ shortLinuxVersionExt="$(echo ${LINUX_VERSION_EXTENSION} | cut -c1-8)"
+
+ if [ "${latestVersion}" != "${LINUX_VERSION_EXTENSION}" ]; then
+ dirtyString="-dirty"
+ echo "CONFIG_LOCALVERSION="\"${shortLinuxVersionExt}${dirtyString}${shortLatestVersion}\" >> ${B}/.config
+ else
+ echo "CONFIG_LOCALVERSION="\"${shortLinuxVersionExt}\" >> ${B}/.config
+ fi
+}