As the Grub2 ebuild has been updated to the stable version 2.00 and appeared keyworded as testing (~) in portage, I have finally decided to update my system. The steps I have done for that were based on official gentoo guides: a short one (Grub2 quick start) I basically followed and the detailed one(Grub2) I also considered. The basic update was rather trivial as whole procedure consists of small number of commands needed to be issued:
# emerge -av1 grub os-prober
I have also emerged os-prober to enable the automatic detection of my secondary operation system: Windows, I rarely use. After the compilation and installation as been finished I have installed it to MBR on the standard location.
# grub2-install /dev/sda
At this stage I have to say, that the gentoo team has done a great job in providing the best possible configuration, so all the necessary settings were already set up in /etc/default/grub. I just generated the grub.cfg file and the system started to work out of the box.
# grub2-mkconfig -o /boot/grub2/grub.cfg
And that was it!!!
As the whole updating process was completed faster as I was expected I started to tweak the setting to gain the best possible result. After briefly reading the official grub2’s documentation and receiving help from the #grub IRC channel, located on freenode server, I have managed to get what I wanted. My intend was to increase the resolution of the boot loader and the followed verbose kernel loading process. Additionally to that, I wanted to hide the grub’s menu entirely, which should only appear, when the shift button is pressed, during the grub’s loading process. This will just allow, to boot up gentoo by default, after the turn on button is pressed, as this is almost always my primary choice. Alternatively, after the “Welcome to Grub” output, the shift button can be hold, which should bring up the boot menu, where I can tell the system otherwise.
To activate the shift keyboard listener, the file custom.cfg should be created, contaning the following line of code:
$ cat /boot/grub2/custom.cfg if keystatus --shift; then timeout=-1; fi
The possibility of creating this custom.cfg file is mentioned here; the description of the keystatus command and the purpose of the timeout variable, respectively. Therefore all two …_TIMEOUT=0 variables were set to zero.
$ cat /etc/default/grub # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/files/grub.default-2,v 1.2 2012/06/28 22:36:53 floppym Exp $ # # To populate all changes in this file you need to regenerate your # grub configuration file afterwards: # 'grub2-mkconfig -o /boot/grub2/grub.cfg' # # See the grub info page for documentation on possible variables and # their associated values. GRUB_DISTRIBUTOR="Gentoo" GRUB_DEFAULT=0 GRUB_HIDDEN_TIMEOUT=0 GRUB_HIDDEN_TIMEOUT_QUIET=true GRUB_TIMEOUT=0 GRUB_CMDLINE_LINUX_DEFAULT="" GRUB_CMDLINE_LINUX="" #GRUB_CMDLINE_LINUX="video=vesafb:mtrr:3,ywrap vga=865" # Uncomment to disable graphical terminal (grub-pc only) #GRUB_TERMINAL=console # The resolution used on graphical terminal. # Note that you can use only modes which your graphic card supports via VBE. # You can see them in real GRUB with the command `vbeinfo'. #GRUB_GFXMODE=640x480 GRUB_GFXMODE=1280x800 GRUB_GFXPAYLOAD_LINUX=keep # Path to theme spec txt file. # The starfield is by default provided with use truetype. # NOTE: when enabling custom theme, ensure you have required font/etc. #GRUB_THEME="/boot/grub2/themes/starfield/theme.txt" # Background image used on graphical terminal. # Can be in various bitmap formats. #GRUB_BACKGROUND="/boot/grub2/mybackground.png" GRUB_BACKGROUND="/boot/grub2/gentoo.png" # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel #GRUB_DISABLE_LINUX_UUID=true # Uncomment to disable generation of recovery mode menu entries #GRUB_DISABLE_RECOVERY=true
In Grub-legacy I was passing the following options “video=vesafb:mtrr:3,ywrap vga=865” to the kernel to squeeze the better resolution than 640×480. However doing so over the GRUB_CMDLINE_LINUX variable has not brought the desired affect. Luckily, it was enough to modify the GRUB_GFXMODE and GRUB_GFXPAYLOAD_LINUX to get the same.