flipturn.org - stuff. things. other stuff.
dvorak | pantera | hacks


Gentoo Linux on a Lifebook P-2040

The Fujitsu Lifebook P-2040 is a Transmeta Crusoe powered laptop with an almost-full-sized keyboard, DVD/CDRW drive and an advertized battery life of over 3 hours. I wasn't looking for a desktop replacement, so in the final choice between this an AMD Athlon 4 laptop, the higher resolution screen and the extended battery life tipped the scales to the Lifebook.

I set out to install Gentoo Linux, a distribution that compiles everything from source. With the horsepower/battery life tradeoff that is the Crusoe processor, Crusoe optimizations for every binary should squeeze every last bit of speed out of the chip.

It turned out to be a more difficult problem than I hoped, but I did eventually get it working.

As of the 1.4 rc4 Gentoo install CDs, you do not need to specify any kernel boot parameters when booting from the CD. The ALi bios does get configured correctly and the hard disk access is set to DMA.

Thanks to John Holder for helping me figure out how to boot the iso images in the old days when Linux used to hang when trying to detect the DMA speed of the ALi chipset. If you run into some other distro that hangs there, try adding the parameters ide0=ata66 ide1=ata66 at the kernel boot prompt.


First, the specs on the laptop itself:

Processor Transmeta TM5800 800 MHz
Memory 128M (upgradeable to 256M)
Graphics ATI Rage Mobility 4M
Display 1280x768 Active Matrix LCD
Sound Trident 4DWave (ALi 5451)/ SigmaTel AC 9757T (trident.o)
Network RealTek RTL-8139C (8193too.o)
Disk Toshiba 20G
DVD/CDRW 8xDVD, 8x/8x/24x CD-RW IDE
Floppy External USB (boot floppies work fine)
Mouse Eraserhead-type PS/2 bus mouse, 3 buttons
USB 2 ports
IEEE-1394 1 port. Texas Instruments controller
PCMCIA/CardBus 1 Type II slot. Texas Instruments PCI1410 controller
S-Video out
VGA out
Modem some unsupported winmodem

WinXP Stuff

The Lifebook comes installed with two partitions on the disk, an 18G partition with WindowsXP (drive C:), and a 2G partition (drive D:) that keeps some backup stuff. I needed to keep windows, so I defragmented the disk using the windows disk defragmenter, and set off to repartition the disk. That old DOS-based utility FIPS would have worked, but rather than mess with Microsoft any longer than I had to, I thought I'd just use the disk partitioner that comes with another Linux distro, Mandrake Linux.


DiskDrake from Mandrake Linux has a nice graphical partition manager, and it includes the ability to resize partitions. Since I had a Mandrake 8.1 install CD sitting around, I thought that I'd just pop it in and go (after specifying the ide0=ata66 ide1=ata66 options to the kernel at boot time). I resized the Windows partition to 10G, and added some new partitions for linux:

/dev/hda2 /mnt/win\_c vfat
/dev/hda3 /boot ext2
/dev/hda5 swap swap
/dev/hda7 / ext3
/dev/hda8 /opt ext3
/dev/hda6 /mnt/win\_d vfat

The Lifebook stores some backup stuff on the Windows D partition, and I left that alone for now.

Gentoo Install

Gentoo is my distribution of choice now, as everything is compiled from source for full optimization for each particular hardware setup. I was particularly interested in this for the Crusoe processor -- every little bit of speed would help.

Based on what the Linux kernel uses to compile on the Crusoe, here are the CFLAGS I used:

gcc 2.95.x -O2 -march=i686 -pipe -fno-strict-aliasing -fno-common -fomit-frame-pointer -mpreferred-stack-boundary=2 -malign-functions=0 -malign-jumps=0 -malign-loops=0
gcc 3.x -O3 -march=i686 -pipe -fomit-frame-pointer -mpreferred-stack-boundary=2 -falign-functions=0 -falign-jumps=0 -falign-loops=0

Install Notes

Once around the boot problem, it is just the typical Gentoo install procedure. When compiling the kernel, don't forget to put the kernel boot parameters in your grub.conf.

Here are some moderately useful benchmarks that I performed using the same Gentoo version and kernel options (although it was a long time ago on a pre 1.0 Gentoo, but you should still be able to get some sense of the relative speed difference):

Lifebook Athlon 1.3GHz
128M 256M 512M
Bootstrap 114m & 50m
Base System 71m &
Kernel Compile 5m47s 5m43s 2m27s


Longrun is working again, thanks to a patch I found on [[Debian unstable|http://packages.debian.org/unstable/utils/longrun.html]]. The longrun-0.9 ebuild currently in Gentoo doesn't work, you need to patch the ebuild; I've filed this [[Gentoo bug report|http://bugs.gentoo.org/show_bug.cgi?id=14931]] that you can use as reference.

The app-admin/longrun ebuild provides the longrun command to control the Transmeta CPU, but the devfs filesystem doesn't create the /dev/cpu/0/cpuid or /dev/cpu/0/msr files automatically.

I found a patch for devfs support on the linux kernel mailing list, but there seems to be some disagreement among kernel developers on how this particular patch will apply to future developments. So, the patch hasn't been included in any official kernels yet.

So, for now, create the device nodes manually:

  • mkdir -p /dev/cpu/0
  • mknod /dev/cpu/0/msr c 202 0
  • mknod /dev/cpu/0/cpuid c 203 0

Distributed Compiling

I just discovered distcc, a distributed compiling system. See tt for a tutorial on using distcc with Gentoo. Support for the integration of distcc into Gentoo seems to be improving rapidly, but the steps to set up distcc seem to be in flux. Check on zwelch's page for the current method.


sound modprobe trident
ethernet modprobe 8139too
usb uses the usb-ohci driver
apm suspend seems to work fine (in console mode and X) with modprobe apm
dvd the combo DVD/CDRW drive seems to show up as /dev/cdroms/cdrom0, so ln -s /dev/cdroms/cdrom0 /dev/dvd


Here's my XF86Config-4 with mode timings courtesy of John Holder.

The ATI-Gatos drivers provide XVideo support, which means that programs like mplayer can play full-screen DVDs!

CD-RW Setup

Writing to CDs requires enabling a few kernel options. Importantly, IDE/ATAPI CDROM support must either be a module that is not loaded by default, or not compiled in to the kernel. If IDE/ATAPI CDROM is loaded first, the CDROM device will not be seen as SCSI.

<*> ATA/IDE/MFM/RLL support
IDE, ATA and ATAPI Block devices  --->
<M>   Include IDE/ATAPI CDROM support
<M>   SCSI emulation support

<M> SCSI support
<M>   SCSI CD-ROM support
[*]     Enable vendor-specific extensions (for SCSI CDROM)
(2) Maximum number of CDROM devices that can be loaded as modules
<M>   SCSI generic support

After recompiling the kernel, edit /boot/grub/grub.conf and add the the option hdc=ide-scsi to the end of your kernel line. For example, my entry looks like this:

kernel /boot/vmlinuz root=/dev/hda7 idebus=66 ide0=ata66 ide1=ata66 hdc=ide-scsi

Also, add the following lines to your /etc/modules.autoload:


Finally, reboot the machine. For some reason, the kernel reports 7 CDROMs are attached to my system, but only one CD is actually detected by cdrecord --scanbus

        0,0,0     0) 'TOSHIBA ' 'DVD-ROM SD-R2102' '1G15' Removable CD-ROM

I burned a test iso image on a blank (high speed) CD-RW with the following command:

cdrecord -v -pad speed=8 dev=0,0,0 rescue.iso

and booted from it. To blank the entire disk, use:

cdrecord -v speed=8 dev=0,0,0 blank=all

but be aware that this takes several (er... many) minutes. The cheapo test media that I bought seems to give me an error when blanking the CD-RW, but I assume that it is due to the media itself and not any problem with the drive as I was able to write a new ISO image to the same media. I'll test this further when I get better media.


Non Working DMA (SOLVED!)

Because the kernel is compiled without ALi15x3 support, there is no DMA support for disk transfers. I assume that this is a significant performance hit, but at this point I'm just glad that the computer works.

ALi has driver information on its chipsets. According to /proc/pci, the computer has the ALi M1533 (Aladdin 4) chipset, and the M5229 IDE controller.

http://www.aliusa.com/eng/support/drivers/m1543 driver.htm has a file, linux-ide-10b3.tgz, but this is apparently an old replacement for alim15x3.c that only works with 2.2 and 2.3 kernels. UPDATE: Michael Leuchtenburg solved the DMA problems with this patch (against 2.4.18).

Benchmarks of hdparm -T -t /dev/hda:

Lifebook Athlon 1.3GHz
Timing buffer-cache reads (MB/sec) 188 188 206
Timing buffered disk reads (MB/sec) 8.05 22.4 31.3

Sound Lost After Suspend (SOLVED!)

As noted by Michael Leuchtenburg, the sound module stops piping anything through the speakers after an APM suspend and restore. The workaround is to remove and reinsert the trident module after a restore.

UPDATE: Eric Lemar solved this sound problem with this patch (against 2.4.18).

Dual Head

WinXP is able to use the VGA-out port as a separate monitor displaying an additional desktop. When I get some time, I'll be looking into attempting to get this to work under Linux.


Currently, the maximum upgrade to the memory is a single 128M Micro DIMM. Crucial doesn't currently have a compatible part. Kingston has the part number KFJ-FPC48/128, but none of their resellers seem to have a clue about it.

Some places that do seem to have the part in stock (at least occasionally) are Zones, Coast Memory and Fry's/Outpost.com.

I bought my 128M upgrade from Fry's.


erection pills new york erection pills new york erection pills california erection pills new york
cialis professional online cialis online free levitra sample pack levitra