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

Add basic GRUB default boot entry support #2693

Merged
merged 4 commits into from
Jun 12, 2023

Conversation

ShellyChang110
Copy link
Contributor

No description provided.

@ShellyChang110 ShellyChang110 changed the title Boot default option Add basic GRUB default boot entry support Jun 7, 2023
@codecov
Copy link

codecov bot commented Jun 7, 2023

Codecov Report

Patch coverage: 94.00% and project coverage change: +2.94 🎉

Comparison is base (a87349c) 72.45% compared to head (0a2fa25) 75.40%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2693      +/-   ##
==========================================
+ Coverage   72.45%   75.40%   +2.94%     
==========================================
  Files         355      414      +59     
  Lines       37729    42116    +4387     
==========================================
+ Hits        27337    31756    +4419     
+ Misses      10392    10360      -32     
Impacted Files Coverage Δ
pkg/boot/localboot/localboot.go 0.00% <0.00%> (ø)
pkg/boot/grub/grub.go 78.04% <93.75%> (+1.60%) ⬆️
pkg/boot/bls/bls.go 89.04% <100.00%> (+14.57%) ⬆️

... and 117 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

pkg/boot/bls/bls.go Outdated Show resolved Hide resolved
pkg/boot/grub/grub.go Outdated Show resolved Hide resolved
Signed-off-by: Shelly Chang <Shelly_Chang@wiwynn.com>
pkg/boot/grub/grub.go Outdated Show resolved Hide resolved
pkg/boot/grub/grub.go Outdated Show resolved Hide resolved
pkg/boot/grub/grub.go Outdated Show resolved Hide resolved
Add support for the default boot entry when GRUB_DEFAULT=saved and GRUB_ENABLE_BLSCFG=true in /etc/default/grub.
For this case grub.cfg would generate the below line:
set default="${saved_entry}"
and grubenv would contain the value of ${saved_entry}, which will be compared and used as the default boot entry.
Here it only handles specifically for this case.
The default boot entry will be assigned with an incremented linux.BootRank, therefore it will be displayed from the top of the boot menu.

Testing method:
With CentOS 8, set GRUB_DEFAULT=saved and GRUB_ENABLE_BLSCFG=true in /etc/default/grub, and then run 'grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg'.
Use 'grubby --set-default' to set the default boot option, run 'cat /boot/*/grubenv' to check the value after saved_entry is expected.
After reboot, 'boot' command can see the default boot option displayed at the top of the boot menu.

Signed-off-by: Shelly Chang <Shelly_Chang@wiwynn.com>
Signed-off-by: Shelly Chang <Shelly_Chang@wiwynn.com>
Copy link
Member

@rminnich rminnich left a comment

Choose a reason for hiding this comment

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

thanks for your patience.

@johnnylinwiwynn
Copy link
Contributor

thanks for your patience.

Thanks for your review Ron.

@rminnich rminnich merged commit 3eafcec into u-root:main Jun 12, 2023
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants