diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 0b1d19b6e1..04f5181ff6 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -223,6 +223,7 @@ sudo cp {{src}} $FILESYSTEM_ROOT/{{dst}} {% if sonic_asic_platform == "mellanox" %} sudo mkdir -p $FILESYSTEM_ROOT/etc/mlnx/ -sudo cp target/files/$MLNX_FW $FILESYSTEM_ROOT/etc/mlnx/fw-SPC.mfa -sudo cp platform/mellanox/mlnx-fw-upgrade.sh $FILESYSTEM_ROOT/usr/bin/ +sudo cp target/files/$MLNX_FW_FILE $FILESYSTEM_ROOT/etc/mlnx/fw-SPC.mfa +j2 platform/mellanox/mlnx-fw-upgrade.j2 | sudo tee $FILESYSTEM_ROOT/usr/bin/mlnx-fw-upgrade.sh +sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/mlnx-fw-upgrade.sh {% endif %} diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 8e916d8176..a50230a025 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,7 +1,9 @@ # mellanox firmware -MLNX_FW = fw-SPC-rel-13_1224_0140-EVB.mfa -$(MLNX_FW)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_FW) -SONIC_ONLINE_FILES += $(MLNX_FW) +MLNX_FW_VERSION = 13.1224.0140 +MLNX_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_FW_VERSION))-EVB.mfa +$(MLNX_FW_FILE)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_FW_FILE) +SONIC_ONLINE_FILES += $(MLNX_FW_FILE) -export MLNX_FW +export MLNX_FW_VERSION +export MLNX_FW_FILE diff --git a/platform/mellanox/mlnx-fw-upgrade.sh b/platform/mellanox/mlnx-fw-upgrade.j2 similarity index 91% rename from platform/mellanox/mlnx-fw-upgrade.sh rename to platform/mellanox/mlnx-fw-upgrade.j2 index d84265e02d..ec002497eb 100755 --- a/platform/mellanox/mlnx-fw-upgrade.sh +++ b/platform/mellanox/mlnx-fw-upgrade.j2 @@ -1,5 +1,6 @@ #!/bin/bash +fw_required="{{ MLNX_FW_VERSION }}" query_retry_count_max="10" fw_file=/etc/mlnx/fw-SPC.mfa @@ -13,7 +14,7 @@ run_or_fail() { # wait until devices will be available query_retry_count="0" -query_cmd="mlxfwmanager --query -i ${fw_file}" +query_cmd="mlxfwmanager --query" ${query_cmd} > /dev/null while [[ (${query_retry_count} -lt ${query_retry_count_max}) && ($? -ne "0") ]]; do @@ -27,7 +28,6 @@ run_or_fail "${query_cmd}" > /tmp/mlnxfwmanager-query.txt # get current firmware version and required version fw_info=$(grep FW /tmp/mlnxfwmanager-query.txt) fw_current=$(echo $fw_info | cut -f2 -d' ') -fw_required=$(echo $fw_info | cut -f3 -d' ') if [[ -z ${fw_current} ]]; then echo "Could not retreive current FW version." diff --git a/platform/mellanox/one-image.mk b/platform/mellanox/one-image.mk index 9293e6a727..db8826951c 100644 --- a/platform/mellanox/one-image.mk +++ b/platform/mellanox/one-image.mk @@ -5,5 +5,5 @@ $(SONIC_ONE_IMAGE)_MACHINE = mellanox $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie $(SONIC_ONE_IMAGE)_DEPENDS += $(SX_KERNEL) $(KERNEL_MFT) $(MFT) $(MLNX_HW_MANAGEMENT) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) -$(SONIC_ONE_IMAGE)_FILES += $(MLNX_FW) +$(SONIC_ONE_IMAGE)_FILES += $(MLNX_FW_FILE) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE)