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/}"
|
2022-11-28 02:18:10 +01:00
|
|
|
MAJOR_VER="0"
|
|
|
|
MINOR_VER="0"
|
|
|
|
COREBOOT_VERSION_FILE=".coreboot-version"
|
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
|
|
|
|
|
2022-11-28 02:38:13 +01:00
|
|
|
if [ -z "${XCOMPILE}" ] || [ "$1" = "--help" ]; then
|
2019-07-09 17:52:16 +02:00
|
|
|
echo "usage: $0 <xcompile>" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-04-12 11:08:17 +02:00
|
|
|
# $1: format string
|
|
|
|
get_git_head_data() {
|
2023-07-16 00:59:55 +02:00
|
|
|
LANG="" git log --no-show-signature --abbrev=12 -1 --format="format:$1" 2>/dev/null || \
|
|
|
|
LANG="" git log --abbrev=12 -1 --format="format:$1"
|
2019-04-12 11:08:17 +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
|
2022-11-28 02:38:13 +01:00
|
|
|
GITREV="$(get_git_head_data %h)"
|
2015-03-07 01:50:22 +01:00
|
|
|
TIMESOURCE=git
|
2022-11-28 02:38:13 +01:00
|
|
|
DATE="$(get_git_head_data %ct)"
|
2022-11-28 02:18:10 +01:00
|
|
|
VERSION="$(git describe)"
|
2022-12-15 05:04:11 +01:00
|
|
|
# Only use the `git describe` output if the tag is in the expected <major>.<minor>
|
|
|
|
# format, e.g. 4.18. Forks of coreboot may have other tags in different formats.
|
|
|
|
if echo "${VERSION}" | grep -q "^[0-9]\.[0-9][0-9]*"; then
|
|
|
|
MAJOR_VER="$(echo "${VERSION}" | sed 's/\([0-9]\)\.\([0-9][0-9]*\).*/\1/')"
|
|
|
|
MINOR_VER="$(echo "${VERSION}" | sed 's/\([0-9]\)\.\([0-9][0-9]*\).*/\2/')"
|
|
|
|
fi
|
2015-03-07 01:50:22 +01:00
|
|
|
else
|
|
|
|
GITREV=Unknown
|
2015-08-09 20:53:16 +02:00
|
|
|
TIMESOURCE="date"
|
2022-11-28 02:18:10 +01:00
|
|
|
DATE=$(LANG="" LC_ALL=C TZ=UTC0 date +%s)
|
|
|
|
if [ -f "${COREBOOT_VERSION_FILE}" ]; then
|
|
|
|
MAJOR_VER="$(sed 's/\([0-9]\)\.\([0-9][0-9]*\).*/\1/' "${COREBOOT_VERSION_FILE}")"
|
|
|
|
MINOR_VER="$(sed 's/\([0-9]\)\.\([0-9][0-9]*\).*/\2/' "${COREBOOT_VERSION_FILE}")"
|
|
|
|
fi
|
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)
|
2022-11-28 02:38:13 +01:00
|
|
|
date -r "$1" "$2"
|
2015-03-27 00:15:20 +01:00
|
|
|
;;
|
|
|
|
*)
|
2022-11-28 02:38:13 +01: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"
|
2022-11-28 02:38:13 +01: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"
|
2022-11-28 02:38:13 +01:00
|
|
|
printf "#define COREBOOT_VERSION %s\n" "\"${KERNELVERSION}\""
|
2015-02-13 03:32:41 +01:00
|
|
|
|
|
|
|
#See if the build is running in a git repo and the git command is available
|
2022-11-28 02:38:13 +01:00
|
|
|
printf "/* timesource: %s */\n" "${TIMESOURCE}"
|
|
|
|
printf "#define COREBOOT_VERSION_TIMESTAMP %s\n" "${DATE}"
|
|
|
|
printf "#define COREBOOT_ORIGIN_GIT_REVISION \"%s\"\n" "${GITREV}"
|
2015-02-13 03:32:41 +01:00
|
|
|
|
2022-11-28 02:38:13 +01:00
|
|
|
printf "#define COREBOOT_EXTRA_VERSION \"%s\"\n" "${COREBOOT_EXTRA_VERSION}"
|
2022-12-09 03:04:02 +01:00
|
|
|
printf "#define COREBOOT_MAJOR_VERSION %s\n" "${MAJOR_VER}"
|
|
|
|
printf "#define COREBOOT_MINOR_VERSION %s\n" "${MINOR_VER}"
|
2022-11-28 02:38:13 +01:00
|
|
|
printf "#define COREBOOT_BUILD \"%s\"\n" "$(our_date "${DATE}" "+%a %b %d %H:%M:%S %Z %Y")"
|
2022-12-09 03:04:02 +01:00
|
|
|
printf "#define COREBOOT_BUILD_YEAR_BCD 0x%s\n" "$(our_date "${DATE}" "+%y")"
|
|
|
|
printf "#define COREBOOT_BUILD_MONTH_BCD 0x%s\n" "$(our_date "${DATE}" "+%m")"
|
|
|
|
printf "#define COREBOOT_BUILD_DAY_BCD 0x%s\n" "$(our_date "${DATE}" "+%d")"
|
|
|
|
printf "#define COREBOOT_BUILD_WEEKDAY_BCD 0x%s\n" "$(our_date "${DATE}" "+%w")"
|
|
|
|
printf "#define COREBOOT_BUILD_EPOCH \"%s\"\n" "$(our_date "${DATE}" "+%s")"
|
2022-11-28 02:38:13 +01:00
|
|
|
printf "#define COREBOOT_DMI_DATE \"%s\"\n" "$(our_date "${DATE}" "+%m/%d/%Y")"
|
2015-02-13 03:32:41 +01:00
|
|
|
printf "\n"
|
2022-11-28 02:38:13 +01:00
|
|
|
printf "#define COREBOOT_COMPILE_TIME \"%s\"\n" "$(our_date "${DATE}" "+%T")"
|
2022-12-09 03:04:02 +01:00
|
|
|
printf "#define ASL_VERSION 0x%s\n" "${IASLVERSION}"
|
2015-02-13 03:32:41 +01:00
|
|
|
printf "#endif\n"
|