Debian Codegraph @

util/genbuild_h/genbuild_h.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. sh
2 #
3 # SPDX-License-Identifier: GPL-2.0-only
4
5 DATE=""
6 GITREV=""
7 TIMESOURCE=""
8 XGCCPATH="${XGCCPATH:-util/crossgcc/xgcc/bin/}"
9 MAJOR_VER=""
10 MINOR_VER=""
11 COREBOOT_VERSION_FILE=".coreboot-version"
12
13 export LANG=C
14 export LC_ALL=C
15 export TZ=UTC0
16
17 XCOMPILE=$1
18
19 if [scip-shell system . . `[`. -z "${XCOMPILE}" ] || [scip-shell system . . `[`. "$1" = "--help" ]; then
20 echoscip-shell system . . echo. "usage: $0 <xcompile>" >&2
21 exit 1
22 fi
23
24 # $1: format string
25 get_git_head_datascip-shell shell coreboot 25.09+dfsg-1 get_git_head_data().() {
26 LANG="" gitscip-shell system . . git. log --no-show-signature --abbrev=12 -1 --format="format:$1" 2>/dev/nullscip-shell filesystem . . `/dev/null`. || \
27 LANG="" gitscip-shell system . . git. log --abbrev=12 -1 --format="format:$1"
28 }
29
30 if [scip-shell system . . `[`. "${BUILD_TIMELESS}" = "1" ]; then
31 GITREV=Timeless
32 TIMESOURCE="fixed"
33 DATE=0
34 elif [scip-shell system . . `[`. "$(gitscip-shell system . . git. rev-parse --is-inside-work-tree 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" = "true" ]; then
35 GITREV="$(get_git_head_datascip-shell shell coreboot 25.09+dfsg-1 get_git_head_data(). %h)"
36 TREE_REV="$(get_git_head_datascip-shell shell coreboot 25.09+dfsg-1 get_git_head_data(). %t)"
37 TIMESOURCE=git
38 DATE="$(get_git_head_datascip-shell shell coreboot 25.09+dfsg-1 get_git_head_data(). %ct)"
39 VERSION="$(gitscip-shell system . . git. describe)"
40 MAJOR_VER="$(echoscip-shell system . . echo. "${VERSION}" | sedscip-shell system . . sed. -n 's/^0*\([0-9]*\)\.0*\([0-9]*\).*/\1/p')"
41 MINOR_VER="$(echoscip-shell system . . echo. "${VERSION}" | sedscip-shell system . . sed. -n 's/^0*\([0-9]*\)\.0*\([0-9]*\).*/\2/p')"
42 else
43 GITREV=Unknown
44 TIMESOURCE="date"
45 DATE=$(LANG="" LC_ALL=C TZ=UTC0 datescip-shell system . . date. +%s)
46 if [scip-shell system . . `[`. -f "${COREBOOT_VERSION_FILE}" ]; then
47 MAJOR_VER="$(sedscip-shell system . . sed. -n 's/^0*\([0-9]*\)\.0*\([0-9]*\).*/\1/p' "${COREBOOT_VERSION_FILE}")"
48 MINOR_VER="$(sedscip-shell system . . sed. -n 's/^0*\([0-9]*\)\.0*\([0-9]*\).*/\2/p' "${COREBOOT_VERSION_FILE}")"
49 GITREV="Based_on_$(sedscip-shell system . . sed. -n 's/^[^-]*-\([^-]*\)-.*/\1/p' "${COREBOOT_VERSION_FILE}")"
50 TREE_REV="Based_on_$(sedscip-shell system . . sed. -n 's/^[^-]*-[^-]*-\(.*\)/\1/p' "${COREBOOT_VERSION_FILE}")"
51 fi
52 fi
53
54 our_datescip-shell shell coreboot 25.09+dfsg-1 our_date().() {
55 case $(unamescip-shell system . . uname.) in
56 NetBSD|OpenBSD|DragonFly|FreeBSD|Darwin)
57 datescip-shell system . . date. -r "$1" "$2"
58 ;;
59 *)
60 datescip-shell system . . date. -d "@$1" "$2"
61 esac
62 }
63
64 # Look for IASL in XGCCPATH and xcompile. Unfortunately,
65 # xcompile isn't available on the first build.
66 # If neither of those gives a valid iasl, check the path.
67 IASL="${XGCCPATH}iasl"
68 eval "$(grepscip-shell system . . grep. ^IASL:= "${XCOMPILE}" 2>/dev/nullscip-shell filesystem . . `/dev/null`. | sedscip-shell system . . sed. s,:=,=,)"
69 if [scip-shell system . . `[`. ! -x "${IASL}" ]; then
70 IASL=$(command -v iasl)
71 fi
72 IASLVERSION="$("${IASL}" -v 2>/dev/nullscip-shell filesystem . . `/dev/null`. | grepscip-shell system . . grep. version | sedscip-shell system . . sed. 's/.*version //')"
73
74 #Print out the information that goes into build.h
75 printfscip-shell system . . printf. "/* build system definitions (autogenerated) */\n"
76 printfscip-shell system . . printf. "#ifndef __BUILD_H\n"
77 printfscip-shell system . . printf. "#define __BUILD_H\n\n"
78 printfscip-shell system . . printf. "#define COREBOOT_VERSION %s\n" "\"${KERNELVERSION}\""
79
80 #See if the build is running in a git repo and the git command is available
81 printfscip-shell system . . printf. "/* timesource: %s */\n" "${TIMESOURCE}"
82 printfscip-shell system . . printf. "#define COREBOOT_VERSION_TIMESTAMP %s\n" "${DATE}"
83 printfscip-shell system . . printf. "#define COREBOOT_ORIGIN_GIT_REVISION \"%s\"\n" "${GITREV}"
84 printfscip-shell system . . printf. "#define COREBOOT_ORIGIN_TREE_REVISION \"%s\"\n" "${TREE_REV:-0}"
85
86 printfscip-shell system . . printf. "#define COREBOOT_EXTRA_VERSION \"%s\"\n" "${COREBOOT_EXTRA_VERSION}"
87 printfscip-shell system . . printf. "#define COREBOOT_MAJOR_VERSION %s\n" "${MAJOR_VER:-0}"
88 printfscip-shell system . . printf. "#define COREBOOT_MINOR_VERSION %s\n" "${MINOR_VER:-0}"
89 printfscip-shell system . . printf. "#define COREBOOT_BUILD \"%s\"\n" "$(our_datescip-shell shell coreboot 25.09+dfsg-1 our_date(). "${DATE}" "+%a %b %d %H:%M:%S %Z %Y")"
90 printfscip-shell system . . printf. "#define COREBOOT_BUILD_YEAR_BCD 0x%s\n" "$(our_datescip-shell shell coreboot 25.09+dfsg-1 our_date(). "${DATE}" "+%y")"
91 printfscip-shell system . . printf. "#define COREBOOT_BUILD_MONTH_BCD 0x%s\n" "$(our_datescip-shell shell coreboot 25.09+dfsg-1 our_date(). "${DATE}" "+%m")"
92 printfscip-shell system . . printf. "#define COREBOOT_BUILD_DAY_BCD 0x%s\n" "$(our_datescip-shell shell coreboot 25.09+dfsg-1 our_date(). "${DATE}" "+%d")"
93 printfscip-shell system . . printf. "#define COREBOOT_BUILD_WEEKDAY_BCD 0x%s\n" "$(our_datescip-shell shell coreboot 25.09+dfsg-1 our_date(). "${DATE}" "+%w")"
94 printfscip-shell system . . printf. "#define COREBOOT_BUILD_EPOCH \"%s\"\n" "$(our_datescip-shell shell coreboot 25.09+dfsg-1 our_date(). "${DATE}" "+%s")"
95 printfscip-shell system . . printf. "#define COREBOOT_DMI_DATE \"%s\"\n" "$(our_datescip-shell shell coreboot 25.09+dfsg-1 our_date(). "${DATE}" "+%m/%d/%Y")"
96 printfscip-shell system . . printf. "\n"
97 printfscip-shell system . . printf. "#define COREBOOT_COMPILE_TIME \"%s\"\n" "$(our_datescip-shell shell coreboot 25.09+dfsg-1 our_date(). "${DATE}" "+%T")"
98 printfscip-shell system . . printf. "#define ASL_VERSION 0x%s\n" "${IASLVERSION}"
99 printfscip-shell system . . printf. "#endif\n"