[devices]: Firmware upgrade support for DellEMC platforms(s5248,s5232,z9100,s6100,z9264f) (#3743)

* This method is used to update firmware components such as CPLD,FPGA,BIOS,SMF
           * This uses ONIE firmware upgrade design to stage firmware update from NOS.

a) Copy latest firmware updater image to target running sonic.
b) Run “./fw-updater -u onie-firmware-x86_64-dellemc_s5200_c3538-r0.3.40.5.1-9.bin”.
c) This would automatically reboot ONIE into update mode and update firmware components to latest and reboot back to sonic without any user intervention.

Signed-off-by: Srideep Devireddy <srideep_devireddy@dell.com>
This commit is contained in:
srideepDell 2019-11-14 01:08:15 -07:00 committed by lguohan
parent 4007d9ba9c
commit 413f07820d
7 changed files with 101 additions and 0 deletions

View File

@ -5,12 +5,14 @@ DELL_Z9100_PLATFORM_MODULE_VERSION = 1.1
DELL_S6100_PLATFORM_MODULE_VERSION = 1.1
DELL_Z9264F_PLATFORM_MODULE_VERSION = 1.1
DELL_S5232F_PLATFORM_MODULE_VERSION = 1.1
DELL_S5248F_PLATFORM_MODULE_VERSION = 1.1
export DELL_S6000_PLATFORM_MODULE_VERSION
export DELL_Z9100_PLATFORM_MODULE_VERSION
export DELL_S6100_PLATFORM_MODULE_VERSION
export DELL_Z9264F_PLATFORM_MODULE_VERSION
export DELL_S5232F_PLATFORM_MODULE_VERSION
export DELL_S5248F_PLATFORM_MODULE_VERSION
DELL_Z9100_PLATFORM_MODULE = platform-modules-z9100_$(DELL_Z9100_PLATFORM_MODULE_VERSION)_amd64.deb
$(DELL_Z9100_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-dell
@ -35,6 +37,9 @@ DELL_S5232F_PLATFORM_MODULE = platform-modules-s5232f_$(DELL_S5232F_PLATFORM_MOD
$(DELL_S5232F_PLATFORM_MODULE)_PLATFORM = x86_64-dellemc_s5232f_c3538-r0
$(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_S5232F_PLATFORM_MODULE)))
DELL_S5248F_PLATFORM_MODULE = platform-modules-s5248f_$(DELL_S5248F_PLATFORM_MODULE_VERSION)_amd64.deb
$(DELL_S5248F_PLATFORM_MODULE)_PLATFORM = x86_64-dellemc_s5248f_c3538-r0
$(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_S5248F_PLATFORM_MODULE)))
SONIC_STRETCH_DEBS += $(DELL_Z9100_PLATFORM_MODULE)
#flashrom tool

View File

@ -0,0 +1,91 @@
#!/usr/bin/python
# dell staging fw updater script
import os
import sys
import subprocess
import argparse
onie_boot_folder = '/mnt/onie-boot/onie/tools/bin/onie-fwpkg'
onie_fwpkg_tool = '/mnt/onie-boot/onie/tools/bin/onie-fwpkg'
ONIE_BOOT_MODE_CMD = '/mnt/onie-boot/onie/tools/bin/onie-boot-mode'
HOST_GRUB_DIR = '/host'
HOST_GRUB_CFG = HOST_GRUB_DIR + '/grub/grub.cfg'
HOST_GRUB_ENV = HOST_GRUB_DIR + '/grub/grubenv'
HOST_GRUB_BOOT_DIR = '--boot-directory=' + HOST_GRUB_DIR
HOST_PLATFORM_INFO = HOST_GRUB_DIR + '/platform'
dell_reload_tool = '/usr/bin/reboot'
def set_onie_mode(option):
"""Select the ONIE boot mode, and set the next_entry to point to ONIE"""
_set_env_option('next_entry', 'ONIE')
subprocess.check_call([ONIE_BOOT_MODE_CMD, '-o', option])
def set_onie_fw_update_env():
"""Select the ONIE boot mode, and set the next_entry to point to ONIE"""
if not os.path.exists(onie_boot_folder):
os.makedirs(onie_boot_folder)
try:
subprocess.check_call(['mount','/dev/disk/by-label/ONIE-BOOT','/mnt/onie-boot'])
except:
print "onie-boot not able to mount"
def _set_env_option(option, value):
"""Set an option in the GRUB environment block. Pass None to value to
unset the option"""
if value is None:
action = 'unset'
key_value = option
else:
action = 'set'
key_value = '%s=%s' % (option, value)
subprocess.check_call(['grub-editenv', HOST_GRUB_ENV, action, key_value])
def dell_firmware_update_staging(image_name):
try:
p = subprocess.Popen([onie_fwpkg_tool,"purge"],stdout=subprocess.PIPE,stdin=subprocess.PIPE)
p.communicate("y")
except:
print "onie-fwpkg command not found for purging old fw updates"
try:
subprocess.check_call([onie_fwpkg_tool,"add", str(image_name)])
except:
print "onie-fwpkg is not found to stage fw updates"
try:
set_onie_mode("update")
except:
print "dell-image command not found"
try:
subprocess.check_call([dell_reload_tool])
except:
print "reload command not found"
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Dell HOST Firmware updates')
opts = parser.add_mutually_exclusive_group(required=True)
opts.add_argument('-u', '--update', nargs=1, metavar='IMAGE',
help='update specified image')
args = parser.parse_args()
if os.getuid() != 0:
parser.exit(127, 'ERROR: Must be root\n')
if args.update:
set_onie_fw_update_env()
dell_firmware_update_staging(args.update[0])

View File

@ -7,3 +7,4 @@ s5232f/scripts/qsfp_irq_enable.py usr/bin
s5232f/cfg/s5232f-modules.conf etc/modules-load.d
s5232f/systemd/platform-modules-s5232f.service etc/systemd/system
common/platform_reboot usr/share/sonic/device/x86_64-dellemc_s5232f_c3538-r0
common/fw-updater usr/local/bin

View File

@ -7,3 +7,4 @@ s5248f/scripts/qsfp_irq_enable.py usr/bin
s5248f/cfg/s5248f-modules.conf etc/modules-load.d
s5248f/systemd/platform-modules-s5248f.service etc/systemd/system
common/platform_reboot usr/share/sonic/device/x86_64-dellemc_s5248f_c3538-r0
common/fw-updater usr/local/bin

View File

@ -13,3 +13,4 @@ s6100/scripts/sensors usr/bin
s6100/systemd/platform-modules-s6100.service etc/systemd/system
s6100/systemd/s6100-lpc-monitor.service etc/systemd/system
tools/flashrom/flashrom usr/local/bin/
common/fw-updater usr/local/bin

View File

@ -11,3 +11,4 @@ z9100/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-
z9100/cfg/z9100-modules.conf etc/modules-load.d
z9100/systemd/platform-modules-z9100.service etc/systemd/system
z9100/systemd/z9100-lpc-monitor.service etc/systemd/system
common/fw-updater usr/local/bin

View File

@ -7,3 +7,4 @@ z9264f/scripts/qsfp_irq_enable.py usr/bin
z9264f/cfg/z9264f-modules.conf etc/modules-load.d
z9264f/systemd/platform-modules-z9264f.service etc/systemd/system
common/platform_reboot usr/share/sonic/device/x86_64-dellemc_z9264f_c3538-r0
common/fw-updater usr/local/bin