2020-12-24 20:06:38 +01:00
|
|
|
#!/usr/bin/env sh
|
2015-02-13 03:32:41 +01:00
|
|
|
#
|
util/: Replace GPLv2 boiler plate with SPDX header
Used commands:
perl -i -p0e 's|\/\*[\s*]*.*is free software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and\/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-2.0-only */|' $(cat filelist)
perl -i -p0e 's|This[\s*]*program[\s*]*is[\s*]*free[\s*]*software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*either[\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License,[\s*]*or[\s*]*.at[\s*]*your[\s*]*option.*[\s*]*any[\s*]*later[\s*]*version.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-2.0-or-later */|' $(cat filelist)
perl -i -p0e 's|\/\*[\s*]*.*This[\s*#]*program[\s*#]*is[\s*#]*free[\s*#]*software[;:,][\s*#]*you[\s*#]*can[\s*#]*redistribute[\s*#]*it[\s*#]*and/or[\s*#]*modify[\s*#]*it[\s*#]*under[\s*#]*the[\s*#]*terms[\s*#]*of[\s*#]*the[\s*#]*GNU[\s*#]*General[\s*#]*Public[\s*#]*License[\s*#]*as[\s*#]*published[\s*#]*by[\s*#]*the[\s*#]*Free[\s*#]*Software[\s*#]*Foundation[;:,][\s*#]*either[\s*#]*version[\s*#]*3[\s*#]*of[\s*#]*the[\s*#]*License[;:,][\s*#]*or[\s*#]*.at[\s*#]*your[\s*#]*option.*[\s*#]*any[\s*#]*later[\s*#]*version.[\s*#]*This[\s*#]*program[\s*#]*is[\s*#]*distributed[\s*#]*in[\s*#]*the[\s*#]*hope[\s*#]*that[\s*#]*it[\s*#]*will[\s*#]*be[\s*#]*useful[;:,][\s*#]*but[\s*#]*WITHOUT[\s*#]*ANY[\s*#]*WARRANTY[;:,][\s*#]*without[\s*#]*even[\s*#]*the[\s*#]*implied[\s*#]*warranty[\s*#]*of[\s*#]*MERCHANTABILITY[\s*#]*or[\s*#]*FITNESS[\s*#]*FOR[\s*#]*A[\s*#]*PARTICULAR[\s*#]*PURPOSE.[\s*#]*See[\s*#]*the[\s*#]*GNU[\s*#]*General[\s*#]*Public[\s*#]*License[\s*#]*for[\s*#]*more[\s*#]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-3.0-or-later */|' $(cat filelist)
perl -i -p0e 's|(\#\#*)[\w]*.*is free software[:;][\#\s]*you[\#\s]*can[\#\s]*redistribute[\#\s]*it[\#\s]*and\/or[\#\s]*modify[\#\s]*it[\s\#]*under[\s \#]*the[\s\#]*terms[\s\#]*of[\s\#]*the[\s\#]*GNU[\s\#]*General[\s\#]*Public[\s\#]*License[\s\#]*as[\s\#]*published[\s\#]*by[\s\#]*the[\s\#]*Free[\s\#]*Software[\s\#]*Foundation[;,][\s\#]*version[\s\#]*2[\s\#]*of[\s\#]*the[\s\#]*License.*[\s\#]*This[\s\#]*program[\s\#]*is[\s\#]*distributed[\s\#]*in[\s\#]*the[\s\#]*hope[\s\#]*that[\s\#]*it[\s\#]*will[\#\s]*be[\#\s]*useful,[\#\s]*but[\#\s]*WITHOUT[\#\s]*ANY[\#\s]*WARRANTY;[\#\s]*without[\#\s]*even[\#\s]*the[\#\s]*implied[\#\s]*warranty[\#\s]*of[\#\s]*MERCHANTABILITY[\#\s]*or[\#\s]*FITNESS[\#\s]*FOR[\#\s]*A[\#\s]*PARTICULAR[\#\s]*PURPOSE.[\#\s]*See[\#\s]*the[\#\s]*GNU[\#\s]*General[\#\s]*Public[\#\s]*License[\#\s]*for[\#\s]*more[\#\s]*details.\s(#* *\n)*|\1 SPDX-License-Identifier: GPL-2.0-only\n\n|' $(cat filelist)
perl -i -p0e 's|(\#\#*)[\w*]*.*is free software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and\/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.\s(#* *\n)*|\1 SPDX-License-Identifier: GPL-2.0-only\n\n|' $(cat filelist)
Change-Id: I1008a63b804f355a916221ac994701d7584f60ff
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41177
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-05-08 20:48:04 +02:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
2015-02-13 03:32:41 +01:00
|
|
|
|
2015-03-07 01:50:22 +01:00
|
|
|
DATE=""
|
|
|
|
GITREV=""
|
|
|
|
TIMESOURCE=""
|
util/genbuild_h: Update IASL location finding code
Update the iasl path finding code to use XGCCPATH if it's set, and to
look for iasl on the path if it's not set and not under util/crossgcc.
On the jenkins builders, iasl is in the path, not in util/crossgcc/xgcc.
On the systems of people who have multiple copies of coreboot, it makes
sense to just have a single copy of the toolchain and define XGCCPATH in
the environment to point to it.
Previously, either of these situations resulted in a warning from the
genbuild_h tool that iasl was not found under util/crossgcc, which was
true, but not particularly relevant, and generated confusion.
If xcompile already existed before make was run, the correct path would
be found, but on an initial build, this check couldn't find iasl.
BUG=None
TEST=Build with iasl in /util/crossgcc/xgcc/bin, in the path and in a
directory pointed to with XGCCPATH.
Signed-off-by: Martin Roth <martin@coreboot.org>
Change-Id: Ic2f8dca0be8bfb54d3c672fab6cf6f005bb394c3
Reviewed-on: https://review.coreboot.org/c/coreboot/+/54001
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2021-05-09 19:44:15 +02:00
|
|
|
XGCCPATH="${XGCCPATH:-util/crossgcc/xgcc/bin/}"
|
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
|
|
|
|
2019-07-09 17:52:16 +02:00
|
|
|
XCOMPILE=$1
|
|
|
|
|
|
|
|
if [ -z "$XCOMPILE" ] || [ "$1" = "--help" ]; then
|
|
|
|
echo "usage: $0 <xcompile>" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-04-12 11:08:17 +02:00
|
|
|
# $1: format string
|
|
|
|
get_git_head_data() {
|
|
|
|
LANG= git log --no-show-signature -1 --format="format:$1" 2>/dev/null || \
|
|
|
|
LANG= git log -1 --format="format:$1"
|
|
|
|
}
|
|
|
|
|
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-04-12 11:08:17 +02:00
|
|
|
GITREV=$(get_git_head_data %h)
|
2015-03-07 01:50:22 +01:00
|
|
|
TIMESOURCE=git
|
2019-04-12 11:08:17 +02:00
|
|
|
DATE=$(get_git_head_data %ct)
|
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
|
|
|
|
}
|
|
|
|
|
util/genbuild_h: Update IASL location finding code
Update the iasl path finding code to use XGCCPATH if it's set, and to
look for iasl on the path if it's not set and not under util/crossgcc.
On the jenkins builders, iasl is in the path, not in util/crossgcc/xgcc.
On the systems of people who have multiple copies of coreboot, it makes
sense to just have a single copy of the toolchain and define XGCCPATH in
the environment to point to it.
Previously, either of these situations resulted in a warning from the
genbuild_h tool that iasl was not found under util/crossgcc, which was
true, but not particularly relevant, and generated confusion.
If xcompile already existed before make was run, the correct path would
be found, but on an initial build, this check couldn't find iasl.
BUG=None
TEST=Build with iasl in /util/crossgcc/xgcc/bin, in the path and in a
directory pointed to with XGCCPATH.
Signed-off-by: Martin Roth <martin@coreboot.org>
Change-Id: Ic2f8dca0be8bfb54d3c672fab6cf6f005bb394c3
Reviewed-on: https://review.coreboot.org/c/coreboot/+/54001
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2021-05-09 19:44:15 +02:00
|
|
|
# Look for IASL in XGCCPATH and xcompile. Unfortunately,
|
|
|
|
# xcompile isn't available on the first build.
|
|
|
|
# If neither of those gives a valid iasl, check the path.
|
|
|
|
IASL="${XGCCPATH}iasl"
|
2019-07-09 17:52:16 +02:00
|
|
|
eval $(grep ^IASL:= "$XCOMPILE" 2>/dev/null | sed s,:=,=,)
|
util/genbuild_h: Update IASL location finding code
Update the iasl path finding code to use XGCCPATH if it's set, and to
look for iasl on the path if it's not set and not under util/crossgcc.
On the jenkins builders, iasl is in the path, not in util/crossgcc/xgcc.
On the systems of people who have multiple copies of coreboot, it makes
sense to just have a single copy of the toolchain and define XGCCPATH in
the environment to point to it.
Previously, either of these situations resulted in a warning from the
genbuild_h tool that iasl was not found under util/crossgcc, which was
true, but not particularly relevant, and generated confusion.
If xcompile already existed before make was run, the correct path would
be found, but on an initial build, this check couldn't find iasl.
BUG=None
TEST=Build with iasl in /util/crossgcc/xgcc/bin, in the path and in a
directory pointed to with XGCCPATH.
Signed-off-by: Martin Roth <martin@coreboot.org>
Change-Id: Ic2f8dca0be8bfb54d3c672fab6cf6f005bb394c3
Reviewed-on: https://review.coreboot.org/c/coreboot/+/54001
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2021-05-09 19:44:15 +02:00
|
|
|
if [ ! -x "${IASL}" ]; then
|
|
|
|
IASL=$(command -v iasl)
|
|
|
|
fi
|
|
|
|
IASLVERSION="$(${IASL} -v | grep version | sed 's/.*version //')" >/dev/null
|
2019-04-12 11:12:25 +02:00
|
|
|
|
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"
|
2021-04-07 23:17:50 +02:00
|
|
|
printf "#define COREBOOT_BUILD_EPOCH \"$(our_date "$DATE" +%s)\"\n"
|
2015-03-27 00:15:20 +01:00
|
|
|
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"
|
util/genbuild_h: Update IASL location finding code
Update the iasl path finding code to use XGCCPATH if it's set, and to
look for iasl on the path if it's not set and not under util/crossgcc.
On the jenkins builders, iasl is in the path, not in util/crossgcc/xgcc.
On the systems of people who have multiple copies of coreboot, it makes
sense to just have a single copy of the toolchain and define XGCCPATH in
the environment to point to it.
Previously, either of these situations resulted in a warning from the
genbuild_h tool that iasl was not found under util/crossgcc, which was
true, but not particularly relevant, and generated confusion.
If xcompile already existed before make was run, the correct path would
be found, but on an initial build, this check couldn't find iasl.
BUG=None
TEST=Build with iasl in /util/crossgcc/xgcc/bin, in the path and in a
directory pointed to with XGCCPATH.
Signed-off-by: Martin Roth <martin@coreboot.org>
Change-Id: Ic2f8dca0be8bfb54d3c672fab6cf6f005bb394c3
Reviewed-on: https://review.coreboot.org/c/coreboot/+/54001
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2021-05-09 19:44:15 +02:00
|
|
|
printf "#define ASL_VERSION 0x%d\n" "${IASLVERSION}"
|
2015-02-13 03:32:41 +01:00
|
|
|
printf "#endif\n"
|