Setting up Debian (AMD 64 port) on the HP nx6125

History

Last updated: 05 December, 2006.
macerl at telkomsa dot net

Introduction

The following is a brief description of what you need to do to get a working Debian (AMD 64 port) system on the HP nx6125. This page was written partly to document what I've done so far to set up my HP nx6125, so that I have something to reference should I need to do it again, and partly to help out other users who might find this information useful. I should add that I did not figure out all I describe below myself. I learned most of this from sources on the web and from the Debian newsgroups. (The Debian AMD 64 newsgroup is particularly active and people are keen to help. My thanks to all who helped out with my queries.) Further, I do not claim to be an expert on this machine. It is my first laptop and it has been a steep learning curve, so if there are any innaccuracies in what I've written below, then you can email me at: macerl at telkomsa dot net.

This is an updated (December, 2006) version. The old version of this document can be found here.

Installing Sarge/Etch

You will probably need to boot with vga=771 if you are using the Sarge (3.1) Debian installer, otherwise you won't see anything and the installer will hang. I recently re-installed my entire system with a netinst CD image (a daily snapshot from www.debian.org/devel/debian-installer on or around July 10, 2006) and it worked very well, indeed. The 2.6.15 kernel was new enough that DMA was enabled on the HD and I didn't have to bother about the double timer problem that plagued earlier kernels. I chose not to select a mirror, because I wanted a minimal initial install, and I only checked standard system and laptop. Then I fetched a recent 2.6.17.x kernel from www.kernel.org, applied Alexey Starikovskiy's 4th patch and compiled, and installed (see below for details). Finally, I edited my /etc/apt/sources.list, added my usual mirror and installed all the necessary software, xorg, KDE, etc.

Kernel bugs affecting the HP nx6125

Description and solution

The HP nx6125 seems to require a multi-threaded ACPI system to operate correctly. Currently the linux kernel handles ACPI events in a single thread, which leads to blocking and consequently erratic fan behaviour. You can find more details at kernel bug #5534).

Thankfully the problem is now solved. There are two patches available: see comments #159 and #160 at the above bugzilla link. Apply these patches with the patch utility as follows

# cd /usr/src/linux-2.6.18.2-159-160
# patch -p1 < full_path_to_patch

Then edit the Makefile and append something like -159-160 to the EXTRAVERSION. Configure and build the kernel as follows

# make menuconfig
# make
# make modules_install
# cp arch/x86_64/boot/bzImage /boot/vmlinuz-2.6.18.2-159-160
# cp System.map /boot/System.map-2.6.18.2-159-160

Finally, update your /boot/grub/menu.lst to point to your newly-compiled kernel and reboot.

When kernel 2.6.19 is released we won't need to patch our kernel anymore! (BTW Happy 1st birthday bug #5534!)

Setting up X.org

ATI X300 graphics adapter

X.Org >= 6.9

To get X working with your ATI graphics adapter you need to use the radeon driver and have a section like this in your /etc/X11/xorg.conf.

Section "Device"
        Identifier      "Generic Video Card"
        Driver          "radeon"
EndSection

When I installed xorg 7.0 from a fresh base install I found that all my hardware was correctly identified (except that xorg installed the vesa driver, if I remember correctly). My synaptics touchpad was autodetected and configured with very sane defaults. However, I did turn off double-tapping with the "MaxTapTime" "0" line marked in red below

Section "InputDevice"
        Identifier  "Synaptics Touchpad"
        Driver      "synaptics"
        Option      "SendCoreEvents" "true"
        Option      "Device" "/dev/psaux"
        Option      "Protocol" "auto-dev"
        Option      "HorizScrollDelta" "0"
        Option      "MaxTapTime" "0"
EndSection

The problem with the radeon driver is that I could not get it to use an external monitor correctly. Therefore your laptop becomes pretty useless as a tool for making presentations. Enter ATI's proprietary driver, fglrx.

Using ATI's fglrx

As of version 8.26.18, ATI's proprietary accelerated driver has worked very well on the HP nx6125. For me the primary benefit is that the driver recognises a second monitor out of the box (no extra /etc/X11/xorg.conf stanzas needed). A secondary reason is that you get 3D acceleration which allows you to use 3D screensavers and play PlanetPenguin Racer.

