Running Debian Linux on an Averatec Laptop

written by: Stephan Müller; mailto: smueller (at) chronox (dot) de

WARNING: The descriptions here are brief notes based on my personal experiences setting up the system. This is not a step-by-step guide. DO NOT attempt anything similar to the steps described here unless you completely understand what you're doing. You risk losing all your data and may even destroy your notebook if something goes wrong during installation. I'm hoping that this information will help experienced users in getting started, and maybe someone who has more free time than I do will be able to provide more detailed instructions.


Working hardware with kernel 2.6

The following hardware is working on my system with kernel 2.6.2-rc3:


Installation party

First steps after unpacking

After I brought my new Averatec home an unpacked it, the first and most important step was the removal of the Windows XP sticker! :-) Guess what, this sticker was made of metal, so I had some trouble removing it without any tools.

Shrink Windows XP partition

The Averatec comes with a preinstalled Windows XP on an NTFS partition that uses the whole hard disk. Since I want to keep Windows XP on it for studying it, I had to find a way to make room on the hard disk.

Unfortunately, wiping this partition, setting up a smaller one and reinstalling the Windows XP from the rescue CDs does not work, because these images are created and installed on the disk using ghost. Since I did not have the commercial ghost version with me (that could be used to manipulate the target partition), there is no other way than resizing the NTFS filesystem and its partition.

To accomplish this task I used the GNU NTFS resizer (see http://linux-ntfs.sourceforge.net/ ) for shrinking the filesystem and fdisk for resizing the partition.

Before you go ahead, you have to keep in mind that the following steps might lead to data loss on the Windows XP partition. So if you follow them, make back ups (or in case you did not touch the Windows XP partition beforehand, you can rely on the recovery CDs). In neither case, I reject any responsibilities in case there goes something wrong or my descriptions are not accurate.

To resize the Windows partition, I used a KNOPPIX CD (see http://www.knoppix.net ) which holds a fully self contained Debian-Linux that does not touch the hard disk at all. Since my KNOPPIX does not include the ntfsresize(8) tool, I put it including the /usr/lib/libntfs.so.4 on a USB stick (you can either recompile the source of the ntfstools package or install the Debian unstable package of ntfstools on another system and copy both files to the USB stick - I am not familiar with other distributions, so there might be a chance that this package is available there as well). Although you can copy it on other media, the following descriptions assumes the ntfsresize tool and its library being put on a USB stick.

Steps:

Installing Linux

Here I made my life easy with just copying an existing Linux installation to my Averated (just tarring each partition separately including storing of the numeric user and group IDs - KNOPPIX has another /etc/passwd that mess the the owners of files other that root when only saving the default of the UID/GID names during tarring).

But now step by step:


Configuration party

Configuring the Kernel

To fully enable the DMA on the block devices (hard disk as well as CD drive), the kernel needs to be configured with VIA82CXXX chipset support (CONFIG_BLK_DEV_VIA82CXXX).

When the CD drive shall be used as burner, the SCSI emulation support needs to be turned on (CONFIG_BLK_DEV_IDESCSI). Do not forget to append the option hdc=ide-scsi as kernel parameter to the boot manager.

Attached there is my kernel configuration (see http://www.chronox.de/averatec_linux/config-2.6 ) for reference.

Since some of my drivers are compiled as modules, they are to be loaded at boottime. Therefore my /etc/modules looks like the following (updated):

        cryptoloop
        twofish
        via-rhine
        evdev
        agpgart
        via-agp
        processor
        thermal
        fan
        battery
        button
        ac

Configuring the WLAN card

Use the latest driver (at least ftp://ftp.linux-wlan.org/pub/linux-wlan-ng/linux-wlan-ng-0.2.1-pre13.tar.gz or higher ) that contains a patch to make the Prism3 USB card working.

The card is now working in my system. As follows, there are configuration hints.

In case you run Debian, I created two patches to configure the card automatically once hotplug has loaded the driver. The patches http://www.chronox.de/averatec_linux/linux-wlan-ng-pre-up and http://www.chronox.de/averatec_linux/wlan.agent have to be used to patch /etc/network/if-pre-up.d/linux-wlan-ng-pre-up and /etc/hotplug/wlan.agent respectively.

Now you can configure the interface using /etc/network/interfaces. Here is a snippet from my configuration file:

        iface wlan0 inet dhcp
                wireless_mode managed
                wlan_ng_authtype sharedkey
                # Enabling the WEP encryption
                wireless_enc on
                # The WEP key
                wlan_ng_key0 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
                # The WLAN Name
                wireless_essid WLANSSID

Configuring XFree86 including touchpad

See my attached XFree86 configuration (see http://www.chronox.de/averatec_linux/XF86Config-4 ). You see, that I included support for any USB mouse that might be attached to the laptop. Since I use the /dev/input/mice device for the touchpad and the USB mouse, any USB mouse can even be attached and will recognized after X is started (thanks to kernel 2.6.0)!

When using the touchpad with the native kernel driver prior to 2.6.1, you may have luck to get it working with the left and right touchpad buttons. Starting with kernel 2.6.1, you do not have to patch the Synaptics kernel driver any more. In case you have an older kernel (somewhat senseless though), you have to grab the synaptics (see http://w1.894.telia.com/~u89404340/touchpad/index.html ) kernel driver updates. Nevertheless, you always need the XFree86 driver, to make the mouse working in X. (this driver is also to be found on the website mentioned above - it will soon be integrated into XFree86, as far as I read in the Internet).

For enabling the driver, you have to enable the synaptics driver in the kernel configuration (select CONFIG_MOUSE_PS2 as a prerequisite for the synaptics touchpad CONFIG_MOUSE_PS2_SYNAPTICS and the event interface CONFIG_INPUT_EVENT). When the kernel driver is loaded, the following will be displayed:

        Synaptics Touchpad, model: 1
         Firmware: 5.1
         180 degree mounted touchpad
         Sensor: 15
         new absolute packet format
         Touchpad has extended capability bits
         -> four buttons
         -> multifinger detection
         -> palm detection
        input: Synaptics Synaptics TouchPad on isa0060/serio4

The configuration of XFree86 is fairly simple, just copy the file synaptics_drv.o that is supplied in the tarball into /usr/X11R6/lib/modules/input/ (actually, I do not recommend recompiling the whole XFree86 with the synaptics sources, since it is adventurous).

To make use of the driver, you have to check that the device files for the event interfaces are there. I had to create them, here is my file listing of /dev/input/:

        crw-r--r--    1 root     root      13,  64 Sep 16 21:37 event0
        crw-r--r--    1 root     root      13,  65 Sep 16 21:37 event1
        crw-r--r--    1 root     root      13,  66 Sep 16 21:38 event2
        crw-r--r--    1 root     root      13,  67 Sep 16 21:38 event3
        crw-r--r--    1 root     root      13,  68 Sep 16 21:39 event4
        crw-r--r--    1 root     root      13,  69 Sep 16 21:39 event5

If you do not have these files, create them as root with the following command

        mknod -m=644 /dev/input/event0 c 13 64

(increment the number in the name and the minor number for generating the others)

Finally you have to enable the driver in the XFree86 configuration file. Look at my configuration and search for the section InputDevice with the synaptics driver, as well as Module section for loading the synaptics driver.

Luckily, starting with 2.6.0-test6, the synaptics driver works with GPM as well!

Unfortunately, there is currently only DRI driver support for the S3 Savage graphics chip on 2.4 kernels (see http://www.linux.org.uk/~alan/S3.zip ), so real 3d hardware acceleration is not available. However, I made a kernel patch to enable AGP for the VIA chips. It will be in the stock kernel with 2.6.0-test7. Since DRI people seems to work on DRI for Savage chips, we might get this support sooner or later.

In case your display is flickering when running X, put the configuration option UseBios Off into the device section of the graphics card (see attached configuration file).

Configuring ACPI and CPU Frequency scaling (dismissing APM)

CPUFreq is the utilization of the PowerNow! technology from AMD. It basically supports manipulation of the processor cycles. It helps greatly in enhancing your battery life without you would notice it! In case the processor has nothing to do, the cpudynd throttles the processor to 400 MHz. If there are tasks to perform, it immediately switches back to 1400 MHz.

For using CPUFreq, you have to enable the kernel driver and run the cpudynd (see attached kernel configuration).

WARNING: ACPI does not work for me correctly. So take care of your data (disks do not get unmounted properly if you use suspend).

ACPI is somewhat tricky: you have to enable the kernel support and start the acpid that monitors events and executes scripts for each event. For the Averatec, there are three buttons that can cause events:

Unfortunately, there is the issue that you have to press the power button when the system is in suspend mode to wake it up. So I had to disable the shutdown sequence when pressing the power button, otherwise the system shuts down properly when you want to wake it up. However, Philipp Hartmann has sent me a patch that is reasonable for enabling the power button. See atached files.

Here (see http://www.chronox.de/averatec_linux/acpi-scripts.tar.gz ) you can find my ACPI scripts (to be put in /etc/acpi/) and my ACPI event files (see http://www.chronox.de/averatec_linux/acpi-events.tar.gz ), to be copied to /etc/acpi/events/.

Update 20031107:

Since the laptop does not shut down itself in case of a power failure of the batteries, you have to check for it yourself. You can do this by means of the GUIs (KDE, Gnome, etc.), however you are not protected in case you do not run them. There is a sleep daemon that can be started during startup. The following instructions show my setup of sleepd:

Configuring Sound

Sound is fairly easy to configure: Just enable the kernel configuration option CONFIG_SND_VIA82XX in conjunction with generic ALSA drivers (such as OSS API emulation). My /etc/modprobe.conf file contains for enabling sound the following entries (keep in mind to add these lines to /etc/modprobe.d/alsa on a Debian system and update the modprobe.conf file with update-modules):

This list includes MIDI support

        alias char-major-116 snd
        alias char-major-14 soundcore
        options snd major=116 cards_limit=4
        alias sound-service-0-0 snd-mixer-oss
        alias sound-service-0-1 snd-seq-oss
        alias sound-service-0-3 snd-pcm-oss
        alias sound-service-0-8 snd-seq-oss
        alias sound-service-0-12 snd-pcm-oss
        alias snd-card-0 snd-via82xx
        alias snd-card-1 snd-mpu401
        options snd-via82xx dxs_support=4
        options snd-mpu401 port=0x330 irq=7
        alias sound-slot-0 snd-card-0
        alias sound-slot-1 snd-card-1
        alias sound-slot-2 snd-card-2
        alias sound-slot-3 snd-card-3

In case you do not hear anything from the speakers, you might want to check whether you have output from the line out. If yes and you ask how to reactivate the speaker, invoke alsamixer (other mixers might not able to do that) and disable ``External Amplifier Power Down'' (by selecting it and press ``.'').

Configuring the Modem

I just discovered that there is a slmdm driver for 2.6 (to be found at http://www.smlink.com ). You have to use version 2.9.x for getting it to work properly under kernel 2.6. Just follow the install instructions. As follows there is the start script (take care, the script expects the slmodemd daemon at /usr/local/sbin, in contrast to /usr/sbin of the default installation):

        #! /bin/sh
        #
        PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
        DAEMON=/usr/local/sbin/slmodemd
        NAME=slmodemd
        DESC="Winmodem slmodem"
        test -x $DAEMON || exit 0
        # if error, then admin has to create char major 212, minor 0 device
        if [ ! -c /dev/slamr0 ] ; then
                echo "ERROR: no /dev/slamr0 device"
        fi
        set -e
        case "$1" in
          start)
                echo -n "Starting $DESC: $NAME"
                modprobe slamr > /dev/null 2>&1
                lsmod | grep -q slamr
                if [ $? -ne 0 ]; then
                        echo "Error starting $DESC: $NAME (module not loaded)"
                        exit 1
                fi
                start-stop-daemon --start --background --quiet \
                        --exec $DAEMON -- --country=GERMANY
                # let 'em starting
                sleep 1
                chmod 660 /dev/ttySL0
                chgrp --dereference dialout /dev/ttySL0
                echo "."
                ;;
          stop)
                echo -n "Stopping $DESC: $NAME"
                start-stop-daemon --stop --quiet \
                        --exec $DAEMON
                rmmod slamr > /dev/null 2>&1
                echo "."
                ;;
          *)
                N=/etc/init.d/$NAME
                # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
                echo "Usage: $N {start|stop}" >&2
                exit 1
                ;;
        esac
        exit 0

However, I had to tweak the thing a bit: during the install routine, the devices /dev/ttySL[0..3] are generated. This however is stupid as the daemon deletes these files. Instead you have to create the device file manually:

        mknod -m 600 /dev/slamr0 c 212 0

When calling my start script, you can use the modem device at /dev/ttySL0 (this is a symlink to a pseudo TTY as interface to the modem daemon). The pseudo TTY access rights are set to 660 with user root and group dialout. So if you want to access the modem device /dev/ttySL0, your user ID has to be assigned to the group dialout.


Changelog

20040201 - Configuration of WLAN interface added some ACPI updates

20031130 - new kernel config - removes a nasty oops for ACPI sleep/suspend; news for enabling the USB Prism2 card

20031107 - sleepd, sound updates (including MIDI support)

20031010 - ACPI update

20031006 - inital presentation


Copyright

(stupid stuff, but needed)

Copyright (C) 2003-2004 Stephan Müller - smueller (at) chronox (dot) de

$Id: linux_on_3156X.pod,v 1.7 2004/02/01 21:39:45 smueller Exp $