3 # This file is part of the coreboot project.
5 # Copyright (C) 2014 Sage Electronic Engineering, LLC.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; version 2 of the License.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 if [ -d "${top}/.git" ] && [ -f "$(command -v git)" ]; then
25 GITREV
=$
(LANG
= git log remotes
/origin
/master
-1 --format=format
:%h
)
27 DATE
=$
(git log
--pretty=format
:%ct
-1)
30 TIMESOURCE
="LANG= TZ=UTC date"
34 #Print out the information that goes into build.h
35 printf "/* build system definitions (autogenerated) */\n"
36 printf "#ifndef __BUILD_H\n"
37 printf "#define __BUILD_H\n\n"
38 printf "#define COREBOOT_VERSION %s\n" "\"$KERNELVERSION\""
40 #See if the build is running in a git repo and the git command is available
41 printf "/* timesource: $TIMESOURCE */\n"
42 printf "#define COREBOOT_VERSION_TIMESTAMP $DATE\n"
43 printf "#define COREBOOT_ORIGIN_GIT_REVISION \"$GITREV\"\n"
45 printf "#define COREBOOT_EXTRA_VERSION \"%s\"\n" "$COREBOOT_EXTRA_VERSION"
46 printf "#define COREBOOT_BUILD \"%s\"\n" "$(LANG= TZ=UTC date -d @$DATE)"
47 printf "#define COREBOOT_BUILD_YEAR_BCD 0x%s\n" "$(TZ=UTC date -d @$DATE +%y)"
48 printf "#define COREBOOT_BUILD_MONTH_BCD 0x%s\n" "$(TZ=UTC date -d @$DATE +%m)"
49 printf "#define COREBOOT_BUILD_DAY_BCD 0x%s\n" "$(TZ=UTC date -d @$DATE +%d)"
50 printf "#define COREBOOT_BUILD_WEEKDAY_BCD 0x%s\n" "$(TZ=UTC date -d @$DATE +%w)"
51 printf "#define COREBOOT_DMI_DATE \"%s\"\n" "$(TZ=UTC date -d @$DATE +%m/%d/%Y)"
53 printf "#define COREBOOT_COMPILE_TIME \"%s\"\n" "$(TZ=UTC date -d @$DATE +%T)"