2015-02-13 03:32:41 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# This file is part of the coreboot project.
|
|
|
|
#
|
|
|
|
# Copyright (C) 2014 Sage Electronic Engineering, LLC.
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; version 2 of the License.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
|
2015-03-07 01:50:22 +01:00
|
|
|
DATE=""
|
|
|
|
GITREV=""
|
|
|
|
TIMESOURCE=""
|
2015-06-07 02:07:34 +02:00
|
|
|
|
|
|
|
export LANG=C
|
2015-06-07 02:10:57 +02:00
|
|
|
export LC_ALL=C
|
2017-09-27 15:06:57 +02:00
|
|
|
export TZ=UTC0
|
2015-06-07 02:07:34 +02:00
|
|
|
|
2016-03-13 04:15:18 +01:00
|
|
|
if [ "${BUILD_TIMELESS}" = "1" ]; then
|
2016-01-24 16:00:50 +01:00
|
|
|
GITREV=Timeless
|
|
|
|
TIMESOURCE="fixed"
|
|
|
|
DATE=0
|
2018-01-14 12:59:47 +01:00
|
|
|
elif [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]; then
|
2019-03-30 23:09:57 +01:00
|
|
|
GITREV=$(LANG= git log --no-show-signature -1 --format=format:%h)
|
2015-03-07 01:50:22 +01:00
|
|
|
TIMESOURCE=git
|
2019-03-30 23:09:57 +01:00
|
|
|
DATE=$(git log --no-show-signature --pretty=format:%ct -1)
|
2015-03-07 01:50:22 +01:00
|
|
|
else
|
|
|
|
GITREV=Unknown
|
2015-08-09 20:53:16 +02:00
|
|
|
TIMESOURCE="date"
|
2017-09-27 15:06:57 +02:00
|
|
|
DATE=$(LANG= LC_ALL=C TZ=UTC0 date +%s)
|
2015-03-07 01:50:22 +01:00
|
|
|
fi
|
2015-03-07 01:34:55 +01:00
|
|
|
|
2015-03-27 00:15:20 +01:00
|
|
|
our_date() {
|
|
|
|
case $(uname) in
|
2015-09-09 11:16:40 +02:00
|
|
|
NetBSD|OpenBSD|DragonFly|FreeBSD|Darwin)
|
2015-06-07 02:07:34 +02:00
|
|
|
date -r $1 $2
|
2015-03-27 00:15:20 +01:00
|
|
|
;;
|
|
|
|
*)
|
2015-06-07 02:07:34 +02:00
|
|
|
date -d @$1 $2
|
2015-03-27 00:15:20 +01:00
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2015-02-13 03:32:41 +01:00
|
|
|
#Print out the information that goes into build.h
|
|
|
|
printf "/* build system definitions (autogenerated) */\n"
|
|
|
|
printf "#ifndef __BUILD_H\n"
|
|
|
|
printf "#define __BUILD_H\n\n"
|
|
|
|
printf "#define COREBOOT_VERSION %s\n" "\"$KERNELVERSION\""
|
|
|
|
|
|
|
|
#See if the build is running in a git repo and the git command is available
|
2015-03-07 01:50:22 +01:00
|
|
|
printf "/* timesource: $TIMESOURCE */\n"
|
|
|
|
printf "#define COREBOOT_VERSION_TIMESTAMP $DATE\n"
|
|
|
|
printf "#define COREBOOT_ORIGIN_GIT_REVISION \"$GITREV\"\n"
|
2015-02-13 03:32:41 +01:00
|
|
|
|
|
|
|
printf "#define COREBOOT_EXTRA_VERSION \"%s\"\n" "$COREBOOT_EXTRA_VERSION"
|
2019-02-15 17:39:56 +01:00
|
|
|
printf "#define COREBOOT_MAJOR_VERSION %d\n#define COREBOOT_MINOR_VERSION %d\n" `git describe --match [0-9].[0-9]* | sed 's/\([0-9]\)\.\([0-9]\+\).*/\1 \2/'`
|
2015-06-07 02:07:34 +02:00
|
|
|
printf "#define COREBOOT_BUILD \"$(our_date "$DATE")\"\n"
|
2015-03-27 00:15:20 +01:00
|
|
|
printf "#define COREBOOT_BUILD_YEAR_BCD 0x$(our_date "$DATE" +%y)\n"
|
|
|
|
printf "#define COREBOOT_BUILD_MONTH_BCD 0x$(our_date "$DATE" +%m)\n"
|
|
|
|
printf "#define COREBOOT_BUILD_DAY_BCD 0x$(our_date "$DATE" +%d)\n"
|
|
|
|
printf "#define COREBOOT_BUILD_WEEKDAY_BCD 0x$(our_date "$DATE" +%w)\n"
|
|
|
|
printf "#define COREBOOT_DMI_DATE \"$(our_date "$DATE" +%m/%d/%Y)\"\n"
|
2015-02-13 03:32:41 +01:00
|
|
|
printf "\n"
|
2015-03-27 00:15:20 +01:00
|
|
|
printf "#define COREBOOT_COMPILE_TIME \"$(our_date "$DATE" +%T)\"\n"
|
2019-02-25 21:24:19 +01:00
|
|
|
printf "#define ASL_VERSION 0x%d\n" `./util/crossgcc/xgcc/bin/iasl -v | grep version | sed 's/.*version //'`
|
2015-02-13 03:32:41 +01:00
|
|
|
printf "#endif\n"
|