To use fglrx you need to go to www.ati.com and download the latest driver. Then (following roughly the steps for method 2 at wiki.cchtml.com/index.php/Debian_Installation_Guide) you do

# apt-get install module-assistant build-essential fakeroot dh-make debconf
# sh ./ati-driver-installer-8.27.10-x86_64.run --buildpkg Debian/etch

Which should create about 5 .deb packages in your current directory. You need to install the following .deb files as follows:

# dkpg -i fglrx-control_8.27.10-1_amd64.deb
# dpkg -i fglrx-driver_8.27.10-1_amd64.deb
# dpkg -i fglrx-kernel-src_8.27.10-1_amd64.deb

The next step in the installation is to build the kernel driver using

# module-assistant prepare
# module-assistant update
# module-assistant a-i fglrx

Finally, update your /etc/X11/xorg.conf with

# aticonfig --initial

Reboot and you should now have 3D accelerated X and the ability to drive an external monitor attached to your VGA port.

The only disadvantage that fglrx has compared to the radeon driver is that the LCD brightness keys don't work. However, a bit of Googling uncovered a workaround. To change your LCD brightness while using fglrx simply go to a text console with ctrl-alt-F1, change the brightness as usual with fn-f9 or fn-f10 and then switch back to X with ctrl-alt-F7. Your LCD brightness should now be changed.

NOTE: Having trouble building fglrx 8.30.3 for Debian etch with xorg 7.1? You can find the solution at this link. In short the solution is to use --buildpkg Debian/experimental even if using etch. Before you do this you need to unpack and edit "packages/Debian/overlay/experimental/rules". Replace the strings containing the directory etc/ with etc/ati/. Then build. See the forum above for details.

Setting up wireless ethernet

Introduction

Linuxant's WLAN DriverLoader worked very well for me for about a year. Linuxant have just released a new version (2.35), but in the meantime the folks at Ndiswrapper and the bcm43xx kernel module people have made great gains. On a recent trial I found that ndiswrapper 1.28 works, but sadly freezes my machine at intervals ranging from about 20 mins to several hours. This is a showstopper; so I'm back to using Linuxant's DriverLoader (if someone can point me to a version of ndiswrapper that works stably with the HP nx6125, I'd be very happy to hear from them). The native Broadcom bcm43xx drivers also work, but only at a peak throughput of 11Mbps and only within a relatively short range of an AP. This will improve, I'm sure, and kudos to the broadcom kernel people for this astonishing feat of reverse engineering!

Ndiswrapper

Anthony Butler (anthony at butler dot co dot nz) kindly sent me detailed instructions on how to get ndiswrapper working with the Broadcom ethernet adapter. You can find them here. They provide a useful example of how to install ndiswrapper the "Debian way". For more cutting edge versions of ndiswrapper you must build from source, so I'm going to explain that procedure here. However, be warned that on my machine I have tested both ndiswrapper 1.23 (Debian repository; Debian method of install) and 1.28 (sourceforge) and in both cases I experienced random freezes/lockups.

I had some success with Ndiswrapper 1.23 which is currently (16-11-2006) in etch. But there was an annoying message in my syslogs:

Nov  6 13:51:56 dilbert kernel: ndiswrapper (iw_set_freq:376): setting configuration 
failed (00010003)

So, I went to sourceforge and picked up the most recent ndiswrapper 1.28 and built straight from source. Ndiswrapper 1.28 works perfectly (apart from the random freezes I mentioned ;-)) with the Broadcom 4318 and there are no errors in the syslogs. This is how I did it (following the precise instructions that came with ndiswrapper)

# cp ndiswrapper-1.28.tar.gz /usr/src/modules
# cd /usr/src/modules
# tar -zxvf ndiswrapper-1.28.tar.gz
# cd ndiswrapper-1.28
# make uninstall
# make
# make install

After that sequence of commands you should have the ndiswrapper module installed. We now need to install the 64 bit Windows driver. First get it and save it somewhere useful.

$ wget  ftp://ftp.support.acer-euro.com/notebook/ferrari_4000/driver/winxp64bit/80211g.zip
$ unzip 80211g.zip

This should create a directory that looks something like WL_T60H906\(8.0.10.0\,XP64_logo\)/. Change into that directory and install the windows driver via

# ndiswrapper -i bcmwl5.inf

The Windows driver should now be installed. To see that all went well issue

# ndiswrapper -l

which should report

installed drivers:
bcmwl5          driver installed, hardware (14E4:4318) present

If you've set up the firmware for the bcm43xx kernel module correctly (see later) you'll see instead

installed drivers:
bcmwl5          driver installed, hardware (14E4:4318) present (alternate driver: bcm43xx)

If all is well, then load the ndiswrapper module with

# modprobe ndiswrapper

If you're using a kernel that has built the bcm43xx module, then make sure that you have added the line

blacklist bcm43xx

to your /etc/modprobe.d/blacklist file. To automate the loading of ndiswrapper at boot add it to your /etc/modules.

DriverLoader

I have had much success with DriverLoader. It is rock-solid stable and will not freeze your machine. Easy to set up and configure from source. On the downside, after the 30 day trial period is up, you will have to pay US$ 20. As of this writing the current version is 2.35, which works with 2.6.18.x system kernels.

You will need to download and install DriverLoader from www.linuxant.com. I downloaded the tarball and installed from source (METHOD C at the link below). Took all of five minutes. You can find detailed instructions on how to install DriverLoader at www.linuxant.com/driverloader/wlan/install.php. You will also need to download/apply for a trial license from Linuxant at www.linuxant.com/store/. (Remember this step. The lack of it caused me much frustration.) Without a trial license you will be able to see your access point, but be unable to connect to it. Finally, you will need the 64bit Win XP drivers from ftp://ftp.support.acer-euro.com/notebook/ferrari_4000/driver/winxp64bit/80211g.zip. I have contacted HP about the availability of 64 bit Win XP drivers for the Broadcom on the HP nx6125 and the message I received was "no plans to develop them yet" (go figure!).

If you only need to connect to open wireless networks and are content to manually bring the interface up when needed, then you can simply add a stanza like the following to your /etc/network/interfaces (assuming you're using DHCP to get an IP address)

iface eth2 inet dhcp
  wireless-mode Managed
  wireless-essid ANY

which will connect to any available wireless network when you bring the interface up with

# ifup eth2

If you want the interface to be brought up automatically, and would like something a little more sophisticated then read the section on WPA supplicant.

Use the native Linux Broadcom bcm43xx drivers

I've tested these (briefly) and they work with the HP nx6125, which has a Broadcom BCM4318 [AirForce One 54g] (in my case). I have used them successfully with wpa_supplicant, using the setup described in section on WPA Supplicant below. However, I have not done exhaustive tests. Most of the information below comes from a useful gentoo source which can be found here.

To use the bcm43xx kernel module you'll need a 2.6.17 or newer kernel. I am using vanilla kernel 2.6.18.2. In your kernel configuration enable the following. In the Networking --> section enable

Networking -->
	<M>   Generic IEEE 802.11 Networking Stack                           
	[*]     Enable full debugging output                                 
	---     IEEE 802.11 WEP encryption (802.1x)                          
	<M>     IEEE 802.11i CCMP support                                    
	<M>     IEEE 802.11i TKIP encryption                                 
	<M>     Software MAC add-on to the IEEE 802.11 networking stack      
	[*]       Enable full debugging output                               

In the Device drivers --> Network device support --> Wireless LAN (non-hamradio) --> section enable

Device drivers--> Network device support --> Wireless LAN (non-hamradio) -->
	<M>   Broadcom BCM43xx wireless support
	[*]     Broadcom BCM43xx debugging (RECOMMENDED)

Now build the kernel in the normal way. Then install the Broadcom firmware cutter with

# aptitude install bcm43xx-fwcutter

Download the Windows 64 bit drivers as described in the Ndiswrapper section above. Unzip them and change into the directory as listed above. Now issue an

# bcm43xx-fwcutter -w /lib/firmware BCMWL564.SYS

and check that you have generated a whole bunch of .fw files in /lib/firmware. Configure the wlan0 interface as described above (on my system the bcm43xx module introduces the wlan0 device) and in the WPA supplicant section below (if you use wpa_supplicant).

Finally we need to

# modprobe bcm43xx

and watch dmesg or syslog for messages. Alternatively just reboot. If you haven't already blacklisted the bcm43xx module, it should be autoloaded by hotplug. Check your system logs and make sure the driver is loaded with lsmod. If you've been using ndiswrapper, then make sure that you haven't loaded it as well. If all went well you should now have a working native Broadcom 4318 driver! Configure your interface wlan0 as described (for eth2) in the section on Driverloader above, or, if you need encryption, move on to the next section to install and configure wpa_supplicant. At the moment I cannot get connect speeds greater than 11 Mbps, but I suspect this will improve with subsequent kernel versions as the support for the Broadcom BCM4318 improves.

Note: There is nothing to stop you having ndiswrapper and the bcm43xx drivers on your machine at the same time and to switch from one to the other. Just make sure that you don't try to use them simultaneously ;-). If you want to use ndiswrapper just blacklist the bcm43xx module by adding the line

blacklist bcm43xx

to your /etc/modprobe.d/blacklist file. Conversely, to use the bcm43xx module, remove its blacklist and ensure that you remove the ndiswrapper module using rmmod, or comment it out in your /etc/modules and do a reboot.

WPA supplicant

Issue an

# apt-get install wpasupplicant

To configure wpasupplicant for roaming mode I followed the instructions in /usr/share/doc/wpasupplicant/README.modes.gz and copied the file /usr/share/doc/wpasupplicant/examples/wpa_supplicant.conf.template to /etc/wpa_supplicant/wpa_supplicant.conf. Next I edited it so that it looks something like

# Minimal /etc/wpa_supplicant.conf to associate with open
#  access points. Please see
#  /usr/share/doc/wpasupplicant/wpa_supplicant.conf.gz for more complete
#  configuration parameters.

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0

eapol_version=1
ap_scan=1
fast_reauth=1

### Associate with any open access point
###  Scans/ESSID changes can be done with wpa_cli
network={
        ssid=""
        key_mgmt=NONE
}

### Home network
network={
        ssid="the-name-of-my-home-network"
        key_mgmt=WPA-PSK
        psk="mycleverpassphrase"
}

The first network={..} block will associate with any open wireless network. The second is customised to my home network. Add networks as appropriate.

Then, I edited /etc/network/interfaces so that my wlan0 (for ndiswrapper and the bcm43xx module) stanza looks like:

allow-hotplug wlan0
iface wlan0 inet manual
        wpa-driver wext
        wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

If you're using driverloader 2.34 and above then you should simply replace wlan0 with eth2 (in my case). Driverloader 2.34 and above use the wext driver.

Now, each network={...} block in your /etc/wpa_supplicant/wpa_supplicant.conf can (I did not do this in the above segment) be given a unique logical identifier by assigning a string to the id_str variable, for example id_str="my_home_network". For each such logical network/interface you must supply the necessary configuration code in /etc/network/interfaces. This allows wpa_supplicant to perform per network initialisation tasks, such as assigning an IP address to your card via DHCP when associating with your home network, whilst setting up a fixed IP for your work network, say. In this example you will have lines similar to the following in your /etc/network/interfaces file

# id_str="my_home_network"
iface my_home_network inet dhcp

#id_str="my_work_network"
iface my_work_network inet static
   ...
   ...

If you omit to set the id_str logical identifier in a network={...} block in /etc/wpa_supplicant/wpa_supplicant.conf then it defaults to, surprisingly ;-), default. In my case I set my IP address via DHCP both at home and at work and hence it is not necessary to distinguish between these cases. For my purposes the single line defining the default configuration method suffices

# this behaviour is used if no matching id_str is found in wpa_supplicant.conf
iface default inet dhcp

My entire wireless network configuration in /etc/network/interfaces looks something like

allow-hotplug wlan0
iface wlan0 inet manual
        wpa-driver wext
        wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

# this behaviour is used if no matching id_str is found in wpa_supplicant.conf
iface default inet dhcp

Much more complicated setups can be implemented. As always read the wpa_supplicant docs. Once you're ready reboot, modprobe ndiswrapper and you should associate. I've found that sometimes I don't immediately associate with an autoload of the ndiswrapper module. To fix this, after a failed association simply open up a root console and type

# wpa_cli reassociate

and wait a few seconds. You should then associate.

Firewire

Nothing to configure; it works out of the box. I installed kino and now I can control my Sony digital video camera and download the DV files directly to my laptop.

Bluetooth

Bluetooth works fine. Just install kdebluetooth, bluez-utils and their dependencies. You should then be able to transfer files between your PC and other bluetooth devices (like my newly acquired Dell Axim X51v PDA ;-)) via OBEX push.

SD card reader

Works fine, after a bit of tweaking. I compiled my kernel (2.6.18.2) with the following options set

#
# MMC/SD Card support
#
CONFIG_MMC=y
# CONFIG_MMC_DEBUG is not set
CONFIG_MMC_BLOCK=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_WBSD=m

Presumably you could modprobe the corresponding modules, but I haven't tried this. Now issue an

$ lspci

and look for the following lines

02:04.2 FireWire (IEEE 1394): Texas Instruments OHCI Compliant IEEE 1394 Host Controller
02:04.3 Mass storage controller: Texas Instruments PCIxx21 Integrated FlashMedia Controller
02:04.4 Generic system peripheral [0805]: Texas Instruments PCI6411, PCI6421, PCI6611, PCI6621, PCI7411, PCI7421, PCI7611, 
PCI7621 Secure Digital (SD) Controller

Isolate the Mass storage controller line, which is the red line in my example above. Now note the numbers in boldface. They constitute the PCI address of the Flash media controller. Then manually issue as root, before using the device

# setpci -s 04.3 4c=0x22

where the bold numbers correspond to the ones noted in red above. You should now have a functioning, if slow, SD card reader. The reference for the above hint can be found here. Pop in an SD card and it will be autodetected (at least in KDE) producing a beautiful icon on your KDE desktop.

When copying lots of data to and from an SD card, pay attention to the flashing lights on your card reader. Even though your window manager says the files are copied and you've clicked "safely remove", I've found, in KDE, that the actual process seems to be buffered. Wait until all lights stop flashing, indicating no activity, before removing the card (sometimes several minutes for big files).

Volume control keys

Credit for this goes to http://gentoo-wiki.com/HOWTO_Use_Multimedia_Keys. Create a file called .Xmodmap in your $HOME directory containing the following:

! The settings below enable the volume up, down and mute keys on the
! HP nx6125. All we have to do is set up this .Xmodmap file. Nothing else
! in KDE

keycode 160 = XF86AudioMute
keycode 176 = XF86AudioRaiseVolume
keycode 174 = XF86AudioLowerVolume

To test your .Xmodmap file execute

$ xmodmap ~/.Xmodmap

Now press any of the three top right hand buttons on your laptop (the ones with the loudspeaker icons on them). If you are using KDE then they should work immediately. Upon pressing either of the volume up or down keys, a window overlay should briefly appear giving you the volume expressed as a percentage of maximum. If the mute key is pressed the orange LED should light and a window overlay with "Mute On" should appear briefly (this toggles the current mute state of course). Also, the blue fn-shifted volume control buttons on f5, f6 and f7 will now work. Just hit fn-f6, for example.

If you use Gnome then there may be more that you need to do. See http://gentoo-wiki.com/HOWTO_Use_Multimedia_Keys.

(KDE Specific) Now create a file called Xmodmap in ~/.kde/Autostart containing

#!/bin/sh

[ -f $HOME/.Xmodmap ] && /usr/bin/xmodmap $HOME/.Xmodmap

Make it executable with

$ chmod +x ~/.kde/Autostart/Xmodmap

and your volume control keys should be set automatically every time you log in to KDE.

Fingerprint reader

Haven't really tried. Don't know if I really care.

Suspend

I'm really clueless when it comes to suspend to disk and suspend to ram. If any kind soul knows how to set this up properly on the HP nx6125, and can point me to a HOWTO, I'd be very grateful. I could link it in here....