Skip to content

BIOS upgrade support in sonic_installer#570

Closed
paavaanan wants to merge 3 commits intosonic-net:masterfrom
paavaanan:flashrom-bios-infra
Closed

BIOS upgrade support in sonic_installer#570
paavaanan wants to merge 3 commits intosonic-net:masterfrom
paavaanan:flashrom-bios-infra

Conversation

@paavaanan
Copy link
Copy Markdown
Contributor

@paavaanan paavaanan commented Jul 3, 2019

- What I did

  • Added BIOS upgrade support in sonic_installer

- How I did it

  • "sonic_installer install sonic-broadcom.bin" --> Post installation of the new image, fetch the next_image version and mount sqashfs filesystem.
  • With the help of install_component_firmware() pass component name as "BIOS" and mount location.
  • Respective vendor API fetch the BIOS image from mounted location and take appropriate decisions (upgrade/Downgrade/Nochange) respectively.

- How to verify it

  • sonic_installer install sonic-broadcom.bin

- New command output (if the output of a command-line utility has changed)

--------Upgrade BIOS------------------------------------------------------------
   creating: /host/image-master.0-dirty-20190703.033247/platform/x86_64-dell_s6000_s1220-r0/
  inflating: /host/image-master.0-dirty-20190703.033247/platform/x86_64-dell_s6000_s1220-r0/platform-modules-s6000_1.1_amd64.deb
   creating: /host/image-master.0-dirty-20190703.033247/platform/x86_64-accton_as7312_54x-r0/
  inflating: /host/image-master.0-dirty-20190703.033247/platform/x86_64-accton_as7312_54x-r0/sonic-platform-accton-as7312-54x_1.1_amd64.deb
  inflating: /host/image-master.0-dirty-20190703.033247/fs.squashfs
Installed SONiC base image SONiC-OS successfully

Command: grub-set-default --boot-directory=/host 0

Command: rm -rf /host/old_config

Command: cp -ar /etc/sonic /host/old_config

Command: mount /host/image-master.0-dirty-20190703.033247/fs.squashfs /tmp/tmpQEjjBC -t squashfs -o loop


        ********************************************************************
        * Warning - Upgrading BIOS is inherently risky and should only be  *
        * attempted when necessary.  A failure at this upgrade may cause   *
        * a board RMA.  Proceed with caution !                             *
        ********************************************************************

New BIOS image 3.25.0.2-7 available to install, continue? [y/N]: y
Command: /usr/local/bin/flashrom -p internal -w /tmp/tmpQEjjBC/usr/share/sonic/device/x86_64-dell_s6100_c2538-r0/bin/S6100-BIOS-3.25.0.2-7.bin
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.

Command: umount /tmp/tmpQEjjBC

Command: sync;sync;sync

Command: sleep 3

Done

-->

import urllib
import tempfile
import subprocess
import sonic_platform.chassis
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not all platform has this module implemented, so this will break all platforms that do not have this module defined. we need to check the module availability.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in new commit...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. We will need to do this until all vendors have transitioned to the new platform API.

run_command(
'mount ' + squashfs_path + ' ' + tmpdir + \
' -t squashfs -o loop')
status = chassis.install_component_firmware(component_name, tmpdir)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not see the bios firmware name in the tmpdir. should that be a filename?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be at least under /usr/sonic/dev/{platform} folder.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • It is already addresed. DellEMC BIOS file do reside in following directory:
    /usr/share/sonic/device/x86_64-dell_s6100_c2538-r0/bin/ BIOS filepath
  • BIOS filename is fetched from chassis.py. BIOS filename
  • Do you need any change here?

@paavaanan
Copy link
Copy Markdown
Contributor Author

closing this PR due to change in BIOS update procedure.

@paavaanan paavaanan closed this Sep 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants