mb/google/poppy/variants/nocturne: remove dup'ed dptf_enable
[coreboot.git] / util / genbuild_h / genbuild_h.sh
blob95846ceae6cd6229ab2ca46e457e3002e658eab4
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.
17 DATE=""
18 GITREV=""
19 TIMESOURCE=""
21 export LANG=C
22 export LC_ALL=C
23 export TZ=UTC0
25 if [ "${BUILD_TIMELESS}" = "1" ]; then
26 GITREV=Timeless
27 TIMESOURCE="fixed"
28 DATE=0
29 elif [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]; then
30 GITREV=$(LANG= git log -1 --format=format:%h)
31 TIMESOURCE=git
32 DATE=$(git log --pretty=format:%ct -1)
33 else
34 GITREV=Unknown
35 TIMESOURCE="date"
36 DATE=$(LANG= LC_ALL=C TZ=UTC0 date +%s)
39 our_date() {
40 case $(uname) in
41 NetBSD|OpenBSD|DragonFly|FreeBSD|Darwin)
42 date -r $1 $2
45 date -d @$1 $2
46 esac
49 #Print out the information that goes into build.h
50 printf "/* build system definitions (autogenerated) */\n"
51 printf "#ifndef __BUILD_H\n"
52 printf "#define __BUILD_H\n\n"
53 printf "#define COREBOOT_VERSION %s\n" "\"$KERNELVERSION\""
55 #See if the build is running in a git repo and the git command is available
56 printf "/* timesource: $TIMESOURCE */\n"
57 printf "#define COREBOOT_VERSION_TIMESTAMP $DATE\n"
58 printf "#define COREBOOT_ORIGIN_GIT_REVISION \"$GITREV\"\n"
60 printf "#define COREBOOT_EXTRA_VERSION \"%s\"\n" "$COREBOOT_EXTRA_VERSION"
61 printf "#define COREBOOT_BUILD \"$(our_date "$DATE")\"\n"
62 printf "#define COREBOOT_BUILD_YEAR_BCD 0x$(our_date "$DATE" +%y)\n"
63 printf "#define COREBOOT_BUILD_MONTH_BCD 0x$(our_date "$DATE" +%m)\n"
64 printf "#define COREBOOT_BUILD_DAY_BCD 0x$(our_date "$DATE" +%d)\n"
65 printf "#define COREBOOT_BUILD_WEEKDAY_BCD 0x$(our_date "$DATE" +%w)\n"
66 printf "#define COREBOOT_DMI_DATE \"$(our_date "$DATE" +%m/%d/%Y)\"\n"
67 printf "\n"
68 printf "#define COREBOOT_COMPILE_TIME \"$(our_date "$DATE" +%T)\"\n"
69 printf "#endif\n"