FreeBSD

on Compaq Presario R3000 Series ( AMD64 R3000z )

Please read the Disclaimers and Copyright Notices section at the bottom of this document before trying to implement any of the suggestions found here.

Topics:

  1. After FreeBSD 5.3
  2. Background Information and Kernel Hacks
  3. Base Config Files
  4. Audio
  5. X11 (xorg)
  6. ALPS Glidepoint Touchpad
  7. Network
  8. Ports
  9. Java and PPower4
  10. cardbus issues
  11. Getting the Wireless Card to Work
  12. The Need for Speed (Good News/Bad News)
  13. Matlab
  14. Video (MPEG-4)
  15. More Information about FreeBSD on laptops
  16. Disclaimers and Copyright Notices

After FreeBSD 5.3

The initial distribution that I put on this laptop was 5.3, and most of the following discussion focuses on the initial installation. Most of the problems with this laptop have to do with quirks in the NVidia chipset, and most of the issues have been addressed in FreeBSD 5.4 and 6.0. I have since reinstalled FreeBSD 6.0 starting from scratch following the directions found below. I had almost no problems, and it was a very smooth install. In fact, I now use ACPI by default and have not yet seen any problems. Once you do the initial install and use cvsup to update the system you should be in relatively good shape.

For an overview of the situation for the 5.4 pre-release take a look at the threads here and here.

Most importantly the booting issue has been addressed, although it has not been entirely fixed. The current FreeBSD boot disk can be used to boot the machine, and details can be found here. Basically, here are the steps that you have to go through to make this work:

  1. Download the current boot disk. Choose the amd64 iso, and you will need disk 1 at a minimum.
  2. Burn the cd and boot your machine from the cd.
  3. Choose option (6), "Escape to loader prompt," from the menu.
  4. At the loader prompt type in the following sequence:
    set hw.acpi.skip_timer_override="1"
    set hint.atkbd.0.flags="0x9"
    set hint.acpi.0.disabled="1"
    boot
  5. At this point the machine should boot up and enter the installation menu as normal. From there follow the directions in the FreeBSD Handbook.
  6. When you boot up again you will have to go through the loader prompt and enter the options as specified above. After booting up you should enter the coresponding lines in your /boot/device.hints file to make the settings permanent.

Background Information and Kernel Hacks

There is a known problem booting the Compaq Presario R3000z series using the stock 5.3 release. The problem is detailed here. I had to create my own release CD from the base package. When you boot from the CD make sure that you choose the option to turn ACPI off. (See the notes above to find out how to use the most current iso.)

Addressing the booting problem turned out to be more difficult than I had planned. A fix has been submitted to the FreeBSD CVS tree which includes changes given here and here. This was good news since I happen to have a desktop system that also has the amd64 processor. Surely this would be an easy hack? I originally tried to apply these patches, but it was to no avail. I ended up having to just remove the offending system calls which was one of the first solutions that I came across in the FreeBSD mail lists. (Sorry I lost the reference.) When I removed the call to the offending routine, the resulting installation disk worked. The two modified files, located in /usr/src/sys/dev/kbd are atkbd.c and atkbdreg.h. Please keep in mind that this is a hack, but it was the only thing I was able to do to get it to work correctly. These changes should be kept in mind when updating the source files.

A copy of the iso that I used to burn the cd that successfully booted up FreeBSD 5.3 can be found here. (See the notes above to find out how to use the most current iso.) This is an iso for the miniinst cd. When you boot from this CD be sure to choose the option to turn ACPI off. The information used to create this iso was found in the FreeBSD Handbook. I used it to install the base system. Once the base system was in place I installed the cvsup port and updated the ports system. From there I began to customize the machine to my liking.

So far it seems to be running fine. The only quirk is that the machine is a little bit buggy when using acpi. At boot up this can be turned off which I did by adding the line hint.acpi.0.disabled="1" to the end of my /boot/device.hints file. There is a proposed fix for this problem which was announced on the FreeBSD amd64 mail list. Another fix has also been proposed that may help make this mess easier to deal with. More details on how to implement this in 5.4 and later can be found here. I have tried this patch, and it worked. It is mostly stable but has a few quirks. ACPI is required for some things such as stepping up the processor speed. (See the section on below.) When I want to use something that requires acpi I reboot the machine and choose the option to use acpi from the boot menu.

Links to relevant files mentioned in this section:

Base Config Files

Here is a list of the configuration files and general information. These files are referenced throughout this page.

Audio

The sound device uses AC'97, so getting the sound to work is one of the easiest parts of the install. You just need to load the snd_ich.ko module. I did this by adding the line snd_ich_load="YES" in the file /boot/loader.conf. You can also accomplish this with the command kldload snd_ich. Whichever floats your boat. Either way the sound works fine.

