diff --git a/Makefile.work b/Makefile.work index 83bf926d8ec3..9db59cf22511 100644 --- a/Makefile.work +++ b/Makefile.work @@ -513,6 +513,7 @@ SONIC_BUILD_INSTRUCTION := $(MAKE) \ MIRROR_URLS=$(MIRROR_URLS) \ MIRROR_SECURITY_URLS=$(MIRROR_SECURITY_URLS) \ MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) \ + SONIC_OS_VERSION=$(SONIC_OS_VERSION) \ $(SONIC_OVERRIDE_BUILD_VARS) .PHONY: sonic-slave-build sonic-slave-bash init reset diff --git a/build_debian.sh b/build_debian.sh index c0d90bdfad51..6c8880144423 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -573,6 +573,7 @@ export release="$(if [ -f $FILESYSTEM_ROOT/etc/sonic/sonic_release ]; then cat $ export build_date="$(date -u)" export build_number="${BUILD_NUMBER:-0}" export built_by="$USER@$BUILD_HOSTNAME" +export sonic_os_version="${SONIC_OS_VERSION}" j2 files/build_templates/sonic_version.yml.j2 | sudo tee $FILESYSTEM_ROOT/etc/sonic/sonic_version.yml ## Copy over clean-up script diff --git a/files/build_templates/sonic_version.yml.j2 b/files/build_templates/sonic_version.yml.j2 index bc6fb54189d4..8b829feeed00 100644 --- a/files/build_templates/sonic_version.yml.j2 +++ b/files/build_templates/sonic_version.yml.j2 @@ -29,3 +29,4 @@ built_by: {{ built_by }} {% if ENABLE_ASAN == "y" -%} asan: 'yes' {% endif -%} +sonic_os_version: {{ sonic_os_version }} diff --git a/platform/vs/sonic-version.mk b/platform/vs/sonic-version.mk index 9e21573227b3..82409abd1ec1 100644 --- a/platform/vs/sonic-version.mk +++ b/platform/vs/sonic-version.mk @@ -2,9 +2,11 @@ sonic_version=$(SONIC_GET_VERSION) sonic_asic_platform=$(CONFIGURED_PLATFORM) +sonic_os_version=$(SONIC_OS_VERSION) export sonic_version export sonic_asic_platform +export sonic_os_version SONIC_VERSION = sonic_version.yml $(SONIC_VERSION)_SRC_PATH = $(PLATFORM_PATH)/sonic-version diff --git a/rules/config b/rules/config index 9b214d582dd5..d3e345cd46a6 100644 --- a/rules/config +++ b/rules/config @@ -269,3 +269,6 @@ ENABLE_FIPS ?= n # SONIC_SLAVE_DOCKER_DRIVER - set the sonic slave docker storage driver SONIC_SLAVE_DOCKER_DRIVER ?= vfs + +# SONIC_OS_VERSION - sonic os version +SONIC_OS_VERSION ?= 11 diff --git a/slave.mk b/slave.mk index 7cfae3d408f5..6b6b65086e7e 100644 --- a/slave.mk +++ b/slave.mk @@ -87,6 +87,7 @@ export CROSS_BUILD_ENVIRON export BLDENV export BUILD_WORKDIR export MIRROR_SNAPSHOT +export SONIC_OS_VERSION ############################################################################### ## Utility rules