2 Compilation, installation, and configuration

Contents of this section

2.1 Prerequisites and kernel setup

For the latest version, you will need to have kernel version 1.2.8 or higher. There are no kernel patches specifically for PCMCIA support. You'll also need to have a relatively recent set of module utilities. If your man page for insmod describes the [symbol=value ...] syntax, your utilities are current enough.

You need to have a complete linux source tree for your kernel, not just an up-to-date kernel image, when you compile the PCMCIA package. The PCMCIA modules contain some references to kernel source files.

Current kernel sources and patches are available from sunsite.unc.edu in /pub/Linux/kernel/v1.2, or from tsx-11.mit.edu in /pub/linux/sources/system/v1.2. Current module utilities can be found in the same places, in the file modules-1.2.8.tgz.

When configuring your kernel, if you plan on using a PCMCIA ethernet card, you should turn on networking support but turn off the normal Linux network card drivers, including the ``pocket and portable adapters''. The PCMCIA network card drivers are all implemented as loadable modules. All of the PCMCIA net drivers except the 3Com 3c589 driver depend on the 8390.o driver module which is built as part of the Linux kernel.

If you want to use SLIP, PPP, or PLIP, you do need to either configure your kernel with these enabled, or use the loadable module versions of these drivers. There is an unfortunate deficiency in the kernel config process, in that it is not possible to set configuration options (like SLIP compression) for a loadable module, so it is probably better to just link SLIP into the kernel if you need it.

If you will be using a PCMCIA SCSI adapter, you should enable CONFIG_SCSI when configuring your kernel. Also, enable any top level drivers (SCSI disk, tape, cdrom, generic) that you expect to use. All low-level drivers for particular host adapters should be disabled.

For recent kernels, you must explicitly do ``make modules'' followed by ``make modules_install'' in /usr/src/linux to build the loadable driver modules. They will be installed under /lib/modules.

Building the PCMCIA modules requires access to the kernel version file versions.h. This file is normally created at the start of a kernel build, and deleted at the end. It will be recreated in the course of doing ``make modules'', or it can be explicitly created by doing ``make include/linux/version.h'' at the top of your Linux source tree.

2.2 Installation

Starting with release 2.4.8, this package includes an X-based card status utility called cardinfo. This utility is based on a public domain user interface toolkit called the Forms Library, which you will need to install before building cardinfo. A binary distribution is on cb-iris.stanford.edu in /pub/pcmcia/extras/bxform-0.61.tgz. There is a small bug in the Makefile: the line that starts with ``ln -s'' should have ``; fi'' added to the end.

Unpack the pcmcia-cs-2.6.3.tgz package in a convenient location, like /usr/src.

Make sure the definitions in make.options are consistent with your site setup. Running ``make prereq'' will check your system configuration to verify that it satisfies all prerequisites for installing PCMCIA support.

Running ``make all'' followed by ``make install'' will build and then install the kernel modules and utility programs. Kernel modules are installed under /lib/modules/<version>/pcmcia. The cardmgr and cardctl programs are installed in /sbin. If cardinfo is built, it is installed in /usr/bin/X11.

Configuration files will be installed in the /etc/pcmcia directory. If you are installing over an older version, the new config files will be installed with a ``.N'' suffix -- you should replace or update your existing files by hand.

If you don't know what kind of PCMCIA controller chip you have, you can use the probe utility in the cardmgr/ subdirectory to determine this. There are two major types: the Databook TCIC-2 type and the Intel i82365SL-compatible type.

A user-level daemon processes card insertion and removal events. This is called cardmgr. It is similar in function to Barry Jaspan's pcmciad in earlier PCMCIA releases. Cardmgr reads a configuration file describing known PCMCIA cards from /etc/pcmcia/config. This file also specifies what resources can be allocated for use by PCMCIA devices, and may need to be customized for your system. See the pcmcia man page for more information about this file.

The script rc.pcmcia, installed in /etc/rc.d, controls starting up and shutting down the PCMCIA system. ``make install'' will use the probe command to determine your controller type and modify rc.pcmcia appropriately. You should add a line to your system startup file /etc/rc.d/rc.M to invoke this:

/etc/rc.d/rc.pcmcia start

In a few cases, the probe command will be unable to determine your controller type automatically. The Tadpole P1000 and some other PCI-based laptops have a special Cirrus PCI-to-PCMCIA bridge chip that can't be detected by probe. If you have one of these systems, you'll need to install rc.pcmcia by hand.

2.3 Site-specific configuration options

Card Services should automatically avoid allocating IO ports and interrupts already in use by other standard devices. This should work for any devices that have Linux drivers, like serial and parallel ports, IDE drives, and some sound cards. If a device is unsupported by Linux, you may need to explicitly exclude the resources it uses in /etc/pcmcia/config.

Some PCMCIA controllers have optional features that may or may not be implemented in a particular system. It is generally impossible for a socket driver to detect if these features are implemented. Check the man page for your driver to see what optional features may be enabled.

The low level socket drivers, tcic and i82365, have numerous bus timing parameters that may need to be adjusted for systems with particularly fast processors. Symptoms of timing problems include card recognition problems, lock-ups under heavy loads, high error rates, or poor device performance. Check the corresponding man pages for more details, but here is a brief summary:

All these options should be configured by modifying the top of /etc/rc.d/rc.pcmcia. For example:

# Should be either i82365 or tcic
PCIC=i82365
# Put socket driver timing parameters here
OPTS="async_clock=1"

On some systems using Cirrus controllers, including the NEC Versa M, the BIOS puts the controller in a special suspended state at system startup time. On these systems, the probe command will fail to find any known PCMCIA controller. If this happens, edit /etc/rc.d/rc.pcmcia by hand as follows:

