FreeBSD4.4 and Win2K on a Toshiba laptop (Portege 7020CT)

Grenville Armitage, 11/7/01
updated 11/14/01
updated 11/20/01
updated 12/31/01


[Note December 2004 - The text below was last updated Dec. 31st 2001, since then the same laptop has been upgraded to FreeBSD 4.7 and then FreeBSD 5.3, and continued to run happily. I haven't the time to update the details of running it under FreeBSD 5.3, but in short: add hint.acpi.0.disabled="1" and change hint.apm.0.disabled from "1" to "0" in /boot/device.hints to stop the fan from running continuously. Oh, and the internal Winmodem can be driven by the ltmdm driver available under /usr/ports/comms/ltmdm.]

Over the past few months I've been upgrading an old Toshiba Portege 7020CT laptop from its original WinNT4 configuration, launching it into the brave new world of FreeBSD. Pragmatic considerations made me decide to setup a dual-boot configuration, with FreeBSD 4.4 and Windows 2000 (Win2K) sharing the machine. Win2K was an easy choice - WinNT stability, support for a wider range of hardware than WinNT (particularly the 7020's internal Winmodem, IR and USB ports), and none of the intrusive behavior of WinXP.

The rest of 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
Dual-booting and Partitioning
Installing FreeBSD
Installing Win2K
Configuring FreeBSD
FreeBSD boot messages



Summary

The quick summary is that Win2K and FreeBSD4.4 can be made to co-exist just fine on separate partitions of the Portege 7020CT's internal hard drive. You'll need a number of Portege-specific patches to fully enable Win2K power managment and hardware configuration tools. All standard devices and interfaces (including the internal winmodem) appear to function properly using the drivers supplied on the Win2K installation CD-ROM.

FreeBSD4.4 also works fine. The docking station's Ethernet port is recognized, the DVD/CD-ROM drive was confirmed to work as CD-ROM, and XFree86-4.1.0_10 can drive the LCD display and/or external monitor. A third-party kernel module is available to drive the internal winmodem, and PCMCIA networking cards are supported when undocked (e.g. Lucent/Orinoco's 802.11b wireless PCMCIA card, a generic 10baseT ethernet card, etc). Armed with KDE2.2 as my desktop and StarOffice, the laptop is quite useful on the road for email, code development, and document preparation under FreeBSD.

Equipment

I upgraded the memory to 192MB (replaced the removable 64MB SO-DIMM with a 128MB SO-DIMM card) and replaced the internal Toshiba 6GB 2.5" IDE drive (TOSHIBA MK6411MAT) with a 20GB IDE drive from IBM (IBM-DJSA-220). Good news for battery life, the new drive is rated to draw only 500mA (compared to 700mA for the original 6GB drive). Also made sure the machine's BIOS was updated to the latest version ("ACPI Flash BIOS version 8.10" released 7/24/01, available from the Toshiba website).

Dual-booting and Partitioning

FreeBSD4.4 and Windows 2000 were installed on separate BIOS partitions of the hard drive, and FreeBSD4.4's boot loader provided OS selection at boot time. Win2K uses the first two partitions, FreeBSD4.4 uses the third and fourth partitions.

Win2K supports FAT16 partitions and enhanced NTFS partitions. FreeBSD4.4 can natively mount FAT16 partitions in addition to regular FreeBSD UFS partitions. Although most of the disk is split between NTFS and UFS, I allocated 1GB of space as a FAT16 partition to be shared between FreeBSD and Win2K. This partition would be home to files that needed to be accessed under either OS. [Note: Neither Win2K nor FreeBSD can support multi-user permissions on files in the FAT partition. Under FreeBSD I mount the partition with my user account as the owner and group for the entire partition.]

I installed FreeBSD4.4 first, and used the FreeBSD installers tools to partition the hard drive.

Installing FreeBSD

Although the FreeBSD installation CDROM is bootable in many machines, I had to initially boot the laptop from the two FreeBSD4.4 installation diskettes. (You may need to access the BIOS to set the diskette drive as the primary boot device. Hold <esc> key during power-cycle, then F1 when prompted to reach the laptop's BIOS configuration panel.)

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.

From FreeBSD's perspective, the 7020's internal IDE drive is device /dev/ad0. The first step in the installation process is the FDISK Partition Editor, which allows you to modify the BIOS partitions of the hard drive. I deleted the existing partition entries, manually created four slices and set their partition types explicitly:

ad0s1 5GB NTFS (type 7)
ad0s2 1GB FAT16 (type 6)
ad0s3 11GB FreeBSD (type 165)
ad0s4 1.6GB FreeBSD (spare, type 165)

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'll be key to selecting FreeBSD or Win2K each time the machine powers up). 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 ad0s3 and ad0s4. The following BSD-style partitions were created inside ad0s3 and ad0s4:

 ad0s3b             (swap) [512MB]
 ad0s3a             /      [150MB]
 ad0s3e             /var   [150MB]
 ad0s3f             /usr   [the rest of the space on the ad0s3 slice]
 ad0s4e             /usr2  [entire ad0s4 slice]


(ad0s3c conventionally represents the entire slice ad0s3, ad0s3d is unused by default.)

I manually set the sizes for each partition to be 512MB swap, 150MB for / and /var, and the remainder for /usr.

Continue with the FreeBSD installation onto ad0s3. From this point onwards, the DVD/CD-ROM drive in the docking station will function correctly and you can do the remainder of the installation from your local CD-ROM(s). FreeBSD also correctly recognizes the docking station's Ethernet port as "fxp0", which means if you're connected to the Internet you could also install from a remote FTP repository, or from another machine on the local LAN.

When the installation process prompts you to add additional packages, I found the following to be useful: The 'ports' collection, KDE2 (the K desktop environment), linux-compatibility, dsniff, scanssh, mtools, and nmap. They are all available either over the Internet or on the CD-ROM set (FreeBSD4.4 was the first release where four CD-ROM ISO images could be downloaded from ftp.freebsd.org containing almost all of the packages collection.)  KDE2 is a meta-package that pulls in key KDE2.2 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.

A caveat about X11: During the installation process you'll be prompted to install X11. Don't. The default installation is XFree86-3.3.6, which doesn't handle the laptop's video chip particularly well. Wait until after you've completed FreeBSD installation, and then go back to manually add XFree86-4.1.0_6 from the CDROM (or later version from the freebsd.org mirror sites).

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 XF86Setup either from console or during the installation process).

A caveat about mouse settings: Make sure the BIOS is set to auto-select the 'pointing device'. Do not let the Portege's BIOS try and concurrently support both internal and external PS/2 pointing devices, otherwise FreeBSD's mouse daemon will be confused (the internal pointer doesn't seem to generate PS/2-style mouse commands). If a PS/2 mouse is attached at boot then the pointer is disabled. However, if a USB mouse is attached (during or after boot) it appears to co-habitate happily with the internal pointer. [When undocked the Portege needs an ugly portable expansion port to support PS/2 mice, so using a USB mouse is preferable.]

A caveat about the modem: Toshiba's internal V.90 modem is a software 'Winmodem' based on the Lucent chipset. FreeBSD4.4 does not have native support for these modems. A third-party driver (kernel-loadable module 'ltmdm', version 0.6) was added later and seems to work fine.


Installing Win2K

Boot from the Win2K CD-ROM, and Win2K's installer will recognize the NTFS and FAT partitions. The installer insisted that the FAT partition (ad0s2) was drive C and the NTFS partition (ad0s1) was drive D. In addition, even though I told the installer that I wanted to place Win2K on the NTFS partition, the installer insisted on placing some basic WinNT/2K boot files on the C drive (the 2nd partition). Nevertheless, the Win2K installer then happily installed almost all of Win2K onto the D drive (under /WINNT, /ProgramFiles, etc...) and took up less than 700K of the 1GB FAT partition for boot time files. (Ignore any offer to convert/format the C drive partition to NTFS, and definitely ignore offers to reclaim the remaining two drive partitions that Win2K doesn't recognize.) The Win2K installation process will include some intermediate reboots (if you're watching at the time, FreeBSD's boot loader should fall through to booting the new/partially installed Win2K boot code that's now on the first partition). At least in my case the Win2K installation process went off without a hitch. In the end you'll have a machine that boots into Win2K, and shows you have a 1GB "C:" drive and a 5GB "D:" drive. Win2K includes drivers for the docking station's internal Ethernet port, and I was immediately able to connect to, and mount remote folders from, my local LAN-based SAMBA server.

From the Toshiba website download and install the latest Win2K-specific patches and drivers for the Portege 7020, and that's pretty much it. (See further down this page for the laptop's hardware devices recognized during FreeBSD boot sequence while docked.)


Configuring FreeBSD

After installing Win2K, you should find that at boot time you're prompted with a list of four possible boot options "F1 ???, F2 DOS, F3 FreeBSD, F4 FreeBSD". You should select F3 for FreeBSD or F2 for Win2K (because the "C:" drive contains the Win2K boot files, even though the "D:" drive contains the entire Win2K distribution). If the machine is going directly into Win2K without offering you these choices, re-boot from the FreeBSD4.4 installation diskettes, bypass the standard installation and select post-installation configuration. Select FDISK, and mark ad0s3 as a bootable partition. Use 'w' to write the new FDISK parameters to the harddrive, quit, accept the offer to (re)install the FreeBSD boot manager, then exit the installer to reboot the machine. You should now get the F1, F2, F3, or F4 prompt from the FreeBSD boot manager whenever the machine is rebooted. 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 ad0s3 is marked bootable.)

X11 using XFree86-4.1.0: The CDROM contains a pre-built binary package for XFree86-4.1.0_6, but I pulled a slightly later version (XFree86-4.1.0_10) down from ftp.freebsd.org . Run "pkg_add XFree86-4.1.0_10.tgz" (as root). XFree86-4.1.0 uses a single server process, and contains drivers for the laptop's Neomagic NM2200 chipset. I used the following entries for monitor modelines and display selection:

Section "Monitor"
    Identifier  "My Monitor"
    # I use a Dell M991 external monitor
    HorizSync   30-96
    VertRefresh 50-160
   Modeline "1024x768"     98.90   1024 1092 1252 1380    768  778  784  814 -hsync -vsync
EndSection

Section "Device"
    Identifier  "My Video Card"
        Driver      "neomagic"
        VendorName  "Neomagic"
        BoardName   "NM2200"
EndSection

Section "Screen"
    Identifier  "Screen 1"
    Device      "My Video Card"
    Monitor     "My Monitor"
    DefaultDepth 16

    Subsection "Display"
        Depth       8
        Modes       "1024x768" "1280x1024"
        ViewPort    0 0
    EndSubsection
    Subsection "Display"
        Depth       16
        Modes       "1024x768"
        ViewPort    0 0
    EndSubsection
    Subsection "Display"
        Depth       24
        Modes       "1024x768"
        ViewPort    0 0
    EndSubsection
EndSection

X11 using XFree86-3.3.6: Not recommended, but it can be made to work. Make sure you installed the SVGA server. Run XF86Setup, and select "Neomagic 2200" or "NM2200" for the video chipset, SVGA mode, and do the usual fiddling with xvidtune to get the display aligned on the external monitor. NOTE: When using an external monitor/keyboard/mouse on the docking station I couldn't reliably get the video output to either monitor or internal display when the X11 server first starts up. Had to bang on the video-mode-change keys on the laptop's keyboard (Fn-F5) a few times to cycle through to the correct mode (monitor, display, both, and some wierd mode where nothing shows). Will figure out what's wrong someday. However, when running in stand-alone mode (undocked, no monitor) X11 would reliably startup on the laptop's internal display. [This failure mode did not occur when using XFree86-4.1.0_10.]

Accessing Win2K partition: In order for FreeBSD to see the 1GB FAT partition, add the following line to /etc/fstab:

 /dev/ad0s2 /mnt/win msdos rw,-u=gja,-g=gja 2 2

