Running Linux on a Laptop
A laptop which runs Linux: most Linux enthusiasts think this is a great idea, but not surprisingly, some people who don't use Linux wonder why you would want to run a flavor of UNIX on a laptop. The answer is simple. If Linux is the operating system you use, the one on which all the applications and software you employ on a daily basis run, then you want it for your portable machine as well.
This article is intended for those who are considering getting a laptop on which to run Linux. It is a quick summary of what you should be thinking about when looking for a laptop for Linux, and a brief outline of what you need to get Linux configured and running on a laptop.
For more information, the reader is directed to the web pages in the Resources section at the end of this article. They will be invaluable in researching and later configuring your laptop for Linux.
The first thing to ask yourself is, how do you want to use the laptop? Is it just for fun? Is it for transferring files between two locations? Is it to be used for word processing, programming or graphic manipulation? Do you need only a simple terminal with which to log in to other machines? Just as with a desktop machine, considerations like these will affect the decision regarding which kind of laptop you should get.
Other questions to consider are: Do you want a CD-ROM drive? Do you want sound, and if so, what quality? Do you want a built-in modem? A built-in Ethernet adapter or PCMCIA, a PCMCIA modem, or neither? Do you want to run X? If so, what video mode do you need (640x480 is the low end, 800x600 is common, and 1024x728 is approaching the high-end level of the market)? Do you want color, and if so, what bit depth (8, 16, 32 bits)?
Finally, you need to make sure the features you require in the laptop you are considering are supported with Linux. This is far less problematic than it was in the past. When I first installed Linux on a laptop (a Twinhead SubNote with only 4MB of memory), I was taking a gamble that the hardware I needed would be supported; fortunately, it was.
These days, laptop hardware is far less proprietary and you have a much better chance of just buying a laptop and getting it to work. Buying a used laptop with a PCMCIA slot for an Ethernet card is probably sufficient if you just want a machine to use as a terminal without X. If you are planning on doing more with it, you will need to verify that your hardware is supported by Linux. (See Resources.)
Since laptop LCD (liquid crystal display) screens have fixed pixel video modes, they usually emulate lower video modes by duplicating the contents of rows and columns at increments of a set number of rows and columns, respectively. This means that if you get a laptop with 800x600 resolution and you plan to use it just for virtual consoles, you will find that when it is emulating the 640x480 standard VGA mode, the characters will be blocky and ugly. If fidelity is important for virtual consoles (especially if that is all you plan to use), you will want to get either a laptop with 640x480 or one with a considerably higher video mode (1024x768). For these, the virtual consoles will look less blocky and will be easier to read. Some high-end laptops (such as the Sony Vaio PCG-505FX) have configuration settings that don't do this “zooming”, which makes everything easy to read, albeit smaller.
Obviously, you need a boot disk appropriate to your laptop's hardware, just like any other Linux installation. Laptops generally use IDE, so normally you don't have to worry about SCSI support unless you have special needs (and have a SCSI PCMCIA card).
Many laptops these days come with CD-ROM drives, making installation easy. The CD-ROM drives are generally IDE interface-compatible, so a standard IDE boot disk will usually suffice. For slightly-incompatible drives, you will need to enter special parameters into the kernel.
Some laptops, such as my Sony Vaio PCG-505FX, have CD-ROM drives available only through PCMCIA interfaces. Surprisingly, these do work, although you might have to send parameters to the kernel at boot time. For instance, my Sony drive works fine only if I send the kernel parameter ide2=0x180,0x386 on boot. I could also put an append statement in my lilo.conf file.
A large number of PCMCIA devices are supported by Linux: modem cards, network cards, SCSI cards, combination cards and so on.
PCMCIA isn't supported in the kernel, so you will need to use a PCMCIA root disk which starts the PCMCIA daemon, cardmgr. Many PCMCIA devices are automatically supported; just insert the card, start the machine with the PCMCIA root disk and away you go. For devices which aren't immediately supported, you will have to do some tweaking of the configuration files (see Resources).
The Brute-Force Method
For older laptops, you might have no option other than the brute-force method. My Twinhead SubNote, for instance, didn't have a CD-ROM drive (almost no laptops had CD-ROM drives back then), and I didn't bother buying the optional floppy drive for it. I was left with one option: buy a 2.5-inch drive adapter for a normal IDE controller, pop open the laptop, take out the drive, plug it into another desktop machine, then install Linux. It is crude, but effective.
You'll most likely want to have Ethernet support on your laptop. Modem detection and configuration is fairly straightforward on laptops (often completely automatic), since many have built-in modems that respond normally on the serial ports to which they're assigned. Also, most of the standard PCMCIA modem cards are easily supported, even if they are on combo cards with Ethernet adapters, such as the IBM Home & Away card.
For laptops which have on-board Ethernet (such as the Hitachi VisionBook Pro 7000 series), you use the same method as for a desktop machine to get TCP/IP networking up and running.
For PCMCIA Ethernet adapters, you will need to edit the PCMCIA network options file, probably /etc/pcmcia/network.opts. Editing /etc/rc.d/rc.inet1 or /etc/resolv.conf won't help, because the kernel Ethernet services won't be used.
The format of /etc/pcmcia/network.opts is straightforward; it contains the same sort of options as in /etc/rc.d/rc.inet1, as well as DNS_1 through DNS_3, for specifying domain name servers, and MOUNTS, for specifying NFS mounts which also must be listed in the /etc/fstab file. It also contains other options for configuring your Ethernet card in the event it is not automatically supported. (See Resources.)
If you are like me, you have an Ethernet network at home and at the other places you take your laptop (a friend's house, work, etc.). I've found that generally I have no need to use the laptop “in transit”. Since it is possible that I may not get around to plugging it into an AC adapter wherever I'm going, I don't need to keep the machine on while I'm switching from one network to another.
If this is also your situation, there is a simple solution. When switching networks, all that must be changed is either the /etc/rc.d/rc.inet1 and /etc/resolv.conf files, in the case of built-in Ethernet support in your laptop, or just /etc/pcmcia/network.opts if you are using a PCMCIA Ethernet card.
Let's say you want to call the two locations (though there can be more) between which you want to transfer “home” and “away”. Rename the above-mentioned files to have extensions of .home and .away, for the configuration of each location respectively, then use a simple shell script such as the one shown in Listing 1 to point to the proper location. This script makes symbolic links for each configuration file, pointing to the corresponding location-specific file, if it exists. If it doesn't, it won't do anything, so nothing will break.
When you are ready to shut down your laptop for the journey, log in as root, run this program with a single command-line argument which is the location to which you are moving (e.g., away), then shut it down. When you start it back up, it will be configured for its new temporary home.
Configuring X is fairly straightforward for laptops with supported hardware. The only place to be cautious here is making sure you have a laptop that supports Linux with the display hardware on the laptop (which is still somewhat proprietary, but far less so than when laptops first began coming out), has sufficient memory to run the X server, and runs the video mode and bit depth you need. The newer, high-end laptops often use the NeoMagic chip set, which is fully supported only in XFree86 3.3.2 and higher, so you may have to upgrade.
The best resource for determining whether a laptop will meet your needs is the Linux on Laptops web page (see Resources).
Erik Max Francis is a UNIX engineer who lives in San Jose, California. His main interests are programming, Linux, physics and mathematics. He has been using Linux exclusively at home since kernel version 1.2.8 and has been reading and contributing avidly to Usenet since 1989. He can be reached via e-mail at email@example.com.