Other texts

intro

dates

20031219-20090923

goal

WARNING (20090923): This document is unmaintained (I no longer use an IBM X31).

On an IBM X31 laptop I want to use a Debian sarge, along with many 'testing' packages, under optimized kernels (fast and lean).

Status

It works for me under Linux 2.6.

About...

This doc

BEWARE: the setup documented here is NOT official, albeit it does not break any Linux or Debian convention (AFAIK, please let me know if you detect a misfit).

I use it since mid-december 2003 w/o any problem not related here, but your mileage may vary. If you are not experimented please DO NOT use this material (use Ubuntu). If you are a beginner buy a Knoppix CD (Ikarios is a reseller in Europe).

This document evolves, please refer to URL instead of copying it. If you copy a part of in it state the complete URL leading to it (http://www.makarevitch.org/debian/kernel_2.6.html)

Please do not send any trivial question to me, I just cannot take time to tackle your problems but you may use the Linux31 mailing list (if you have interesting material please publish it there)

... IBM X31

I use subnotebooks since 1999 (Toshiba Portégé, which were pretty good).
In my opinion the IBM X31 (RAM upgraded to 768 MB) is a very good machine (robust, fast and without any major glitch) albeit it has some ...

... minor dubious achievements

Keyboard
Weird layout. The magic 'Fn' key place is where, on most other keyboards, 'Control' stays. 'Escape' is above 'F1'.
Fix: remap the keys placed around the arrows by xmodmap'ing:
keycode 234 = Escape
keycode 233 = Control_R
add Control = Control_R
The backspace key location is weird, one has to set the 'DontZap' option in the X server's configuration in order to avoid killing it unintentionally. The X31 keyboard puts the X on X :-)

The spacebar re-insertion in the keyboard proves to be very difficult.

ACPI
I don't use it, APM is OK albeit ACPI may be more efficient... but seems less stable, thanks to a buggy BIOS (in my machine, bought in 2003)
Fix: BIOS upgradable on field (see below)
modem

fetch the driver on the Smlink site (not tested here. An older version worked under 2.4 but impeded kernel stability). After 2.6.5 the modem chip seems recognized by the snd_intel8x0m driver but I did not test it.

Install the 'sl-modem-source' and 'sl-modem-daemon' packages, then compile a kernel and use 'module-assistant -f a-i sl-modem')

The 'sl' driver was not very stable. apparently this is fixed after 2.6.7. One may use the snd_intel8x0m kernel module instead

Detail: the 'sl' driver used to (after being used for approx 30 minutes) freeze 2.4.2x kernels and also freezes 2.6.5. This may be related to some APM event. You may try 'apt-cache search slmodem' to limit the bad effects of any crash I let all filesystems mounted in 'sync' mode while using it. Example (root fs):

mount -o remount,sync /
 (use the slamr module and slmodemd deaemon)
mount -o remount,async /
BIOS
One cannot upgrade it without installing MS-Windows.
USB
(USB mouse under X Window: please read the 'X Window' section)

There was a bug in the USB driver, fixed in Linux 2.6.5

Detail: when I plug an USB memory stick the EHCI (USB version 2) driver sometimes hangs the kernel.

Explanation (thx to Dimitris Kogias): the EHCI driver doesn't like suspend/resume cycles. Linux 2.6.5 fixes this problem.

Not using the EHCI driver is not a workaround because it considerably reduces the transfer rate of the USB port (no more USB version 2.0!).

Useless details:
adding the appropriate apmd suspend/resume scripts ('modprobe [-r] ehci_hcd' for APM events 'suspend or standby' and 'modprobe ehci_hcd' when resuming) is not sufficient because it does not fix the X problem.

USB peripherals used: Genius and Logitech mice, Logitech Quickcam, low-end Epson scanner, i-Bead

integrated Ethernet interface
It whistles when used at high speed.

Hints

Avoid: ... because it sometimes leads to crashes.

Pre-requisites

This doc details how to use a 2.6 kernel and pertinent tools. To use it you must already have a running Debian Linux (probably at least 3.0) on your IBM X31. To install Debian please read: network (Chaes) (pointers to various docs: TuxMobil - Linux on laptops, PDAs and mobile phones and Linux on Laptops)

Remember: backup

Back your data up frequently and do it just before installing a new major system revision!

Hardware

Built-in Ethernet (100 Mbps, beware: some X31 are equipped with a 1 Gbps interface)

Kernel

(Beware: techie stuff ahead) When there is not enough RAM the kernel can release RAM used by the cache (where data read from disks tend to stay in order to avoid reading it over and over, and data waits to be written in order to avoid storing useless things or being forced to order many disk-head moves) and/or store some data used by running programs on virtual memory.

Simplified version: when a running software need work memory (RAM!) the kernel must recover some occupied RAM. For this it can throw away (forgot) a piece of cache or store (on virtual memory) some data sleeping (not frequently used) in RAM, effectively freing. But any choice can be expensive a few seconds later, if the very cache content which was thrown away is requested by a program (implying a real disk read) or a program accesses to the very data stored on virtual memory.

As root you can give a hint to the kernel by placing a value into /proc/sys/vm/swappiness.

I experimented a -ck (Con Kolivas) kernel but after a few hours and/or some APM events it was not as snappy under loads than a standard kernel (the mouse cursor was stuck for a few seconds).

(Linux 2.6.8.1) For network QoS (with the 'wondershaper' Debian package) I used the 'CPU cycle counter' as a packet scheduler clock source (CONFIG_NET_SCH_CLK_CPU, in "Device Drivers"/"Networking support"/"Networking options"/"QoS and/or fair queueing"). It does NOT work properly whenever the CPU frequency changes but I don't care as it only changes when the laptop is not plugged in (for power), which in most cases implies that it is not plugged to any nw.
I experienced a complete freeze when invoking 'wshaper.htb eth0 102400 102400 (the 'M' in '100Mbps' is expressed at a power of two, therefore 100Mbps are 102400Kbps), may be related to the fact that the sound chip was active.

Install the laptop-mode-tools and check that /proc/sys/vm/laptop_mode contains '0' when the power line is plugged and '2' when the laptop runs from battery power.

APM (I don't use ACPI nor suspend-on-disk), using this APM script (name it /etc/apm/scripts.d/ibmx31):

#!/bin/sh
# this is /etc/apm/scripts.d/ibmx31

#flush all caches
sync
/sbin/hdparm -f /dev/hda
sync ; sync ; sync # ;-)
/sbin/hdparm -f /dev/hda

case "$1" in
suspend|standby)
rmmod psmouse
#USB resume.  it is useles under 2.6.5 (and above)
#modprobe -r ehci_hcd

#paranoid mode implies no write-back cache nor IRQ unmasking
#to be pretty sure that we will resume gracefully.
#on some laptops this helped me to overcome some random problems during the
#awakening process, especially after a suspend made during a disc I/O.
#dunno if the X31 can live w/o that
 /sbin/hdparm -W0 -u0 /dev/hda

#I often resume in a new network context but don't want to restore a
#parameter (IP, gateway...) which may be inadequate locally and therefore
#cause some glitch (for example triping a NIDS)
 ifdown eth0

# Wifi adapter
 ifdown eth1
 rmmod ipw2100
;;
  
resume)
modprobe psmouse

#restoring the HD parameters
/etc/init.d/hdparm restart

#USB resume. it is useles under 2.6.5 (and above)
#modprobe ehci_hcd
;;
esac
Then symlink it appropriately:
chmod +x /etc/apm/scripts.d/ibmx31
cd /etc/apm/event.d
ln -s ../scripts.d/ibmx31

PCMCIA (CardBus)

XFree (with or w/o hardware-assisted OpenGL (GL))

No Suspend to Disk, Bluetooth, IrDA nor FireWire (I don't use them for now) but the necessary modifications in the kernel config are AFAIK easy

According to Kevin Krause: suspend to disk works under APM. created a partition (Type 16), formatted as FAT12, made a hibernation file using tphdisk, rebooted, pressed Fn+F12

Compact Flash: invoke 'modprobe ide_cs'. not tested.

I2C and I2O seem useless

ATAPI: here my /etc/hdparm.conf (-A1 -c3 -d1 -m16 -u1 -W1 -X69)
hdparm -t: approx. 25 MB/s
hdparm -T: approx 650 MB/s

HZ environment variable

2.6 kernels works at 1000 Hz. There was a kernel logic handling it at 100 Hz in order to cope with software only compatible with the old '100' frequency. Under 2.6.13 one can configure it, I choose 1000 and this environment variable now contains 1000 (defined in /etc/login.defs). Please inform me if you know for sure.

Modules (sound and other stuff)

20050518: under 2.6.11 ALSA is mute (no sound produced), albeit there is no problem under 2.6.10 and after 2.6.12.2. solution:
amixer set 'Line Jack Sense' off
amixer set 'Headphone Jack Sense' off
alsactl store
A properly configured kernel (the configuration published in this document does the job) can automagically load the necessary module(s) whenever you access to a given special file (something in /dev/, tied to some kernel code). The '/etc/modprobe.conf' file stores the nitty gritty details: what module must be loaded but also how (load order, parameters passed ...).

/etc/modprobe.d/thinkpad. You may install it then run (as root) 'update-modules' (the 'vmmon' module is for VMWare)

Some driver codes are built inside the kernel because I always use them

... Linux 2.6

Please read The Wonderful World of Linux 2.6 and post-halloween-2.6.txt, then, for example, this Debian Kernel 2.6 How To

My path to Linux 2.6

Beware: all this applies to a Debian woody (2.2)

on my box I mainly edited /etc/apt/sources.list in order to fetch at least the 'stable' and 'testing' packages.
in France (metro) on my particular site it leads to this content (do not copy it, please adapt it for example by using apt-spy):

#stable
deb http://security.debian.org stable/updates main contrib non-free
deb http://ftp.fr.debian.org/debian-non-US stable/non-US main contrib non-free
deb http://ftp.fr.debian.org/debian stable main contrib non-free

#sarge
deb http://security.debian.org sarge/updates main contrib non-free
deb http://ftp.fr.debian.org/debian-non-US sarge/non-US main contrib non-free
deb http://ftp.fr.debian.org/debian sarge main contrib non-free

#testing
deb http://security.debian.org testing/updates main contrib non-free
deb http://ftp.fr.debian.org/debian-non-US testing/non-US main contrib non-free
deb http://ftp.fr.debian.org/debian testing main contrib non-free

# unstable
deb http://ftp.fr.debian.org/debian-non-US unstable/non-US main contrib non-free
deb http://ftp.fr.debian.org/debian unstable main contrib non-free
Then I invoked:
$ apt-get update

$ apt-get install -t apt testing kernel-image-2.6.6-1-686 hotplug \
kernel-doc-2.6.6 kernel-source-2.6.6 fxload ifrename coreutils \
fileutils initrd-tools module-init-tools kernel-package \
libncurses5-dev locales manpages-dev gcc-3.3 gcc-3.3-base gcc make \
binutils procps e2fsprogs nfs-common nfs-kernel-server binutils-doc \
cpp-doc cpp-2.95-doc e2fsck-static autoconf automake1.8  libtool flex \
bison gcc-doc laptop-mode-tools

Automatic modules unloading

I use the script developed by Steve Youngs
in root's crontab:
* */5 * * * ~/bin/utis/auto-rmmod.sh 'ci_hcd\|hid\|psmouse\|vm'
Note: 'vm' is for VMWare (if you don't know what it is just neglect it, use the proposed line)

Filesystems

Some softwares (old and new) use various fs, let's mount them

In order to open terminals: xterm, rxvt.. you need the 'devpts' driver in the kernel. It is now mounted by /etc/init.d/mountvirtfs (installed by the 'initscripts' package)
Note: it used to be mounted by /etc/init.d/devpts.sh which was in the 'libc6' package

'sysfs' is mandatory

My /etc/fstab contains:

tmpfs           /dev/shm        tmpfs   defaults,nosuid,nodev,size=128M,noatime    0    0
sysfs           /sys            sysfs   default         0       0
none            /proc/bus/usb   usbfs        defaults        0       0
Note: 'usbdevfs' (for 2.4 kernels) is obsolete (albeit recognized by 2.4.26) and replaced (on 2.6) by 'usbfs'

The new kernel modules suffix is '.ko'. To load a module use 'modprobe' instead of 'insmod'

The "update" package

The "update" package is now obsolete because the kernel now does his job. Therefore (if you only use 2.6 kernels) uninstall 'update' (dpkg -r update) if your logs contain those messages:
kernel: warning: process `update' used the obsolete bdflush system call
kernel: Fix your initscripts?

IRQ (interruption request, physical lines)

By default IRQ 11 was shared among many drivers (see 'cat /proc/interrupt'). AFAIK declaring a dedicated IRQ line for each peripheral is faster (moreover the relative priority of an IRQ line is inversely proportional to its number). Therefore I used the SETUP program (at boot time) to enable (in the 'Config/PCI' menu) an automatic configuration of each hw exception line ('INTA', 'INTB' ...). Be careful to not let the ISA bridge grab a line also used by PCI (for example: AFAIK the infrared chip grabs one)

Here is my interrupt lines setup:

root@nataf:~ # cat /proc/interrupts
           CPU0       
  0:  587939841          XT-PIC  timer
  1:     676437          XT-PIC  i8042
  2:          0          XT-PIC  cascade
  5:    1463100          XT-PIC  Intel 82801DB-ICH4 Modem, yenta, Intel 82801DB-ICH4
  7:    3587327          XT-PIC  parport0
  8:         28          XT-PIC  rtc
  9:     329034          XT-PIC  uhci_hcd:usb1, uhci_hcd:usb3, yenta
 10:    3443786          XT-PIC  uhci_hcd:usb2
 11:   42439627          XT-PIC  ehci_hcd:usb4, eth0
 12:     897852          XT-PIC  i8042
 14:    4025735          XT-PIC  ide0
NMI:          0 
ERR:          0

X Window

OpenGL

My X server (/etc/X11/xorg.conf) does not enable OpenGL anymore (saving a few MB RAM).

Invoke 'dpkg-reconfigure xserver-common' and set the X server niceness to 0

To use an OpenGL-enabled server: use my kernel config and load some pertinent kernel modules (agpgart, i830, intel_agp, radeon), for example by putting their names in /etc/modules.

Launch X. Remember that you need DRI, therefore as long as you get:

root@nataf # grep -i 'Direct.*rendering' /var/log/XFree86.0.log
(II) RADEON(0): Direct rendering disabled
you are stuck.

you need:

root@nataf # grep -i drm /var/log/XFree86.0.log
 [ ... blah ... ]
(II) RADEON(0): [drm] Initialized kernel agp heap manager, 5111808
And must be able to read '/dev/dri/card0'.

Invoke 'glxinfo |grep -i renderer' which produces here:
"OpenGL renderer string: Mesa DRI Radeon 20020611 AGP 1x x86/MMX/SSE NO-TCL"

the total memory footprint of GL (on top of XFree's footprint) is, under use, approx 11 MB

xengine ticks at approx 14800 RPM

Related problem: I use an (external) USB mouse. The X Window server (xfree) does looses it after each (unplug-plug) or (APM suspend-resume) sequence
Solution: declare 'X11_USBMICE_HACK=true' in '/etc/default/hotplug' and use at least a 2.6.5 kernel (or 2.6.4 patched with http://www.clarkson.edu/~evanchsa/software/kernel/patches/usb_resume-2.6.4.patch)

X Window and external monitor

Check this thread

Dual head

20050817: my pal Dominique Quatravaux devised a way to configure X in order to simultaneously display on the internal monitor and on an external one

Using the old XFree86-debug server (XFree86 Version 4.3.0.1 (Debian (static) 4.3.0-0woody4+4.0pre1v3 20031004135351 rnolden@) and Xorg 6.8.

DRI et GLX are working (thx to Mathias Brossard!)

Use the appropriate conf file: XF86Config-4 or xorg.conf.

Then invoke "X :1 -layout dualhead" to obtain a dual-headed server

GDM

Add to your gdm.conf:
[server-Xdualhead]
name=Double affichage pour videoprojecteur
command=/usr/X11R6/bin/X -layout dualhead -audit 0
flexible=true
Here is Dom's gdm.conf.

To obain a new Xinerama visual invoke 'gdmflexiserver' (under KDE, menu K -> System -> New connection)

Quirks:

Useless details

DO NOT READ THIS SECTION. I keep it here to attract people searching for a solution

Debug 4.1 server w/o fb and the DRM driver: GLX works but glxgears peakses at 320 FPS and drains all the CPU power: it is in fact done by MESA (soft GLX emulation), as revealed by invoking 'glxinfo|grep -i mesa'. I need to put the hardware at work, therefore this is not adequate :-(

There is a fglrx-glc22-4.3.0-3.2.8 X server downloadable from ATI website. It is an alien'isable RPM but its content (for example /usr/X11R6/lib/libGL.so.1.2) conflicts with useful other things and I don't want to uninstall completely XFree to let it run

I then installed a 4.3 server (apt-get -t experimental install xserver-xfree86, which now installs 'xserver-xfree86_4.3.0-0pre1v4_i386'), w/o fb. it speeds the thing up (xengine reaches 7100+ RPM) but OpenGL is not there, even w the DRM and export MESA_FORCE_SSE=1, even with the XFree 'ati' (instead of 'radeon') driver (glxgears just hangs and stays black as soon at it is mapped, the complete server does not react to mouse or kbd events albeit the mouse cursor moves as I fiddle with the mouse)

xserver-xfree86_4.3.0-0pre1v4_i386 w/o the DRM and any GLX declaration in the XF86Config-4 works fine. no GLX but the speed seems ok (xengine ticks at 4500 RPM) and the working set is 28 MB (approx 21MB shared), therefore I keep this setup.

LILO

'compact' works

'vga=0x314' is ok for me

Kernel config

The CPU is theoritically a P4 but AFAIK it lacks some P4-specific functions, i.e. it is not a P4 but a P3-compatible

Here is my .config, check the version (comment at the top).

BEWARE: install (make modules, GRUB/LILO ...) this new kernel w/o destroying the old (working) modules or kernels files (or the corresponding declarations in the LILO/GRUB config files)

CPU frequency scaling

To benefit from the CPU freq scaling function I use 'powernowd' (see also the documentation in ((2.6_kernel_tree))/Documentation/cpu-freq): /etc/default/powernowd contains:
OPTIONS="-q -p 200 -u 60 -l 40"
5 times per second (200 millisec) the CPU frequency is raised to the max if the load is above 60% and reduced by 100 MHz if it is below 40%
no provision for letting the CPU only run at low speed when on battery because I prefer to see the machine crunch work as fast as possible. To monitor it: # watch grep '^cpu.MHz' /proc/cpuinfo

Thinkpad (TODO, experimental)

apt-get -t install experimental thinkpad-source

Dunno, for now, if it is useful. let me know

Mouse and trackpoint

'Trackpoint' is the name of the little micro-joystick plugged in the keyboard

Virtual mousewheel

The proposed setup gives a virtual mousewheel: maintain button 3 down and play with the 'trackpoint' (the little joystick replacing a mouse)

Synaptics

I don't use it for now but the xfree86-driver-synaptics Debian packages may offer the same functionnality (thx to Richard Renard)

Kernel patch from Stephen Evanchik

Use it (for Linux 2.6.4) to configure the Trackpoint. It enables the button placed on it (you can do a mouse click by pushing it vertically). It ceases to work after a resume if I don't unload (rmmod) then reload (modprobe) it (it is now done automagically by APM my script) the patch is there

Jaime Towns documents this as follows:


You can modify any of the parameters inside the trackpoint controller (inside the hardware). I only use it to set the sensitivity to maximum and to change the speed of the controller, but you can change any of the parameters specified in the IBM engineering specification

For example, you can enable "Press to select" which lets you press on the trackpoint, which emulates a mouse button (you now have four buttons in total!) If you compile the patch as a module, try adding the following to /etc/modprobe.conf:

options psmouse speed=120 sens=240 pts=1
then:
modprobe -r psmouse
 (to remove the module)

modprobe psmouse
 (to insert the module again, with the new parameters)
Here is a Documentation

I don't use it as a module - I just modify the defaults in the patch (near the bottom of the patch) and compile them into my kernel.


thx Jaime!

wifi

I use the ipw2100 driver, included in any kernel above 2.6.14.

I use the Wi-Fi adapter as eth1. In order to only enable it when needed I disabled it at boot time by adding to the /etc/modprobe.d/blacklist (and /etc/hotplug/blacklist ?) file a line containing 'ipw2100'.

On WEP mode the /etc/network/interfaces (used to activate the interface with 'ifup') file is something along those lines:

iface eth1 inet dhcp
 pre-up DO SOMEHTING HERE IN ORDER TO BRING YOUR FIREWALL UP
 pre-up modprobe ipw2100
 pre-up iwconfig eth1 key PutYourWEPKeyHere open # 'open' or 'restricted'
 up iwconfig eth1 essid PutYourESSIDHere
 down ifconfig eth1 down
 down rmmod ipw2100
For WPA (more secure than WEP) you will need the 'wpasupplicant' (probably in 'testing' instead of 'stable') and a /etc/network/interfaces:
iface eth1 inet dhcp
 pre-up DO SOMEHTING HERE IN ORDER TO BRING YOUR FIREWALL UP
 pre-up modprobe ipw2100
 pre-up /usr/sbin/wpa_supplicant -ieth1 -c/etc/wpa_supplicant.conf -Dwext
 down ifconfig eth1 down
 down rmmod ipw2100
Don't forget to set adequate parameters in /etc/wpa_supplicant.conf

Disable Wifi at boot

To disable wifi at boot put a line containing 'ipw2100' in /etc/./hotplug/blacklist and a line '-ipw2100' in the '/etc/modules' file and a line 'ipw2100' in './hotplug/blacklist'.
Any browser! hacker
emblem TuxMobil - Linux on Laptops, PDAs and mobile Phones

Other texts