Installing Slackware 10.1 on a PC110

From ThinkWiki
Jump to: navigation, search

Summary

This article describes how to configure Slackware 10.1 on a PC110, with a 4GB Hitachi Microdrive in one PCMCIA type II slot, a wireless network adapter in the other PCMCIA slot, as well as configuration settings for the video hardware, the built-in peripheral devices including the pointing stick and touch pad, the modem and IrDA serial ports, the sound hardware, and the power management features.

What works

  • 4GB Hitachi Microdrive in a PCMCIA slot, from where the root filesystem is mounted
  • PCMCIA Network adapters (3Com 3c589, Linksys WPC11 11Mbps 802.11b WLAN Card)
  • Graphics adapter and accelerator (CT-65535)
  • X.Org 6.8.1
  • Digitizer pad
  • IrDA
  • ES488 Audio controller
  • Modem
  • Suspend/resume to RAM

What needs to be fixed

  • Occasional video corruption when switching from X to console
  • Suspend to disk (FnF12 -- there is an appropriate symbol on the key, but it is unknown whether the PC110 can suspend to disk at all)
  • Floppy drive
ed@carrot:~$ sudo mount -t msdos /dev/fd0h1440 /mnt/floppy/
mount: block device /dev/fd0h1440 is write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/fd0h1440,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

ed@carrot:~$ dmesg | tail
inserting floppy driver for 2.4.29
Floppy drive(s): fd0 is 1.44M
FDC 0 is a post-1991 82077
FAT: bogus logical sector size 223
VFS: Can't find a valid FAT filesystem on dev 02:28.
FAT: bogus logical sector size 223
VFS: Can't find a valid FAT filesystem on dev 02:28.

Kernel configuration

NOTE!
These instructions are intended for use with Slackware 10.1 plus Linux kernel version 2.4.29, rather than with any of the kernels included with the Slackware 10.1 distribution.


The stock 2.4.29 Linux kernel requires a patch before $ make config will produce a configuration appropriate for an i486. Alternatively, skip the $ make config stage and use this configuration.

