FreeBSD on a Thinkpad X23

This describes my experience installing and running FreeBSD 4.5-R on an IBM ThinkPad X23. The exact model number is 2662-E5U. This is important since knowing this reduces the uncertainty about which chips are installed in the machine. In particular, IBM makes knowing your modem chipset in advance (and determining whether it will work with FreeBSD or Linux) very hard.

I'm assuming you already know how to install a port, and also how to compile your own kernel.

What about 5.X?

I had recently (October 2004) installed 5.3b5 on this laptop. It works well. I have tested the following to work: X, built-in ethernet, wirelss (PCCARD), built-in modem, sound, suspend/resume with ACPI, compact flash slot. I didn't test USB or infrared yet, and there is no hibernation file, so that doesn't work either.

I will make my notes, and various tips, available here as soon I have time to write them. Don't hesitate to email me if you need some particular bit of information sooner rather than later. I won't promise I'll write about it, but I'll try.

Initially when I tried -CURRENT, I ran into some problems. The following tip from Andreas Ott might help, but I am not sure it is still needed. Here is a more detailed explanation.

Preparation

The machine ships with two partitions: a 600MB rescue partition at the end of the disk, and a Win2K FAT partition taking up the rest.

Use Partition Magic or a similar tool to nuke the Win2K partition, but don't touch the rescue partition. Next, create a smaller FAT partition (let's say 5 to 10 GB).

Now reboot from the disk. The BIOS will see that the Win2K partition is gone, and will start running the rescue routine. It will install Win2K on the first partition (the small one you created previously). This can take an hour or two to complete, but doesn't require too much user intervention.

Now you have free space in which you can install FreeBSD.

Install

I borrowed a media slice and installed from a CD-ROM. I suppose netbooting is also possible, but I have no experience with such a thing.

See "preparation" above - you now have free space on the disk, just install FreeBSD on it (or on part of it).

Display

ATI Mobility Radeon chip - works with XFree-4.2.0 and higher. By now this is in ports already, and it looks like it will be bundled with FreeBSD 4.6. So for the most part that's a non-issue.

I followed the advice from the port message and put this in /boot/loader.conf:
agp_load="YES"

Also, I added this line to the "Screen" section of /etc/XF86Config:
DefaultDepth 24

Booting

I installed the FreeBSD boot manager and dual-boot works fine.

Ethernet

Works out-of-the-box (fxp driver).

Wireless

I alternate between a ORiNOCO silver card and a USR 2410 card - you'll need to enable pccardd (see an article by Michael Lucas).

If you need to set the network name, just drop this line in /etc/start_if.wi0:
wicontrol -n MYNET

Note that if you have both ifconfig_fxp0="DHCP" and pccard_ifconfig="DHCP" in your /etc/rc.conf, and you boot with the wireless card inserted but no network cable in the ethernet port, dhclient will get confused and won't pick up any leases. I don't know if the more recent dhclient will behave better. There are two workarounds for this:

  1. Don't bring up the wired interface on boot if it isn't plugged in. For a while I used this patch to /etc/rc.network. Also, I had this set in /etc/rc.conf:
    network_interfaces="fxp0 lo0"

  2. Now I use the /usr/ports/net/nicmond port. It monitors the wired interface and brings it up when you plug it in. The relevant section in /usr/local/etc/nicmond.conf looks like:
    interface fxp0
       up /etc/pccard_ether $device start
       down /etc/pccard_ether $device stop

    Note that when the carrier appears on the wired interface the wireless interfaces can't be used or else you'll run into the same dhclient problem mentioned above. But that's not likely to happen (or bother you). Although the docs for nicmond are in Japanese, it works well enough out-of-the-box to be used by non-speakers. For some history about the port see this message

Modem

It's a Lucent WinModem. Works with the /usr/ports/comms/ltmdm/ port.

See above regarding whether the model you have (or want to buy) has such a modem. I've received reports that the following models do not have chipsets that work with FreeBSD:

While the following models are reported to work fine with the ltmdm port:

USB

The port on the back works. To get the side one to work, do this:

cd /dev; sh MAKEDEV usb1

Don't forget to restart usbd after you do it. Thanks to Wei-Hon Chen for the tip!

I use the /usr/ports/palm/coldsync/ port to sync the visor over USB. Drop this in your /etc/usbd.conf:
device "Handspring Visor"
   devname "ugen0"
   vendor 0x082d
   product 0x0100
   release 0x0100
   attach "/usr/local/bin/coldsync -t usb -svv -md ${DEVNAME}"

infrared

I installed the /usr/ports/comms/birda port. And added this startup script in /usr/local/etc/rc.d/birda.sh (thanks to Brandon Allbery).

The important thing to remember is that the device to point your utilities to is /dev/ttypv. Yes, that's not a mistake - irs talks to ptypv but the application needs to talk to ttypv. This works with the pilot-link utilities, as well as coldsync. It's very slow, though, and not very reliable.

I received reports from people that this doesn't work for them. It appears that the "correct" way to do this is to let irs talk to the master at ttypv and have the application talk to the slave at ptypv. So, if the above fails for you, change the script above and point your applications appropriately.

I don't use the "correct" way because I found that in in my particular setup, this causes:

  • The birda.sh script to not detach (irs only detaches once the first sync is started).
  • I must kill and restart irs after every sync.
  • I presume this is due to some bug in irs. But, since it works for me if I switch the device nodes, I didn't pursue it further.

    Audio

    After getting kind help from people on the mailing lists, it works. It seems all of the patches will be (or have been) committed. Here's the list of things to do, depending on how old your system is:

    4.5-based systems

    Follow the instructions in Colin Perkins' mailing-list post.

    Systems younger than 20-May-2002 (including 4.6-RELEASE, 4.6.1-RC1, 4.6.1-RC2, and 4.6.2)

    Most of the patches above have already been committed, you just need the last patch, documented in this PR

    Later than 4.6

    According to the note in this PR, all of the needed patches will be committed shortly after 4.6 is released.

    All systems

    Whether you need to apply patches or not, have a look at my comment.

    Num Lock

    I had trouble getting it to work, but I got a tip (which works) to drop this line in ~/.xsession:
    xmodmap -e "keycode 77 = Num_Lock"

    Thanks to Simon Hooper!

    Problems

    Hibernation for FreeBSD: still doesn't work. I'm not sure how to create an appropriate hibernation file. There's one for the Windows side. There's a utility called "PS2" you can download from IBM's site that's supposedly can create it, but I wasn't able to use it. I did gets lots of tips regarding this, and I do intend to try them out as soon as I have the time and the media slice.

    APM

    suspend, resume, battery status - all work fine. Just add the following line to your kernel config:
    device apm0

    And this to your /etc/rc.conf:
    apm_enable="YES"
    apmd_enable="YES"

    I'm getting 3h45m out of the IBM 4.0 A-H battery. It's 15 minutes less with wireless (30 minutes less if the card is not in powersave mode). Overall, pretty good.

    Here are some power-saving tricks:

  • Mount your filesystems noatime.
  • Change the atrun line in /etc/crontab to start with */30 so at(1) wakes up only once in 30 minutes, instead of 5. Or just comment the whole line out, if you don't want at(1) to run.
  • If you use postfix, increase the "wakeup" values for the "qmgr" and "pickup" services. I use 600 (meaning 10 minutes) for both.
  • Note: If I suspend the machine when it's plugged in, and resume when it's on battery, then I'd lose the time. Usually it will jump ahead a day or two (and up to four). Nothing a date and ntpdate can't fix. Unless, of course, X gets confused and I lose the keyboard autorepeat. So until I figure this out, I'll just need to remember to not do that...

    CF slot

    Works without problems. I've set up pccardd to mount it as soon as it's inserted, copy the contents to local disk and then unmount it. You can find the whole story in this DaemonNews article regarding Compact Flash on FreeBSD.

    If you have comments, be my guest.


    [Back arrow] Back to my home page