blob: 94b30c04e0707f5381dbfe02122520e9ed008b1e (
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
27
28
29
30
31
32
33
34
35
36
37
38
|
# Freescale 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 (default to '+fslc')
#
# Copyright 2014 (C) O.S. Systems Software LTDA.
SCMVERSION ??= "y"
LOCALVERSION ??= "+fslc"
UBOOT_LOCALVERSION = "${LOCALVERSION}"
do_compile:prepend() {
if [ "${SCMVERSION}" = "y" ]; then
# Add GIT revision to the local version
if [ "${SRCREV}" = "INVALID" ]; then
hash=${SRCREV_machine}
else
hash=${SRCREV}
fi
if [ "$hash" = "AUTOINC" ]; then
branch=`git --git-dir=${S}/.git symbolic-ref --short -q HEAD`
head=`git --git-dir=${S}/.git rev-parse --verify --short origin/${branch} 2> /dev/null`
else
head=`git --git-dir=${S}/.git rev-parse --verify --short $hash 2> /dev/null`
fi
patches=`git --git-dir=${S}/.git rev-list --count $head..HEAD 2> /dev/null`
printf "%s%s%s%s" +g $head +p $patches > ${S}/.scmversion
printf "%s%s%s%s" +g $head +p $patches > ${B}/.scmversion
else
printf "%s" "${UBOOT_LOCALVERSION}" > ${S}/.scmversion
printf "%s" "${UBOOT_LOCALVERSION}" > ${B}/.scmversion
fi
}
|