Toshiba Libretto L1 with Debian Sarge


Kernel 2.6.11 custom built

This site is:    and Document made with Nvuand has been visited times.

Here I will try to explain as best as I can how I got Debian Sarge working on my Toshiba Libretto L1 laptop. Most things are very straight forward, so I wont go into them. What I will focus on, is:

1. Install Debian Sarge
2. Kernel Update to 2.6.11
3. 1280x600 resolution, and X configuration. (Look for pointer device "mouse" problems covered here)
4.
ACPI power management

1. Debian Sarge Install

I got Debian's new Sarge installer from
here. I will assume you know how to choose what is suited for this laptop (i386)

First off, this Laptop does not have a CD rom nor a Floppy Drive. I had a USB floppy drive laying around, so I gave that a shot with no luck what so ever. I grabbed the latest Boot floppies from Debian.org, and they had 2.4.27-2 kernel on them at the time of writing, 2005 April 24th. The reason this did not work is that the PCMCIA controller does not get an IRQ from the kernel, hence there is no PCMCIA card available, therefore there is no WAY ON EARTH to do an install over the Internet. You might compile your own kernel at this point, but I didnt do that because I found it easier to do a harddrive swap, and install the base on another computer.

ATTENTION

However, it was brought to my attention that taking the laptop apart might be a risky thing to do for some, and a custom kernel compile would be the way to go. So from here on what I explain about the install, please do at your OWN risk. I have taken apart many laptpos, so I did not hesitate to do it this time as well. 

I have the luck of owning a great Dell 700m laptop, so I quickly (not so quickly actually) took the harddrive from the Toshiba and put it in the Dell, and did a Sarge minimal install. That left the Harddrive with a working Debian system that will pull all the rest of the Operating System over the net. I placed the HDD back to the Toshiba, and booted the beast. VOILA, the PCMCIA works fine. I was a bit freightened at first, as the Network card (Netgear MA401 wireless) did not show any lights. What I did I quickly switched out to another console (CTRL-ALT-F2) and did an "lsmod" to make sure the modules are loaded. Sure enough, the orinoco was there smiling at me among all the other modules being already loaded. So I did a "ifconfig eth0 up" and there came the light and the network at once alive. Here I made sure I have the interface set up right, get WEP correctly for Wireless , and all this is done in /etc/network/interfaces

Then I restarted the network "/etc/init.d/networking restart" and I quickly got an IP from my DHCP server. At this point I switched back to the original console where the debian install was waiting for me (CTRL-ALT-F1) and selected a mirror for the download, and gave it a go, and it went. I pulled 500 or so MB's from one of the Japanese mirrors (I was in Japan at the time).

It wasnt easy compare to an other notebook's usuall install, but it was doable. Pay attention when you disassemble the unit, as it is quite sensitive. There are a few cables to disconnect to get to the Harddrive. The whole laptop has to come apart just to get to the Harddrive.

2. Kernel Configuration 2.6.11 and compiling

I updated to kernel 2.6.11 as soon as I got the laptop booted for the first time. I like the latest but not bleeding edge stuff on my laptops, besides Acpi is always improving with later kernels, and that is one thing I really needed (ACPI). I did about 20 kernel compiles until I reached a point where I was satisfied with my kernel. Thankfuly as I earlier said, I own a Dell 700m with a Centrino 1.6GHz, so I did all the kernel compiles on that rather than on the Toshiba. Dell700m one kernel compile = 28 minutes, Toshiba Libretto = 3 hours. I did save a lot of time with that. After compiling I just copy (SCP) the .deb kernel to the Toshiba, install it and reboot.

Things I included in my kernel, and things I didnt. I added support for the Longrun stuff, so that the necessary /DEV/CPU devices are created. CPUID and MSR are both compiled in to the kernel. Longrun itself is also, so it can be started automatically be default. No modules needed. Sound and Video support, plus Framebuffer for Video is also compiled in. IDE controller (ALI) is also compiled in, and all others are removed even as modules, because they show an ERROR every time I boot, for example ERROR: Via IDE controlled is not found. Dooh, its not present on the motherboard, but I guess Kernel 2.6.11 has a bug of some kind, so I removed it. It didnt effect anything, but I like a clean boot. Other than this, I removed most unnecessary stuff, Video controllers, sound controllers, eth adapters etc. I left bluetooth as a module as I plan on purchasing one for myself.

As a note, I have a PCMCIA MA401 Netgear WiFi card, so I included HERMES-ORINOCO support. It was quite tricky as I had to enalbe a bunch of stuff. By default in Debians 2.6.11 kernel, PCMCIA controller is disabled, Wireless networking is disabled. You can imagine now why i compiled 20 times or more. But long story short everything works now (what I needed to work). So if it is satisfactory for you, please download my kernel-config file, and do any mods to it what you may need. (I assume you can compile a kernel).

Another note that this kernel requires the INITRD stuff, but debian should have it by default. If your system crashes with this kernel on boot, saying that ROOT filesystem cannot be mounted or somthing similar, then you need to look into INITRD. (not covered here)

Kernel-2.6.11 Config file HERE

3. X Windows settings, Input device configuration and Framebuffer

This laptop has a beautiful display in my opinion. It sure is small, but that is why we got it, right? The resolution is 1280x600. This resolution is great if you do coding, as you can watch most websites in 1024 width so that your browser leaves some space for another small window for coding, or what not. Great stuff.

Below I will share my X configuration file that I got from another website, but works great, so I didnt mess with it. However, before that I will explain about framebuffer, and a funky mouse probem I had when i first started up X.

Framebuffer:

If you compiled the kernel with my kernel-config file, then you already have framebuffer support so no need to worry. If you havent used my kernel, you might need to recompile yours. Google for what to include in the kernel for framebuffer. Or just grab my config file, and use that.

To get framebuffer in your console, you need to pass a command in your boot loader. I use GRUB so that is what I will cover here. The command works with Lilo also, so you can google for that too, how to pass teh command with Lilo.

In grub, just add vga=0x404 and this will give you a nice 1280x600 console upon boot. I dont use it becuase the letters are so small, that it is almost unreadable, but it sure is nice, and the text actually is where it is supposed to be, right by the left side of the screen, and not in the middle of it.

Here is my Grub entry from /boot/grub/menu.lst

title           Debian GNU/Linux, kernel 2.6.11
root            (hd0,1)
kernel          /boot/vmlinuz-2.6.11 root=/dev/hda2 ro vga=0x404
initrd          /boot/initrd.img-2.6.11
savedefault
boot

Pointer Device Problems (mouse)

The Libretto L1s pointer is a PS/2 intellimouse compatible mouse. So in your install, if you have such an option, choose ImPS/2. With the 2.6.8 and 2.6.11 kernel I had a problem, that my X wouldnt start, it kept saying that /dev/psaux (which is normally the mouse`s device) is missing. That kept me busy for a while when I realized that the module, "psmouse" isnt loaded on boot, therefore the mouse device isnt present for X. I fixed it by plugging

psmouse

in the /etc/modules file. This make sure that its loaded on boot, therefore the /dev/psaux device is created, and you have your mouse working. You can also do a

modprobe psmouse

And see if X works after its loaded.

Below is my X config file that belongs to /etc/X11/XF86Config-4

#------------------------------------------------------------------------------------------------------------

Section "ServerLayout"
        Identifier     "XFree86 Configured"
        Screen      0  "Screen0" 0 0
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
        FontPath     "unix/:7100"
        RgbPath      "/usr/X11R6/lib/X11/rgb"
        ModulePath   "/usr/X11R6/lib/modules"
        FontPath     "/usr/X11R6/lib/X11/fonts/misc/"
        FontPath     "/usr/X11R6/lib/X11/fonts/Speedo/"
        FontPath     "/usr/X11R6/lib/X11/fonts/Type1/"
        FontPath     "/usr/X11R6/lib/X11/fonts/CID/"
        FontPath     "/usr/X11R6/lib/X11/fonts/75dpi/"
        FontPath     "/usr/X11R6/lib/X11/fonts/100dpi/"
#       FontPath     "/usr/X11R6/lib/X11/fonts/freefont/"
EndSection

Section "Module"
        Load  "pex5"
        Load  "record"
        Load  "extmod"
        Load  "dbe"
        Load  "dri"
        Load  "glx"
        Load  "xie"
        Load  "GLcore"
        Load  "speedo"
        Load  "type1"
#       Load  "freetype"
        Load  "xtt"
EndSection

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "keyboard"
        Option      "XkbRules" "xfree86"
        Option      "XkbModel" "jp106"
        Option      "XkbLayout" "jp"
#       Option      "XkbDisable"
EndSectionhere

Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "Protocol" "IMPS/2"
        Option      "Device" "/dev/psaux"
        Option      "Emulate3Buttons" "on"
        Option      "ZAxisMapping" "4 5"
EndSection

Section "Monitor"
        Identifier   "Monitor0"
        VendorName   "Monitor Vendor"
        ModelName    "Monitor Model"
EndSection

Section "Monitor"
        Identifier   "Monitor1"
        VendorName   "Unknown Vendor"
        ModelName    "tos5088"

        HorizSync       31.5 - 64.3
        VertRefresh     50 - 70

        Modeline "1280x600" 60 1280 1328 1512 1712 600 601 603 625
#       Modeline "1280x600" 69 1280 1328 1360 1696 600 600 615 631
EndSection

Section "Device"
        ### Available Driver options are:-
        #Option     "slow_edodram"
        #Option     "slow_dram"
        #Option     "fast_dram"
        #Option     "fpm_vram"
        #Option     "NoAccel"
        #Option     "HWCursor"
        #Option     "SWCursor"
        #Option     "ShadowFB"
        #Option     "Rotate"
        #Option     "UseBIOS"
        Identifier  "Card0"
        Driver      "savage"
        VendorName  "S3"
        BoardName   "Savage/IX-MV"
        BusID       "PCI:0:4:0"
EndSection

Section "Screen"
        Identifier "Screen0"
        Device     "Card0"
        Monitor    "Monitor1"
        DefaultColorDepth 16

#       SubSection "Display"
#               Depth     1
#       EndSubSection
#       SubSection "Display"
#               Depth     4
#       EndSubSection
#       SubSection "Display"
#               Depth     8
#       EndSubSection
#       SubSection "Display"
#               Depth     15
#       EndSubSection
        SubSection "Display"
                Depth     16
                Modes     "1280x600"
                ViewPort  0 0
#               Virtual   1280 600
        EndSubSection
#       SubSection "Display"
#               Depth     24
#       EndSubSection
EndSection

Section "DRI"
EndSection

#----------------------------------------------------------

This is what I use, and what works for me. Please change it if you need any modifications.


4. ACPI POWER MANAGEMENT

This was a big issue for me and took me 3 days to figure it out. The kernel that I built, and that you may build if you download the config file from above, has all required things built in to make suspend work, which was my only goal. All I need is when I close the lid it suspends to RAM and when i open it, it resumes. That isnt very hard to do, except a few things.

Sometimes:

1. Computer doesnt wake up, and spits ERROR messages on screen regarding ALSA.
    Alsa module needs to be removed and instered later when resuming.
2. Computer wakes up, but shuts down immediately after resuming.
    ACPI bug, it recieves a power button event, as if I had pushed the button, therefore it shuts down. Need                     modification in the script.
3. Computer wakes up, but network refuses to work (PCMCIA CARD) no matter what you do until rebooted.
    Card manager of PCMCIA is buggy and needs to be shut and restarted upon resuming.

All these problems I had to diiscover the hard way, but for your convenience I will include all the scripts and things to make your Suspend to RAM work in just minutes.

This script is /etc/acpi/lidbtn.sh and it gets executed by a lidbtn event (Lid Button - when its closed or opened)

The following script is /etc/acpi/lidbtn.sh

#!/bin/bash

killall cardmgr
sleep 2
cardctl eject
rmmod ohci_hcd
rmmod snd_ali5451
touch /var/run/ignore_powerbtn

echo "Oyasumi..."
sleep 2
echo "mem" > /sys/power/state

cardctl insert
cardmgr
modprobe snd_ali5451
modprobe ohci_hcd


As you see, there is a "touch" command in the script, which makes sure that the computer wont be shut down due to the fake powerbtn event that is received by no reason. For this to work, we need to add a few lines to the /etc/acpi/powerbtn.sh script. Please put these lines right at the beginning of the script, just below the shell line #!/bin/sh

# Check for hint to ignore power button.
# This is useful for wake from suspend to RAM, etc.
POWER_IGNORE=/var/run/ignore_powerbtn
if [ -f $POWER_IGNORE ]; then
        rm -f $POWER_IGNORE
        exit 0
fi
#---------------------END------------------------


The following scipt is /etc/acpi/event/lidbtn and this is what tells ACPID what to do when a lid button event is received.

event=button/lid
action=/etc/acpi/lidbtn.sh

#------------------END----------------

UPDATE: Please note that while suspend works 99% of the time, sometimes it just refuses to suspend anymore. When I close the lid, it wont do anything. Log files indicate that ACPID received the event, but it wont execute lidbtn.sh. Restarting ACPID does not better the situation at all. Restart required to get suspend working again. Other than suspend not working, the laptop is still functional.

LONGRUN and GKRELLM - Gkrellongrun

Since we have this great Crusoe CPU, we might just take advantage of it. There are a few things we can do. Longrun can set its operating mode to Economy and Performance. I think performance will adjust frequency in a faster way. So to go from 300-600MHz takes less time than in Economy mode. Other than this we can tell it a minimum speed, maximum speed. If we work in a hot room, we might set it to a lower speed, so it wont overheat. Dont forget that the Crusoe chip has no CPU fan.
You can execute longrun commands from console or you can have something to monitor it for you in a X session. I run KDE and I use GkrellM. Great tool. Settings are endless. Besides I think the 1280 screen width is great for a dockpanel on the right side, and a full size browser still fits next to it. This way we can keep an eye on our system. I know i am paranoic, but I like to see whats going on. GkrellM will monitor Port activities, Temperature, Fan Speed, Longrun activity (Provided you install the plugin), system emails, CPU and Harddrive activities, and mount unmount USB drives for one examle, which I use a lot. I have an external Memory card reader, so this automation is very handy. But I dont want to promote Gkrellm, just use it if you like it.

apt-get install gkrellm

Now for the longrun plugin you need to get it from the developer`s  website because the 2.6 kernel needs a special command to be passed when compiling. if you just apt-get it, it wont work.

Go
here and download the sources. The developer of the package is extremely nice, he developed this new version for my request back a year ago when I had a NEC Ultralite laptop. The older versions wont work anymore, so we needed a new one.

Download the latest one, and unzip it. Read the INSTALL file and follow the instructions. You need to install libgtk2.0-dev package if I remember correctly, but it will be in the INSTALL or README.linux file.

What to look out for is that you need to pass a special argument when you compile the module. Instead of the command

make

please use

CFLAGS=-D_FILE_OFFSET_BITS=64 make

Now, if you want to run GkrellM as user and not as root which is a good idea always, you need to give permissions to /dev/cpu/0/msr and cpuid files so that they can be read by user. Chmod is the command to use, read the man page for details. You dont want to give too much easy access to those modules. I personally didnt care, as nobody logs into my machine ever, and I am behind a firewall, so I did chmod 755 but I do not advise you to do the same.

Now you can start GkrellM as a user (not as root) by typing

gkrellm &

Go to options, and go to plugins and select the gkrellongrun plugin. Now you should see the Crusoe activity.  By right clicking on the Longrun window, you can select more features.

What if it doesnt work?

Did you make sure you compiles your kernel with MSR and CPUID included? Do you have longrun installed? (apt-get install longrun). If MSR and CPUID are in your kernel, but only as modules, are they loaded? (lsmod | grep msr) (if not do modprobe msr and modprobe cpuid).
Did you make gkrellongrun with the special command detailes above and in README.linux of the package?

TOSHIBA ACPI FEATURES

There is a great tool which is included in newer kernels, called toshiba acpi. With this you can adjust screen brightness and switch to external monitor display. The later one I never tried, but the brightness works great for me. I have a script that reduces screen brightness when I unplug the AC adapter. This is a great battery saver. Here is the script I use. (/etc/acpi/acunplug). Of course make sure you have execution rights to the file. This script came right off a website that I got most of my ideas from, and the link to those great guys will be included at the end of the document. Since the script was not written by me, it includes other things as well that doesnt bother me at all. It also reduces CPU power when you unplug the AC adapter. But you should be able to figure it out if you look at the script.

#!/bin/sh

# create cpuid and msr devices if they don't exist
# (this happens with some versions of udev)
#This scipt for me is at /etc/acpi/acunplug

if [ ! -d /dev/cpu/0 ]; then
        mkdir /dev/cpu
        mkdir /dev/cpu/0
fi

if [ ! -c /dev/cpu/0/cpuid ]; then
        mknod /dev/cpu/0/cpuid c 203 0
fi

if [ ! -c /dev/cpu/0/msr ]; then
        mknod /dev/cpu/0/msr c 202 0
fi

case "$4" in
        00000001)
                echo "brightness: 7" > /proc/acpi/toshiba/lcd
                longrun -f performance
                longrun -s 0 100
        ;;
        00000000)
                echo brightness: 3 > /proc/acpi/toshiba/lcd
                longrun -f economy
                longrun -s 0 33
        ;;
        *)
                echo "Usage: ac [00000000|00000001]"
                exit 1
esac

exit 0

For this to work, I have a file (/etc/acpi/events/ac_adapter) that tells acpid what to run when the AC is unplugged.

event=ac_adapter
action=/etc/acpi/acunplug %e

This is all what I have for now. As I reveal more, I publish more. Cheers, and drop me a line at  linux AT celifornia com with questions.

Benedek Frank

LINKS:

http://memebeam.org/toys/ToshibaLibretto

I got most of my ideas from these guys, just I tailored it to my needs. If you want to check other sites, this would be the one to check.