penduleum
February 15th, 2011, 08:00 PM
hey all.
After reading a while in this tread:
http://ubuntuforums.org/showthread.php?t=30341
i disided to do some tweaking in grub2.
I have got the image working, not the same way as the tutorial, but it works.
When i add the image (extention .tga) to the section wallpaper in 05_debian_theme, and update grub, it works. But i have some kind of a problem that i cant understand...
and that is this section:
c/p from 05_debian_theme:
# this allows desktop-base to override our settings
f=/usr/share/desktop-base/grub_background.sh
if test -e ${f} ; then
. ${f}
else
WALLPAPER="/usr/share/images/grub/Sparkler.tga"
COLOR_NORMAL="black/red"
COLOR_HIGHLIGHT="black/green"
fi
set_mono_theme()
{
cat << EOF
set menu_color_normal=green/brown
set menu_color_highlight=black/black
EOF
}
the part:
COLOR_NORMAL="black/red"
COLOR_HIGHLIGHT="black/green"
gives me some headic...
This part puts the background (wallpaper) complete to whatever i have put in there.. (red blue brown ect).
If i remove that part, i get the *.tga wallpaper, but cant read the menu enterys, and it gives me a syntax error of some kind (cant read it).
So, what can i do to resolve this problem?
Here is the complete 05_debian_theme and grub.cfg:
05_debian_theme:
#!/bin/sh -e
. /usr/lib/grub/grub-mkconfig_lib
# this allows desktop-base to override our settings
f=/usr/share/desktop-base/grub_background.sh
if test -e ${f} ; then
. ${f}
else
WALLPAPER="/usr/share/images/grub/Sparkler.tga"
COLOR_NORMAL="black/red"
COLOR_HIGHLIGHT="black/green"
fi
set_mono_theme()
{
cat << EOF
set menu_color_normal=green/brown
set menu_color_highlight=black/black
EOF
}
# check for usable backgrounds
use_bg=false
for output in ${GRUB_TERMINAL_OUTPUT}; do
if [ "$output" = "gfxterm" ] ; then
for i in /boot/grub/`basename ${WALLPAPER}` ${WALLPAPER} ; do
if is_path_readable_by_grub $i ; then
bg=$i
case ${bg} in
*.png) reader=png ;;
*.tga) reader=tga ;;
*.jpg|*.jpeg) reader=jpeg ;;
esac
if test -e /boot/grub/${reader}.mod ; then
echo "Found background image: `basename ${bg}`" >&2
use_bg=true
break
fi
fi
done
break
fi
done
# set the background if possible
if ${use_bg} ; then
prepare_grub_to_access_device `${grub_probe} --target=device ${bg}`
cat << EOF
insmod ${reader}
if background_image `make_system_path_relative_to_its_root ${bg}` ; then
set color_normal=${COLOR_NORMAL}
set color_highlight=${COLOR_HIGHLIGHT}
else
EOF
fi
# otherwise, set a monochromatic theme for Ubuntu
if ${use_bg} ; then
set_mono_theme | sed -e "s/^/ /g"
echo "fi"
else
set_mono_theme
fi
Ofcourse, i do a grup update so that the changes have there effect....
(
grub.cfg:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
set default="4"
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 recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}
function load_video {
insmod vbe
insmod vga
}
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 7284759a-64ac-4f93-b89e-8a3a0808e229
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=1280x1024
load_video
insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 7284759a-64ac-4f93-b89e-8a3a0808e229
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
if [ "${recordfail}" = 1 ]; then
set timeout=-1
else
set timeout=5
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 7284759a-64ac-4f93-b89e-8a3a0808e229
insmod tga
if background_image /usr/share/images/grub/Sparkler.tga ; then
set color_normal=
set color_highlight=
else
set menu_color_normal=green/brown
set menu_color_highlight=red/blue
fi
### END /etc/grub.d/05_debian_theme ###
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.35-22-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 7284759a-64ac-4f93-b89e-8a3a0808e229
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=7284759a-64ac-4f93-b89e-8a3a0808e229 ro splash vga=795 quiet splash
initrd /boot/initrd.img-2.6.35-22-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-22-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 7284759a-64ac-4f93-b89e-8a3a0808e229
echo 'Loading Linux 2.6.35-22-generic ...'
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=7284759a-64ac-4f93-b89e-8a3a0808e229 ro single splash vga=795
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.35-22-generic
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 7284759a-64ac-4f93-b89e-8a3a0808e229
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 7284759a-64ac-4f93-b89e-8a3a0808e229
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###
### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sda1)" {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set 62bee1dbbee1a82d
chainloader +1
}
### 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.
### 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 ###
My question is, how can i activate the wallpaper that i have selected, and that whit colloured menus. Whitout the problem that the wallpaper get replaced by any of the collors i put in there...
thx for the help!!
After reading a while in this tread:
http://ubuntuforums.org/showthread.php?t=30341
i disided to do some tweaking in grub2.
I have got the image working, not the same way as the tutorial, but it works.
When i add the image (extention .tga) to the section wallpaper in 05_debian_theme, and update grub, it works. But i have some kind of a problem that i cant understand...
and that is this section:
c/p from 05_debian_theme:
# this allows desktop-base to override our settings
f=/usr/share/desktop-base/grub_background.sh
if test -e ${f} ; then
. ${f}
else
WALLPAPER="/usr/share/images/grub/Sparkler.tga"
COLOR_NORMAL="black/red"
COLOR_HIGHLIGHT="black/green"
fi
set_mono_theme()
{
cat << EOF
set menu_color_normal=green/brown
set menu_color_highlight=black/black
EOF
}
the part:
COLOR_NORMAL="black/red"
COLOR_HIGHLIGHT="black/green"
gives me some headic...
This part puts the background (wallpaper) complete to whatever i have put in there.. (red blue brown ect).
If i remove that part, i get the *.tga wallpaper, but cant read the menu enterys, and it gives me a syntax error of some kind (cant read it).
So, what can i do to resolve this problem?
Here is the complete 05_debian_theme and grub.cfg:
05_debian_theme:
#!/bin/sh -e
. /usr/lib/grub/grub-mkconfig_lib
# this allows desktop-base to override our settings
f=/usr/share/desktop-base/grub_background.sh
if test -e ${f} ; then
. ${f}
else
WALLPAPER="/usr/share/images/grub/Sparkler.tga"
COLOR_NORMAL="black/red"
COLOR_HIGHLIGHT="black/green"
fi
set_mono_theme()
{
cat << EOF
set menu_color_normal=green/brown
set menu_color_highlight=black/black
EOF
}
# check for usable backgrounds
use_bg=false
for output in ${GRUB_TERMINAL_OUTPUT}; do
if [ "$output" = "gfxterm" ] ; then
for i in /boot/grub/`basename ${WALLPAPER}` ${WALLPAPER} ; do
if is_path_readable_by_grub $i ; then
bg=$i
case ${bg} in
*.png) reader=png ;;
*.tga) reader=tga ;;
*.jpg|*.jpeg) reader=jpeg ;;
esac
if test -e /boot/grub/${reader}.mod ; then
echo "Found background image: `basename ${bg}`" >&2
use_bg=true
break
fi
fi
done
break
fi
done
# set the background if possible
if ${use_bg} ; then
prepare_grub_to_access_device `${grub_probe} --target=device ${bg}`
cat << EOF
insmod ${reader}
if background_image `make_system_path_relative_to_its_root ${bg}` ; then
set color_normal=${COLOR_NORMAL}
set color_highlight=${COLOR_HIGHLIGHT}
else
EOF
fi
# otherwise, set a monochromatic theme for Ubuntu
if ${use_bg} ; then
set_mono_theme | sed -e "s/^/ /g"
echo "fi"
else
set_mono_theme
fi
Ofcourse, i do a grup update so that the changes have there effect....
(
grub.cfg:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
set default="4"
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 recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}
function load_video {
insmod vbe
insmod vga
}
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 7284759a-64ac-4f93-b89e-8a3a0808e229
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=1280x1024
load_video
insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 7284759a-64ac-4f93-b89e-8a3a0808e229
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
if [ "${recordfail}" = 1 ]; then
set timeout=-1
else
set timeout=5
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 7284759a-64ac-4f93-b89e-8a3a0808e229
insmod tga
if background_image /usr/share/images/grub/Sparkler.tga ; then
set color_normal=
set color_highlight=
else
set menu_color_normal=green/brown
set menu_color_highlight=red/blue
fi
### END /etc/grub.d/05_debian_theme ###
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.35-22-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 7284759a-64ac-4f93-b89e-8a3a0808e229
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=7284759a-64ac-4f93-b89e-8a3a0808e229 ro splash vga=795 quiet splash
initrd /boot/initrd.img-2.6.35-22-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-22-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 7284759a-64ac-4f93-b89e-8a3a0808e229
echo 'Loading Linux 2.6.35-22-generic ...'
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=7284759a-64ac-4f93-b89e-8a3a0808e229 ro single splash vga=795
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.35-22-generic
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 7284759a-64ac-4f93-b89e-8a3a0808e229
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 7284759a-64ac-4f93-b89e-8a3a0808e229
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###
### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sda1)" {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set 62bee1dbbee1a82d
chainloader +1
}
### 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.
### 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 ###
My question is, how can i activate the wallpaper that i have selected, and that whit colloured menus. Whitout the problem that the wallpaper get replaced by any of the collors i put in there...
thx for the help!!