Skip to main content

MadWifi HAL DKMS Mini-How-To

Update: Ubuntu Karmic Koala 9.10 seems to support my card at full 54Mbit, however, I get max 12Mbit upload/download rate… Interesting…

Update: Ubuntu Jaunty 9.04 has ath5k driver which supports my card out-of-the-box without binary blobs and dkms magic is no longer needed :). Max speed is around 11Mbit with ath5k though

devices with newer radios (RF2413 and up) have a different way to handle tx power control and because we don’t support tx power calibration yet, they have problems transmitting on rates above 18M. On these cards try to manually set 11M to get better results.

I happened to own a Wi-Fi card which is not supported by LRM (AR5BX63, Ethernet controller: Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter (rev 01)). Nearly every time my kernel modules got updated from the repository I got ‘Revision not supported’ message and had to perform reinstallation of the modules from branch of MadWifi SVN repository. After upgrade to Intrepid (which has DKMS support built in) I decided that the same approach may be applied to madwifi-hal.

So, here’s how it can be done:

  1. Download madwifi-hal- from madwifi SVN

    svn co

    Note that madwifi project has changed their domain name from to last November.

  2. Put the following dkms.conf to the madwifi-hal- directory:

    CLEAN="make clean"
    MAKE[0]="make modules KERNDIR=/lib/modules/$kernelver"
  3. Create an archive for the directory:

    tar cfz madwifi-hal- madwifi-hal-
  4. Load madwifi-hal to DKMS source tree:

    sudo dkms ldtarball --archive=madwifi-hal-
  5. Build madwifi-hal:

    sudo dkms build -m madwifi-hal -v
  6. Install madwifi-hal:

    sudo dkms install -m madwifi-hal -v

Now when kernel is updated or reinstalled – madwifi will be automatically rebuilt.

Virtualization on Linux

I’ve been asked several times about what software I prefer to make and run virtual machines.

Here’s my summary.

VmWare Workstation

I’ve started using VmWare Workstation since version 3.something. This is an awesome piece of software that nicely integrates into any Linux distribution. It has nice GUI with no manual file editing is required. Now it supports headless mode and multiple snapshot that makes these machines indispensable when used for development purposes. It is a commercial product and it costs money. I stopped using it when GSX server went out as a free product under VmWare Server name.

VmWare Server

Basically a stripped down version of VmWare Workstation. Headless mode, management console, support of snapshots. It requires serial number that can be obtained for free from VmWare web site. We have experienced some minor performance and network problems on VmWare Server guests even when host CPU was not busy. This may have changed with VmWare Server 2 that is being rolled out now though. If you need a solution that will be easily controlled remotely with no manual config file changes then it may be suitable for you. The other disadvantage is the networking setup: it is easy and almost no configuration is needed, but in case of Host-Only networking all hosts do connect to the hub inside the vmnet* host interface. In case you need some strange routing setup you may not like it.

You can download VmWare Server and VmWare workstation from VmWare web site.


Completely OpenSource software. Used as development environment by OpenMoko and Android projects and can emulate wide range of architectures. It requires kqemu kernel module to speed up things and it is command-line driven application. It contains possibility to administer it remotely via TCP or local PTY socket. It is extremely simple to start. It uses regular tun/tap device found in your kernel to create virtual networking that appear as tun interfaces on the host and ethernet ones on your guests. No performance problems were found even under stress test. We have successfully run FreeBSD, Windows XP/2003, OpenSolaris and Linux guests using QEMU. I am using it now on my workstation. You might also need libvirt to make your virtual machines management easy.

You can download QEMU from Fabrice Bellard’s web page. You will also need kqemu sources if you want it to work really fast.


Kernel-based Virtual Machine is a project by Qumranet (now owned by RedHat) that lets linux kernel be a hypervisor for guest machines. The core of the system is now accepted into the mainline kernel. It uses AMD-V and Intel VT-X technologies to let unmodified guests to run under linux hypervisor by exporting kvm device node. Later on a modified version of Qemu uses this device to set up memory mappings and interrupts. It has dramatically developed over time, the early versions contained some incompatibilities with FreeBSD guests but now it looks like all is working. I am using it at the virtualization server providing Win2K3, Oracle Enterprise Linux with database and FreeBSD guests.

