Debian GNU/Linux on the HP Compaq nc4000 Laptop

Last February-2004 I upgraded my laptop to an HP Compaq nc4000. It came without an operating system installed and so the first task was to install one on the machine. This page describes some of my experiences.

For most of the last year I have been continually improving my installation on this machine. I am using it right now to update this web page. However over this last year I have not kept this page up to date and it may have led you to believe that GNU/Linux did not work as well as it has been working for me. Let me say that Debian 'sarge' works quite well. In general it is a fine laptop. If I have any complaint it is only about the moderately low battery life. But all else is good.

I am greatly indebted to both Martin Michlmayr's page and to Bdale Garbee's page with their installation notes. Theirs were the first pages available with information when I started work on mine. I don't need to repeat their information here but will instead supplement it since I went a different direction with some things.

Live-CD boot images

I could not boot KNOPPIX 3.3 on the nc4000. It did not know how to boot the USB disk drive. I could not find a "cheatcode" to enable it. If someone knows how to boot KNOPPIX from a USB device please let me know.

I had a Gentoo based system rescue live-cd disk in my hand so I tried it. It worked well when booted with the following options. Using a live boot cd can be advantageous in a number of situations.

fb1024 usbstick cdcache

Installing Debian GNU/Linux

The earliest linux-2.4 kernel that supports the hardware in the nc4000 is linux-2.4.24. The earliest linux-2.6 kernel that supports the hardware is linux-2.6.8. (Well actually I know that 2.6.6 has issues and I never tested 2.6.7 so I don't know if 2.6.7 has the same problems as earlier kernels or not. But 2.6.8.1 works fine.) I recommend using a linux-2.6 kernel. A linux-2.6.8.1 or a more recent kernel should work fine.

When I initially installed Debian way back in February 2004 I had some issues with the current drivers available at that time in the kernel. In particular the needed network driver is the tg3 driver. (Or the bcm5700.) ACPI was also troublesome up through linux-2.6.5. I am happy to say that those days are past. You should have no trouble using a recent debian-installer with a linux-2.6 kernel to install.


http://gluck.debian.org/cdimage/testing/netinst/i386/current/

In order to boot from the cdrom I needed to change the BIOS factory settings. Enabling legacy USB support in the BIOS enabled me to boot from the USB cdrom. You will probably want to inspect and review the BIOS settings in general.

Way back when I initially installed the system I was booting the linux-2.4.24 kernel and in that kernel the console after boot had problems on this machine. Booting the 2.4 based kernel with vga=771 enabled a sane console. I don't think this is needed with the newer linux-2.6 kernels but may be a useful configuration to know about.

linux vga=771

Configuring Sudo

The very first thing you will want to do when installing any system will be to configure sudo. This is a must have system administration command. See the sudo home page for details. The /etc/sudoers file will come preconfigured for 'root' to have sudo access. The easiest thing is to copy that line and change the 'root' field to be your login name.

root    ALL=(ALL) ALL
bob ALL=ALL
ALL ALL=NOPASSWD: /usr/bin/apt-get
ALL ALL=NOPASSWD: /usr/bin/dpkg
ALL ALL=NOPASSWD: /usr/bin/dpkg-reconfigure
ALL ALL=NOPASSWD: /usr/sbin/hibernate
ALL ALL=NOPASSWD: /etc/init.d/*

Never log in as root again. Only log in as your own login. Use sudo to run root level commands as needed.

Linux Kernel Modules

I prefer to use a stock kernel. Especially with Debian I can rely upon security and other updates to be easily available. But unfortunately the built-in wifi requires a driver that is not available in the stock linux kernel. I also wanted to be able to suspect to disk with the swsusp2 patches. Therefore I did recompile everything. I use the stock Debian kernel configuration with an initrd.

I won't describe the kernel+madwifi build in much detail. That is available elsewhere. But here is my make-kpkg configuration. I have the following in my $HOME/.kernel-pkg.conf file.

do_clean := NO
delete_build_link := YES
maintainer := Your Name
email := you@address.example.com

Note that I specify the "build" link to be deleted. This is the link from /lib/modules/$(uname -r)/build to the kernel source used to build the kernel. That symlink has no business being part of the binary kernel package. The source is not part of the package. If the source is removed or the binary package installed on another machine then the symlink is left dangling. That is not a good thing. However the madwifi makefile expects that symlink to be there. So to produce a clean kernel package without this symlink requires some minor fixup of the madwifi Makefile. Really the madwifi Makefile is making an incorrect assumption.

I used the following to build the kernel portion. Here is a simple trace of my build commands. You should use at least 2.6.8.1 in order to get all of the drivers working.

apt-get install kernel-source-2.6.8
cd /usr/src
tar xjvf kernel-source-2.6.8.tar.bz2
cd /usr/src/kernel-source-2.6.8
cp /boot/config-2.6.8-1-686 .config
time fakeroot make-kpkg clean
time fakeroot make-kpkg --initrd --append-to-version -1+1-686 kernel_image
sudo dpkg -i ../kernel-image-2.6.8-1+1-686_1.1_i386.deb

Here is my current list for the linux 2.6.8 kernel.

# Mostly standard stuff.
keybdev
mousedev
psmouse
# USB stuff.
hid
ohci-hcd
usb-storage
usbkbd
# Audio.
trident
# Broadcom networking.
tg3
# ACPI modules
acpi
ac
processor
battery
button
fan
thermal
speedstep-centrino

Wireless

Then after rebooting to the new kernel build the madwifi driver. I found this reference very useful. I am basically summarizing it here. Except the reference says to create the build symlink manually. That should not be needed if "delete_build_link := NO" which is the default but I emphasized it in the above just because of this. But normally that symlink is annoying and I normally have the configuration "delete_build_link := YES" except for this so I assume that author in the wiki reference does too.

cd /usr/src
cvs -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/madwifi co madwifi
cd madwifi
make
sudo make install
apt-get install dhcp3-client    # Replace version 2 with version 3
apt-get install wireless-tools  # iwconfig, iwlist

Getting the wireless running consists of the following for me. These are all done as root. Of course if you have a closed access point you will need to set the SSID to match instead of to "any". This is the "coffee shop" setting.

modprobe ath_pci
iwconfig ath0 mode managed rate auto rts off frag off key off enc off
iwconfig ath0 txpower auto  # seems to power up transmitter
iwconfig ath0 essid any     # seems to power up transmitter
ifconfig ath0 up            # initiates active scan for access point
sleep 2
iwlist ath0 scanning
shorewall start
dhclient ath0

Initially iwconfig shows the txpower off. But after this txpower is on (0 db). Unloading the module seems to power off the transmitter. I am still experimenting with this.

ifconfig ath0 down
rmmod ath_pci
rmmod ath_hal
rmmod wlan

The blue led indicating that the wifi is active is never lit on my laptop with this driver. I have seen it light up with other nc8000 laptops. However everything works fine without the light so this is not a concern at all.

I would like to use the wifi button on the top row to turn the wifi on and off. But the left three buttons do not generate a keyboard event at all. Therefore there is nothing to hook them too. But see Martin's page for how to get those extra keys working. I just have not bothered.

Suspend to Disk

I am happy to report that I have swsusp2 2.0.0.105 working nicely with linux 2.6.8.1 to suspend to the swap partition. It works very well and I am a user of it every day.

Because this is a ACPI generation laptop there is no longer any APM BIOS controlled suspend to disk as far as I can determine. Now it must be done in the OS. Unfortunately ACPI suspend to disk is not yet in the mainstream linux.org kernels. You will need to patch your kernel and recompile everything to make this work.

Here is a little explanation of software suspend. There are three major forks of code here. One is the original swsusp code. One is the pmdisk rewrite of it. One is the swsusp2 based on SourceForge.

Here is my kernel, md5sum and config which worked. This is basically a stock Debian tuned kernel config plus the swsusp2 core patch plus the swsusp2 2.6.8.1 specific patch. See the main Software Suspend for Linux site. Here is a tar of corresponding madwifi driver. Sorry, no package for it at this time. It was installed using the upstream Makefile with an install. But it is only the three files in the top level net directory. Unpack it from your filesystem root and the three files should be placed in the correct locations.

Here is how I am booting this kernel. Replace the devices with your specific devices. Yes, the version naming is ugly. I was cranking through development versions at a high rate. You must have a swap device configured to use this feature.

vmlinuz-2.6.8.1-1+8-686 root=/dev/hda5 ro acpi=off resume2=swap:/dev/hda1

Then to activate it use the hibernate script.

apt-get install hibernate
hibernate

USB DVD/CD-RW Configuration

The DVD/CD-RW is an external USB device. It works fine with no special preparation. USB devices show up through the SCSI emulation layer.

Use 'cdrecord --scanbus' to determine the device address. You may specify the resulting address on the commandline to cdrecord explicitly. Here is an example.

cdrecord dev=0,0,0

But for convenience you will want to configure the default for cdrecord so that you won't need to specify it on the command line. This is set in the file /etc/default/cdrecord. Here are the important entries to configure in that file. My DVD/CD-RW is manufactured by Teac. Yours might vary.

CDR_DEVICE=teac
teac=		0,0,0	-1	-1	""

Other Useful Packages

I installed a number of programs for use with the laptop. These may be useful to you. Tune to your taste. And if you have hints in return for me about your "Hot Pick's" please send them my way.

apt-get install powernowd         # Tune frequency and power for battery life
apt-get install laptop-mode-tools # Turns off the disk to save power
apt-get install wavemon           # Sweet realtime monitoring application
apt-get install ifplugd           # Nice "hotplug" utility
apt-get install shorewall         # You would be on the network without one?
apt-get install xfree86-driver-synaptics # Synaptics TouchPad driver
apt-get install hibernate         # Software Suspend 2 script

I had initially installed battery-stats when using APM. It is a very nice APM program for battery usage and graphing. However it is not ACPI enabled. A shame because it is a really nice program. If you have a suggestion for a battery graph program such as this that is good for ACPI I would like to hear about it.

Again with APM I had installed xbattbar for my graphical battery power indicator. But it is only APM and knows not how about ACPI. So right now I am living without a graphical ACPI based battery indicator and am just using the command line tool when I want to peak at it.

Keyboard

Generally I like the keyboard. Better than many of the very small notebooks. Some things are a compromise but overall I approve.

I always configure the capslock as a control key like on the vt100. Why the caplock key was moved there I will never know but it has been a terrible thing or touch typists for years.

This is mostly a placeholder section to document later how to control the keyboard and move control around.

Touchpad

I generally like touchpads and use it instead of the pointing stick. The touchpad on the nc4000 is centered. I would prefer it offset as in some other laptops. The buttons are symmetrical. Which means it is equally disfunctional for both left and right handed people. I prefer the right-handed design which has a large raised left button but I appreciate the problems of making things work well for both left handed and right handed people.

The buttons are too low profile for me. They are marginally more difficult to use than other laptops like my previous Compaq 1621 with raised buttons. The pointing stick buttons seem fine but the touchpad buttons feel like they are low to me. I would prefer a bump there to be able to find the buttons by feel easier. I keep hitting the right button when I want the left and that type of thing. Something I am sure I will get used to soon enough. Maybe I will glue something there to improve the tactile feedback.

Interestingly with 2.6.2 taps were not enabled on the touchpad. This is something many would debate as a good thing. I am one of them. Actually I like to able to switch taps on and off dynamically. But off is a better default than on as I often drag my wrist over the touchpad and send the pointer flying. Especially during an active presentation where I am teaching this is very annoying. Taps set to off prevents this.

The touchpad worked with taps enabled by default with the 2.4.24 kernel.

I have read that a full functionality of dynamically controlling the taps, scrolling, etc. is available with additional tweaks. But I have not been motivated to explore this yet.

Battery Life

In a ram suspend mode the battery will last around 10 hours from 100% battery to 0% battery. Others have reported days of life from other manufactures models. I don't leave it in that mode but I do use it for brief periods. Anything to extend battery life when I am not actively using it. It is not a huge increase in life over just leaving it running but better than nothing.

In "meeting mode", in a mostly passive state with little running actively, with powernowd throttling the cpu to 600MHz, without the wireless transmitter running, but with the disk drives running constantly, I am getting around 2h40m of battery life from the internal battery. IBAM - the Intelligent Battery Monitor predicts 2h56m from charged to flat. That is probably a best case situation and any real use would be less than that. But probably not much less. I expect to be able to better this when I can configure the disk drives to power off. See my battery-stats graph below.

In "coffee shop" mode, the same as the above but with the wireless transmitter active and surfing the web, I am getting at least two hours but have not finished the experiments yet. I think I can probably get 2.5 hours. Don't take this number seriously yet as I definitely need more data. I have just now started to collect it. And don't forget my disk drive is spinning the entire time wasting power needlessly.

Obviously compiling a kernel or doing anything else heavy will run the cpu frequency up to the maximum in my machine of 1.5GHz and burn power much faster than at 600MHz. (Remember that I am running powernowd which does user space frequency control.) If you are running cpu intensive applications then you will drain the battery faster. That is life. I don't have any data yet of battery life under heavy cpu use. I would guess an hour.

Here is a graph of a charge discharge cycle and the raw data from 'battery-stats' for the nc4000. Notice that the battery reported 0% for 20 minutes before the machine finally crashed due to lack of power. I was not using the machine and just let it sit and drain. Nothing special has been done, cron is still running, etc. I am getting just short of three hours. I would really like more. My previous Compaq 1621 I would get more than four hours of battery use. Here is a graph of a charge discharge cycle and the raw battery-stats data. Of course it was a lot heavier. I do appreciate the ligher weight and smaller size of the nc4000.

There is an additional travel battery available as an option. I need to look into it as that might make all of the difference for me.

Links to Other Useful Pages