Xaero.org Tech news, reviews, and whatever else I wanna put here!

Getting FreeBSD 7.0 working on an IBM Thinkpad T40

I've been experimenting with various operating systems on my Thinkpad and have been trying to get a Unix-like system on there. I've played with Ubuntu but the battery life is abysmal. I can get around 3 hours with Windows XP installed and barely half that with Ubuntu 8.10 installed.

Just for grins, I decided to see how difficult it would be to get FreeBSD 7.0 working on this machine. Here's my specs:

  • Model 2373-94U
  • Pentium M 1.6GHz
  • 1.5 GB RAM
  • 80GB 4200rpm HDD
  • 14.1 SXGA+(1400x1050) TFT LCD
  • 32MB ATI Radeon 9000
  • 16x10x24x/8x CD-RW/DVD(slim)
  • Bluetooth/Modem(CDC)
  • 10/100/1000 Mbit Ethernet(LOM)
  • Intel 802.11b Wireless(MPCI)
  • Secure Chip(TCPA)
  • UltraNav Touchpad
  • 9 cell battery

To start, I downloaded the first of the FreeBSD install ISOs, the one labeled 7.0-RELEASE-i386-disc1.iso. After burning it to a CD as a data disc, I booted it up and began the install. Since I have no fancy disk format or partition needs, I hit 'a' to auto allocate and 'q' to write and save the changes for both screens. Ever the minimalist, when I install FreeBSD, I always use the "Minimal" distribution set. This gets you all the basic binaries, no man pages, and supports most of your hardware including networking and graphics cards. Sounds kind of silly but I prefer this to precompiled binaries. Aside from the ability to really optimize the applications you install for your hardware, the Minimal distribution leaves out much of the cruft you normally get when installing a typical Linux distribution (seriously, who needs 7 different text editors and 5 different email clients?). The last benefit is that it takes practically no time at all to install FreeBSD since you're installing so little. As an interesting aside, when installing, I chose to install from an FTP site instead of my local CD. Believe it or not, the actual install went faster from an FTP server (located less than 20 miles from my home) than from my installation CD!

The first thing I wanted to get working after installation was the wireless card. My laptop has the Intel 2100 wireless chipset which supports only 802.11b. Slow, yes, but I don't move a lot of data to and from my laptop with it untethered. To get wireless working requires loading the firmware for the card and configuring WPA encryption (you do use WPA instead of WEP, right?). Let's first get the firmware in place. Since it comes as part of the base system, you need only add the following lines to /boot/loader.conf:

legal.intel_ipw.license_ack=1
if_ipw_load="YES"
wlan_load="YES"
firmware_load="YES"

ipw_bss_load="YES"
ipw_ibss_load="YES"
ipw_monitor_load="YES"

Save your changes. Next, we need to enable wireless encryption. Most home users will be using WPA so we'll need to use wpa_supplicant which is also included in the base system. Create the file /etc/wpa_supplicant.conf and add the following lines, replacing the items in <> symbols with your setup:

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel

network={
ssid="<YOUR SSID>"
bssid=<YOUR BSSID>
proto=WPA
key_mgmt=WPA-PSK
pairwise=TKIP
group=TKIP
scan_ssid=1
psk="<YOUR WPA PASSWORD>"
}

Since the BSSID may not be readily obvious, you may need to first initialize your wireless card. You can either kldload the modules above or just reboot. Either way, issue the dmesg | grep ipw command when you've done so. You should see your wireless card listed as ipw0 in the output. Now, issue the ipconfig ipw0 up scan command to scan for available networks. If you've hidden your SSID (which is trivial to bypass so why bother?), you may not see it. Once you see your home network, make note of the BSSID and add it to the wpa_supplicant.conf file. It should look like a 48-bit MAC address. Save the file and quit your text editor. For the icing on the cake, let's add a few items to your rc.conf:

#Enable Powerd to scale the CPU down
powerd_enable="YES"

#Time sync
ntpdate_flags="pool.ntp.org"
ntpdate_enable="YES"

#Enable wireless
wpa_supplicant_enable="YES"
defaultrouter="<add your router's IP here>"
ifconfig_ipw0="WPA DHCP"

Folks, that's it! After saving the file, you can either reboot once more or issue /etc/rc.d/netif restart and watch your wireless connection come up.

I don't use Bluetooth for anything but the built in Bluetooth adapter does work by default. I'll leave that up to you to mess with. Same goes for the TPM chip. I'd rather manage an asymmetric keypair than forget the key to the TPM chip and lose anything important. Come to think of it, I think I've only used the TCPA features once on this laptop and that was just to clear the existing password (you can't recover it, only clear it)!

Last but not least is the graphics adapter. This is easy enough. Update your ports tree and build X.org. Be sure to build the Radeon driver. My version of X.org had some weird DRM (Direct Rendering Manager, not Digital Restrictions Management) issues, so I also built the vga and vesa drivers for a fallback. I wound up using the vesa driver. It's a bit slower since it's a generic driver but it got the job done. Once you've built X, issue Xorg -configure as the root user. This should dump a configuration to your home directory. Change the driver from radeon to vesa, then copy the xorg.conf.new file to /etc/X11/xorg.conf. At this point you should have a working Xorg configuration and the ugly twm window manager. Your choice of a window manager is purely your preference but I tend to shun Gnome or KDE for more a more lightweight window manager. So far, I've settled on xfce but I'm also experimenting with the Stump window manager. I'm a bit picky with these sorts of things.

By now, you should have a nice working FreeBSD system on your Thinkpad and you can install fun stuff like a web browser or your favorite music jukebox. Be warned that the sheer volume of software in the ports tree can make you get carried away. Ah, the goodness of Open Source!