# Should be either i82365 or tcic
PCIC=i82365
# Put socket driver timing parameters here
OPTS="wakeup=1"

If you have an ARM Pentium-90 or Midwest Micro Soundbook Plus laptop, use the combination ``freq_bypass=1 cmd_time=8'' to slow down your PCMCIA bus cycles. On a Midwest Micro Soundbook Elite, try ``cmd_time=12''. These may help on other very fast systems that use the non-PCI Cirrus chip (the PD672x).

2.4 What about installation on Caldera?

Caldera has a System V-ish arrangement for system startup files. The PCMCIA installation scripts will automatically detect this and adjust accordingly. The rc.pcmcia script will be installed as /etc/rc.d/init.d/pcmcia. There is no need to edit any of the Caldera startup scripts to enable PCMCIA: it will happen automatically. Also, the PCMCIA configuration scripts will be installed under /etc/sysconfig/pcmcia-scripts, instead of /etc/pcmcia.

A separate configuration file, /etc/sysconfig/pcmcia, will be created for startup options. If you need to change any module options (like the PCIC= or OPTS= settings), edit this config file rather than the actual PCMCIA startup script. This file will not be overwritten by subsequent installs.

2.5 Can I install Linux via NFS with a PCMCIA network card?

I've created a set of 1.44MB boot and root disks with PCMCIA support for the Slackware 2.2 distribution. The files are pcboot14.gz and pcroot14.gz on cb-iris.stanford.edu and sunsite.unc.edu (see section 1.3 ). The root disk includes cardmgr, the core PCMCIA modules, and all the network drivers. As for how to use these, you should familiarize yourself with the Slackware installation instructions, available from the usual FTP sites. The PCMCIA drivers will be loaded automatically, and installation will be the same as for a non-PCMCIA net card. Note that Slackware root disks do not include any normal user-level network utilities (ftp, telnet, etc). They only include enough network support to establish an NFS mount.

If you use these disks with an IBM Thinkpad, you may need to specify ``floppy=thinkpad'' at the lilo prompt when you boot the pcboot disk.

After installation is complete, you'll have a non-PCMCIA setup on your root disk. It is possible to copy things from the boot and root disks to your hard disk to get a working network setup, but it is a little tricky to put everything in the right places by hand. Once you have booted your newly installed Linux system from your hard disk, mount the Slackware boot disk on /mnt, and do:

cp /mnt/vmlinuz /linuz
rootflags /vmlinuz 1
lilo

Then, mount the Slackware root disk on /mnt, and do:

cp /mnt/sbin/cardmgr /sbin
(cd /mnt ; tar cf - etc/pcmcia lib/modules) | (cd / ; tar xf -)

Edit /etc/pcmcia/config and un-comment the ``start'' and ``stop'' commands for the net card drivers. Rename /etc/pcmcia/network.sample to /etc/pcmcia/network and edit to conform to your network setup. You will need to edit /etc/rc.d/rc.M by hand to start up the PCMCIA stuff as in /etc/rc.local on the Slackware root disk.

Alternatively, if your install server has a current set of source files, you can copy current kernel sources, pcmcia sources, and module utilities to your hard disk while it is NFS mounted. Then, after rebooting, build a new kernel and install the PCMCIA software as normal.

The Slackware boot/root disk combination is configured to work in many systems, but no one configuration can work in all situations. It is difficult to debug PCMCIA setup problems encountered with these disks, because of the very limited set of tools available. When cardmgr is running, /etc/stab will show what cards are configured. At boot time, messages from the PCMCIA modules are hard to spot before they scroll off the screen, so ``/etc/rc.d/rc.pcmcia restart'' may give some useful info.

This disk set is really only meant to be used to install Slackware; I do not recommend trying to use it to avoid having to compile the full PCMCIA support package. The disk images are updated infrequently and are missing several important PCMCIA components.

2.6 Why don't you distribute PCMCIA binaries?

For me, distributing binaries is a significant hassle. It is complicated because some features can only be selected at compile time, and because the PCMCIA modules are somewhat dependent on having the ``right'' kernel configuration. So, I would probably need to distribute precompiled modules along with matching kernels. Beyond this, the greatest need for precompiled modules is when installing Linux on a clean system. This typically requires setting up PCMCIA so that it can be used in the installation process for a particular Linux distribution. Each Linux distribution has its own procedures, and it is not feasible for me to provide boot and root disks for even just the common combinations of drivers and distributions.

I think binary distributions are best handled by the people who put together distributions, rather than by me. If you would like your favorite Linux bundler to include PCMCIA in their distributions, I encourage you to ask them for it. Several have talked to me already and I expect that PCMCIA will become a standard part of most Linux distributions in the future.

According to the Linux Distribution HOWTO, the Nascent Technology Linux distribution already includes PCMCIA support.

2.7 Why doesn't my system respond to card insertions?

In most cases, the socket driver (i82365 or tcic) will automatically probe and select an appropriate interrupt to signal card status changes. The automatic interrupt probe doesn't work on some Intel-compatible controllers, including Cirrus chips and the chips used in some IBM ThinkPads. If a device is inactive at probe time, its interrupt may also appear to be available. In these cases, the socket driver may pick an interrupt that is used by another device.

With the i82365 and tcic drivers, the irq_mask option can be used to limit the interrupts that will be tested. This mask limits the set of interrupts that can be used by PCMCIA cards as well as for monitoring card status changes. The cs_irq option can also be used to explicitly set the interrupt to be used for monitoring card status changes.

If you can't find an interrupt number that works, there is also a polled status mode: both i82365 and tcic will accept a poll_interval=100 option, to poll once per second.

All these options should be set in the OPTS= line in either /etc/rc.d/rc.pcmcia or /etc/sysconfig/pcmcia, depending on your site setup.

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter