Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Grub2 mkconfig does not create settings
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
musv
Advocate
Advocate


Joined: 01 Dec 2002
Posts: 3258
Location: de

PostPosted: Wed Oct 12, 2011 7:59 am    Post subject: Grub2 mkconfig does not create settings Reply with quote

Hi there!

More just for fun I switched a few weeks ago to Grub-2. And after a lot of trouble (script to generate the grub.cfg fails if the root partition is btrfs formatted) I got it working. Means, it's booting my kernel stuff.

My problem:
Like Grub-0.97 I would like to have a higher resolution than 640x480 when booting the kernel. Also a background-pic and some colors in boot menu would be nice.

Files:
/etc/grub.d/09_gentoo:
#!/bin/sh -e
echo "Adding Gentoo (09_Gentoo)"
cat << EOF
menuentry "Gentoo 3.0.1"   {
   set root=(hd0,1)
   linux /boot/bzImage-301 root=/dev/sda1 ro splash CONSOLE=/dev/tty1
}

menuentry "Gentoo 3.0.6"   {
   set root=(hd0,1)
   linux /boot/bzImage-306 root=/dev/sda1 ro splash CONSOLE=/dev/tty1
}
EOF


and the settings:
/etc/default/grub/:
GRUB_GFXPAYLOAD_LINUX=1600x1200x24
GRUB_COLOR_HIGHLIGHT=light-blue/dark-gray
GRUB_COLOR_NORMAL=blue/black
GRUB_TIMEOUT=10
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_DEFAULT=saved
GRUB_GFXMODE=1600x1200x24
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_HIDDEN_TIMEOUT=0
GRUB_CMDLINE_LINUX=""
GRUB_BACKGROUND=/boot/grub2/Alley_Baggett_003.jpg
GRUB_DEVICE="/dev/sda1"


grub2-mkconfig -o /boot/grub2/grub.cfg creates:
Code:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/09_gentoo ###
Adding Gentoo (09_Gentoo)
menuentry "Gentoo 3.0.1"   {
   set root=(hd0,1)
   linux /boot/bzImage-301 root=/dev/sda1 ro splash CONSOLE=/dev/tty1
}

menuentry "Gentoo 3.0.6"   {
   set root=(hd0,1)
   linux /boot/bzImage-306 root=/dev/sda1 ro splash CONSOLE=/dev/tty1
}
### END /etc/grub.d/09_gentoo ###

### BEGIN /etc/grub.d/10_linux ###
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry "Memtest86+" {
      insmod bsd
         netbsd /boot/memtest86plus/memtest.bin
}
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

And the result is like expected the standard resolution in black-white without any background-pic.

Is there a way to get it working?
Back to top
View user's profile Send private message
tclover
Guru
Guru


Joined: 10 Apr 2011
Posts: 516

PostPosted: Wed Oct 12, 2011 8:56 am    Post subject: Have to do the other way around Reply with quote

I've got that issue as well, it seems, for some reasons I ignore, some settings in `/etc/default/grub' are just ignored when invoking grub2-mkconfig. You just have to do it the other way around! I cannot understand why so many warnings are placed there with GRUB2 to not set up a bit manually the config file and make you you understand that you have to leave it to some scripts, because hey, automated scripts are so much better aren't they? You don't even have to bother to see what's going when running them, and then, reboot without knowing what happened after running them?

Anyway, I've jut had to place something like
/etc/grub.d/01_header wrote:
#!/bin/sh
exec tail -n +3 $0

set timeout=10

insmod fat
insmod font
set gfxmode=1680x1050
set gfxpayload=keep
load_video
insmod gfxterm
terminal_output gfxterm
loadfont ${prefix}/unifont.pf2
insmod jpeg
background_image ${prefix}/ultra-${gfxmode}.jpg
set menu_color_normal=white/black
set menu_color_highlight=black/magenta

to get my base settings done the way i like and not rely solely on the automated scripts. The automated scripts are a bit long so I did not bother to go fishing the "whys" and "why not" it doesn't work.
Back to top
View user's profile Send private message
musv
Advocate
Advocate


Joined: 01 Dec 2002
Posts: 3258
Location: de

PostPosted: Wed Oct 12, 2011 10:33 am    Post subject: Reply with quote

Thanx, I'll try that way.

The reason for the automated scripts is just, that you'll find Hundreds of documents and tutorials. And nothing works really. That's frustrating.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software 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