Previous Next Contents

2. Compilation and installation

2.1 Prerequisites and kernel setup

Before starting, you should think about whether you really need to compile the PCMCIA package yourself. All common Linux distributions come with pre-compiled PCMCIA driver packages. Generally, you only need to install the drivers from scratch if you need a new feature of the current drivers, or if you've updated and/or reconfigured your kernel in a way that is incompatible with the drivers included with your Linux distribution. While compiling the PCMCIA package is not technically difficult, it does require some general Linux familiarity.

The following things should be installed on your system before you start installing PCMCIA:

The current driver package actually works with most kernel versions back to 1.2.8. However, use with older kernels is deprecated, and backwards compatibility with very old kernels may go away at any time.

You need to have a complete linux source tree for your kernel, not just an up-to-date kernel image, to compile the PCMCIA package. The PCMCIA modules contain some references to kernel source files. While you may want to build a new kernel to remove unnecessary drivers, installing PCMCIA does not require you to do so.

Current ``stable'' kernel sources and patches are available from, or from Development kernels can be found in the corresponding v2.1 subdirectories. Current module utilities can be found in the same locations.

In the Linux source tree for 2.0 and 2.1 kernels, the Documentation/Changes file describes the versions of all sorts of other system components that are required for that kernel release. You may want to check through this and verify that your system is up to date, especially if you have updated your kernel. If you are using a 2.1 kernel, be sure that you are using the right combination of shared libraries and module tools.

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. Any drivers compiled into your kernel will only waste space.

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 1.2.X kernels, 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.

In order to use a PCMCIA token ring adapter, your kernel should be configured with ``Token Ring driver support'' (CONFIG_TR) enabled, though you should leave CONFIG_IBMTR off.

If you want to use a PCMCIA IDE adapter, your kernel should be configured with CONFIG_BLK_DEV_IDE_PCMCIA enabled, for 1.3.72 through 2.1.7 kernels. Older kernels do not support removeable IDE devices; newer kernels do not require a special configuration setting.

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, as they will just take up space.

If you want to modularize a driver that is needed for a PCMCIA device, you must modify /etc/pcmcia/config to specify what modules need to be loaded for what card types. For example, if the serial driver is modularized, then the serial device definition should be:

device "serial_cs"
  class "serial" module "misc/serial", "serial_cs"

This package includes an X-based card status utility called cardinfo. This utility is based on a freely distributed user interface toolkit called the XForms Library. This library is available as a separate package with most Linux distributions. If you would like to build cardinfo, you should install XForms and all the normal X header files and libraries before configuring the PCMCIA package.

2.2 Installation

Here is a synopsis of the installation process:

If you plan to install any contributed client drivers not included in the core PCMCIA distribution, unpack each of them in the top-level directory of the PCMCIA source tree. Then follow the normal build instructions. The extra drivers will be compiled and installed automatically.

Running ``make config'' prompts for a few configuration options, and checks out your system to verify that it satisfies all prerequisites for installing PCMCIA support. In most cases, you'll be able to just accept all the default configuration options. Be sure to carefully check the output of this command in case there are problems.

If you are compiling the PCMCIA package for installation on another machine, specify an alternate target directory when prompted by the configure script. This should be an absolute path. All the PCMCIA tools will be installed relative to this directory. You will then be able to tar this directory tree and copy to your target machine, and unpack relative to its root directory to install everything in the proper places.

If you are cross compiling on another machine, you may want to specify alternate names for the compiler and linker. This may also be helpful on mixed a.out and ELF systems. The script will also prompt for additional compiler flags for debugging.

Some of the support utilities (cardctl and cardinfo) can be compiled either in ``safe'' or ``trusting'' forms. The ``safe'' forms prevent non-root users from modifying card configurations. The ``trusting'' forms permit ordinary users to issue commands to suspend and resume cards, reset cards, and change the current configuration scheme. The configuration script will ask if you want the utilities compiled as safe or trusting: the default is to be safe.

There are a few kernel configuration options that affect the PCMCIA tools. The configuration script can deduce these from the running kernel (the most common case). Alternatively, if you are compiling for installation on another machine, it can read the configuration from a kernel source tree, or each option can be set interactively.

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, your old config scripts will be backed up before being replaced. The saved scripts will be given extensions like *.~1~, *.~2~, and so on.

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.

In a few cases, the probe command will be unable to determine your controller type automatically. If you have a Halikan NBD 486 system, it has a TCIC-2 controller at an unusual location: you'll need to edit rc.pcmcia to load the tcic module, and also set the PCIC_OPTS parameter to ``tcic_base=0x02c0''.

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 rc.pcmcia and set PCIC to i82365, and PCIC_OPTS to ``wakeup=1''.

2.3 Post-installation for systems using BSD init scripts

Some Linux distributions, including Slackware, use a BSD arrangement for system startup scripts. If /etc/rc.d/rc.M exists, your system is in this group. 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 the PCMCIA startup script, like:

/etc/rc.d/rc.pcmcia start

It does not really matter where you insert this line, as long as the PCMCIA drivers are started after syslogd.

2.4 Post-installation for systems using System V init scripts

Red Hat, Caldera, and Debian Linux have a System V-ish arrangement for system startup files. If you have a directory called /etc/init.d or /etc/rc.d/init.d, then your system is in this group. The rc.pcmcia script will be installed as /etc/rc.d/init.d/pcmcia, or /etc/init.d/pcmcia, as appropriate. There is no need to edit any of the startup scripts to enable PCMCIA: it will happen automatically.

If the /etc/sysconfig directory exists, then 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 PCIC_OPTS= settings), edit this config file rather than the actual PCMCIA startup script. This file will not be overwritten by subsequent installs.

Some previous releases used the /etc/sysconfig/pcmcia-scripts directory in place of /etc/pcmcia on these platforms. The current release instead uses /etc/pcmcia for all systems, and will move an existing /etc/sysconfig/pcmcia-scripts to /etc/pcmcia.

2.5 Socket driver options

Some PCMCIA controllers have optional features that may or may not be implemented in a particular system. In some cases, it is impossible for the socket driver to detect if these features are implemented. Check the man page for your socket driver to see what optional features may be present for your controller.

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
# Put socket driver timing parameters here
# Put pcmcia_core options here

Here are some timing settings for specific systems:

2.6 System resource settings

Card Services should automatically avoid allocating IO ports and interrupts already in use by other standard devices. It will also attempt to detect conflicts with unknown devices, but this is not completely reliable. In some cases, you may need to explicitly exclude resources for a device in /etc/pcmcia/config.opts.

Here are some resource settings for specific laptop types.

Previous Next Contents