FreeBSD4.6 on a Compaq EVO 500

Grenville Armitage, 6/29/02

Mid 2002 I re-configured a Compaq EVO 500 (desktop PC) to dual-boot Windows 2000 and FreeBSD 4.6. This documentation is largely for my own benefit - a record of what I did in case I ever need to rebuild the machine. With any luck, this information will be useful to others (like you, if you're reading this page and you aren't me).

Summary
Equipment
Installing FreeBSD
Configuring FreeBSD
FreeBSD boot messages

Summary

It is a relatively trivial task to setup a dual-boot Win2K/FreeBSD4.6 environment on a Compaq EVO 500 desktop. FreeBSD4.6 + XFree86-4.2.0 + KDE 3.0 provides quite a useable code development and web-surfing enviroment, with Win2K for those pesky windows-only corporate software packages. FreeBSD had no trouble accessing the CD-R/RW drive to burnd CD-Rs. At the time (June 2002) I had to downgrade the BIOS to v2.06, as the then-current Compaq BIOS (v3.01) prevented FreeBSD from booting.

Equipment

The machine is pretty much the standard desktop item at Swinburne University mid-2002, with the exception of the Nvidia GeForce2 MX/MX 400 video card.

Installing FreeBSD

My machine began life with Win2K installed on the entire 20GB drive. PartitionMagic was used to shrink the Win2K installation into 6GB on the first BIOS partition, freeing the remaining 14GB for FreeBSD.

Assume we have a FreeBSD4.6 installation disc (disc 1 of the four disk ISO set). Reboot the machine with the FreeBSD CDROM installed. The FreeBSD boot process will prompt you for an initial kernel configuration step - skip it, and continue to the main Installation program. Select a Standard Installation, and you'll now be prompted to create the intial partitioning of the hard drive.

Because of its BSD/Unix roots, FreeBSD actually uses the term "slice" to refer to what the PC-world calls "partition". The traditional PC BIOS allows a disk to contain up to four distinct partitions, each containing a different file system (FAT16, NTFS, FreeBSD UFS, Linux, etc). Traditional BSD (from which FreeBSD is derived) uses partitions as key mount points for members of the unix directory tree and the swap space. Since FreeBSD was designed to co-exist on PC platforms and their BIOSes, BSD-style partitions are created inside BIOS partitions. To keep the names distinct, FreeBSD decided that BIOS partitions would be referred to as slices.

The first step in the installation process is the FDISK Partition Editor, which allows you to modify the BIOS partitions of the hard drives. From FreeBSD's perspective, the EVO500's internal IDE drive is device /dev/ad0. You'll see an existing slice (partition) ad0s1 with 6GB assigned to it. That's the Win2K installation. Do not touch it. Of the remaining 14GB free I manually created two more slices and set their partition types explicitly. We end up with:

ad0s1 6GB NTFS (type 7)
ad0s2 4GB FreeBSD (type 165)
ad0s3 9GB FreeBSD (type 165)
ad0s4 <empty>

[I create two FreeBSD partitions so I can separate out /home from the rest of the OS-specific directories. This allows me to simply blow away ad0s2 during upgrades to newer versions of FreeBSD without touching my data, personal files, etc.]

Quit the partition editor ('q' option) and you'll be prompted to install the FreeBSD boot loader in the Master Boot Record (MBR). Do this. It will later allow you to select between Win2K and FreeBSD at boot time. You'll then be taken to the "Disk Label Editor" and offered the chance to set up BSD-style partitions inside the previously assigned FreeBSD slices ad0s2 and ad0s3. Using the 'autodefaults' on ads02, and assigning all of ads03 to /home, results in (as later reported by 'df'):

/dev/ad0s2a    /          [128MB]
/dev/ad0s2b    (swap)     [~512MB]
/dev/ad0s2f    /tmp       [256M]
/dev/ad0s2g    /usr       [~2.8G]
/dev/ad0s2e    /var       [256MB]
/dev/ad0s3e    /home      [~8.7G]

(ad0s2c conventionally represents the entire slice ad0s2, ad0s2d is unused by default.)

Continue with the FreeBSD installation onto ad0s2. At this point both the local CDROM drive and internal ethernet port are recognized. (Although there's probably no reason not to continue installing from the CDROM, you could choose to continue the installation over NFS or AnonymousFTP from another machine on the local LAN.)

When the installation process prompts you to add additional packages, I found the following to be a useful initial set: The 'ports' collection, X windows, KDE3 (the K desktop environment), linux-compatibility, scanssh, and mtools. KDE3 is a meta-package that pulls in key KDE 3.0 desktop components. [You don't need to pull in too many packages during the installation process, they can be added later from the CD-ROM or over an Internet connection with "pkg_add -r <packagename>"]

A note about X11: During the installation process you'll be prompted on whether to include X windows by default. As of FreeBSD4.6 the default is XFree86-4.2.0, so I advise selecting the "X Windows + " installation option. (If you don't, you can always add XFree86-4.2.0 as a package later.)  However, I chose to keep the installation process simple by declining to configure the X server until after I'd completed the entire FreeBSD4.6 installation process. (The configuration of X is easily performed as 'root' later.)  The X server is installed non-suid. If you like living dangerously, remember to make it suid-root before trying to start up an X session as a regular user otherwise it wont be able to write a log file.

A caveat about security settings: don't select the highest security setting when prompted during installation, otherwise the X11 server will be unable to start (e.g. when you run "XFree86 -configure" either from console or during the installation process). 

Configuring FreeBSD

At boot time you're prompted with a list of three possible boot options "F1 ???, F2 FreeBSD, F3 FreeBSD". You should select F1 to boot back into Win2K, and F2 to boot FreeBSD from ad0s2. (ad0s3 is not bootable, since it contains only one large partition holding the /home directory.)  If you don't make a selection within a small number of seconds the previously selected OS is booted. (If you reboot and get an error message of an invalid partition table then somehown you've marked more than one partition bootable. Go back to FDISK and make sure only ad0s2 is marked bootable.)

If you have BIOS v3.01 you'll need to downgrade the BIOS to v2.06 before FreeBSD will boot properly. For reasons I didn't figure out, v3.01 would cause FreeBSD's BTX (boot loader) to crash after you select "F2" to boot. No idea if Compaq have fixed this in later (post June 2002) BIOS releases.

Sound: To enable sound support recompile/reinstal the FreeBSD kernel after adding the following option added to the kernel config file:

device pcm

Reboot the machine, go into /dev/ and run "./MAKEDEV snd0"  (the 'sox' package includes a 'play' command that seems capable of driving the sound card). Now "cat /dev/sndstat" should result in something like this to confirm correct installation of sound driver and recognition of the internal card:

FreeBSD Audio Driver (newpcm)
Installed devices:
pcm0: <Intel 82801BA (ICH2)> at io 0x2000, 0x2400 irq 11 bufsz 16384 (1p/1r/0v channels duplex)

[When recompiling the kernel for sound support, it is probably also useful to edit the kernel config file to remove support for cpu support 386, 486 and 586 processors, since the Pentium 4 doesn't need it.]

XFree86-4.2.0

Run "Xfree86 -configure" as root to generate the initial XF86Config.new file, then copy it to /etc/X11/XF86Config. XFree86 seemed to have no problem recognizing my NVidia GeForce2 MX/MX 400 graphics accelerator. However, it might get confused about the type of mouse you're using (e.g. if you are using a KVM between the mouse and the computer, which I was). If you see the following line in your XF86Config file:

        Option     "Protocol" "MouseSystems"

then replace it with:

         Option      "Protocol" "auto"

Also add this line to the mouse input device section to enable support for wheel-mice:

    Option "ZAxisMapping"    "4 5"

Finally, add the imwheel-0.9.9 package and make sure imwheel is started from your ~/.xinitrc.

KDE 3.0

The last line of your ~/.xinitrc should be startkde. KDE will take care of the rest.


Automounter

Since this was a workstation some common directories are NFS-mounted from other machines. To simplify the process, the amd automounter service was activated. This required two lines in the global /etc/rc.conf file:

nfs_client_enable="YES"
amd_enable="YES"


The default rule-set in /etc/amd.map work fine. The automounter watches access to /host/<blah> and translates them into mount requests for host <blah>. For example, the directory /home/gja on machine xxx is now accessible through /host/xxx/home/gja.

Burning CD-Rs

The EVO500 came with a CD-RW <HL-DT-ST CD-RW GCE-8240B> drive and a regular CD drive (/dev/acd0 and /dev/acd1 respectively). Burning CD-Rs on IDE-bus CD-R/RW drives(like the one on /dev/acd0) is easily achieved using the FreeBSD4.6 burncd utility, which is installed by default.  I have not tried CD-RW operation (as opposed to CD-R).

FreeBSD boot messages

I didn't tweak IRQs or search for conflicts. Here's what FreeBSD4.6 reported when booting.

Copyright (c) 1992-2002 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD 4.6-RELEASE #0: Wed Jun 19 16:06:31 EST 2002
    gja@garmitage.caia.swin.edu.au:/usr/src/sys/compile/GARMITAGE
Timecounter "i8254"  frequency 1193182 Hz
CPU: Pentium 4 (1595.30-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0xf12  Stepping = 2
  Features=0x3febfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,<b28>,ACC>
real memory  = 268435456 (262144K bytes)
avail memory = 255950848 (249952K bytes)
Preloaded elf kernel "kernel" at 0xc0520000.
md0: Malloc disk
Using $PIR table, 9 entries at 0xc00ec050
npx0: <math processor> on motherboard
npx0: INT 16 interface
pcib0: <Intel 82845 Host to PCI bridge> on motherboard
pci0: <PCI bus> on pcib0
pcib1: <Intel 82845 PCI-PCI (AGP) bridge> at device 1.0 on pci0
pci1: <PCI bus> on pcib1
pci1: <NVidia model 0110 graphics accelerator> at 0.0 irq 10
pcib2: <Intel 82801BA/BAM (ICH2) Hub to PCI bridge> at device 30.0 on pci0
pci2: <PCI bus> on pcib2
fxp0: <Intel Pro/100 Ethernet> port 0x1000-0x103f mem 0xfd200000-0xfd200fff irq 5 at device 8.0 on pci2
fxp0: Ethernet address 00:08:02:08:a4:59
inphy0: <i82562EM 10/100 media interface> on miibus0
inphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
isab0: <Intel 82801BA/BAM (ICH2) PCI to LPC bridge> at device 31.0 on pci0
isa0: <ISA bus> on isab0
atapci0: <Intel ICH2 ATA100 controller> port 0x2480-0x248f at device 31.1 on pci0
ata0: at 0x1f0 irq 14 on atapci0
ata1: at 0x170 irq 15 on atapci0
uhci0: <Intel 82801BA/BAM (ICH2) USB controller USB-A> port 0x2440-0x245f irq 11 at device 31.2 on pci0
usb0: <Intel 82801BA/BAM (ICH2) USB controller USB-A> on uhci0
usb0: USB revision 1.0
uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
uhci1: <Intel 82801BA/BAM (ICH2) USB controller USB-B> port 0x2460-0x247f irq 10 at device 31.4 on pci0
usb1: <Intel 82801BA/BAM (ICH2) USB controller USB-B> on uhci1
usb1: USB revision 1.0
uhub1: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 2 ports with 2 removable, self powered
pcm0: <Intel 82801BA (ICH2)> port 0x2400-0x243f,0x2000-0x20ff irq 11 at device 31.5 on pci0
pcm0: measured ac97 link rate at 55916 Hz
orm0: <Option ROM> at iomem 0xc0000-0xca7ff on isa0
fdc0: <NEC 72065B or clone> at port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on isa0
fdc0: FIFO enabled, 8 bytes threshold
fd0: <1440-KB 3.5" drive> on fdc0 drive 0
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
atkbd0: <AT Keyboard> flags 0x1 irq 1 on atkbdc0
kbd0 at atkbd0
psm0: failed to get data.
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: model IntelliMouse, device ID 3
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0
sio0: type 16550A
sio1 at port 0x2f8-0x2ff irq 3 on isa0
sio1: type 16550A
ppc0: <Parallel port> at port 0x378-0x37f irq 7 on isa0
ppc0: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode
ppc0: FIFO with 16/16/13 bytes threshold
lpt0: <Printer> on ppbus0
lpt0: Interrupt-driven port
ppi0: <Parallel I/O> on ppbus0
plip0: <PLIP network interface> on ppbus0
ad0: 19092MB <WDC WD200BB-60CVB0> [38792/16/63] at ata0-master UDMA100
acd0: CD-RW <HL-DT-ST CD-RW GCE-8240B> at ata1-master PIO4
acd1: CDROM <Compaq CRD-8484B> at ata1-slave PIO4
Mounting root from ufs:/dev/ad0s2a