Debian GNU/Linux on the HP Compaq nc4000
In the following, I'm going to describe how to install Debian GNU/Linux 3.1 (sarge) on a HP Compaq nc4000 notebook. This page only contains nc4000-specific information and should therefore be read together with Debian's more general installation guide.
lspci
Just to get an overview of which components are in this notebook, here is the output of lspci:
00:00.0 Host bridge: ATI Technologies Inc: Unknown device cbb2 (rev 02)
00:01.0 PCI bridge: ATI Technologies Inc: Unknown device 7010
00:06.0 Multimedia audio controller: ALi Corporation M5451 PCI AC-Link
Controller Audio Device (rev 02)
00:07.0 ISA bridge: ALi Corporation M1533 PCI to ISA Bridge [Aladdin IV]
00:08.0 Modem: ALi Corporation Intel 537 [M5457 AC-Link Modem]
00:09.0 Ethernet controller: Unknown device 168c:0013 (rev 01)
00:0b.0 CardBus bridge: O2 Micro, Inc.: Unknown device 7114 (rev 20)
00:0b.1 CardBus bridge: O2 Micro, Inc.: Unknown device 7114 (rev 20)
00:0b.2 System peripheral: O2 Micro, Inc.: Unknown device 7110
00:10.0 IDE interface: ALi Corporation M5229 IDE (rev c4)
00:11.0 Bridge: ALi Corporation M7101 PMU
00:12.0 USB Controller: NEC Corporation USB (rev 43)
00:12.1 USB Controller: NEC Corporation USB (rev 43)
00:12.2 USB Controller: NEC Corporation USB 2.0 (rev 04)
00:13.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5705M
Gigabit Ethernet (rev 01)
01:05.0 VGA compatible controller: ATI Technologies Inc Radeon IGP 340M
More verbose is available as well: lspci -v and lspci -vv. The output of dmesg from a 2.4 kernel.
Installing sarge
There are multiple ways to install Debian. The most convenient method is probably net booting via PXE. Alternatively, you can boot from an USB CD-ROM drive if you have the docking station with a CD drive or an external USB drive. Finally, it is also possible to boot from an USB memory stick.
Sarge is currently in development and it will feature a new installation system, known as debian-installer. This system is currently in development and therefore there might still be some problem. However, the installer is very stable now and your installation should proceed very smoothly. The current version of debian-installer is the first release candidate, and it has been tested to work on the nc4000. For information on getting started with debian-installer, please see this site.
Installation via the net using PXE
In order to perform the installation via booting from the net using PXE, you first have to configure a PXE server. Joe Nahmias wrote a good summary about this, and there is a wiki entry with more information. Once you have a PXE server to boot from, you have to configure your laptop to enable net booting. When you boot, press F10 to get into the BIOS. Then, select Security, Device Security and Internal Network. There, you have to enable adapter boot and set Boot mode to PXE. After you've enabled PXE, you'll be able to select Notebook NIC when the nc4000 asks you where to boot from. If your PXE server is configured properly, it will be found automatically.
Installation from a CD
First, you have to download a CD image with sarge on it. Torrents are available. Once you have a CD with sarge, you can boot from your USB CD-ROM drive. For this, you have to first turn Enable USB Legacy Support on in your BIOS. You will then have the choice to boot either from the laptop hard drive or from the USB CD-ROM drive.
Booting from USB memory stick
Aleksandr Koltsoff wrote that he was able to boot from a USB memory stick. He said that you have to do some trickery:
- instead of partitioning the flash, you make the msdos-filesystem directly on it (/dev/hda instead of /dev/hda1).
- then run syslinux on /dev/hda
(or whatever the memory stick is instead of /dev/hda. Most probably it is /dev/sda).
General installation instructions
Just follow the installation as you would normally would. I did not create a hibernation partition. Windows uses a hibernation file instead of an own partition and while Linux ACPI doesn't support that currently I expect it will once I get around to set up ACPI. However, you may want to read the ACPI documentation and consider making your swap partition bigger.
Ethernet
The nc4000 has a Broadcom NetXtreme BCM5705M chip which supports Gigabit Ethernet (10/100/1000). The Linux kernel includes the tg3 driver for these types of chipsets. Current versions of the 2.4 and 2.6 kernel (starting with 2.4.23 and 2.6.0-test7) support the chipset. The chip is detected fine and the card works without any problems.
Alternatively, you can use the the bcm5700 driver developed by Broadcom. The driver is included in Debian in the form of the bcm5700-source package. Building the driver is straight forward. While the tg3 driver had some problems in the past, it generally works very well these days and there is in my opinion no need to use the bcm5700 driver.
Sound
The laptop has an ALi Corporation M5451 audio chip which is supported by Linux. If you want to use OSS, simply load the trident module and you should see something like:
Trident 4DWave/SiS 7018/ALi 5451,Tvia CyberPro 5050 PCI Audio, version 0.14.10h, 23:44:34 Sep 5 2003 trident: ALi Audio Accelerator found at IO 0x3000, IRQ 11
The chip is also supported by ALSA with the snd_ali5451 module. Ali Shah pointed out that the module takes about 10 seconds to load (see the ALSA bug), but other than that the driver works fine.
Video
The nc4000 features a ATI Radeon IGP 340M graphics chip. As far as I know, this chip is also known as Mobility U1. You have to load the radeon module. The version of XFree86 in sarge will work without any problems. My complete XF86Config-4 config file is available here.
It seems that VGA output to a projector does not work correctly. While 800x600 works, 1024x768 displays some problems. Apparently, this is because some modelines got broken in a version of XFree86. If it doesn't work for you, you can temporarily switch from the radeon to the vesa driver (in the Device section). This problem has been fixed in X.org.
Michael Rasmussen wrote to let me know that X.org (xserver-xorg, taken either from unstable or from backports.org) provides excellent performance and power management. Michael claims that "with this setup I have been able to increase the standby time on battery power with 25%. This means a standby time of 2 hours and 18 minutes." Furthermore, "a side benefit is that VGA output to a projector now works in 1024x768" A configuration file for X.org is available here.
Touchpad
With the XF86Config-4 config file from above, both the touchpad and pointer stick work for me.
Aki Mimoto adds that there are synaptics touchpad drivers for neat additional features (such hitting the touchpad with three fingers will fake a middle button event, and rubbing the side of the touchpad will generate z-scroll events) but it seems to cause the pointer stick to become inactive. They seem to have a fix for this but I haven't tried it out. More information on this can be found here.
Additional Buttons
Aki Mimoto mentioned that you can also get the 7 special buttons on the upper side of the keyboard to word. Simply add the following lines to your ~/.Xmodmap file:
keycode 160 = F21 keycode 174 = F22 keycode 176 = F23 keycode 136 = F24 keycode 248 = F25 keycode 138 = F26
(160 = cpqmute, 174 = cpqvoldown, 176 = cpqvolup, 136 = cpqpresentation, 248 = cpqwireless, 138 = cpqlock)
USB
USB works without any problems. Simply load the usb-ohci module. Aki Mimoto suggests to load ehci-hcd as well since that will allow faster connections to the cdrom.
Wireless
The wireless chip is supported by the madwifi project. I obtained the source code from them, compiled the modules, loaded them (all according to their documentation) and the wireless chip was recognized. I couldn't test it, though, due to lack of wireless around here. In the meantime, Michael Schulz told me that it works for him. Aki Mimoto adds that it works great. Scanning, attaching, wep based on 802.11b all work with madwifi. I have since then used wireless as well.
Michael Rasmussen adds that he got the wireless LED to work with the madwifi driver. After the driver is loaded, you can simply execute the following commands:
/sbin/sysctl -w dev.ath0.ledpin=1 /sbin/sysctl -w dev.ath0.softled=1
Michael notes that these commands should be placed in some sort of init.d script. If you use waproamd for automatically activating wireless, it seems appropriate to put the commands somewhere at the beginning of /etc/init.d/waproamd.
Power management
APM
APM shows the battery status, and suspend to RAM also works if a few things are taken into account. In particular, the tg3 driver has some problems with suspend. After resuming, the network no longer works. I have reported this bug and I suspect it will be fixed in the near future (maybe it has been fixed already, I have no tried for a while). In the meantime, there is a fairly easy workaround: bring the network interface down, remove the tg3 module, load it again, bring the interface up and there you go. Alternatively, use the bcm5700 driver which does not display this problem. Note that I've recently upgraded to 2.6 and I don't see this problem anymore. 2.6 enables ACPI by default so in order to get APM to work on 2.6 you have to boot with the acpi=off parameter and then load the apm module.
ACPI
Aki Mimoto reports that ACPI thinks there is no battery. However, when you take the battery out and put it back in, Linux will recognize it. HP has been working on a fix for this and this bug is fixed in their current BIOS upgrade available from their web site. ACPI suspend is known not to work; some progress has been made on this, but it still does not work.
Heat Problems
It seems that the machine has various heat problems which might be related to CPU frequency scaling. When the machine operates at its highest frequency, the fans will power on and after a while the machine often turns itself off! This usually doesn't happen during normal operation (mail, web) but is quite common when compiling a large piece of software. As a workaround, you can temporarily limit the frequency so they machine won't get too hot:
# Check which frequencies are supported cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies 600000 800000 1000000 1200000 1400000 1600000 # And limit the machine to a low frequency echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
Gunnar Florus Johansen writes that he has just discontinued the use of powernowd and switched to the "ondemand" scaling governor, letting the kernel decide rather than a user application. For me this makes more sense as the actual scaling is done in the kernel anyway.
echo -n ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
I have personally not tried if this makes an improvement but it's worth giving it a go.
Radeon PowerPlay
Fabian Kneißl pointed out to me that the Radeon IGP video chip has a power-saving feature known as PowerPlay which can be activated by patching the XFree86 package. According to some benchmarks on the web, this feature leads to an improvement of approximately 18%. I tried it myself and archived 12% more time on battery, so it seems worth to enable this feature.
There are instructions how to patch and recompile the XFree86 package. The instructions are in Spanish but if you just follow the commands listed there you should end up with an XFree86 package which has the PowerPlay feature. Alternatively, you can simply download my xserver-xfree86 package (5.5 MB) and install that. Furthermore, you have to edit /etc/X11/XF86Config-4 and add the following line in the device section:
Option "DynamicClocks" "true"
If you use a backport of X.org to sarge, you have to use the following line:
Option "DynamicPM" "true"
After installing the patched package and adding this option, you should see the following in /var/log/XFree86.0.log when starting X:
(**) RADEON(0): Option "DynamicClocks" "true" ... (II) RADEON(0): Dynamic Power Management Enabled
Software Suspend
An alternative to APM's suspend to memory is Software Suspend (swsusp2). It saves the contents of memory to disk and powers the machine down. When you start your machine again, it reloads the contents and you can continue from where you left off. The advantage of swsusp is that the laptop is turned off after suspend and so requires no battery power. This might be advantageous to APM suspend to memory if you want to suspend your laptop for longer periods.
Michael Rasmussen recently mailed me to say that he got swsusp2 (Software Suspend version 2) to work on his nc4000. Using Michael's config file, I built a kernel using the swsusp2 patches (version 2.1.5.7 for kernel 2.6.9). I followed swsusp2's HOWTO, applied the patches to a pristine 2.6.9 kernel from kernel.org (not to Debian's kernel sources since there are some conflicts with the swsusp2 patches), and booted with the command line options described in the HOWTO. Please be aware that swsusp requires that support for the chosen file system is compiled into the kernel and not as a module.
After booting the swsusp2 enabled kernel, I installed the hibernate package from Debian and started /usr/sbin/hibernate. This saved the contents of my memory to disk and powered off my machine. When I turned the machine on again and booted the swsusp2 kernel, it automatically restored the system.
Modem
Not tested. Bdale Garbee said he got it to work.
IRDA
Not tested.
PCMCIA
Aki Mimoto says that it works well, and Bdale Garbee used it successfully with 2.6.0-test on Debian. I tested it with 2.4 on Debian and it worked. I installed the pcmcia-cs and kernel-pcmcia-modules-2.4-686 packages and typed /etc/init.d/pcmcia start. This loaded the yenta_socket module and the PCMCIA card was recognized.
Useful utilities
Michael Rasmussen pointed out that laptop-mode-tools is a useful package for laptops. The package contains several userland scripts that can be used to save considerable battery power. By default, this package remounts your partitions with the noatime parameter when you are on battery. Unfortunately, this breaks mutt, a popular e-mail client. Please be sure to read through the documentation of this package and to look at the configuration file, /etc/laptop-mode/laptop-mode.conf.
The package powernowd will control the CPU speed depending on the workload of your machine. This only works with the 2.6 kernel and you need to load the speedstep-centrino and cpufreq-userspace modules. Up to kernel 2.6.9, these modules would only work when ACPI was enabled, but since 2.6.10 they also work with APM.
Caveats
- Aleksandr Koltsoff told me that memdisk (a program to boot e.g. from a floppy image via the network) does not work; interestingly, I observed the same so this seems to be a bug in the nc4000. Aleksandr observes that "there's definitely something fishy about the BIOS since for example using memdisk with syslinux doesn't work on nc4000, although on nc6000 it works as expected."
- When the laptop is in the docking station and I connect a USB memory stick during bootup, the system freezes hard.
- I'd like to hear from other nc4000 users how long their battery lasts. I seem to be getting less than advertised (about 1.45 hours).
- The machine seems to have various heat problems under Linux (maybe related to CPU frequency scaling), see above.
Configuration Files
Put the following in your /etc/modules file in order to load the modules needed for the nc4000:
usb-ohci usb-storage # graphics radeon # sound trident # ethernet tg3
Kernel 2.6 requires the following modules:
ohci-hcd mousedev psmouse keybdev drm # sound trident # ethernet tg3 # ACPI ac fan thermal processor battery button # Speedstep speedstep-centrino cpufreq-userspace
Links
- Bdale Garbee's Debian on the HP nc4000 page.
- Bob Proulx's Debian GNU/Linux on the HP Compaq nc4000 Laptop page.
- Matt Taggart's Debian GNU/Linux on the HP nc4010 laptop page.
- The Battery University, a web site with a nice presentation on battery information.
Acknowledgements
Thanks to Herbert Xu for kernel related help. Jerullah K. and Aki Mimoto for various tips. Michael Schulz for telling me that wireless works, and Bdale Garbee for miscellaneous help. Aleksandr Koltsoff for information on booting from an USB memory stick. Bob Proulx for various stuff. Michael Rasmussen for information about swsusp, X.org and the wireless LED. Fabian Kneißl for information about Radeon's PowerPlay feature.