This invokes 'mount_msdos' and allows direct access to the entire Win2K partition through /mnt/win in the FreeBSD file space. All files will show up as owned by user 'gja', group 'gja' under FreeBSD.

After installing a few packages on both the FreeBSD and Win2K sides, the output from 'df -h' under FreeBSD looked like:

Filesystem Size Used Avail Capacity Mounted on
/dev/ad0s3a 145M 101M 33M 76%    /
/dev/ad0s2 1024M 563M 461M 55%   /mnt/win
/dev/ad0s3f 9.9G 7.9G 1.2G 87%   /usr
/dev/ad0s4e 1.6G 1.0K 1.5G 0%    /usr2
/dev/ad0s3e 145M 6.7M 127M 5%    /var


There's a man page for 'mount_ntfs' which suggests FreeBSD can also access NTFS partitions directly. However, the man page includes this cryptic warning under CAVEATS: "This utility gives almost only read-only access to NTFS volume." and a list of limitations in the driver's ability to write to NTFS partitions. I'll be very wary of allowing FreeBSD direct access to ad0s1 (where 99% of Win2K resides).

Sound: Sound support can be enabled simply by recompiling the FreeBSD kernel with the following option added to the kernel config file:

device pcm

followed by a reboot, going into /dev/ and running "./MAKEDEV snd0"  (the 'sox' package includes a 'play' command that seems capable of driving the sound card). Running "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) Oct 25 2001 02:33:16
Installed devices:
pcm0: <ESS Technology Maestro-2E> at I/O port 0xee00 irq 11 (4p/0r/0v channels duplex)

PCMCIA card support: The kernel includes support for PCMCIA cards, but you need to specifically enable it during boot time with the following lines in /etc/rc.conf:

pccard_enable="YES"
pccard_ifconfig="DHCP"

The second option ensures that when a network interface card is inserted, an attempt will be made to configure the card's IP identity using DHCP. I've used this successfully with a Lucent/Orinoco 802.11b GOLD card to become part of a wireless LAN (interface wi0). Note that running DHCP on the fxp0 internal ethernet port and 802.11b port at the same time confuses things. Using either the fxp0 or wi0 interfaces (one or both manually configured) I've been able to establish ssh sessions, export X11 sessions directly and over ssh, download large files using ftp, and surf the web using Netscape and Konqueror (KDE2).

Winmodem support:

FreeBSD4.4 does not contain drivers for Winmodems, so initially the Portege's internal modem shows up as:

pci0: <unknown card> (vendor=0x11c1, dev=0x0440) at 7.0 irq 3

There's a Linux binary-only winmodem driver released for winmodem's based on the Lucent chipset, which has been wrapped to form a dynamically loadable FreeBSD kernel module. The latest driver can probably be obtained from http://www.geocities.com/wtnbkysh/. I used the version ltmdm-0.6 and have successfully established ppp dial-up sessions lasting hours. (Some inexplicable kernel freezes have occurred since installing the winmodem driver in early December, but there's no obvious correlation to whether it is active or not at the time.)

Once ltmdm-0.6 is installed, add the following line to /etc/boot/loader.conf

ltmd_load="YES"

This causes the kernel module to be loaded early in the boot process, and the following message should now appear in the message log:

ltmdm0: <Lucent Winmodem> port 0x1c00-0x1cff,0x2f8-0x2ff mem 0xffefff00-0xffefffff irq 3 at device 7.0 on pci0
ltmdm0: type Virtual 16550A

The ltmdm-0.6 distribution includes instructions on how to use this interface with the ppp program and other dial-up applications.



FreeBSD boot messages

I haven't yet tweaked IRQs or searched for conflicts. Here's what FreeBSD4.4 reported when booting while undocked, with a USB mouse attached and the ltmdm winmodem driver installed:

Copyright (c) 1992-2001 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.4-RELEASE #0: Mon Nov 19 11:03:09 PST 2001

gja@7020bsd:/usr/src/sys/compile/GJA_7020

Timecounter "i8254" frequency 1193182 Hz

CPU: Pentium II/Pentium II Xeon/Celeron (366.60-MHz 686-class CPU)

