Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Grub2: EFI Firmware Setup Menu Request
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
Anthony7E
n00b
n00b


Joined: 18 Mar 2015
Posts: 10

PostPosted: Wed Mar 18, 2015 1:40 pm    Post subject: Grub2: EFI Firmware Setup Menu Request Reply with quote

Short story: Is there a way to add a menu option to Grub2 to boot into the EFI Firmware Setup (aka: the "BIOS")? I believe this should be added as a USE flag.

Long story:
On my current machine I have the ability to turn off CSM and enter a strict EFI mode (ASRock calls it "Ultra Fast Boot"). This is indeed fast. The problem is that once this is enabled it is impossible to re-enter the BIOS/Firmware Setup without either: A) Resetting the CMOS or B) Using a tool within the OS to force the Firmware setup to load on next boot. Windows 8 and other versions have this tool, and ASRock offers a utility to perform this function. I have not been able to find a way to do this on Linux, until now.

I have several other Linux distributions though, one of them Debian just recently updated to Jessie (testing) provides grub 2.02~beta2-21. On my Gentoo box, I have sys-boot/grub-2.02_beta2-r3:2. The Grub on Debian box has something interesting though, it has a menu option to return to UEFI Firmware Setup.

Below is the configuration:
$ cat /etc/grub.d/30_uefi-firmware
Code:

#! /bin/sh
set -e

# grub-mkconfig helper script.
# Copyright (C) 2012  Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.

prefix="/usr"
exec_prefix="/usr"
datarootdir="/usr/share"

export TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"
                                                                                                                                           
. "${datarootdir}/grub/grub-mkconfig_lib"                                                                                                   
                                                                                                                                           
efi_vars_dir=/sys/firmware/efi/vars                                                                                                         
EFI_GLOBAL_VARIABLE=8be4df61-93ca-11d2-aa0d-00e098032b8c                                                                                   
OsIndications="$efi_vars_dir/OsIndicationsSupported-$EFI_GLOBAL_VARIABLE/data"                                                             
                                                                                                                                           
if [ -e "$OsIndications" ] && \                                                                                                             
   [ "$(( $(printf %x \'"$(cat $OsIndications | cut -b1)") & 1 ))" = 1 ]; then                                                             
  LABEL="System setup"                                                                                                                     
                                                                                                                                           
  gettext_printf "Adding boot menu entry for EFI firmware configuration\n" >&2                                                             

  onstr="$(gettext_printf "(on %s)" "${DEVICE}")"

  cat << EOF
menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' {
        fwsetup
}
EOF
fi


I am going to attempt to create this file on my Gentoo box and see if the menu works. If so I will be happy, and hopefully this post helps someone else.
Back to top
View user's profile Send private message
tclover
Guru
Guru


Joined: 10 Apr 2011
Posts: 516

PostPosted: Wed Mar 18, 2015 10:00 pm    Post subject: Re: Grub2: EFI Firmware Setup Menu Request Reply with quote

Anthony7E wrote:
Short story: Is there a way to add a menu option to Grub2 to boot into the EFI Firmware Setup (aka: the "BIOS")? I believe this should be added as a USE flag.


Huh? Try not to get lost and confused with features enabled by USE flags and capabilities/functionalities of the software... I might be confusing sometimes. You can indeed build platform specific boot loaders depending on USE flags. Howver, once a specific platform variant is installed, this variant would be booting the machine and not another thing. Still, one can chain-load another boot loader with GRUB[2]--this is what would be giving you the ability to chain-load another EFI/BIOS boot loader. If you're booting with (GRUB) EFI, you could chain-load GRUB4DOS to get what you're looking for--a BIOS boot loader.

NOTE: I did not read the rest of your post because it's too long. And what I've written can/could be retrieved from the official wiki. Maybe a few bits are splited into sus-articles, however, the info should be there IIRC--it's been a while I did not check that article because some people just kept removing some useful info I've took the time to put together.
_________________
home/:mkinitramfs-ll/:supervision/:e-gtk-theme/:overlay/
Back to top
View user's profile Send private message
Anthony7E
n00b
n00b


Joined: 18 Mar 2015
Posts: 10

PostPosted: Sat Mar 21, 2015 3:17 pm    Post subject: Reply with quote

Thanks for the reply. I am actually not looking to chain load but a way to get back to the BIOS setup after the system boots and loads the boot loader.

This is because once "Ultra Fast Boot" mode is enabled on some newer UEFI motherboards you are not presented with the option to press F2 for Setup, or because the keyboard drivers have not loaded and do not accept the F2 input in this fast boot mode.

The only way to return to the BIOS Setup in those situations is:

  1. Clear CMOS
  2. A special option from within the OS (ASRock provides a "Restart to UEFI" utility)
  3. The bootloader sends you to the BIOS


For Linux, option 2 is not available that I am aware. Option 1 sucks (and wipes out the EFI boot list requiring you to have to boot a UEFI USB drive and rewrite it with efibootmgr)

Thus, option 3 is the easiest. I have recently found that Grub 2 does offer this feature, and I found that solution through Debian Jessie. I am asking if it can be added to the Portage copy of Grub 2, or is it better if I just add it to the Wiki?
Back to top
View user's profile Send private message
dweezil-n0xad
Apprentice
Apprentice


Joined: 30 Oct 2006
Posts: 156
Location: Ostend, Belgium

PostPosted: Sat Mar 21, 2015 8:11 pm    Post subject: Reply with quote

This is very interesting. My motherboard (MSI H97 Gaming 3) has a "fast boot" and "MSI fast boot" option in the bios menu under "Windows 8/8.1 settings". They were both disabled.

So to enter the bios menu from grub, you only need this entry in /boot/grub/grub.cfg
Code:
menuentry 'System setup' $menuentry_id_option 'uefi-firmware' {
   fwsetup
}

I tested this on my gentoo system and it actually works. I enabeld "fast boot" in the bios menu and now my system boots faster. I can't enter the bios menu anymore with the keyboard while booting, but with the "System setup" entry the system reboots into the bios menu.

Then I enabled "MSI fast boot" and the system boots even faster. However the keyboard didn't work in the grub menu :P I had to put the fwsetup menuentry on top of the os list to be able to enter the bios and disable "MSI fast boot".

I added the menuentry to /etc/conf.d/40_custom, I can't get it working with 30_uefi-firmware.
_________________
i7-4790K | 16GB DDR3 | GTX 970 | 500GB SSD
ASUS N56VV | i7-3630QM | 12GB DDR3 | GT 750M | 256GB SSD
Back to top
View user's profile Send private message
Anthony7E
n00b
n00b


Joined: 18 Mar 2015
Posts: 10

PostPosted: Tue Apr 07, 2015 4:10 pm    Post subject: Reply with quote

Excellent! I'm glad it helped someone.

As I mentioned, I spent a lot of time researching this issue because I had locked myself out of my mobo's firmware a few times and it was a pain trying to get to the CMOS reset jumper.



It would be nice to have this added to the pack as a default option. I'm not very experienced in package development though. What is the best way to provide this feedback?
Back to top
View user's profile Send private message
dweezil-n0xad
Apprentice
Apprentice


Joined: 30 Oct 2006
Posts: 156
Location: Ostend, Belgium

PostPosted: Tue Apr 07, 2015 6:15 pm    Post subject: Reply with quote

I found my error, I forgot to "chmod +x /etc/grub.d/30_uefi-firmware"
now the BIOS setup is automatically added to my grub menu and I no longer need to put it in 40_custom.
_________________
i7-4790K | 16GB DDR3 | GTX 970 | 500GB SSD
ASUS N56VV | i7-3630QM | 12GB DDR3 | GT 750M | 256GB SSD
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum