Wednesday, September 24, 2008

Installing finit-mod on an eeePC with default Xandros

finit-mod is a reimplementation of fastinit used by asus in the eeePCs. I struggled a lot before having it working, and I'd like to share my efforts. My steps are referring to an eeePC 900 (bought in Italy) and I don't know if they fit to other models/localizations.

My actual configuration is:


I struggled a lot before having it working, because finit-mod (ver 0.5):

  • requires to launch "/bin/openvt" (which is missing);
  • does not mount user partition (uses folder "/home/user" on "/dev/sda1" instead);
  • does not properly shutdown (power led remains on).


My steps were:

  1. download finit sources from http://helllabs.org/finit/#download;
  2. unpack sources;
  3. edit "finit-mod.c" by adding a mount statement (the bold line) at the end of the "Mount filesystems" section:

    /*
    * Mount filesystems
    */
    mount("proc", "/proc", "proc", 0, NULL);
    mount("sysfs", "/sys", "sysfs", 0, NULL);
    mount("devpts", "/dev/pts", "devpts", 0, "gid=5,mode=620");
    mount("tmpfs", "/dev/shm", "tmpfs", 0, NULL);
    mount("tmpfs", "/tmp", "tmpfs", 0, "mode=1777,size=128m");
    mount("tmpfs", "/var/run", "tmpfs", 0, "mode=0755");
    mount("tmpfs", "/var/lock", "tmpfs", 0, "mode=1777");
    mount("/mnt", "/", NULL, MS_MOVE, NULL);
    mount("/dev/sdb1", "/home", "ext3", 0, NULL);
  4. edit "Makefile" to declare "user" as default login user;
  5. compile;
  6. install "console-tools" (contains the missing "openvt" program);
  7. install "lsof" (used to fix shutdown);
  8. in /sbin, edit "fastshutdown.sh" (as stated here) by inserting kill process and remove module statements (the bold lines):

    #!/bin/sh

    if [ "$1" = "--ask" ]
    then
    zenity --question && sudo $0
    exit $?
    fi

    [ `id -u` = "0" ] || echo "Must be root."

    killall -9 -w `lsof +c 15 /dev/dsp | awk {print $1}`
    killall -9 -w `lsof +c 15 /dev/snd/* | awk {print $1}`

    rmmod snd_hda_intel

    /usr/bin/killall --wait usbstorageapplet

    /bin/kill -USR2 1
  9. in /sbin, copy "fastinit" to "fastinit.orig" (to make a spare copy);
  10. copy the just compiled finit-mod over fastinit (use -f to force, "cp -f finit-mod /sbin/fastinit");
  11. reboot.


You should see finit-mod booting now.
You should also be able to shutdown properly (leds off) from Easy Mode.

If you want (why not?) to shutdown properly from Advanced Mode too:

  1. switch to Advanced Mode (Full desktop);
  2. go to "Control Center", then "Login Manager" and change the shutdown command from "halt" to "fastshutdown.sh".

Booting time is only slightly shorter than using original fastinit but it makes some improvements (as stated here), so I'm keeping it.