Are You Pondering What I'm Pondering?

I think so Brain, but where are we going to find rubber pants our size?

My Site


idealisms

red hair

January 2010

S M T W R F S
  1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31  

Recent orange xml icon

and now it's starting to m...

would life itself stay or ... (6)

we played boxes like drums...

I'm getting tied / I'm for... (3)

when the wind begins to sw... (4)

Tired and wired we ruin to...

and he abandoned his dream... (1)

I never wash my pants. I l... (7)

?


Setting up FreeBSD 4.x on a Dell Latitude X200 laptop

Table of Contents
- Credits
- System Information
- Config Files
- Updates
- Installing FreeBSD
- APM
- Wireless
- Firewire (media base cd-rom)
- Audio
- USB
- XFree86
- VMware 2.0

Credits
Manuel Chakravarty's page about installing linux on the Dell C400 laptop provided an excellent starting point for this article.

Also, if you want to install FreeBSD 5.x, try checking out Taka-chan's install page.

System Information
CPU: PIII-M 800mHz
HDD: 30gb
Ethernet: 3COM 3C920 (integrated)
Wireless Card: Dell True Mobile 1150 (optional integrated)
Video: Intel i830M
Modem: PCTEL 2304WT V.92 WinModem (integrated)
Audio: Crystal Sound (integrated)
CD-ROM (Media Base): Samsung SN-124 N102 (connects via IEEE 1934)
USB: 2 on the laptop, 2 on the media base, 4 total

Config Files
Kernel config file
XFree86 config file
rc.conf

Updates
2004-01-14

Updated the links in Config Files to the files in my cvs repository. I'm currently running FreeBSD 4.9-stable. At some point I will move up to 5.x, but I don't have the time or the resources to backup/format/ install right now.

2003-03-28

I've re-written most of this page to reflect my current system. The config files have also been updated. I am currently running FreeBSD 4.7-STABLE and XFree86 4.3.0-1. Pretty much everything works except suspending the system (perhaps not an issue in FreeBSD 5.x).

Installing FreeBSD 4.x
The first thing that needed to be done was to make space for FreeBSD. Since I wanted a dual boot system between WinXP and FreeBSD, I installed Partition Magic 7.0 and used it to alter the partitions on the system. Upon launching Partition Magic 7.0, I noticed that there were two partitions on the system, a small 30mb partition and the NTFS partition taking the rest of the drive space. The 30mb partition is partition made by Dell which held the initial setup options the first time you turned on your laptop. I left the Dell partition untouched and I shrunk the NTFS partition by 6GB. I left the last 6GB of the disk as unformatted space. After Partition Magic finished resizing the disk, I restarted into WinXP. Oddly, when the system restarted, my touchpad and onboard ethernet were detected as new hardware. The touchpad drivers were reinstalled automatically, but I had to manually install the NIC drivers from c:\drivers etwork\onboard\.

