Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[grub]: Allow ONiE oneshot boot for FW update #3935

Merged
merged 1 commit into from
Jan 21, 2020

Conversation

nazariig
Copy link
Collaborator

Signed-off-by: Nazarii Hnydyn nazariig@mellanox.com

This small improvement enables ONiE oneshoot boot for various firmware update operations
(BIOS, CPLD, etc.):
https://opencomputeproject.github.io/onie/design-spec/firmware_update.html

The new flow allows to avoid the certain types of issues:

root@sonic:/home/admin# sonic_installer list
Current: SONiC-OS-HEAD.140-fc36ca6e
Next: SONiC-OS-HEAD.140-fc36ca6e
Available:
SONiC-OS-HEAD.140-fc36ca6e
SONiC-OS-HEAD.5-386619ac
root@sonic:/home/admin# grub-editenv /host/grub/grubenv set next_entry=2
root@sonic:/home/admin# sonic_installer list
Traceback (most recent call last):
  File "/usr/bin/sonic_installer", line 12, in <module>
    sys.exit(cli())
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/sonic_installer/main.py", line 380, in list
    nextimage = get_next_image()
  File "/usr/lib/python2.7/dist-packages/sonic_installer/main.py", line 194, in get_next_image
    next_image = images[next_image_index]
IndexError: list index out of range

Example:

root@sonic:/home/admin# sonic_installer list
Current: SONiC-OS-HEAD.140-fc36ca6e
Next: SONiC-OS-HEAD.140-fc36ca6e
Available:
SONiC-OS-HEAD.140-fc36ca6e
SONiC-OS-HEAD.5-386619ac
root@sonic:/home/admin# grub-editenv /host/grub/grubenv set onie_entry=2
root@sonic:/home/admin# sonic_installer set_next_boot SONiC-OS-HEAD.5-386619ac
Command: grub-reboot --boot-directory=/host 1
root@sonic:/home/admin# grub-editenv /host/grub/grubenv list
saved_entry=0
next_entry=1
onie_entry=2
root@sonic:/home/admin# sonic_installer list
Current: SONiC-OS-HEAD.140-fc36ca6e
Next: SONiC-OS-HEAD.5-386619ac
Available:
SONiC-OS-HEAD.140-fc36ca6e
SONiC-OS-HEAD.5-386619ac

- What I did

  • Added ONiE oneshoot boot feature

- How I did it

  • Modified grub configuration

- How to verify it

  1. grub-editenv /host/grub/grubenv set onie_entry=<onie_entry_index>

- Description for the changelog

  • N/A

- A picture of a cute animal (not mandatory but encouraged)

      .---.        .-----------
     /     \  __  /    ------
    / /     \(  )/    -----
   //////   ' \/ `   ---
  //// / // :    : ---
 // /   /  /`    '--
//          //..\\
       ====UU====UU====
           '//||\\`
             ''``

Signed-off-by: Nazarii Hnydyn <nazariig@mellanox.com>
@lguohan
Copy link
Collaborator

lguohan commented Dec 27, 2019

cannot find the onie_entry spec in the url provided above. can you point out the link to the onie_entry?

@lguohan lguohan changed the title [grub]: Allow ONiE oneshoot boot for FW update [grub]: Allow ONiE oneshot boot for FW update Dec 27, 2019
@nazariig
Copy link
Collaborator Author

nazariig commented Jan 2, 2020

cannot find the onie_entry spec in the url provided above. can you point out the link to the onie_entry?

There is no official spec for this naming convention. It's just a proposal to introduce a separate Grub environment variable to control oneshoot boot for FW update. This approach allows to avoid user accident modification of next boot partition.

@nazariig
Copy link
Collaborator Author

@lguohan please merge if no further concerns

@nazariig nazariig requested a review from lguohan January 15, 2020 18:02
@nazariig
Copy link
Collaborator Author

@lguohan kindly reminder - please have a look

@lguohan lguohan merged commit bcc4e55 into sonic-net:master Jan 21, 2020
abdosi pushed a commit that referenced this pull request Feb 24, 2020
Added ONiE oneshoot boot feature

Signed-off-by: Nazarii Hnydyn <nazariig@mellanox.com>
pphuchar pushed a commit to SONIC-DEV/sonic-buildimage that referenced this pull request Mar 9, 2020
Added ONiE oneshoot boot feature

Signed-off-by: Nazarii Hnydyn <nazariig@mellanox.com>
tiantianlv pushed a commit to SONIC-DEV/sonic-buildimage that referenced this pull request Apr 24, 2020
Added ONiE oneshoot boot feature

Signed-off-by: Nazarii Hnydyn <nazariig@mellanox.com>
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.

7 participants