summaryrefslogtreecommitdiff
path: root/classes/toradex-u-boot-localversion.bbclass
blob: 3ad86dbc1f05d38411192d52c57ccc1001963098 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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.

TDX_VERSION ??= "0"
SCMVERSION ??= "y"
LOCALVERSION ??= "-${TDX_VERSION}"

UBOOT_LOCALVERSION = "${LOCALVERSION}"

do_compile_prepend() {
	if [ "${SCMVERSION}" = "y" ]; then
		head=`cd ${S} ; git rev-parse --verify --short=12 HEAD 2> /dev/null`
		printf "%s+git.%s" "${UBOOT_LOCALVERSION}" $head > ${S}/.scmversion
		printf "%s+git.%s" "${UBOOT_LOCALVERSION}" $head > ${B}/.scmversion
	fi
}