t132: Add monotonic_timer.c to rmodules_arm
[coreboot.git] / util / genbuild_h / genbuild_h.sh
blobb161dffcafc09d051fba609e8f1aaef564903782
1 #!/bin/sh
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
21 DATE=""
22 GITREV=""
23 TIMESOURCE=""
24 if [ -d "${top}/.git" ] && [ -f "$(command -v git)" ]; then
25 GITREV=$(LANG= git log remotes/origin/master -1 --format=format:%h)
26 TIMESOURCE=git
27 DATE=$(git log --pretty=format:%ct -1)
28 else
29 GITREV=Unknown
30 TIMESOURCE="LANG= TZ=UTC date"
31 DATE=$(date +%s)
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)"
52 printf "\n"
53 printf "#define COREBOOT_COMPILE_TIME \"%s\"\n" "$(TZ=UTC date -d @$DATE +%T)"
54 printf "#endif\n"