Differences between revisions 6 and 7
Revision 6 as of 2008-07-17 18:23:21
Size: 7015
Editor: ?FrancoLanza
Comment:
Revision 7 as of 2008-07-17 18:27:34
Size: 7547
Editor: ?FrancoLanza
Comment:
Deletions are marked like this. Additions are marked like this.
Line 233: Line 233:

now test if all is working.
rebuild your initramfs with:

{{{
update-initramfs -u -k `uname -r`
}}}

edit your grub menu.lst, duplicate the kernel entry, and add fbhack to your kernel option, like this:

{{{
title Debian GNU/Linux, kernel 2.6.25-2-686 fb
root (hd0,0)
kernel /vmlinuz root=/dev/mapper/rootfs ro fbhack
initrd /initrd.img
}}}

reboot your system, select your "fb" kernel entry, and you shuld get now the frame buffer working in early stage from initramfs and at right resolution!

When the kernel 2.6.26 will be officially packaged in debian, make the frame buffer work on eeepc will be more easy, but with the actual (as Jul, 17 2008) kernel package, 2.6.25, some kernel changes are required, and also some packages (klibc) needs to be recompiled to make it work. Some other changes are also needed to make dmcrypt and splashy both in initramfs work good. Let's start:

Frame Buffer: uvesafb module

With 2.6.25 debian kernel, uvesafb isn't compiled by default. So, the first thing to do is to get the kernel source. You don't need to rebuild whole package just the module, but anyway you will need a kernel build later to rebuild some other packages. Recompile the kernel on your EeePC can be a problem if you have little free space or you are impatient, if you have such problem, you can build it on another machine.

apt-get install linux-source-2.6.25
cd /usr/src/
tar xfj linux-source-2.6.25.tar.bz2 
cd linux-source-2.6.25

Now copy your actual kernel config file under the source tree and start the kernel configuration menu

cp /boot/config-2.6.25-2-686 .config 
make menuconfig

Now to Device Driver -> Graphics support -> Support for frame buffer devices and select "Userspace VESA VGA graphics support" ad module <M>.

Exit and save the kernel configuration

Build your kernel, you don't need to rebuild the package, you just need to have a source tree compiled with this option enabled.

make

... and wait, it's time for a coffee!

When the compilation is done, copy the uvesafb.ko module on your eeepc. the module is under /usr/src/linux-source-2.6.25/driver/video/ and it is called uvesafb.ko.

cp driver/video/uvesafb.ko /lib/modules/`uname -r`/kernel/driver/video/
depmod -a

EeePC resolution is 800x480, that isn't a standard VGA resolution, so, uvesafb don't support it. To make it working as expected, we also need to use 915resolution binary to make it recognize the right resolution. In sid the package 915resolution was dropped cause obsolete, and if you try to install the old .deb, it will conflict with the xserver-xorg-video-intel driver, that is the one needed to make X work on eeepc, so, you can't install it.

The solution is to download the tarball package of 915resolution

cd /usr/src
wget http://www.geocities.com/stomljen/915resolution-0.5.3.tar.gz
tar xfz 915resolution-0.5.3.tar.gz
cd 915resolution-0.5.3

if you want, you can recompile it with a simple make, but we don't need to compile it, inside the tarball there is a functional binary precompiled for us. Copy it somewhere in your path

cp 915resolution /usr/sbin

now you can test your framebuffer!

915resolution 5c 800 480 32
modprobe uvesafb mode=800x480-32@60

You will see now a fancy frame buffer working.

Put framebuffer initialization in initramfs

As i was saying before, some packaged needs to be recompiled to before to put the framebuffer in initramfs. This is cause uvesafb needs to be loaded in userspace with v86d, but to make v86d work in initramfs we need to have klibc compiled with a kernel compiled with uvesafb enabled.

So, lets recompile our packages:

cd /usr/src
apt-get source v86d libklibc
cd klibc-1.5.12

A little dirty hack to point klibc to the right kernel source: edit debian/rules with your favorite text editor, go at the line starting with pre-build:: and change this section to:

pre-build:: 
        if [ ! -e linux ]; then \
                rm -rf linux/include; \
                mkdir -p linux/include ;\
                ln -s /usr/src/linux-source-2.6.25/include/linux/ linux/include; \
                for x in /usr/src/linux-source-2.6.25/include/asm*; do \
                        ln -s $${x} linux/include; \
                done ;\
        fi ; \

Save and exit, and now rebuild the package:

debuild

and install the new packages:

cd ..
dpkg -i klibc-utils-1.5.12-1_i386.deb libklibc_1.5.12-1_i386.deb

it's time to rebuild also v86d.

cd v86d-0.1.5
vim debian/rules

Here we need a very little change, under config-stamp: configure line, where there is a ./configure line, change it with:

           ./configure --with-klibc

save and rebuild the package

debuild

and install it

cd ..
dpkg -i v86d_0.1.5-1_i386.deb

Now we have all we need for our initramfs. First of all, you need to install initramfs tools:

apt-get install initramfs-tools

and make some modification on our initramfs image.

My scripts are dirty and they aren't so well done, but they work, feel free to rewrite those scripts how you prefer!

We need to:

  • include uvesafb.ko, v86d, 915resolution in your image
  • make frame buffer start if we pass the right option to the kernel command line

to include uvesafb.ko just add it to /etc/initramfs-tools/modules

echo uvesafb >> /etc/initramfs-tools/modules

To include 915resolution and v86d, we need to create an hook script, so, edit /etc/initramfs-tools/hooks/915resolution and put this:

PREREQ=""
prereqs()
{
   echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
   prereqs
   exit 0
   ;;
esac

. /usr/share/initramfs-tools/hook-functions


copy_exec /usr/sbin/915resolution /sbin
copy_exec /sbin/v86d /sbin

We need also to get uvesafb loaded in the right way when needed, so we will create another script inside our initramfs. I don't like to use video=something in my kernel command line, cause i have the impression that framebuffer script inside initramfs can broke something in our hack, so, i use another option, i've called it "fbhack".

create the file /etc/initramfs-tools/scripts/init-top/fbhack and put this inside:

PREREQ=""
prereqs()
{
   echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
   prereqs
   exit 0
   ;;
esac

echo "FBHACK FOR EeePC"

for x in $(cat /proc/cmdline); do
    case $x in
      fbhack)
         echo "creating /dev/mem file"
         mknod /dev/mem c 1 1
         if [ -e /dev/zero ] ; then
            echo "Dev Zero Exists" 
         else
            mknod /dev/zero c 1 5
         fi
         if [ -e /dev/tty1 ] ; then
            echo "tty1 exists"
         else
            mknod /dev/tty1 c 4 1
         fi
         if [ -e /dev/console ] ; then
            echo "console exists"
         else
            mknod /dev/console c 5 1
         fi
         echo "Set 915resolution to 800x480"
         /sbin/915resolution 5c 800 480 32
         depmod -a
         #/sbin/modprobe fbcon
         echo "modprobe uvesafb"
         chk=`cat /proc/modules  | grep uvesafb`
         if [ "x$chk" != "x" ] ; then
            rmmod uvesafb
         fi
         /sbin/modprobe uvesafb mode=800x480-32@60
         echo "Done!"
      ;;
    esac
done

now test if all is working. rebuild your initramfs with:

update-initramfs -u -k `uname -r`

edit your grub menu.lst, duplicate the kernel entry, and add fbhack to your kernel option, like this:

title    Debian GNU/Linux, kernel 2.6.25-2-686 fb
root     (hd0,0)
kernel      /vmlinuz root=/dev/mapper/rootfs ro  fbhack
initrd      /initrd.img

reboot your system, select your "fb" kernel entry, and you shuld get now the frame buffer working in early stage from initramfs and at right resolution!