You can get KVM kernel module and userspace application from KVM web site.


User Mode Linux. This is as simple as running linux kernel as a process in the host system. You can have virtualized storage devices and network. You just configure some stock kernel with ARCH=um and get a regular ELF binary. Unfortunately I haven’t managed to do a lot with this setup yet but it looks pretty good under average webserver load and Ubuntu upgrade testing. There is a limited admin console (uml_mconsole) that will let you send ctrl+alt+del event or halt your guest kernel. It consumes a lot less resources than all of the mentioned above solutions because it does not need to emulate all the diversity of the hardware. If your project involves linux-only guests then you may want to give UML a try. After all it does not require patching your host kernel as it is the case with OpenVZ/Virtuozzo and you can apply all resource constraints to the running guest kernel that can be applied to all other processes. You can even run different kernel versions with different options.

You can get UML utilities from User-Mode-Linux web page. You can build UML kernel with sources from


I haven’t used VirtualBox a lot, the version shipped with Ubuntu 7.10 had CPU usage problems but it looks like these had been fixed since. It has nice UI with no manual tweaks so it can be used right out-of-the-virtualbox by everyone.

You can download VirtualBox from VirtualBox web site.

That’s It

Unfortunately I had a lot less experience with Xen because it would have required me to modify my running system. OpenVZ/Virtuozzo were used only as a guest (I have one VPS running under OpenVZ). These options may be checked in the future and results will probably be posted here.

This should not be taken as the authoritative source but if you see something that does not match at all, please leave a comment about it.

Libvirt Bridged Setup

Being fond of different automatic setups when things just work after a bit of manual tweaking, i decided to let OpenSolaris go to the home network, i.e. have a nice 192.168.1.x address from my Linksys router and access the internet as if it was a regular machine.

After reading this, I’ve spent a couple of moments trying to create a network definition that could simply bridge vnet{something} to my ethernet card. I got some iptables rules added but no real effect. Until I read Bridge to LAN carefully. I should have just specified the name of the bridge in VM configuration instead of a global one. Phew.

So if you want to do this kind of setup, first (on a Ubuntu system) create bridge definition in /etc/network/interfaces like

auto br0

iface br0 inet static
    bridge_ports eth0

And in your vm configuration file simply attach the virtual ethernet to the bridge:

<interface type='bridge'>
  <source bridge='br0'/>
  <mac address='52:54:00:00:00:11'>

Yep, libvirt adds another level of configuration that could be easily performed in your own scripts, but I just tired to maintain my own set of scripts that perform the same functions as libvirtd does.

Kernel Virtual Machine

Yummy! No more VmWare, all my 3 development systems run Qemu and KVM. Machines are managed by libvirt.

Why? Because it is easy, it is a part of the kernel, it is fast and efficient.

Yes, there are bugs. I found one that is related to FreeBSD guests reboot that does not happen to regular Qemu. This is not a show-stopper. I like it :)

Everything Bridged

I must admit that I have some networking concepts missing or killed in action. Therefore when I achieve working setup I become as happy as i don’t know who.

Today I finally managed to bridge wl0 to eth0.0 and both wired network and wireless one are connected now. Before that I spent a couple of hours trying to bridge two TAP interfaces for 2 qemu virtual machines. While the setup looked like trivial for VirtualBox, with QEMU it is not that straightforward or I am missing something obvious…

Yes, I am. By default QEMU assigns the same hardware address (MAC) to all the virtual machines which in turn makes routing impossible:

rtg$ arp -a
pb-slave.vm.desert.intra ( at 52:54:00:12:34:56 [ether] on br0
pb-master.vm.desert.intra ( at 52:54:00:12:34:56 [ether] on br0

And I can host all the virtual machines on the same network, woo-hoo!

VirtualBox uses TAP device as well but it keeps eating my CPU even when guest machines are idle.

However this experience allowed me to configure bridging at home in less than 5 minutes, remove a lot of rules from netfilter configuration…

Practice makes perfect.

302 Moved Temporarily

So, I have moved to Kiev with my girlfriend, congratulations :)

As a part of accommodation process, I have signed a contract with Volia-Broadband ISP and bought a new router. Having had a lot of interesting moments with Netgear WGR614v6 (if I’m not mistaken) I decided to take Linksys router now, especially when I found out that it runs Linux. So I now have Linksys WRT54GL (L stands for Linux) ready to serve.

The default firmware does not permit any tampering using telnet/ssh, but OpenWRT claims to fully support this device (since WRT614G was the reason the project launched).

So far I am pretty satisfied with the setup via the Web interface, though I must admit I had to refer to the User Manual bundled on CD.

Before I purchased the router my laptop was functioning as the AP. It turned out that Ad-Hoc mode is not well supported by madwifi drivers i use (, grabbed from SVN) resulting in kernel panic after a while.

Alps Touchpad – Bad Touchpad

Sent a mail to local Acer service centers asking whether they can replace Alps touchpad with Synaptics one. Waiting for the answer…

The Alps GlidePoint device is the best thing you need to start looking for a mouse for your laptop. It is low-resolution, inaccurate, and completely non-finger-friendly. However all vendors make some laptops with Alps and some with Synaptics, even within one product line. C’mon Acer, was it that expensive to ship a decent input device?

I visited store again after buying this laptop and checked all laptops against touchpad responsiveness and sensitivity… And there were only 2 variants. Those that performed well and those that performed in a weird way, so this is pretty common :(

Update (2008-07-15)

So I got a response from one of our authorized service centers. It is promising enough as well as daunting. They can order Synaptics touchpad but in case European Acer part stock does not have Synaptics, they will receive Alps. Well, in worst case I’ll have 2 unusable pointing devices (which is not that bad, since sometimes i want to break this crappy device and having a spare part is a plus :) ).

The FRU of this unit is 56.TK901.001, TOUCHPAD BD.SYNAP. It seems that Acer tends not to differentiate these pointing devices. Yes, they are interchangeable, yes, they both work. Yet one of them is superior than the other. The price ranges from $12 to $25 (work is not included) which I am willing to pay to have Alps touchpad replaced with Synaptics one. To be or not to be :) ?

Aspire 5520 Alps Touchpad Joystick

Just realized that I have not posted “this thing works under linux”-style note for my brand new Acer Aspire 5520G. So far I have managed to migrate my data completely from my old Acer Aspire 3000LC, brought wifi up and now I am happily using it


There are some minor issues, though. My old laptop featured outstanding Synaptics touchpad which was not only supported by linux but the manufacturer actually provided all the required information for drivers to be written. This turned out not to be the case with Alps. Although their device is PS/2 one, reverse-engineering was required to get it working. It is now supported by linux kernel psmouse module (if you enable CONFIG_MOUSE_PS2_ALPS) but for me it looks like support is not complete. While I am not yet sure what exacly drives me mad about it, be it low sensitivity when you need high one or accidental tapping when you touch it as light as possible with our palm…

One thing that is now actually missing is support for four-direction joystick located between left and right “mouse” buttons. By default joystick works partially, vertical axis is upside-down and horizontal axis does not generate any events. So I took advantage of my sick day off and added support for correct processing of touchpad joystick events. Here’s my /proc/bus/input/devices entry:

I: Bus=0011 Vendor=0002 Product=0008 Version=7325 N: Name="AlpsPS/2 ALPS GlidePoint"

You can download the updated kernel patch here: alps-aspire5220-take2.patch. You will not need to patch synaptics driver. As a drawback, it also affects Dell Vostro 1400 which contains the same touchpad hardware, but it is missing the joystick completely (according to what I saw on the pictures posted). So this should not be an issue.


This idea came to me almost the same day I got a1200. Then this question was brought up in motoezx conference. So here it is, lightsensor daemon that makes your camera work as light sensor which is missing in A1200. Checks your camera every 5 seconds and adjusts the backlight appropriately.

Usage: lightsensord [-d] [-f] [-m level]
        -m level        Set minimal brightness level (0..100)
        -e level        Set brightness level on camera open error (0..100)
        -d              Debug mode
        -f              Run in foreground

Source code and compiled binary for a1200 are available here: lp:~rye/+junk/lightsensord-0.4 (updated). Version is 0.3 at the time of writing. The thread for this app is here:

May your screen be always readable :)