Origin = "GenuineIntel" Id = 0x66a Stepping = 10

Features=0x183f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR>

real memory = 201195520 (196480K bytes)

avail memory = 190926848 (186452K bytes)

Preloaded elf kernel "kernel" at 0xc04ba000.

Preloaded elf module "ltmdm.ko" at 0xc04ba09c.

Pentium Pro MTRR support enabled

md0: Malloc disk

Using $PIR table, 9 entries at 0xc00f0180

apm0: <APM BIOS> on motherboard

apm: found APM BIOS v1.2, connected at v1.2

npx0: <math processor> on motherboard

npx0: INT 16 interface

pcib0: <Intel 82443BX host to PCI bridge (AGP disabled)> on motherboard

pci0: <PCI bus> on pcib0

pci0: <NeoMagic MagicMedia 256AV SVGA controller> at 4.0 irq 11

isab0: <Intel 82371AB PCI to ISA bridge> at device 5.0 on pci0

isa0: <ISA bus> on isab0

atapci0: <Intel PIIX4 ATA33 controller> port 0xfe60-0xfe6f at device 5.1 on pci0

ata0: at 0x1f0 irq 14 on atapci0

ata1: at 0x170 irq 15 on atapci0

uhci0: <Intel 82371AB/EB (PIIX4) USB controller> port 0xffe0-0xffff irq 11 at device 5.2 on pci0

usb0: <Intel 82371AB/EB (PIIX4) USB controller> 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

ums0: Logitech N48, rev 1.00/4.01, addr 2, iclass 3/1

ums0: 3 buttons and Z dir.

chip1: <Intel 82371AB Power management controller> port 0xfe70-0xfe7f at device 5.3 on pci0

ltmdm0: <Lucent Winmodem> port 0x1c00-0x1cff,0x2f8-0x2ff mem 0xffefff00-0xffefffff irq 3 at device 7.0 on pci0

ltmdm0: type Virtual 16550A

chip2: <Toshiba Fast Infra Red controller> port 0xff80-0xff9f irq 11 at device 9.0 on pci0

pci_cfgintr_unique: hard-routed to irq 11

pci_cfgintr: 0:11 INTA routed to irq 11

pcic0: <Toshiba ToPIC97 PCI-CardBus Bridge> irq 11 at device 11.0 on pci0

pcic0: PCI Memory allocated: 0x44000000

pccard0: <PC Card bus (classic)> on pcic0

pci_cfgintr_linked: linked (61) to hard-routed irq 11

pci_cfgintr: 0:11 INTB routed to irq 11

pcic1: <Toshiba ToPIC97 PCI-CardBus Bridge> irq 11 at device 11.1 on pci0

pcic1: PCI Memory allocated: 0x44001000

pccard1: <PC Card bus (classic)> on pcic1

pcm0: <ESS Technology Maestro-2E> port 0xee00-0xeeff irq 11 at device 12.0 on pci0

pci0: <unknown card> (vendor=0x123f, dev=0x8888) at 13.0 irq 11

eisa0: <EISA bus> on motherboard

eisa0: unknown card @@@0000 (0x00000000) at slot 1

orm0: <Option ROM> at iomem 0xc0000-0xcbfff on isa0

fdc0: <NEC 765 or clone> at port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on isa0

atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0

atkbd0: <AT Keyboard> flags 0x1 irq 1 on atkbdc0

kbd0 at atkbd0

psm0: <PS/2 Mouse> irq 12 on atkbdc0

psm0: model GlidePoint, device ID 0

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: configured irq 3 not in bitmap of probed irqs 0

sio1 at port 0x2f8-0x2ff irq 3 on isa0

sio1: type 16550A

ppc0: <Parallel port> at port 0x378-0x37f irq 7 on isa0

ppc0: Generic chipset (NIBBLE-only) in COMPATIBLE mode

plip0: <PLIP network interface> on ppbus0

lpt0: <Printer> on ppbus0

lpt0: Interrupt-driven port

ppi0: <Parallel I/O> on ppbus0

ad0: 19077MB <IBM-DJSA-220> [38760/16/63] at ata0-master UDMA33