Wenn der Kernel 2.6.26 offiziell in Debian gepackt ist, wird es viel einfach sein, frame buffer auf dem EeePC zu betreiben, aber mit dem aktuellen Kernelpaket 2.6.25 (Stand 17. Juli 2008) sind einige Kernel-Änderungen notwendig und einige Pakete (z.B. klibc) müssen neu kompiliert werden um zu funktionieren. Es sind auch einige andere Veränderungen notwendig, damit sowohl dmcrypt als auch splashy im initramfs gut arbeiten. Lasst uns loslegen:
Frame buffer: uvesafb-Modul
uvesafb ist nicht standardmäßig mit dem 2.6.25er Debian-Kernel kompiliert. Somit müssen wir zuerst die Kernel-Quellen besorgen. Sei müssen nicht das gesamte Paket neu erstellen, nur das Modul, aber in jedem Fall müssen Sie den Kernel später für einige andere Pakte neu bauen. Das Re-Kompilieren des Kernels würd auf Ihrem EeePC viel Speicherplatz benötigen und sehr lange dauern. Daher empfehlen wir, dies auf einer andere Maschine zu tun.
Bitte reparieren: bitte die folgendenen Anweisungen durchsehen, damit sie den selben Debian Kernel-tree wie module-assistant verwenden - falls möglich. Dies wird die Dinge vereinfachen.
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
Jetzt kopieren Sie ihre tatsächliche Kernel-Konfigurationsdatei in den Quell-tree und starten das Kernel-Konfigurationsmenü:
cp /boot/config-2.6.25-2-686 .config make menuconfig
Gehen Sie jetzt zu Device Driver -> Graphics support -> Support for frame buffer devices und wählen Sie "Userspace VESA VGA graphics support" als Modul <M>.
Verlassen und speichern Sie die Kernel-Konfiguration.
Bauen Sie Ihren Kernel. Sie müssen nicht das Paket neu bauen, sondern nur einen Quell-tree mit dieser aktivierten Option kompilieren.
make
... und warten ... Zeit für einen Kaffee!
Wenn das Kompilieren abgeschlossen ist, kopieren Sie das Modul uvesafb.ko auf Ihren EeePC. Das Modul befindet Sie unter /usr/src/linux-source-2.6.25/driver/video/ und heisst uvesafb.ko.
cp driver/video/uvesafb.ko /lib/modules/`uname -r`/kernel/driver/video/ depmod -a
Ab hier noch zu übersetzen!
Eee PC resolution is 800x480 which isn't a standard VGA resolution so uvesafb doesn't support it. To make it work as expected, we also need to use 915resolution binary to make it recognize the right resolution. In sid, the package 915resolution was dropped because it is obsolete. It can't be installed because it conflicts with xserver-xorg-video-intel which is needed to make X work on the Eee PC.
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. However, we don't need to compile it since 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 packages need to be recompiled to support the frame buffer in our initramfs. This is because 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 to 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, beneath the "config-stamp: configure" line, where there is a ./configure line, change it to:
./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 however 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 a hook script, so, edit /etc/initramfs-tools/hooks/915resolution and put this in it:
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 because I have the impression that the framebuffer script inside initramfs can break something in our hack, so I use another option. I've called it "fbhack".
Create the file /etc/initramfs-tools/scripts/init-top/framebuffer 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|video=*) 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 now the frame buffer should work from the earliest stage in initramfs and at the right resolution!
Splashy in initramfs with dmcrypt
Now it's time to install splashy. Simply perform:
apt-get install splashy
If you just rebuild your initramfs and you append the right parameters to your boot command line, splashy initially seems to work, but, since you have also an encrypted root file system, you can't insert your fs password. The result is you can't boot into your system. This is because the initramfs script cryptmount by default can't manage splashy at all. It uses askpass to get your password used by cryptsetup, but askpass doesn't work with splashy, at least in the way that splashy is managed by initramfs default script.
We will make some changes in both scripts to make it all work as we want.
Get the original splashy script and put it inside your initramfs:
cd /etc/initramfs-tools/scripts/init-top cp /usr/share/initramfs-tools/scripts/init-top/splashy .
Create a new patch file called splashy.patch and put it inside this file:
--- splashy.old 2008-07-17 20:49:09.000000000 +0000 +++ splashy 2008-07-17 15:26:18.000000000 +0000 @@ -1,6 +1,6 @@ #!/bin/sh -PREREQ="" +PREREQ="framebuffer" prereqs() { echo "$PREREQ" @@ -37,7 +37,7 @@ nosplash) SPLASH=false ;; - vga=*|video=*) + vga=*|video=*|fbhack) FBMODESET=true ;; esac @@ -46,9 +46,9 @@ test $SPLASH = "true" || exit test $FBMODESET = "true" || exit -depmod -a -silent modprobe fbcon -silent modprobe vesafb +#depmod -a +#silent modprobe fbcon +#silent modprobe vesafb if [ -s /proc/fb ]; then while read fbno desc; do
Save the patch file, apply it to splashy and remove the patch file:
patch -p0 < splashy.patch rm splashy.patch
Now we work on dmcrypt. We make some changes in order to let cryptsetup use splashy_update instead of askpass to get the root file system password.
Copy the original script:
cd /etc/initramfs-tools/scripts/local-top cp /usr/share/initramfs-tools/scripts/local-top/cryptroot . }} Copy and paste this patch file inside cryptroot.patch: {{{ --- cryptroot.old 2008-07-17 20:54:12.000000000 +0000 +++ cryptroot 2008-07-17 16:28:18.000000000 +0000 @@ -29,6 +29,8 @@ { if [ -p /dev/.initramfs/usplash_outfifo ] && [ -x /sbin/usplash_write ]; then usplash_write "TEXT-URGENT $@" + elif [ -x /sbin/splashy_update ] && [ ! -z "`pidof splashy`" ] ; then + /sbin/splashy_update "print $@" else echo "$@" >&2 fi @@ -224,16 +226,27 @@ fi if [ -z "$cryptkeyscript" ]; then - cryptkeyscript="/lib/cryptsetup/askpass" + if [ -x /sbin/splashy_update ] && [ ! -z "`pidof splashy`" ] ; then + cryptkeyscript="/sbin/splashy_update" + else + cryptkeyscript="/lib/cryptsetup/askpass" + fi cryptkey="Enter passphrase to unlock the disk $cryptsources ($crypttarget): " fi - - if ! crypttarget="$crypttarget" cryptsource="$cryptsource" \ - $cryptkeyscript "$cryptkey" | $cryptcreate --key-file=- ; then - message "cryptsetup: cryptsetup failed, bad password or options?" - continue - fi + if [ -x /sbin/splashy_update ] && [ ! -z "`pidof splashy`" ] ; then + if ! crypttarget="$crypttarget" cryptsource="$cryptsource" \ + $cryptkeyscript "getpass $cryptkey" | $cryptcreate --key-file=- ; then + message "cryptsetup: cryptsetup failed, bad password or options?" + continue + fi + else + if ! crypttarget="$crypttarget" cryptsource="$cryptsource" \ + $cryptkeyscript "$cryptkey" | $cryptcreate --key-file=- ; then + message "cryptsetup: cryptsetup failed, bad password or options?" + continue + fi + fi if [ ! -e "$NEWROOT" ]; then message "cryptsetup: unknown error setting up device mapping"
Save it, apply it and remove the patch file:
patch -p0 < cryptroot.patch rm cryptroot.patch
Now rebuild your initramfs:
update-initramfs -u -k `uname -r`
Re-edit the grub menu.lst and make these changes to the "fb" kernel entry in the kernel line:
title Debian GNU/Linux, kernel 2.6.25-2-686 fb root (hd0,0) kernel /vmlinuz root=/dev/mapper/rootfs ro splash quiet video=uvesafb:800x480-32@60 initrd /initrd.img
Finally, reboot!
You will now have your splashy and dmcrypt working from initramfs on your Eee PC!