Support to add SONiC OS Version in device info (#14601)

Why I did it
Support to add SONiC OS Version in device info.
It will be used to display the version info in the SONiC command "show version". The version is used to do the FIPS certification. We do not do the FIPS certification on a specific release, but on the SONiC OS Version.

SONiC Software Version: SONiC.master-13812.218661-7d94c0c28
SONiC OS Version: 11
Distribution: Debian 11.6
Kernel: 5.10.0-18-2-amd64
How I did it
This commit is contained in:
xumia 2023-04-12 09:20:08 +08:00 committed by GitHub
parent 38f0ec6563
commit f1fd42558a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 0 deletions

View File

@ -563,6 +563,7 @@ SONIC_BUILD_INSTRUCTION := $(MAKE) \
GZ_COMPRESS_PROGRAM=$(GZ_COMPRESS_PROGRAM) \ GZ_COMPRESS_PROGRAM=$(GZ_COMPRESS_PROGRAM) \
MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) \ MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) \
SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \ SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \
SONIC_OS_VERSION=$(SONIC_OS_VERSION) \
$(SONIC_OVERRIDE_BUILD_VARS) $(SONIC_OVERRIDE_BUILD_VARS)
.PHONY: sonic-slave-build sonic-slave-bash init reset .PHONY: sonic-slave-build sonic-slave-bash init reset

View File

@ -585,6 +585,7 @@ export release="$(if [ -f $FILESYSTEM_ROOT/etc/sonic/sonic_release ]; then cat $
export build_date="$(date -u)" export build_date="$(date -u)"
export build_number="${BUILD_NUMBER:-0}" export build_number="${BUILD_NUMBER:-0}"
export built_by="$USER@$BUILD_HOSTNAME" 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 j2 files/build_templates/sonic_version.yml.j2 | sudo tee $FILESYSTEM_ROOT/etc/sonic/sonic_version.yml
## Copy over clean-up script ## Copy over clean-up script

View File

@ -29,3 +29,4 @@ built_by: {{ built_by }}
{% if ENABLE_ASAN == "y" -%} {% if ENABLE_ASAN == "y" -%}
asan: 'yes' asan: 'yes'
{% endif -%} {% endif -%}
sonic_os_version: {{ sonic_os_version }}

View File

@ -2,9 +2,11 @@
sonic_version=$(SONIC_GET_VERSION) sonic_version=$(SONIC_GET_VERSION)
sonic_asic_platform=$(CONFIGURED_PLATFORM) sonic_asic_platform=$(CONFIGURED_PLATFORM)
sonic_os_version=$(SONIC_OS_VERSION)
export sonic_version export sonic_version
export sonic_asic_platform export sonic_asic_platform
export sonic_os_version
SONIC_VERSION = sonic_version.yml SONIC_VERSION = sonic_version.yml
$(SONIC_VERSION)_SRC_PATH = $(PLATFORM_PATH)/sonic-version $(SONIC_VERSION)_SRC_PATH = $(PLATFORM_PATH)/sonic-version

View File

@ -294,3 +294,6 @@ SONIC_SLAVE_DOCKER_DRIVER ?= vfs
# GZ_COMPRESS_PROGRAM - select pigz (a parallel implementation of gzip) to reduce a build time # GZ_COMPRESS_PROGRAM - select pigz (a parallel implementation of gzip) to reduce a build time
# and speed up a decompression of docker images on target system # and speed up a decompression of docker images on target system
GZ_COMPRESS_PROGRAM ?= gzip GZ_COMPRESS_PROGRAM ?= gzip
# SONIC_OS_VERSION - sonic os version
SONIC_OS_VERSION ?= 11

View File

@ -89,6 +89,7 @@ export BLDENV
export BUILD_WORKDIR export BUILD_WORKDIR
export GZ_COMPRESS_PROGRAM export GZ_COMPRESS_PROGRAM
export MIRROR_SNAPSHOT export MIRROR_SNAPSHOT
export SONIC_OS_VERSION
############################################################################### ###############################################################################
## Utility rules ## Utility rules