Also, mixer works fine in changing the volume. I only use it for mp3's so I assume that the cd and other devices work as well.

This laptop has three buttons on the side for increasing the volume, decreasing the volume, and muting. These keys can be enabled in X11 through the use of xbindkeys. It can be installed as a port at /usr/ports/x11/xbindkeys. The configuration file maps buttons 160, 174, and 176 to the appropriate mixer control. This is a bit of a hack because the way it is set up the mute button toggles between volume levels of 0 and 60.

X11 (xorg)

Had some difficulties here. First, X would not start because it was not able to find certain fonts. I had installed the xorg x11 server through the x11-servers/xorg-server port, and I installed xfce4 through the x11-wm/xfce4 port. After installing other ports such as abiword, emacs and others I just assumed that there were no problems with dependencies, but that was just wrong. This was a fairly stupid mistake, since the handbook clearly states how to install xorg. (The problem was that x11-fonts/xorg-fonts-miscbitmaps was not installed which fixed the problem when I installed this port.) Glad I didn't ask about this on IRC, they would have filleted me.

The mouse worked fine in text mode so I assumed that there would be no problem in X. Of course this was a stupid assumption. There was a problem with the ALPS Glidepoint and the mouse would only move up and right so it would always move to the top right of the screen. Messing around with the xorg.conf file did not seem to make it work so I had to add the argument -z 4 to moused. This was done by adding the following line to my /etc/rc.conf:

moused_flags="-3 -z 4 -t auto"

This turned out to be the hardest and most frustrating part of configuring X which was a surprise. I found the fix for this problem here. Note that this interfered with my usb mouse. See the mouse section below for more information.

Finally getting the screen set up was not near as difficult that I thought it would be. There is a lot of information out there on this from people who set up linux on this machine. A list of other pages is given below. Here is a copy of my xorg.conf. The pages at the links below go into great detail on the modeline and other parameters to be set in the file so I will skip that here.

Here are the sites where I got information about configuring xorg:

At this time NVidia does not support FreeBSD on 64 bits, so the first thing that I tried was the nv driver. The original driver screwed up all of the text terminals, but when I upgraded to the most recent version of Xorg it fixed the problem. I do not know yet if it fixed the problem of incorrectly identifying a projector when I hook it up to the external video port.

When I want to use a projector I switch to using the vesa driver. It works correctly when I hook it up to a projector. I cannot use this all the time because it does not understand the weird screen size. This is actually good because it scales things to the projector screen rather than panning the desktop. When I first set this machine up using the nv driver it panned the desktop on the projector and was not usable. The combination of xfce4 and the vesa driver does exactly what it should do rather than trying to compensate for a problem that isn't there!

ALPS Glidepoint Touchpad

The touchpad on this laptop is an ALPS Glidepoint Touchpad. This was configured during the installation and there were not any problems until I tried using X. The pointer would only move up and to the right putting the pointer in the upper right hand corner. This was corrected by adding the following line to my /etc/rc.conf:

moused_flags="-3 -z 4 -t auto"

This caused a problem in that interferes with my usb mouse. If I want to use the usb mouse I have to get rid of the -3 -t auto part. These arguments are necessary if I want to paste text using the touchpad in a text terminal. So if I want to use the usb mouse I kill off moused and then enter the command moused -z 4 -p /dev/psm0.

More detailed information about the mouse can be found in the FreeBSD FAQ.

Network

As usual the easy parts are easy and the hard parts can be very frustrating. The ethernet device is by Realtek and uses the rl driver. This requires the following two lines in the kernel configuration file:
device miibus # MII bus support
device rl # RealTek 8129/8139
I used dhcp for the network and have no problems here.

The wireless device is made by broadcom. In recent versions of FreeBSD this device can be made to work using the windows drivers and ndisulator. Please see the section Getting the Wireless Card to Work for more information. You can also find out details on how to configure a wireless connection here.

There is a firewire port on this machine, but I have nothing to attach to it. However, I kept these lines in my kernel configuration file:
device firewire # FireWire bus code
device sbp # SCSI over FireWire (Requires scbus and da)
device fwe # Ethernet over FireWire (non-standard!)
The fwe0 device appears when I enter the ifconfig command, but I have no idea if it really works. (It must, this is FreeBSD??!!?)

Ports

Partial list of ports that were added with no problems (so far):

List of ports that would not install or had difficulties:

Java and PPower4

I need to use PPower4 for presentations which requires Java. Unfortunately, it is not a simple matter to just use the Java port. First, I had to apply the patchs described here. Once that was done I had to make use of the linux compatability modes which are described here. Now Java seems to work, and I was able to install PPower4 according to the directions at their website.

cardbus issues

There is a problem with cardbus on this machine. Details can be found here. I have applied these patches but have not tried it out. I do not happen to have any cards to plug in here in the office. I am hoping that when the time comes everything will be fine. I assume that peace in the middle east will work the same....

At any rate, the best way to find fixes to problems is to search the freebsd-amd64 digest by looking for Jung-uk Kim. This person seems to be turning the machine inside out and finding the fixes. They should give out medals for this sort of thing...

Getting the Wireless Card to Work

In the current version of FreeBSD the Broadcom wirless device on this beast can work. Unfortunately, it takes a little bit of teasing to get it right. Fortunately, other people have done a lot of work. (As usual Jung-uk Kim helped quite a bit.)

The way to use ndisulator now is to use a script called "ndisgen." This script uses the windows 64-bit drivers to generate a loadable module. At the time of this writing it did not work correctly, and a patch by Jung-uk Kim had to be applied. I had some trouble applying the patch using the "patch" command and had to apply the changes by hand. A copy of the patch file can be found here. Of course, you should try the default version first in case the problem has been fixed.

Once the patch is made to ndisgen, the script can be used to generate a loadable module. You will need the files associated with the 64-bit windows driver, BCMWL564.SYS and netbc564.inf.ascii. When you run ndisgen choose the option to "convert driver." It will first ask for the .inf file and give it the full path (including the file name) to your copy of netbc564.inf.ascii. When it asks for the .sys file give it the full path (including the file name) to your copy of BCMWL564.SYS. When it asks for the path the firmware files just keep pressing the enter key.

Assuming that everything went okay, keep hitting the enter key until you are returned to the shell prompt. At that point you should see a file called BCMWL564_SYS.ko in your current directory. To load the module you need to first load the ndis.ko and if_ndis.ko modules using "kldload." If those modules were not automatically installed on your system go to /usr/src/sys/modules/ndis and /usr/src/sys/modules/if_ndis and do a "make; make depend; make install" in both directories. You should then be able to do the "kldload" for the files. Check to see if the files are loaded using kldstat. Note that a "kldload if_ndis.ko" by itself should automatically load ndis.ko as well. Finally, to start ndis you have to load the module that you created using ndisgen, BCMWL564_SYS.ko.

I do not normally use the wireless device so I have not configured my machine to automatically load the modules when it boots. This could be easily done by modifying your /etc/rc.local. You would need to add the following commands to your /etc/rc.local:

/sbin/kldload if_ndis.ko
/sbin/kldload /root/broadcom/BCMWL564_SYS.ko

Note that I personally keep my file in the /root/broadcom subdirectory. You would have to change this to the location of your module of course. Also note that you will have to repeat all this nonsense and rebuild the module whenever you update your kernel.

You can find out details on how to configure a wireless connection here.

The Need for Speed (Good News/Bad News)

Once the machine was up and running I ran a test. I took a program designed to approximate the solution to a nonlinear PDE and ran it on the Presario. I ran the exact same program on this machine while running under Windows XP using CygWin. This is a program that performs some heavy computations using a relatively small matrix (300x300) so it is a good test of the CPU's power and not the bus speed and the OS's ability to manage its memory. The bad news, FreeBSD was a full 33% slower.

The program is an implementation of the algorithm described in the following paper:

K. Black and J. B. Geddes, Spectral hermite approximations for the actively mode-locked laser, J. Sci. Comput., 16 (2001), pp.81--120.

It turned out that the problem is that under FreBSD the processor was not running at full speed. There is a driver available that will vary the processor speed according to load, but the laptop has to have acpi implemented. To do this you need to apply the patchs indicated above. Once that is done you need to make sure that you apply the patch given here. Note that another fix may be necessary depending on how you load the module. (The original message can be found here.)

Finally, when the patches are in place you need to download the acpi_ppc driver. To do this download and untar the file. Issue a make and a make install which will put acpi_ppc.ko in your /boot/kernel directory. The driver is loaded using kldload acpi_ppc.ko. I do this automatically in my /etc/rc.local file.

When I did this and rebooted the machine to run with acpi enabled I ran the test program. The machine automatically boosted the processor speed as soon as the load went up. The time it took to run the program dropped dramatically, and this machine is even faster then my desktop machine, a Dell Precision 360 workstation. The only problem is that to take advantage of the driver I have to run the machine with acpi enabled, and I have had problems with the machine occasionally locking up. This is a mix of good and bad news.

Matlab

I was able to install matlab and get it running. As usual there was some wrestling that had to be done. I was able to copy the files off of another machine that I have access to that runs gentoo linux. Instructions for doing a fresh install can be found here. I also made use of the freebsd documentation.

My home directory for the matlab files is /compat/linux/usr/local/matlab. The license file is the one we use on our machines at this site. I did have a minor issue in that when I first created the license file, /compat/linux/usr/local/matlab/etc/license.dat, I had the wrong permissions. The file needs to be readable by all users. Of course, this stupid mistake took up most of my time.

Note that when I use matlab the command I use is /compat/linux/usr/local/matlab/bin/matlab -nojvm. If I leave off the -nojvm argument then matlab takes forever to run. It pops right up without the graphical interface and seems to work fine in this mode.

Some other files had to be tweaked to match up with FreeBSD on an amd64 machine. I will try to detail them below. First, the script /compat/linux/usr/local/matlab/bin/matlab required two extra lines at the top of the file. I put these two lines immediately after the line that includes arg0_=$0:

LD_LIBRARY_PATH=/compat/linux/lib:/compat/linux/usr/X11R6/lib
PATH=/compat/linux/bin:/compat/linux/usr/bin:$PATH

These lines are required to make sure that the script uses the correct commands for expr and a couple of other commands that use different arguments in linux.

In the file /compat/linux/usr/local/matlab/bin/util/oscheck.sh I replaced every occurrence of /bin/uname with /usr/bin/uname. Also, I changed the line

ver=`/lib/libc.so.6 | head -n 1 | sed -e "s/^[^0-9]*//" -e "s/[,].*$//"`

to

ver=2.3.4

Finally, in the file /compat/linux/usr/local/matlab/bin/util/arch.sh I also changed every occurrence of /bin/uname with /usr/bin/uname. Several other lines required additions. The lines that looked like

Linux)
case "`/bin/uname -m`" in
i*86)
ARCH="glnx86"
;;

were changed to

Linux|FreeBSD)
case "`/usr/bin/uname -m`" in
i*86|amd64)
ARCH="glnx86"
;;

I realize that this means that I am running the 32bit version of matlab when there is a 64 bit version. I decided that it was worthwhile to just do this because I do not know how 64bit linux code runs in emulation. Besides I use matlab to test algorithms and then implement them in C++ when I decide it is worthwhile. The extra performance for matlab is not an issue for me.

Video (MPEG-4)

One way to display video under X11 is to use mplayer. There is a port for this application but the order that you do things matters. I first had to install the codec's that I want and then install mplayer. A list of the codec's that are supported are listed at the mplayer website. Also, you have to install the mplayer fonts in a separate step.

The first thing that I did was install libavcodec. I only watch mp4's so my video needs are fairly simple. To install the libavcodec I installed the multimedia/ffmpeg port. This automatically installed libavcodec as one part of the port.

The next step is to install mplayer itself. You have to do this as the second step because it tries to detect the installed codec's on your system at compile time. If you change or add a codec you have to reinstall mplayer. The port is the multimedia/mplayer port.

The final port is for the fonts and is the multimedia/mplayer-fonts port.

To use mplayer you need to take two more steps. As an individual user you need to change directories to /usr/ports/multimedia/mplayer and enter the command "make install-user". You will be asked for some options and provide answers that suit your preferences. Then you have to tell mplayer to not use a driver for your card but to use native x11 commands. You need to create a file ~/.mplayer/config and add the line "vo=x11".

You should be able to use mplayer to view mpegs now. The command is simply "mplayer filename".

More Information about FreeBSD on laptops

Links to sites with information about FreeBSD on laptops (in no particular order):

Disclaimers and Copyright Notices

The description above is an attempt by me to share my experience of installing FreeBSD 5.3 on my Compaq Presario laptop computer. The process of installing the operating system was nontrivial because of issues booting FreeBSD 5.3 and the hardware on this computer. It is likely that I have forgotten or simply missed some of the things that I had to do or should have done. Some of the things listed above may even be harmful to your computer. You should check and double check each thing and check to make sure something has not been left out. Good places to check things are the various FreeBSD email lists:

This document was originally written by Kelly Black to document his experience installing FreeBSD 5.3 on his Compaq Presario laptop. I am providing this documentation "as is" with no warranty. Please see sections 5 and 6 of the license for more details.

Copyright © 2007 Kelly Black (kjblack at gmail.com).
Creative Commons License This work is licensed under a Creative Commons Attribution 2.5 License.


TuxMobil - Linux on laptops, notebooks, PDAs and mobile phones Valid HTML 4.01!
playbyplay-juice
playbyplay-juice