BSD DevCenter
oreilly.comSafari Books Online.Conferences.


Big Scary Daemons

Laptops, PC Cards, and FreeBSD


FreeBSD on laptops has had a checkered history. For a long time, unique laptop hardware had minimal support. Eventually, various Japanese users began the FreeBSD-PAO project to support this hardware. The main FreeBSD tree finally absorbed most of PAO just before 4.0-RELEASE. Now, various people are working on a complete rewrite of the laptop system to accommodate CardBus. FreeBSD on a laptop is quite comfortable to work in; my main system has been a laptop for the last two years, and I've never regretted it.

Laptops are tricky pieces of hardware. Laptop vendors delight in making their systems proprietary, or revamping components to save a few critical ounces, or reducing battery power to extend life. Much of this trickery is undocumented. This makes hardware support marginal. And Unix was never designed for hot-swappable hardware. As you might guess, vendor support is nonexistent.

When you're considering purchasing a laptop, your biggest concern should be hardware. FreeBSD doesn't support all of the hardware on some of the latest and greatest laptops, and won't until a developer gets his hands on both the hardware and the documentation for it. This usually happens fairly quickly -- many developers want high-end laptops, after all -- but you probably don't want to wait for that support to trickle down to you.

The three big problems in laptop hardware are generally the video card, sound card, and any built-in modem.

Many integrated modems are actually software modems (i.e., Winmodems) and won't work under FreeBSD at all. You can use a PC Card modem, however, so this isn't that critical.

Video and sound cards are more problematic. FreeBSD can use any video card in text mode, but you probably want XFree86 of some version or another. Check the manufacturer documentation to see what sort of video card the laptop has, and then check the XFree86 supported cards list. Similarly, check the freebsd-mobile archives or pcm(4) to see if the sound card is supported.

The first place to check for the latest information on particular laptop models is the freebsd-mobile mailing list archive. People frequently report their successes with particular models or ask if anyone else has that laptop. If the archives contain nothing, a friendly query to freebsd-mobile usually gets at least one or two answers. You could also check David Kulp's FreeBSD Laptop Compatibility Page.

Once you get a laptop, you'll need to configure FreeBSD properly. Your kernel must include device card and device pcic to use PC cards. You probably also want device apm, to handle power management. The exact syntax of these lines varies depending on the version of FreeBSD you're using; check GENERIC for the proper form. (If you're running -current, you'll want to look at /boot/device.hints as well.)

If you don't intend to hot-swap your hardware, and you're running older versions of FreeBSD, you can compile some drivers statically into the kernel. For example, in FreeBSD 3-stable, the 3com Etherlink III works under both the zp and ep drivers. If you never intend to remove the card and will settle for lousy performance, you can use the zp driver and skip the rest of this article. To use more sophisticated hardware, newer hardware, newer FreeBSDs, or to change hardware in midstream, however, you need to use pccardd.

The pccardd daemon watches for card insertion and removal events. Enable pccardd in /etc/rc.conf, or start in on the command line as such:

pccardd -f /etc/defaults/pccard.conf

When you insert a card, you'll see console messages like:

Sep 7 09:44:54 turtledawn pccardd[57]: Card "3Com Corporation"("3C589D") [TP/BNC LAN Card Ver. 2a] [000002] matched "3Com Corporation" ("3C589") [(null)] [(null)]

This first message indicates that pccardd has found your hardware and has matched it to an entry in its configuration file. Then, pccardd hands this information off to the kernel.

Sep 7 09:44:59 turtledawn /boot/kernel/kernel.ko: ep0: <3Com Etherlink III 3C589> at port 0x240-0x24f irq 3 slot 0 on pccard0

The kernel now realizes that it has a new interface, and brings it up.

Sep 7 09:44:59 turtledawn pccardd[57]: ep0: 3Com Corporation (3C589) inserted.

Finally, pccardd reports that it's finished. For now.

The daemon issues warnings if something goes wrong. For example, my modem card doesn't work properly out-of-the-box:

Sep 8 07:33:21 turtledawn pccardd[59]: Card "Toshiba America"("3CXM056-BNW") [3COM/NoteWorthy 56K Modem] [(null)] matched "Toshiba America" ("3CXM056-BNW") [(null)] [(null)] Sep 8 07:33:26 turtledawn pccardd[59]: driver allocation failed for Toshiba America(3CXM056-BNW): Device not configured

It identifies the card correctly, but cannot allocate resources for it. This is not uncommon; we'll look at how to solve this later.

If you want FreeBSD to auto-configure your Ethernet pccard when it's inserted, use something like this in /etc/rc.conf:


or perhaps

pccard_ifconfig="inet netmask"

Ejecting a card is fairly straightforward. If you're fairly lucky, pccardd will handle everything for you when you eject the card. If you have problems, disable the card in software before ejecting. If it's a network card, do an ifconfig down and an ifconfig delete. If it's a storage device or SCSI card, unmount any filesystems on the card. This will keep FreeBSD from attempting to access any resources on the card when you hit the little black button.

The system might panic if you don't disable a card before ejecting it. If you eject a network card that is in promiscuous mode, the kernel will almost certainly panic. Consider yourself warned.

If pccardd doesn't get your card running properly, it's time to troubleshoot. Start with the /etc/defaults/pccard.conf file. This file contains the configuration information for pccardd and general configuration information on the system resources available on your laptop.

Pages: 1, 2

Next Pagearrow

Sponsored by: