diff --git a/Makefile b/Makefile index ee5e2e7a8..dd46f9522 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ # VERSION_MAJOR := 2 VERSION_MINOR := 7 +VERSION := ${VERSION_MAJOR}.${VERSION_MINOR} # Default goal is build all images .DEFAULT_GOAL := all @@ -322,7 +323,7 @@ endif ifeq (${BUILD_STRING},) BUILD_STRING := $(shell git describe --always --dirty --tags 2> /dev/null) endif -VERSION_STRING := v${VERSION_MAJOR}.${VERSION_MINOR}(${BUILD_TYPE}):${BUILD_STRING} +VERSION_STRING := v${VERSION}(${BUILD_TYPE}):${BUILD_STRING} ifeq (${AARCH32_INSTRUCTION_SET},A32) TF_CFLAGS_aarch32 += -marm diff --git a/common/bl_common.c b/common/bl_common.c index 9bfaafd2b..8fce02fba 100644 --- a/common/bl_common.c +++ b/common/bl_common.c @@ -269,3 +269,12 @@ void print_entry_point_info(const entry_point_info_t *ep_info) #endif #undef PRINT_IMAGE_ARG } + +/* + * This function is for returning the TF-A version + */ +const char *get_version(void) +{ + extern const char version[]; + return version; +} diff --git a/include/common/bl_common.h b/include/common/bl_common.h index 3a06cfbf9..539280e12 100644 --- a/include/common/bl_common.h +++ b/include/common/bl_common.h @@ -178,6 +178,7 @@ void dyn_disable_auth(void); extern const char build_message[]; extern const char version_string[]; +const char *get_version(void); void print_entry_point_info(const entry_point_info_t *ep_info); uintptr_t page_align(uintptr_t value, unsigned dir); diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk index a58caf565..abdd4d069 100644 --- a/make_helpers/build_macros.mk +++ b/make_helpers/build_macros.mk @@ -499,7 +499,8 @@ ifdef MAKE_BUILD_STRINGS $(call MAKE_BUILD_STRINGS, $(BUILD_DIR)/build_message.o) else @echo 'const char build_message[] = "Built : "$(BUILD_MESSAGE_TIMESTAMP); \ - const char version_string[] = "${VERSION_STRING}";' | \ + const char version_string[] = "${VERSION_STRING}"; \ + const char version[] = "${VERSION}";' | \ $$(CC) $$(TF_CFLAGS) $$(CFLAGS) -xc -c - -o $(BUILD_DIR)/build_message.o endif ifneq ($(findstring armlink,$(notdir $(LD))),) diff --git a/make_helpers/windows.mk b/make_helpers/windows.mk index 26ea88ef0..0f78f61a7 100644 --- a/make_helpers/windows.mk +++ b/make_helpers/windows.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2016-2020, ARM Limited and Contributors. All rights reserved. +# Copyright (c) 2016-2022, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -81,6 +81,7 @@ BUILD_STRING ?= development build # by defining the MAKE_BUILD_STRINGS macro. BUILT_TIME_DATE_STRING = const char build_message[] = "Built : "${BUILD_MESSAGE_TIMESTAMP}; VERSION_STRING_MESSAGE = const char version_string[] = "${VERSION_STRING}"; +const char version[] = "${VERSION}"; define MAKE_BUILD_STRINGS @echo $$(BUILT_TIME_DATE_STRING) $$(VERSION_STRING_MESSAGE) | \ $$(CC) $$(TF_CFLAGS) $$(CFLAGS) -x c -c - -o $1