diff --git a/src/sbom/Makefile.mk b/src/sbom/Makefile.mk index 4e3adc27d1..26f48dc3e8 100644 --- a/src/sbom/Makefile.mk +++ b/src/sbom/Makefile.mk @@ -110,10 +110,10 @@ $(build-dir)/compiler-%.json: $(src-dir)/compiler-%.json | $(build-dir)/goswid $(build-dir)/goswid add-payload-file -o $@ -i $@ --name $$(basename $$tool) --version $$version; \ done -$(build-dir)/coreboot.json: $(src-dir)/coreboot.json .git/HEAD | $(build-dir)/goswid +$(build-dir)/coreboot.json: $(src-dir)/coreboot.json $(obj)/build.h | $(build-dir)/goswid cp $< $@ - git_tree_hash=$$(git log -n 1 --format=%T);\ - git_comm_hash=$$(git log -n 1 --format=%H);\ + git_tree_hash=$$(grep 'COREBOOT_ORIGIN_TREE_REVISION' $(obj)/build.h | sed 's/.*"\(.*\)".*/\1/');\ + git_comm_hash=$$(grep 'COREBOOT_ORIGIN_GIT_REVISION' $(obj)/build.h | sed 's/.*"\(.*\)".*/\1/');\ sed -i -e "s//$$git_tree_hash/" -e "s//$$git_comm_hash/" $@;\ $(build-dir)/goswid add-license -o $@ -i $@ $(coreboot-licenses) diff --git a/util/genbuild_h/genbuild_h.sh b/util/genbuild_h/genbuild_h.sh index b381ab2776..e83d4e177f 100755 --- a/util/genbuild_h/genbuild_h.sh +++ b/util/genbuild_h/genbuild_h.sh @@ -33,6 +33,7 @@ if [ "${BUILD_TIMELESS}" = "1" ]; then DATE=0 elif [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]; then GITREV="$(get_git_head_data %h)" + TREE_REV="$(get_git_head_data %t)" TIMESOURCE=git DATE="$(get_git_head_data %ct)" VERSION="$(git describe)" @@ -45,6 +46,8 @@ else if [ -f "${COREBOOT_VERSION_FILE}" ]; then MAJOR_VER="$(sed -n 's/^0*\([0-9]*\)\.0*\([0-9]*\).*/\1/p' "${COREBOOT_VERSION_FILE}")" MINOR_VER="$(sed -n 's/^0*\([0-9]*\)\.0*\([0-9]*\).*/\2/p' "${COREBOOT_VERSION_FILE}")" + GITREV="Based_on_$(sed -n 's/^[^-]*-\([^-]*\)-.*/\1/p' "${COREBOOT_VERSION_FILE}")" + TREE_REV="Based_on_$(sed -n 's/^[^-]*-[^-]*-\(.*\)/\1/p' "${COREBOOT_VERSION_FILE}")" fi fi @@ -78,6 +81,7 @@ printf "#define COREBOOT_VERSION %s\n" "\"${KERNELVERSION}\"" printf "/* timesource: %s */\n" "${TIMESOURCE}" printf "#define COREBOOT_VERSION_TIMESTAMP %s\n" "${DATE}" printf "#define COREBOOT_ORIGIN_GIT_REVISION \"%s\"\n" "${GITREV}" +printf "#define COREBOOT_ORIGIN_TREE_REVISION \"%s\"\n" "${TREE_REV:-0}" printf "#define COREBOOT_EXTRA_VERSION \"%s\"\n" "${COREBOOT_EXTRA_VERSION}" printf "#define COREBOOT_MAJOR_VERSION %s\n" "${MAJOR_VER:-0}" diff --git a/util/release/build-release b/util/release/build-release index c8e939b4bb..7c4aeb597f 100755 --- a/util/release/build-release +++ b/util/release/build-release @@ -89,7 +89,7 @@ fi git submodule update --init --checkout - printf "%s-%s\n" "$VERSION_NAME" "$(git log --pretty=%h -1)" > .coreboot-version + printf "%s-%s-%s\n" "$VERSION_NAME" "$(git log --pretty=%h -1)" "$(git log --pretty=%t -1)" > .coreboot-version printf "%s\n" "$(git log --pretty=format:%ci -1)" > "${TIME_FILE}" ) tstamp=$(cat "${TIME_FILE}" | sed 's/ +0000//')