Since I don't have high speed internet at my house, I decided to install from a CD. I burned FreeBSD 4.6-RC2 onto a CD and booted from the CD. I went ahead and started the installation without making changes to the kernel. sysinstall started up and asked if I wanted to install using a pccard. I declined sysinstall's offer (actually, an installation over wireless should work. look below for details about the wireless card). In the slice manager, I created a new slice in the unformatted section of the hard drive. I set all three slices as bootable -- the Dell slice, the WinXP slice, and the FreeBSD slice (there's really no need to set the Dell partition as bootable).

FreeBSD refers to what is normally call a partition as a slice. Within the slice, there are partitions that logically separate your FreeBSD system (e.g. /, /usr, /tmp, swap)

When determining how to partition the FreeBSD slice, I just used auto. I selected the FreeBSD boot manager. I did a custom install of the FreeBSD components that I wanted installed. When I was finally ready to start the installation, I chose CD-ROM as the media format to install from. Oddly, I was told that there was no CD-ROM drive found (but I booted from it?). So I took the CD out of the media base and copied the files onto my desktop computer and installed from an FTP server (using the onboard NIC). There were no problems during the install. I exited sysinstall and the laptop rebooted automatically. When the boot manager came up, it listed three options: ??, ??, and FreeBSD. Choosing the first ?? boots to the Dell setup, the second ?? boots to WinXP, and FreeBSD boots to FreeBSD. When I selected FreeBSD, it booted without any problems. But on a side note, when I booted into WinXP for the first time, it said new hardware was detected, drivers were automatically installed, and I was asked to reboot. Upon rebooting into WinXP, everything worked like normal.

I would actually recommend installing grub from the ports tree and using that in place of the FreeBSD boot manager. It's a little bit prettier and more powerful once you get it installed.

APM
If you want to be able to check your battery power, then change the device apm line in the kernel config. The following line:

device    apm0    at nexus? disable flags 0x20

to

device    apm0

Recompile the kernel, install, reboot. Now you can check your batterly power by using apc -l. Suspend (apm -z) successfully suspends the system, but it doesn't wake back up when the power key is pressed. Because it doesn't resume, I don't ever suspend my system.

Wireless
80211.b is controlled by wi(4), which needs to be uncommented from the GENERIC kernel. It should be labeled:

device          wi

Simply rebooting the system after building and installing the new kernel didn't work. In rc.conf, I added the following two lines:

pccard_enable="YES"
pccard_mem="0xd8000"

Now when the system boots, it successfully detects the wireless card. If you're using DHCP, you can run /sbin/dhclient wi0 to get an IP address.

Of course, if you don't want to compile a new kernel, you could just do a kld_load if_wi.

Firewire (media base cd-rom)
The CD-ROM is in the Dell media base and the media base connects via firewire. So the key to making the CD-ROM work is to add firewire support to FreeBSD. To enable firewire, you need the following lines in your kernel config:

device   scbus
device   cd
device   pass # for cdda
device   firewire
device   sbp

When you boot your system, you should see something about firewire0, sbp0, and cd0. Now, to mount a cd to /mnt/cdrom, type mount -t cd9660 -o ro /dev/cd0a /mnt/cdrom.

I wasn't able to get any CD audio to work and have resorted to using cdda2wav and sending the data to the sound card (see man cdda2wav for an example of how to do this).

On a side note, I was able to attach my sister's Firefly hard drive to the firewire port on the side of the laptop. Unfortunately, it was mac formatted so I wasn't able to read or write files to it.

Audio
All I had to do was add device pcm to the kernel config. It doesn't get any easier than this.

USB
After booting with a kernel with USB support, I get a flood of system messages saying "usb0: host controller halted". I thought this was simply an annoying message caused by not being docked to the media base, but when I tried to a attach a usb mouse, it didn't work. So I took out kernel support for usb by commenting out device usb and related USB kernel items. In my rc.conf file, I have a line that loads usbd, the program that checks to see if usb devices are attached, that looks like this: usbd_enable="YES". Now, when usbd starts, it automatically loads the kernel usb module. This can be seen in dmesg. To make sure it's loaded, you can use kldstat from the command line.

USB mouse support requires a second kernel module, ums. This can be loaded by typing kldload ums while root. Again, kldstat will list what kernel modules are loaded. After that, if usbd is already running, simply plugging in the USB mouse should have it automatically work. While the mouse is attached, running usbdevs as root lists what USB devices are attached to the system. e.g. on my system it says:

addr 1: UHCI root hub, Intel
 addr 2: Kensington PocketMouse Pro, Kensington

You can also try starting moused manually with the command moused -p /dev/ums0. The USB mouse and the touch pad both work while the mouse is plugged in. Wheel support can be enabled in X by adding Option "ZAxisMapping" "4 5" to the input device section of XF86Config.

The USB mouse works properly on either of the ports on the actual laptop, but if I plug it into either of the USB ports on the base station, nothing happens. It doesn't show up in usbdevs.

I also tried to hook up a USB compact flash card reader using the umass kernel module and also compiling it directly into the kernel, but I couldn't get camcontrol to detect the device. I use a PCMCIA compact flash card reader instead.

XFree86 4.3
With the release of XFree86 4.3, FreeBSD has working video drivers. The easiest way to get X running is to install XFree86 4.3 from the ports tree and simply download the XF86Config file I'm using. You will also need to make sure you have agp compiled into your kernel. This can be added with the line device agp to your kernel config file. This allows your video card to steal memory from main memory.

I tried to get the dual heads to work (LCD+monitor) but wasn't able to get X to start. I also don't know if there is a way to steal more than 8mb of memory for the video card (Windows is able to steal 48mb of memory).

VMware 2.0.4.1142 (Windows 2000)
I wanted to install VMware so that I could spend even more time in FreeBSD and less time in Windows. It was pretty tricky getting it to work correctly . . .

First I installed the port from /usr/ports/emulators/vmware2. It asks you if you want to use "netgraph bridging" after you start building the port. If you don't have a wireless card, select "yes" because it's easier to get networking to work using bridging. However, I wasn't able to get bridging to work using wi (I'm told that it's because wi can't go into promiscuous mode). Oh, you may also want to select "no" if you can't request a second IP address from your hardline connection. With bridging, Windows will try to get it's own IP.

The port installs a startup script into /usr/local/etc/rc.d/ which is used to start up your network properly. More on this later. You also need to get a trial key to use VMware. However, you can no longer get them from VMware because the software is now on version 3.x. I had to find a key on my own.

Ok, so the trickiness in getting VMware to work is that I couldn't get the CD-ROM drive to be be seen in VMware. This made it quite hard to install an operating system (although I did briefly consider installing from floppies). What I ended up doing was creating two "plain disk" ide drives (I tried virtual disks, but I periodically got errors). The first one is the main partition that I'm going to use; I made mine 2GB and named it 'cdrive'. The second one is a drive I'm using to install Windows from. Mine is 650MB and it's called 'ddrive'. The other benefit of using a plain disk is that it can be mounted, viewed, and altered in FreeBSD. Anyway, I booted using an MS-DOS 6.22 floppy disk (you can either create your own and use the real floppy drive, or use this floppy disk image), and used fdisk and format to create FAT partitions. After that, I shut down VMware.

So what we're trying to do is to copy a CD onto ddrive and install from ddrive. Unfortunately, you can't install Windows 2000 directly since it won't let you install from 16bit DOS. One way to install Windows 2000 would be to make Windows 2000 boot disks (4 floppy disks) from a computer with Windows and install using them. I didn't have 4 floppy disks so I decided to install Windows ME, then install Windows 2000 after Windows ME booted.

Now, you should have 4 files representing your plain disk hard drives: cdrive, cdrive1.dat, ddrive, and ddrive1.dat. cdrive and ddrive are just config files in plain text, cdrive1.dat and ddrive1.dat are the actual hard drives. You can mount the drives by using vnconfig. I use the following commands to mount the drives:

vnconfig -e -s labels /dev/vn0 /mnt/share/vmware/ddrive1.dat
mount_msdos /dev/vn0s1 /mnt/vmware/ddrive

This mounts ddrive to /mnt/vmware/ddrive (cdrive can be mounted in the same way). Now I copied the Windows ME install files from a CD to /mnt/vmware/ddrive. You can use any 16 bit version of Windows at this point (95, 98, ME). To unmount ddrive, I used the following:

umount /mnt/vmware/ddrive
vnconfig -du vn0

Next, I started up VMware using the boot disk, switched over to d:, and ran setup.exe to install Windows ME.

After Windows ME finished installing, I shut down VMware and re-mounted ddrive in FreeBSD. I deleted the Windows ME install files and copied over the Windows 2000 install files. I restarted VMware and booted into Windows ME. From there, I was able to run setup.exe from d:. I chose to do a clean install since it uses less disk space after completely removing Windows ME. After the installation, I simply deleted my old c:\windows directory (Windows 2000 is in c:\winnt at this point, but you could keep it if you wanted both OSes).

VMware - getting online
Random side note: networking using a bridge or by having FreeBSD as a gateway with Windows ME seems broken.

If you selected bridging during the installation of the VMware port, the only thing you need to do is make sure you have bridging in your kernel (options BRIDGE). If you don't, you could just load the bridge kernel module (kldload bridge). After you have bridiging, just select "Host-only" as the connection type and it should automatically grab a new IP across the bridge to your hardline ethernet adaptor (xl0).

If you're not using bridging, you have to set up FreeBSD as a gateway. This involves a few changes to the kernel:

options IPDIVERT
options IPFIREWALL

and a few changes to /etc/rc.conf:

gateway_enable="YES"
natd_enable="YES"
natd_interface="wi0"
firewall_enable="YES"
firewall_type="OPEN" # change this

I also installed dhcpd from /usr/ports/net/isc-dhcp3/. Setting up DHCP can be tricky, see this article for help. In general, you're setting up vmnet1 as the gateway and you want to give out IPs that are in the same subnet as vmnet1. The IP address of vmnet1 should have been set when you installed the vmware2 port. If you don't remember what it is, check /etc/vmware/config.

VMware - Final Note - VERY IMPORTANT!
I wouldn't recommend installing Service Pack 3 for Windows 2000 because it prevents Windows 2000 from booting. The same bug occurs using Virtual PC on a Mac and supposedly to some people running on PC hardware. More information here.