Next Previous 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 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 package is not technically difficult, it does require some general Linux familiarity.

The following things should be installed on your system before you begin:

You need to have a complete linux source tree for your kernel, not just an up-to-date kernel image. The driver 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 ftp://sunsite.unc.edu/pub/Linux/kernel/v2.0, or from ftp://tsx-11.mit.edu/pub/linux/sources/system/v2.0. Development kernels can be found in the corresponding v2.1 subdirectories. Current module utilities can be found in the same locations.

In the Linux kernel source tree, 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 development 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 2.0.* 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, then 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 package for installation on another machine, specify an alternate target directory when prompted by the configure script. This should be an absolute path. All filesf 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 host controller your system uses, 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 host controller. If this happens, edit rc.pcmcia and set PCIC to i82365, and PCIC_OPTS to ``wakeup=1''.

2.3 Startup options

The PCMCIA startup script recognizes several groups of startup options, set via environment variables. Multiple options should be separated by spaces and enclosed in quotes. Placement of startup options depends on the Linux distribution used. They may be placed directly in the startup script, or they may be kept in a separate option file. See the Notes about specific Linux distributions for specifics. The following variables can be set:

PCMCIA

This variable specifies whether PCMCIA support should be started up, or not. If it is set to anything other than ``yes'', then the startup script will be disabled.

PCIC

This identifies the PC Card Interface Controller driver module. There are two options: ``tcic'' or ``i82365''. Virtually all current controllers are in the ``i82365'' group. This is the only mandatory option setting.

PCIC_OPTS

This specifies options for the PCIC module. Some host 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. See the corresponding man page for a complete description of the available options.

CORE_OPTS

This specifies options for the pcmcia_core module, which implements the core PC Card driver services. See ``man pcmcia_core'' for more information.

CARDMGR_OPTS

This specifies options to be passed to the cardmgr daemon. See ``man cardmgr'' for more information.

SCHEME

If set, then the PC Card configuration scheme will be initialized to this at driver startup time. See the Overview of the PCMCIA configuration scripts for a discussion of schemes.

The low level socket drivers, tcic and i82365, have numerous bus timing parameters that may need to be adjusted for systems with unusual bus clocking. 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:

Here are some timing settings for specific systems:

2.4 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. View this list with suspicion: it may give useful hints for solving problems, but it is inevitably out of date and certainly contains mistakes. Corrections and additions are welcome.

2.5 Notes about specific Linux distributions

This section is incomplete. Corrections and additions are welcome.

Debian

Debian uses a System V boot script arrangement. The PCMCIA startup script is installed as /etc/init.d/pcmcia, and startup options are specified in /etc/pcmcia.conf. Debian's syslog configuration will place kernel messages in /var/log/messages and cardmgr messages in /var/log/daemon.log.

Debian distributes the PCMCIA system in two packages: the ``pcmcia-cs'' package contains cardmgr and other tools, man pages, and configuration scripts; and the ``pcmcia-modules'' package contains the kernel driver modules.

Red Hat, and Caldera Open Desktop

These distributions use a System V boot script organization. The PCMCIA startup script is installed as /etc/rc.d/init.d/pcmcia, and boot options are kept in /etc/sysconfig/pcmcia. Beware that installing the Red Hat package may install a default boot option file that has PCMCIA disabled. To enable PCMCIA, the ``PCMCIA'' variable should be set to ``yes''. Red Hat's default syslogd configuration will record all interesting messages in /var/log/messages.

Red Hat's PCMCIA package contains a replacement for the network setup script, /etc/pcmcia/network, which meshes with the Red Hat network control panel. This is convenient for the case where just one network adapter is used, with one set of network parameters, but does not have the full flexibility of the regular PCMCIA network script. Compiling and installing a clean PCMCIA source distribution will overwrite the network script, breaking the link to the network control panel. If you prefer the Red Hat script, either use only Red Hat RPM's, or create /etc/pcmcia/network.opts with the following contents:

if [ -f /etc/sysconfig/network-scripts/ifcfg-eth0 ] ; then
    start_fn () {
        /sbin/ifup $1
    }
    stop_fn () {
        /sbin/ifdown $1
    }
fi

Red Hat bundles their slightly modified PCMCIA source distribution in their kernel SRPM, rather than as a separate package.

Slackware

Slackware uses a BSD boot script arrangement. The PCMCIA startup script is installed as /etc/rc.d/rc.pcmcia, and boot options are specified in rc.pcmcia itself. The PCMCIA startup script is invoked from /etc/rc.d/rc.M.

SuSE

SuSE uses a System V init script arrangement, with init scripts stored under /sbin/init.d. The PCMCIA startup script is installed as /sbin/init.d/pcmcia, and startup options are kept in /etc/rc.config.


Next Previous Contents