Compile the kernel and modules (do this overnight if you're compiling on the PC110 itself) and copy the kernel to /boot/bzImage-2.4.29. Install the modules in /lib/modules/2.4.29. Install any other modules you may have (hostap wireless network card driver modules, for example) if # make modules_install removes them.

Boot sequence

Booting with / on a PCMCIA device is a bit tricky. There are two ways to do it:

  1. Add "PCMCIA" to the start-up disk choices in the BIOS, or
  2. Use an initial ram disk to load the pcmcia modules.

The first option is easier -- the BIOS takes over the slot with the Microdrive in, and the other one is free for other devices. This works for booting, but the BIOS doesn't seem to be able to wake the disk up after a suspend-resume cycle. It used to work with the original type III PCMCIA disk, so it seems the Microdrive needs to be prodded in a different way to revive it.

The solution is to create a PCMCIA-aware initrd to initialise the PCMCIA controller before / is mounted. /sbin/pcinitrd, part of the pcmcia-cs package, will do most of the work. The ramdisk it creates uses ash to execute /linuxrc, so make sure ash is installed before running pcinitrd. The ramdisk created by pcinitrd isn't quite complete; add the missing libraries and binaries like so:

root@carrot:~# /sbin/pcinitrd initrd
2400+0 records in
2400+0 records out
mke2fs 1.35 (28-Feb-2004)
1836K/2357K used
root@carrot:~# mount -o loop initrd /mnt/
root@carrot:~# cp /sbin/insmod.old /mnt/bin/
root@carrot:~# cp /lib/libblkid.so.1 /mnt/lib/
root@carrot:~# cp /lib/libuuid.so.1 /mnt/lib/
root@carrot:~# cp /lib/modules/2.4.29/kernel/drivers/pcmcia/i82365.o /mnt/lib/pcmcia
root@carrot:~# cp /lib/modules/2.4.29/kernel/drivers/ide/legacy/ide-cs.o /mnt/lib/pcmcia
root@carrot:~# ldconfig -v -r /mnt
ldconfig: Can't open configuration file /etc/ld.so.conf: No such file or directory
ldconfig: Can't stat /usr/lib: No such file or directory
/lib:
  libuuid.so.1 -> libuuid.so.1
  libblkid.so.1 -> libblkid.so.1
  ld-linux.so.2 -> ld-linux.so.2
  libc.so.6 -> libc.so.6
root@carrot:~# umount /mnt/
root@carrot:~# gzip initrd
root@carrot:~# cp initrd.gz /boot/initrd

Set the [http://www.basterfield.com/pc110/bios/startup.htm BIOS startup sequence] to "FDD-1", "HDD-1", in that order. It's essential that the BIOS boot sequence doesn't include "PCMCIA", because if it does the BIOS will control the slot with the disk in, and pcmcia-cs will only control the one with the network card. The BIOS doesn't seem to be able to wake up the 4GB Hitachi Microdrive properly after a suspend/resume cycle, whereas the Linux IDE driver does.

/boot is mounted on /dev/hda1, the 4MB internal flash disk (Hard disk 1 in the BIOS).

/etc/lilo.conf should look like

boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
linear
default=slackware-10.1

image=/boot/bzImage-2.4.29
    label=slackware-10.1
    inirtd=/boot/initrd
    read-only
    root=/dev/hdc2
    append="hdd=noprobe"

LILO version 22.5.9, as installed with Slackware 10.1, complains about the linear option, but there is no immediate need to take it out; it's always been there and it's always worked. /dev/hda isn't bigger than 8.4GB, so using lba32 instead wouldn't gain anything.

append="hdd=noprobe" prevents the IDE driver probing for a slave device on the second IDE interface (the other PCMCIA slot); nothing bad happens if the probe takes place, but the boot process hangs for a few seconds. We know there's nothing there, so there's no point looking.

/etc/fstab

/etc/fstab looks like this:

/dev/hda1               /boot                   ext2    ro            1 2
/dev/hdc2               /                     ext3    defaults        1 1
/dev/fd0                /mnt/floppy             auto    noauto,owner    0 0
none                    /proc                   proc    defaults        0 0
none                    /dev/pts                devpts  gid=5,mode=620  0 0
/dev/hdc1               swap                    swap    defaults        0 0
Hint:
Mounting / with option "noatime" might be a good idea.
Hint:
For NFS to work properly, make sure /etc/rc.d/rc.portmap is chmod 755.

PCMCIA configuration

The second serial port and the sound card use IRQs 3 and 5 respectively, and the touch pad uses IRQ 10. Edit /etc/pcmcia/config.opts to prevent any PCMCIA devices being assigned these IRQs:

# Second built-in serial port
exclude irq 3
# Sound card
exclude irq 5
# Touch pad
exclude irq 10

Make sure the /etc/pcmcia/config.opts found in the initial ramdisk /boot/initrd has the same IRQs excluded.

Network

NOTE!
This section describes how to configure Hostap to use a Zyxel ZyAir B-100 11Mbps 802.11b WLAN card. This card uses the Prism3 chipset, and identifies itself as a "Linksys WPC11 11Mbps 802.11b WLAN Card". The following guidelines may work with other Prism3 chipset WLAN PCMCIA cards, but have only been tested with the card named above.

Hostap isn't included with the pcmcia-cs distribution, so needs adding to the configuration files. Edit /etc/pcmcia/config and add this to the "Device driver definitions" section at the top of the file:

device "hostap_cs"
  class "network" module "hostap_cs"

and in the "Wireless network adapters" section (about half way through the file) change

card "Linksys WPC11 11Mbps 802.11b WLAN Card"
  manfid 0x0274, 0x1613
  bind "orinoco_cs"

to

card "Linksys WPC11 11Mbps 802.11b WLAN Card"
  manfid 0x0274, 0x1613
  bind "hostap_cs"

Compile the driver modules and install them in /lib/modules/:

/lib/modules/2.4.29/kernel/drivers/net/pcmcia/hostap_cs.o
/lib/modules/2.4.29/kernel/drivers/net/wireless/hostap.o
/lib/modules/2.4.29/kernel/drivers/net/wireless/hostap_crypt_ccmp.o
/lib/modules/2.4.29/kernel/drivers/net/wireless/hostap_crypt_tkip.o
/lib/modules/2.4.29/kernel/drivers/net/wireless/hostap_crypt_wep.o
/lib/modules/2.4.29/kernel/drivers/net/wireless/hostap_pci.o
/lib/modules/2.4.29/kernel/drivers/net/wireless/hostap_plx.o
/lib/modules/2.4.29/pcmcia/hostap_cs.o

(/lib/modules/2.4.29/pcmcia/hostap_cs.o is a symbolic link to ../kernel/drivers/net/pcmcia/hostap_cs.o).

WPA configuration

NOTE!
WPA requires that the Prism3 card's station firmware is at least version 1.7.0. Newer firmware is available here and instructions for downloading it into the network card's flash memory using tools supplied as part of the hostap driver can be found here.
ATTENTION!
Unsuccessful attempts to reprogram the network card's flash memory may leave it in an unusable state, except as some sort of paperweight, or perhaps a tool for scraping ice off a car window. WEP and unencrypted network configurations will work with whichever station firmware version your card already has; if you don't understand the instructions for installing newer firmware versions, or don't understand why you might want a newer version, don't do it.

Build and install wpa_supplicant according to the instructions in the source package. See its README file for details. Configure wpa_supplicant as described in the README, and summarised here.

Create /etc/wpa_supplicant.conf:

network={
	ssid="<the network name>"
	scan_ssid=1
	key_mgmt=WPA-PSK
	psk="<the key>"
}

Add the following block to the end of 'start' action handler in /etc/pcmcia/wireless:

    if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
        /usr/local/bin/wpa_supplicant -Bw -c/etc/wpa_supplicant.conf -i$DEVICE
    fi

Separate 'restart', 'resume', 'check' and 'suspend' action handlers from 'stop', and add the following block to the end of 'stop' action handler in /etc/pcmcia/wireless:

    if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
        killall wpa_supplicant
    fi

General wireless network configuration

Edit /etc/pcmcia/wireless.opts. Remove the section marked "SECTION TO REMOVE" at the beginning of the file and replace it with this:

*,*,*,*)
    ESSID="<the network name>"
    KEY="<the key>"
    MODE="Managed"
    WPA="y"
;;

Configure the network settings in /etc/pcmcia/network.opts. It's easiest if there is a DHCP server on the network, then the only change necessary is to ensure that

    DHCP="y"

dhcpcd will clobber /etc/ntp.conf if you don't tell it not to. Edit /etc/rc.d/rc.inet1 and /etc/pcmcia/network and add -N to every invocation of /sbin/dhcpcd. dhcpcd restores the original /etc/ntp.conf when it exits, so kill any running dhcpcd process before editing /etc/ntp.conf (described in the next section).

Setting the clock

NTP configuration is optional but it's nice to have the clock tell the right time, particularly if there are NFS mounts.

The ntpd (version 4.2.0) supplied with Slackware 10.1 is a big program that will hog more than 3MB of memory, so chronyd is probably a better choice for the PC110. chronyd also measures the drift of the hardware clock, so can make a better estimate of the time immediately following a reboot.

Create /etc/chrony.conf containing this:

driftfile /etc/chrony.drift
rtcfile /etc/chrony.rtc
rtconutc
keyfile /etc/chrony.keys
commandkey 0

local stratum 10

server 0.europe.pool.ntp.org
server 1.europe.pool.ntp.org
server 2.europe.pool.ntp.org
server ch.pool.ntp.org
server uk.pool.ntp.org

deny all
allow 127.0.0.1
Hint:
Choose NTP servers located fairly close by geographically, if possible. This particular choice of time servers is appropriate for a computer somewhere in Europe.
Hint:
Set the time in the BIOS to UTC, or remove the line "rtconutc" from the configuration file. Keeping the time in the BIOS as UTC allows chronyd to keep track of daylight saving time correctly, but has the disadvantage that the time displayed on the front of the PC110 will be UTC not the local time.

Launch chronyd from /etc/rc.d/rc.local:

Create /etc/rc.d/rc.local, chmod 755, if it doesn't already exist. Add

echo "Starting NTP daemon: /usr/sbin/chronyd"
/usr/sbin/chronyd

to start NTP when the PC110 boots.

Keyboard map

Create /etc/rc.d/rc.keymap containing this:

#!/bin/sh
# Load the keyboard map.  More maps are in /usr/share/kbd/keymaps.
if [ -x /usr/bin/loadkeys ]; then
  /usr/bin/loadkeys pc110.map
fi

and chmod 755.

It'll be called from /etc/rc.d/rc.M when the system boots.

Sound

The sound card is 8-bit, mono, and SoundBlaster compatible.

Put this in /etc/modules.conf:

alias sound-slot-0 sb
alias midi opl3
options opl3 io=0x388
options sb io=0x220 irq=5 dma=1
alias sound sb


Touch pad

The touch pad is fiddly and inconvenient to use, but it may as well be configured.

mknod /dev/pc110pad c 10 9

Run # /usr/sbin/mouseconfig and choose a PS/2 mouse, in order to link /dev/mouse to /dev/psaux and create /etc/rc.d/rc.gpm.

Edit /etc/rc.d/rc.gpm to invoke gpm in repeater mode: change both occurrences of

/usr/sbin/gpm -m /dev/mouse -t ps2

to

/usr/sbin/gpm -R -tps2 -M -tps2 -m /dev/pc110pad -g1 -i500 -d8

And in /etc/modules.conf:

alias char-major-10-9 pc110pad

Serial ports

NOTE!
The PC110 doesn't let you use all the serial ports at the same time: there are three serial devices and one two-channel UART. Here we configure the IrDA port and modem, since those are the two devices built into the computer itself (the ordinary DE9 wired serial port is located on the port replicator). The standard serial port requires no configuration beyond initialisation of the driver.

In the BIOS, [http://www.basterfield.com/pc110/bios/serial.htm set the serial ports] to "Infrared 1" (ttyS0) and "Modem 2" (ttyS1). The potentially most useful setting, activating the serial port on the port replicator and IrDA at the same time and ignoring the crappy modem altogether, is not available because these two devices share UART circuitry.

IrDA

The device files need to be created:

mknod /dev/ircomm0 c 161 0
mknod /dev/ircomm1 c 161 1
mknod /dev/irlpt0 c 161 16
mknod /dev/irlpt1 c 161 17
mknod /dev/irnet c 10 187
chmod 666 /dev/ir*

Put this in /etc/modules.conf:

alias tty-ldisc-11 irtty
alias char-major-161 ircomm-tty

Get the [http://sourceforge.net/project/showfiles.php?group_id=5616 user-space IrDA tools] and install them.

# irattach /dev/ttyS0 -s should load all the required modules, and start flashing the red light.

Modem

The modem is "FAX Class2/2.0 9600bps, DATA 2400/MNP5, VOICE (no standard)", and mostly undocumented. Finding suitable initialisation and command strings is left as an exercise for the reader.

Here is the information it is prepared to tell us:

ati0
Ver. 1.04      

OK
ati1
197

OK
at&v
ACTIVE PROFILE: E1 M1 Q0 T V1 X4 &C1 &D2 &K3 &Q0 &S0 &T0 S00:000 S02:043
S03:013 S04:010 S05:008 S06:003 S07:030 S08:002 S09:020 S10:014 S11:070 S12:050
S96:015

DEFAULT PROFILE: E1 M1 Q0 T V1 X4 &C1 &D2 &K3 &Q0 &S0 &T0 S00:000 S02:043
S06:003 S07:030 S08:002 S09:020 S10:014 S11:070 S12:050 S96:015

OK

The modem is really loud, so ATM0 would be a good start; wvdial might be useful too. /etc/wvdial.conf might look like:

[Dialer Defaults]
Modem = /dev/modem
Baud = 57600
# The PC110 modem doesn't like spaces in command strings.
Init = ATZ
Init2 = ATX3M0
Init3 = ATQ0V1E1S0=0&C1&D2S11=55+FCLASS=0
Phone = 555 555 5555
Username = name
Password = password


APM

Standby mode

The BIOS takes care of entering standby mode and turning off the display backlight when running on battery power. The backlight stays on when connected to AC power.

Sleep mode

The system can be suspended by pressing FnF4, or by closing the lid. Opening the lid, or pressing Fn, wakes the machine up again.

NOTE!
It's essential that the BIOS boot sequence doesn't include "PCMCIA", because if it does the BIOS will control the slot with the disk in, and pcmcia-cs will only control the one with the network card. The BIOS doesn't seem to be able to wake the disk up properly after a suspend/resume cycle, whereas the Linux IDE driver does.

Use the spare space on /dev/hda, mounted at /boot to keep a few handy binaries available even when /, the disk, is unavailable:

root@carrot:/boot# ls -lR apmd/              
apmd/:
total 2
drwxr-xr-x  2 root root 1024 2006-07-23 16:17 bin/
drwxr-xr-x  2 root root 1024 2005-03-21 00:50 lib/

apmd/bin:
total 349
-rwxr--r--  1 root root    650 2006-07-23 12:09 apmd_proxy*
-rwxr-xr-x  1 root root 263064 2005-03-21 01:12 ash.static*
-rwxr-xr-x  1 root root  14276 2005-03-21 00:50 cardctl*
-rwxr-xr-x  1 root root  47656 2005-03-21 18:12 hdparm*
-rwxr-xr-x  1 root root  14288 2005-03-21 18:13 sleep*
-rwxr-xr-x  1 root root  11892 2005-03-21 18:13 sync*

apmd/lib:
total 1433
-rwxr-xr-x  1 root root  100449 2005-03-21 00:49 ld-linux.so.2*
-rwxr-xr-x  1 root root 1357414 2005-03-21 00:50 libc.so.6*

/boot/apmd/bin/apmd_proxy is a script called by apmd immediately before going to sleep, and again immediately after waking up. Some experimentation has resulted in the following script:

#!/boot/apmd/bin/ash.static

# Make sure everything is flushed to the disk before suspending,
# and tell the disk to spin down.

LD_SO=/boot/apmd/lib/ld-linux.so.2
LD_LIBRARY_PATH=/boot/apmd/lib

case "$1" in
suspend)
	$LD_SO --library-path $LD_LIBRARY_PATH /boot/apmd/bin/sync
	$LD_SO --library-path $LD_LIBRARY_PATH /boot/apmd/bin/sync
	$LD_SO --library-path $LD_LIBRARY_PATH /boot/apmd/bin/sync
	$LD_SO --library-path $LD_LIBRARY_PATH /boot/apmd/bin/hdparm -f /dev/hdc
	$LD_SO --library-path $LD_LIBRARY_PATH /boot/apmd/bin/hdparm -Y /dev/hdc
	;;

resume)
        # The IDE disk driver will wake the disk up again if it is properly stopped before suspending.
	;;
esac

Edit /etc/rc.d/rc.M to tell apmd where to find the script to execute.

# Start APM or ACPI daemon.
# If APM is enabled in the kernel, start apmd:
if [ -e /proc/apm ]; then
  if [ -x /usr/sbin/apmd ]; then
    echo "Starting APM daemon:  /usr/sbin/apmd"
    /usr/sbin/apmd -P /boot/apmd/bin/apmd_proxy
  fi
elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:
  . /etc/rc.d/rc.acpid start
fi

Hibernation mode

Although the F12 key has a symbol on it that suggests suspending to disk, FnF12 does nothing.

X.Org 6.8.1

Turn off "Font Window" in the BIOS memory settings.

Here is a working xorg.conf. Note that

    Option "SWCursor"

is essential: configured to use the default hardware cursor, X will fail to start, and will just show a black screen and use 100% CPU until it's killed.

The PC110 has enough video RAM to display 800x600 and 256 colours, either using a virtual desktop and a 640x480 viewport on the computer's own display, or full-screen using an external monitor connected to the VGA port on the port replicator. The appropriate Modeline to use depends on the desired settings for the external monitor.

Using lwm is a good way to make the most of the PC110's limited memory. Finding button 2 on the mouse is a bit tricky, and so is accurately moving the pointer to a window frame, so

lwm*button1:  xterm
lwm*focus:  click

makes a good addition to ~/.Xresources.


Miscellaneous

Prevent syslogd from filling up the log with

Mar 12 08:40:33 carrot -- MARK --
Mar 12 09:00:36 carrot -- MARK --
Mar 12 09:20:41 carrot -- MARK --
Mar 12 09:40:43 carrot -- MARK --
Mar 12 10:20:48 carrot -- MARK --
Mar 12 10:56:35 carrot -- MARK --

messages (and, more importantly, waking up the disk all the time and draining the battery without good reason) by editing /etc/rc.d/rc.syslog: add -m 0 to the invocation:

  echo -n "/usr/sbin/syslogd -m 0 "
  /usr/sbin/syslogd -m 0

/etc/rc.d/rc.modules is mostly comment; it only loads two modules as installed -- agpgart and ide-scsi. Neither are useful on the PC110, so comment both of them out to avoid a couple of error messages at boot time.

External Sources

APM