# HOWTO: Fancy Grub and Splash on Intel graphics (esp. EeePC)

## lxg

HOWTO: Fancy Grub and fbsplash on a machine with Intel graphic chipsets

This Article explains how to have a beautiful Grub screen and a nice boot splash on Intel graphic chipsets. Please read through it first completely and decide then if you're willing to do this, especially the Grub2 migration. However, implementing this Howto should not take more than 1 hour for an experienced Gentoo user.

There are two other, similar Howtos [1, 2]. The cool things  about this one are:

- Fancy Grub!

- No need to load init scripts for adjusting the VBIOS.

- Small, elegant font on the FB console (instead of the clumsy large one).

- Fancy boot splash from the very beginning of the boot process!

There is a disadvantage, too: We will migrate to Grub2, which means that you must update your Grub config. But as Grub2 is the future, you will have to do this some day anyway.

The usual warning: Much of this Howto is not officially supported in Gentoo. You should be either halfway experienced, or passionate about experimenting/learning.  :Wink:  Also, please don't bother Gentoo devs with problems or bugs you might encounter, unless you know that the bug affects a Gentoo-supported feature.

There are some additional files for this Howto, for which I created an archive fancy_on_intel, which you can download from my server. All its contents are Free Software, so you are welcome to share and modify them.

This Howto was developed on an EeePC 901 with an Intel 945GME graphics chipset and a resolution of 1024x600. Please adapt the resolutions in this Howto to fit your environment.

Part 1: Fancy Grub

We will use Grub2 (current version in Portage: 1.96), because we need to apply a patch for this version for the resolution, and because Grub2 has fancy stuff by default. I will refer to Grub 1.96 in the following, but if you have a later ebuild of the 1.x series, use that one (but not grub-9999!).

1.1 Patching and upgrading Grub

We will compile 915resolution directly into Grub. (If you have already installed 915resolution, fbset etc. as userspace tools, you can unmerge them later.) We will use a patch by Nathan Coulson for this.

First, we need to edit the ebuild /usr/portage/sys-boot/grub/grub-1.96.ebuild. Insert a line to apply the patch into the src_compile() section, at the designated position:

```
src_compile() {

        use custom-cflags || unset CFLAGS CPPFLAGS LDFLAGS

        use static && append-ldflags -static

        epatch ${FILESDIR}/${P}-915resolution-0.5.2-3.patch || die "Patching with 915resolution failed." # THIS IS THE LINE TO INSERT

        econf \

                --sbindir=/sbin \

                --bindir=/bin \

                --libdir=/$(get_libdir) \

                || die "econf failed"

        emake -j1 || die "making regular stuff"

}

```

(The src_compile() section might look slightly different in other ebuilds of Grub 1.x.)

Downloading the patch and re-creating the Manifest file:

```
wget -O /usr/portage/sys-boot/grub/files/grub-1.96-915resolution-0.5.2-3.patch \

       http://www.nathancoulson.com/proj/eee/grub-1.96-915resolution-0.5.2-3.patch

ebuild /usr/portage/sys-boot/grub/grub-1.96.ebuild manifest

```

Grub2 is keyworded in Portage, we need to unmask it:

```
echo '=sys-boot/grub-1.96 **' >> /etc/portage/package.keywords
```

Now we can emerge Grub2. However, Ruby must be available in order to have the 915resolution patch compiled as Grub module. (Because Grub will dynamically re-build the install instructions only if Ruby is present, elsewise it will use the shipped one.)

```
[ -z "$(which ruby 2> /dev/null)" ] && emerge -av ruby

emerge -av grub

```

Now you should have Grub2 installed. Now you must migrate your configuration to Grub2 and reinstall Grub! Sorry for the hassle, but this is vitally important. Please be sure to have a Live CD or similar media in reach, because an error in the Grub config might leave you with an unbootable system! (very bad of Grub2, btw)

1.2 Migrating the Grub configuration

If you have /boot on a separate, unmounted partition, mount it now.

Rename your old Grub configuration, create a new Grub directory, and copy the old config:

```
mv /boot/grub /boot/grub.old

mkdir /boot/grub

cp /boot/grub.old/menu.lst /boot/grub/grub.cfg

```

Now you must change your old configuration in grub.cfg to match the new scheme. Again: this is very important, and a syntax error might leave you with an unbootable system.

Here's a demo config, already with the fancy stuff:

```
set default=1

set timeout=10

insmod terminal

insmod 915resolution

insmod gfxterm

insmod vbe

insmod font

insmod jpeg

915resolution 5c 1024 600

font /boot/grub/unifont.pff

set gfxmode=1024x600

terminal gfxterm

set menu_color_normal=white/black

set menu_color_highlight=white/dark-gray

background_image (hd0,1)/boot/grub/bluelines.jpg

menuentry "Gentoo Linux (lean setup)" {

        set root=(hd0,1)

        linux /boot/linux-2.6.28-gentoo_eeepc901 root=/dev/sda1 video=vesafb:mode=1024x600-32 vga=604 \

                splash=verbose,theme:eeepc quiet console=tty1 fbcon=scrollback:64K softlevel=nonetwork

        # The "video=vesafb:mode=1024x600-32" is possibly not required, but vga=604 is important.

        # vga=604 corresponds to the video mode 0x25c, which we overwrote with 915resolution before.

}

menuentry "Gentoo Linux (full power)" {

        set root=(hd0,1)

        linux /boot/linux-2.6.28-gentoo_eeepc901 root=/dev/sda1 video=vesafb:mode=1024x600-32 vga=604 \

                splash=verbose,theme:eeepc quiet console=tty1 fbcon=scrollback:64K

}

# vim:ft=conf:

```

Here are some common pitfalls with the new Grub config:

- The menuentrys now are started with menuentry (not title anymore), the titles are quoted and each entry must be enclosed in curly braces.

- The kernel line now starts with linux.

- Grub counts partitions starting at 1, not 0 as Grub legacy. Thus, hd(0,0) must become hd(0,1)  (if your /boot stuff is on the first partition of the first harddisk).

- The syntax for settings has changed, note for example the line set root=(hd0,1) and the settings at the top.

For the extra files referenced in the above config, copy grub/unifont.pff and grub/bluelines.jpg from the fancy_on_intel archive to /boot/grub.

