April 25th, 2005, 18:31
(Note to the folks at SE: The links are based on the location of my tutorials at Ofb.biz, but everything is elsewhere here on the forum.)

Keep that aging laptop alive and kicking with FreeBSD. Not only that, but the latest technology can work fairly well on older generation systems. In general, FreeBSD as a desktop will run slightly faster on the same system than most Linux distros. You will lose some multimedia functionality in the bargain, so keep that in mind. However, for most business and home use, your older laptop will probably be pretty snappy with FreeBSD's newest release, 5.4.

The installation walk-through (http://ofb.biz/modules.php?name=News&file=article&sid=272) is not much different from the 4.x series. We simply drop the step for examining hardware drivers in the kernel, which is now handled via a "hints" system. The difference comes when you seek to enable features specific to laptops. You will most certainly need to recompile the kernel at a minimum, and the hints will require a bit of tweaking. However, there's no reason a complete novice can't work through most issues. As always, these BSD HOWTOs at Open for Business are designed to fit the average experience, but with laptops there seem to be more glitches, just as we find with using Linux. The hardware is more specialized and too often proprietary. Still, FOSS developers are doing a great job of getting things to work.

There are several documents you might want to consult before starting. The FreeBSD Laptop Compatibility List (http://gerda.univie.ac.at/freebsd-laptops/) covers experiments reported with specific hardware, various FreeBSD releases, and any caveats. If you succeed with installing to a laptop not listed, consider sending the maintainers a run-down of your experience. The FreeBSD Documentation Team also keeps up an article (http://www.freebsd.org/doc/en_US.ISO8859-1/articles/laptop/article.html) outlining most issues. This is bundled in with the other documentation included by default when you install FreeBSD (/usr/share/doc/[LANG]/). There's a general links page (http://www.zapatec.com/freebsd/laptop/) at Zapatec, and O'Reilly's ONLamp site has a very good article on dealing with PCMCIA cards (http://www.onlamp.com/pub/a/bsd/2000/11/02/Big_Scary_Daemons.html) (AKA "pccards") and how to make them work. With the 5.x series of FreeBSD, the support for later cards is much better. Also, I always recommend the forums at Screaming Electron (http://screamingelecton.org/) for a friendly place to discuss just about anything related to BSD.

Discussions I have read indicate that FreeBSD works best on IBM laptops. The greatest number of complaints seem to arise from later Compaq and HP models. The machine used for this demonstration is a Gateway Solo 2500, with a 266 Mhz Pentium II, 160MB of RAM, and a 4GB harddrive. As with most of the hardware I use, it was a donation to the small church where I run a computer ministry. Running on a 80386-class processor requires major work, so research the issue at FreeBSD.org (http://freebsd.org/) before you consider it. If you can't get at least 64MB of RAM, running the X server (the GUI) will be rather unpleasant at best. Also, you'll need to make sure you create at least 256MB of swap space for any compiling activity. FreeBSD defaults to double your RAM, but for lesser amounts you'll want to adjust it upward. As with all things, your mileage may vary with the hardware you choose, but in general the older laptops tend to work rather well with FreeBSD.

If your harddrive is less than 6GB, I would discourage installing either KDE or GNOME. Both take up lots of space, run rather slowly and exhibit more bugs than a simple window manager. If you have any experience at all with FreeBSD, this is a great time to do more serious work from the console. Simply select FVWM as your default window manager, because it takes up very little space, and will allow you to setup the X server right away. You need not use it at all, but it's a fast and light window manager which can be made to work nicely for those who are persistent in working with the configuration. However, the console is adequate for installation and setup, so this article assumes its use.

After the installation is complete, the installer will give you one last chance to make any adjustments, then will tell you to remove the installation media as soon as the machine starts boot sequence and power is available to the drives. On my laptop, the handoff to shutdown sequence didn't work, and I had to hold down the power switch to force the machine to complete the power cycle. Once it rebooted, I was given the usual console login prompt, which you should choose for your default if the installer asks. The graphical login prompt limits your options somewhat, takes extra resources, and offers no real advantages, aside from convenience and eye candy. The first command I always run is to update the database for the locate command. You can find it by reading the manual page for locate (type "man locate" and scroll to the bottom):


You'll need to type the full path as you see it. It will run for awhile, so wait for the command prompt to come back. This process allows finding essential files quickly. Also during installation, you may want to select the Pine email package, mostly because it comes bundled with one of the best console text editors for the inexperienced user: Pico. Remember to always use the -w switch when using Pico on configuration files, to prevent line-wrapping. Wrapping can cause, for example, the kernel rebuild to fail. Once the system is installed and running from the harddrive, we need to tune the kernel for laptop-specific options. Here's the list:

APM -- Unless your laptop's ACPI is recognized during bootup as a good implementation, you'll want to disable it completely and rely on APM

Console -- Most laptop displays offer a very ugly default resolution on the console, and we can at least boost that to VESA mode 800x600, so that we get a sharp 100x37 character display, instead of the default 80x25. There are efforts at patching the kernel to produce a 1024x768 VESA mode in the future, but 800x600 is a big improvement for now. (Linux has one huge advantage on the console with the framebuffer, whereas it is virtually non-existent in BSD. On the other hand, the BSD console pointer is on by default and is actually a graphical arrow-head.)

Sound -- This is a particular area of dissatisfaction on laptops, and your options may be limited.

To gain maximum advantage from what few resources most older laptops offer, I always do a complete system rebuild (http://ofb.biz/modules.php?name=News&file=article&sid=352), along with the kernel rebuild. In the 5.x series of FreeBSD, the /etc/make.conf file should already be there. We'll add a line that tells the build scripts to optimize the system on whatever processor you have. If there's any doubt, you can type dmesg on any commandline interface to see what the kernel detected at boot. If it runs off the top of screen, you can use your SCROLL LOCK key, then use the arrows or the paging keys to see the output of dmesg. The SCROLL LOCK key works as a toggle, so hit it again when you are through, or you cannot type on the commandline. The options for make.conf are extensive, but there seems to be a consensus that for most older systems, you are best sticking with one of these: i486, i586 or i686, whichever is appropriate. Since you should already be logged in as root, let's navigate to the /etc folder and open make.conf with Pico:

pico -w make.conf

Add this line at the top of the options list:


remembering to choose the processor type you have. There are other option you can set (see /usr/share/examples/etc/make.conf), but only if you really know what you're doing. You are highly advised to avoid the optimization flags for anything above level one. Using -O2 is known to break some software in FreeBSD, and offers no apparent advantage for most uses. Just to make sure, I also add this line to my make.conf:

CFLAGS= -O -pipe

The kernel configuration file is GENERIC. By tradition, whatever you name your kernel will be in all caps that way. You thus know you can find the path to the kernel easily by typing:

locate GENERIC

The result will be a list of locations under the various possible architectures, but the one most older laptops use will be /usr/src/sys/i386/conf/GENERIC. In defiance of purist warnings, I don't bother to make a unique name for my kernel. However, I do make a copy for later reference. Then I can use grep to compare future kernel updates to see if I need to rewrite my configuration. When updating by cvsup, the GENERIC file is overwritten, but a copy with a different name is left intact.

cd /usr/src/sys/i386/conf/
cp GENERIC generic
pico -w GENERIC

By making a copy with lowercase letters, cvsup will ignore it. When editing your kernel configuration, it requires only that you place a hash-mark (#) at the left margin and the line will be ignored. The first thing I do is remove references to older CPUs, and build only for the one I have:

machine i386
#cpu I486_CPU
#cpu I586_CPU
cpu I686_CPU

Please note the first line refers to the basic architecture of the Intel-compatible PC processor, so don't change it. Next, there is the issue of sound. I really dislike the sound of older laptop speakers, and only need to hear system beeps and when the modem is working. However, it has been my experience with FreeBSD that the kernel sometimes quits using the PC speaker for some unknown reason somewhere down the road. I have found no explanation, but I have found that including the option for the weird sounds such as produced by old DOS games for the PC speaker seems to help:

device speaker

However, if you wish to play with configuring regular sound, it often helps to add a line at the bottom of the config file:

device sound

You'll need to be prepared to do your own research on this, and Google's BSD Search (http://www.google.com/bsd) can help a lot. Going down through the config file, I usually hash-mark lines referring to hardware never used on laptops, such as RAID. At the line for VGA, I add a couple of options:

device vga # VGA video card driver
options VESA

For more details on this, see this tutorial (http://lickwid.ath.cx/~tlp/fbsd-console.html). It explains in detail how to change the console resolution from the default 80x25 characters. Going down a little further, I make sure APM is enabled in the kernel by default:

# Power management support (see NOTES for more options)
device apm
# Add suspend/resume support for the i8254.
device pmtimer

My system uses the i8254 timer, as well.

Now it's time to rebuild. If you plan to optimize the entire system, allow a large block of time for this on older hardware. Mine takes about 13 hours for the 5.x releases of FreeBSD. The kernel takes about another 2 hours. We've already covered this in detail (http://ofb.biz/modules.php?name=News&file=article&sid=352) but here's an outline of the steps from the commandline:

cd /usr/src
make buildworld
make buildkernel
make installkernel
shutdown now
cd /usr/src
make installworld

In order to actually get APM to working, you'll have to make a couple of changes. Most of the time, the kernel defaults will attempt to load ACPI first. If it fails, as it does on most older laptops, it will also block APM from loading. So we need to change a couple of files. We start with the "hints" file mentioned earlier.

cd /boot
pico -w device.hints

Scroll down to the line that has


and change that "1" to a "0" (zero). You may also want to place a hash-mark in front of the next line as shown, because the 0x20 flag is only for system clocks that don't work properly. Below that, add this line:


to prevent the kernel trying to load ACPI controls. Then, in the loader.conf add this line:


to insure the system knows to activate the APM driver. Finally, take a look at this portion of my /etc/rc.conf:

allscreens_flags="-g 100x37 VESA_800x600"

I snipped the lines not relevant to this discussion. The font was selected during installation when the installer allowed me to select console settings. The Swiss font is the easiest to read for me. I also chose the "twinkling stars" console screensaver. The allscreens entry comes from the console article linked above, and puts the higher resolution on all consoles. The usdb entry is for my USB mouse. If you have USB ports on your laptop, the system will automatically configure a USB mouse for the console and for the GUI. Gateway touchpads are simply far too sensitive, just about useless, so get a good USB optical mouse and disable the touchpad in the BIOS. The next two lines are for the APM service, and the last loads the driver for PCMCIA cards.

The Solo laptop I have came with a very nice 3Com PCCARD modem in the first slot. During boot, the kernel loads the PCCARD driver, and sees this modem as sio4 (the fifth serial port; numbering starts at zero), and this is equivalent to /dev/cuaa4 for the /etc/ppp/ppp.conf file (see Desktop FreeBSD #6 (http://ofb.biz/modules.php?name=News&file=article&sid=331) for details on setup). If you aren't sure, you can scan the /etc/pccard.conf file to see if your PCCARD is already listed. If not, you may be able to create a entry in that file using the ONLamp article linked above.

Finally, you'll need a light window manager. I prefer IceWM. To make this work right, you'll need all the X server packages installed already, plus the old Imlib libraries (not Imlib2). You did install the ports collection, right? Make sure your Internet connection is up, then lets get those like this:

cd /usr/ports/graphics/imlib
make install
make clean
cd /usr/ports/x11-wm/icewm
make install
make clean

Any dependencies not already installed will be pulled in automatically. Once it's all finished, you can finally start your GUI:

startx /usr/X11R6/bin/icewm

Configuring IceWM is covered in its own documentation, but you should start by testing the themes and choosing the one that best suits you from the menu. Then copy some files into your user's home directory. Open an XTerm and do this:

cp /usr/X11R6/share/icewm/preferences ~/.icewm/
cp /usr/X11R6/share/icewm/menu ~/.icewm/

The configuration of these files is rather simple, and well commented. If not, you can always email me and I may be able to help out. I have preferred IceWM over all others since about version 0.9. As with all things BSD, laptops take a bit of effort and research to make it work right, but the reward will breathe new life into old hardware. In my case, the Solo laptop running FreeBSD 5.4 is my main work machine, and was used to write this article.

NOTE: At the time this article was written, the release of FreeBSD 5.4 had not been announced. I installed 5.3 and used cvsup to update the code to 5.4, which is available as much as a week before the installable ISO images can be downloaded. Some details in this article may be inaccurate for that reason.

April 30th, 2005, 11:36
This is a great guide, which I will be linking to people from now on who want help getting FBSD setup as a good desktop OS :)