summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--classes/toradex-u-boot-localversion.bbclass25
1 files changed, 25 insertions, 0 deletions
diff --git a/classes/toradex-u-boot-localversion.bbclass b/classes/toradex-u-boot-localversion.bbclass
new file mode 100644
index 0000000..d2b4910
--- /dev/null
+++ b/classes/toradex-u-boot-localversion.bbclass
@@ -0,0 +1,25 @@
+# Toradex U-Boot LOCALVERSION extension
+#
+# This allow to easy reuse of code between different U-Boot recipes
+#
+# The following options are supported:
+#
+# SCMVERSION Puts the Git hash in U-Boot local version
+# LOCALVERSION Value used in LOCALVERSION
+#
+# Copied from meta-freescale/classes/fsl-u-boot-localversion.bbclass
+# Copyright 2014 (C) O.S. Systems Software LTDA.
+# Copyright 2017-2019 (C) Toradex Inc.
+
+SCMVERSION ??= "y"
+LOCALVERSION ??= "-${TDX_VERSION}"
+
+UBOOT_LOCALVERSION = "${LOCALVERSION}"
+
+do_compile_prepend() {
+ if [ "${SCMVERSION}" = "y" ]; then
+ head=`cd ${S} ; git rev-parse --verify --short HEAD 2> /dev/null`
+ printf "%s+git.%s" "${UBOOT_LOCALVERSION}" $head > ${S}/.scmversion
+ printf "%s+git.%s" "${UBOOT_LOCALVERSION}" $head > ${B}/.scmversion
+ fi
+}