The last step is to install the new grub version into the MBR, and to install the Grub2 files into /boot/grub (adapt the command line according to what's correct for your environment):

```
grub-install --no-floppy /dev/sda
```

Please note that I'm using vesafb instead of intelfb here. This seems to be a bug in either the intelfb driver or the 915resolution stuff which causes the screen to go crazy when the kernel boots. You might be luckier than me with intelfb, but in case you are not, you should use the VESA framebuffer driver. (This affects only the framebuffer -- X.org will still use the Intel driver, if you have it configured to.)

```
Device Drivers  --->

    Graphics support  --->

        <*> Support for frame buffer devices  --->

            < >   Userspace VESA VGA graphics support

            [*]   VESA VGA graphics support

            < >   Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support (EXPERIMENTAL)

```

Also, you should now activate framebuffer console support and initrd support for later.

```
Console display driver support --->

    <*> Framebuffer Console support

    [*]   Support for the Framebuffer Console Decorations

 Device Drivers --->

    Block devices --->

        <*> RAM block device support

            (16)   Default number of RAM disk

            (4096) Default RAM disk size (kbytes)

General Setup --->

    [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support

Device Drivers --->

    Input Device Support --->

        <*> Event Interface

```

If your kernel didn't already have these features, change the config accordingly, re-compile the kernel, and install it in /boot.

You can now reboot and should see a beautiful Grub boot menu.  :Very Happy: 

Grub2 can do a lot more of fancy stuff. Unfortunately, it's very badly documented at the moment, so you have to experiment a lot.

Part 2: Framebuffer splash

After all the hassle with Grub, the Framebuffer splash is almost a breeze.

Note: Most of this section has been done using the FBsplash Howto in the Gentoo wiki. My approach is to avoid all userspace stuff as well as the external initrd (we'll compile it into the kernel). For more information and different approaches, for example usage with genkernel or a separate initrd, have a look there.

We need the splashutils package with fbcondecor support:

```
echo "media-gfx/splashutils fbcondecor" >> /etc/portage/package.use

emerge -av splashutils
```

To obtain a theme, you can either emerge media-gfx/splash-themes-gentoo, or you can create one yourself. I've included a simple one for the 1024x600 resolution in the fancy_on_intel archive which you can put into /etc/splash.

If there is a symlink named default in /etc/splash, you must delete it:

```
[ -L /etc/splash/default ] && rm /etc/splash/default
```

If in your preferred theme there is no resXxresY.cfg file and no resXxresY images for your resolution, you must create them yourself. See the other theme files and especially /usr/share/doc/splashutils/theme_format for more.

Your kernel must support initrd and framebuffer console. See part 1 for the according config.

I prefer to have the little initrd in the kernel, so we are going to compile it in (adapt to fit your needs):

```
splash_geninitramfs -g /usr/src/linux/usr/initramfs_data.cpio.gz -v -r 1024x600 eeepc # 1024x600: your resolution; eeepc: your theme

cd /usr/src/linux && make # recompiling the kernel with the new initrd

# consider making a copy of your working kernel in /boot before you execute this

cp arch/x86/boot/bzImage /boot/linux-2.6.28-gentoo_eeepc901
```

You can now reboot, and you should have see your nice splash screen as soon as the kernel boots.  :Very Happy: 

That's all, folks! Have a lot of fun, and please share your experience.

--

edit: Added comment to Grub config about video/vga cmdline

edit: Corrected a link to gentoo-wiki.com

----------

## SlashBeast

 *Quote:*   

> set gfxmode=1024x600 

 

Can I type here 1280x800 and in kernel boot parametr and it will work for 1280x800 on vesafb? Now I use vga=0x314

----------

## lxg

 *SlashBeast wrote:*   

>  *Quote:*   set gfxmode=1024x600  
> 
> Can I type here 1280x800 and in kernel boot parametr and it will work for 1280x800 on vesafb? Now I use vga=0x314

 

Not exactly, but similar. You must modify my example grub.cfg for your resolution:

```

915resolution 5c 1280 800

set gfxmode=1280x800 

```

The vga statement must have the value 604, because 915resolution overwrote the preset mode 5c, which corresponds to 25c, which is 604 in decimal (but I suppose vga=0x25c should also work).

edit: I just realized that the video=vesafb:mode=1280x800-32 is actually not required.

----------

## Tolstoi

Thanks for this guide. Everything works fine except that I get an error message telling me that mode 25c is not known and I have to scan for other modes.

Cheers

----------

## truc

Hello,

My laptop has both an intel card and a nvidia one (stamina/speed mode). Do you have any idea what would happen if I follow this howto then boot while being in the speed mode (nvidia card)?

----------

## xaviermiller

Tank you ! It worked fine if I create a boot partition in ext2 (my root is in ext4, that scrambled GRUB2).

----------

## Tolstoi

Moved to built in initramfs too meanwhile. Left away i915resolution from the runlevel though.

----------

## d2_racing

Thanks for this great howto  :Razz: 

----------

## hook

If the HOWTO included info on how to use Plymouth instead of FBsplash, it'd rock even harder!  :Wink: 

----------

## civnetra

errr..could anybody put some effect pics?  :Very Happy: 

----------

## kardolus

Hi there,

I was trying to test the splash image on tty1:

```

localhost emerge-world # splash_manager --theme=livecd-2007.0 --cmd=set --tty=1

Error: Theme 'livecd-2007.0' doesn't seem to provide a config file for the current resolution (1024x600).

```

What does your 1024x600 config file look like?

Edit: I was able to test in silent mode btw, but in verbose mode I got the same error.

```

localhost splash # splash_manager -c demo -t livecd-2007.0 -m s --steps=100

localhost splash # splash_manager -c demo -t livecd-2007.0 -m v --steps=100

Error: Theme 'livecd-2007.0' doesn't seem to provide a config file for the current resolution (1024x600).

```

----------

## Xytovl

Thanks for the post, I would just say that the grub2 915-resolution patch doesn't sem to work with grub-1.97.1. You can use the patch from http://aur.archlinux.org/packages.php?ID=22927 that worked for me.

The install didn't copy it in /boot/grub for me, I hade to copy it from /lib/grub/i386-pc/915resolution.mod

The font format has probably been changed, but I had no problem with media-fonts/unifont and instructions from http://grub.enbug.org/gfxterm

My ennemy are black frames now : when grub loads the kernel and when Xorg is starting !

Using hard masked gdm-2.28.1 makes crossfade from gdm to gnome work, for other improvements we could look at fedora. They have some patches for gdm and Xorg that make it reuse the content of the screen instead of blanking it but that didn't work for me (gdm patch fails).

----------

## shgadwa

I've done everything according to this howto here but when I get to the 

```
grub-install --no-floppy /dev/sda
```

 part it says command not found. I did some reading and the gentoo grub2 wiki page says to type grub2-install --no-floppy /dev/sda. So, I tried that, and that did not help. 

Everything installed correctly, with no errors. Any ideas?

EDIT:

It was my fault... somehow I did not install grub2, when I thought I did. I've emerged it now and everything worked beautifully! Thanks for a great howto!

----------

## sparkplug

Is the 915resolution patch necessary anymore?  I got a nice pretty framebuffer on my own with KMS enabled in the kernel...and then I tried to do this stuff:

```
insmod terminal

insmod gfxterm

insmod vbe

insmod font

insmod jpeg

insmod chain

font /boot/grub/unifont.pff

set gfxmode=1024x600

set menu_color_normal=white/black

set menu_color_highlight=white/dark-gray

background_image (hd0,4)/boot/grub/bluelines.jpg

menuentry "Linux" {

set root=(hd0,4)

linux /boot/kernel-2.6.32-gentoo-r3-new root=/dev/sda5 ht=on

}
```

Despite copying the image and the font in, they don't appear to be represented. Grub comes up just white text on black, no frills, and low res.

Oh, and I can't find framebuffer decor in my kernel config...it shows up when searched for but the field itself is locked out one up.

----------

## emc

I have eeePC 100H with intel 945GM. I follow:

http://en.gentoo-wiki.com/wiki/Intel_GMA

to use KMS (DRI and all 3D stuff works i.e compiz). And now splash during boot is smaller than full screen, how to get 1024x600?

I'm a bit confius with:

http://en.gentoo-wiki.com/wiki/Asus_Eee_PC_901#Framebuffer

----------

## sparkplug

Can't get grub-1.96-915resolution and grub-1.98.ebuild to play nice.  Any help?

----------

## ranmakuo

IS anyone know how to patch 915resolution for grub-1.99-r1?

----------

