I attempted an install of Mandriva 2007 Spring on my Acer 5101 laptop (Atheros 5005g card). It reports that Madwifi 0.9.3.2-2 is already installed in this kernel (2.6.17-13). This is wonderful for me, as I am intimidated by all the (excellent) instructions below. The wireless worked 'right out of the box' with a few minor adjustments. Before anyone relies too heavily on my experience, it would be nice to see any other feedback on this distro.
This guide is for adding the Madwifi driver to the official and non-official Mandriva releases. The example used is the 2006 Beta 1 release. The old guides for the "old" (pre November 2005) code are here: * Old Guides (1 & 2).
A version of the "old" code is included in the standard Mandriva releases (Mandriva Club membership is not required). If you install a recognized Atheros type wireless card under Mandriva, the "old" madwifi driver (ath_pci) will be loaded and managed by default. The "old" code is well managed by Mandriva, and you may find it best to use it if you can.
A Caution: If you can already manage your wireless network (it is up and running) and you want your PC to be a station, but not an Access Point, You Might Not Want To Install A Newer Madwifi on Mandriva (c.01/01/2006).
Why you might want to: only a new HAL supports your new card, or you want the new multiple Interface and Virtual Access Points (VAP) features of the new source.
If you want to install the new code, and you already have wireless set up and running (especially if you have WEP/WPA), please see the "Issues with Prior Installations" note near the bottom of this document.
These instructions are for deconstructing your working wireless interface, if you have one, acquiring new source code based on an arcane nonstandard naming style, and then harmonizing various file, directory, program, compiler and source code name parameters in order to compile and install new drivers. If you are building madwifi drivers from the pre r1408 source code, please see: UserDocs/Distro/Mandrake/interregnum_gotcha
Install Kernel Source
If you have Never upgraded your kernel since you installed Mandriva/Mandrake, it is best to go to the Mandrake Control Center GUI and uncheck the RPM sources for updates before you begin (set it back afterwards), otherwise you will Not get the right kernel. Launch Configure My Computer from the Start menu, select Software Management, then Media Manager, and uncheck Contrib and Updates, and quit MCC. You should be able to use the standard software tools to install your kernel source. Be sure to restore your contrib and update sources by going back through MCC, as above, and rechecking them in the Media manager once you've gotten the kernel.
Under Mandriva 2006 the kernel is compiled with a different version of gcc (gcc v 3.3) than the one that is installed with Mandriva 2006 (gcc v 4). A workaround is to download the kernel source (the same one you have already [see uname -r], or a newer one), then build and install that kernel. Another workaround is to manually install gcc v3.3 with the package manager.
If you have the wrong gcc version, you will get warnings when you modprobe ath_pci, and then a FATAL error.
For more information on building the kernel you can use this guide http://www.digitalhermit.com/linux/Kernel-Build-HOWTO.html#BUILDING
To install the kernel source, as root, enter the following from a console:
- urpmi kernel-source
If this fails, you must locate the precise source code RPM file for your current kernel. Google will yield ftp sites where you can download the kernel source code RPM file. I’ll use the Mandriva 2006 beta 1 kernel as an example: You will need to substitute your own version numbers for the example. Google, find, and download the kernel source code RPM file then invoke:
- urpmi kernel-18.104.22.168mdk-1-1mdk.src.rpm
The kernel source is written to /usr/src/linux-2.6.12-12mdk. Make the symbolic link /usr/src/linux from that directory, and another symlink to /lib/modules/linux-2.6.12-12mdk/build Again, please note, You will need to substitute your own version numbers where the example has linux-2.6.12-12mdk.
- ln -s /usr/src/kernel-source-2.6.12-12mdk/ /usr/src/linux
- ln -s /usr/src/kernel-source-2.6.12-12mdk/ /lib/modules/2.6.12-12mdk/build
As root, next key in (exactly as written):
- urpmi gcc cvs
- cd /usr/src/linux
- make distclean
- cp /boot/config .config
- make oldconfig
- make modules
Note that you do not need to make install the kernel or modules.
Please also note that a more explicit make and make install command is available that will overcome small kernel version issues (this is a cheat & can only be used when the kernel source has little or no difference from that used to make the running kernel). If you have kernel version vs madwifi module version mismatch issues substitute these two lines for the last two above:
- make KERNELRELEASE=$(uname -r) MODULEPATH=/lib/modules/$(uname -r)
- make modules KERNELRELEASE=$(uname -r) MODULEPATH=/lib/modules/$(uname -r)
This completes the kernel source setup, now you are ready to build the madwifi drivers. Download the Madwifi drivers. Follow the wiki instructions at UserDocs/GettingMadwifi
If you are using the OLD madwifi code then go here: UserDocs/Distro/Mandrake/makeold
If you are using the current madwifi codebase,
Before you build the drivers see the README file in /usr/src/madwifi and "Creating Interfaces in Madwifi:" in the wiki (UserDocs/GettingMadwifi). If you have a prior madwifi installation, see the note at the bottom of this page.
Build the Drivers:
- cd /usr/src/madwifi
- make clean
- make install
- If the above fails, use make KERNELRELEASE=$(uname -r) MODULEPATH=/lib/modules/$(uname -r)/kernel/net; make install KERNELRELEASE=$(uname -r) MODULEPATH=/lib/modules/$(uname -r)/kernel/net
After You Build the Drivers:
- modprobe ath_pci
- if you ifconfig -a right now, you should see ath0. For pre R1408 NG code, see: UserDocs/Distro/Mandrake/interregnum_NGmake
- You may be able to use the GUI Mandrake Control Center to manage the first VAP on the card. This is unlikly because the Mandriva Control Center does not recognize that madwifi is installed since mandriva is RPM based and madwifi is compiled from source.
- wlanconfig should now work to add a VAP to the default station, for example, wlanconfig ath create wlandev wifi0 wlanmode AP nosbeacon NOTE: this is incorrect syntax. nosbeacon only applies to stations. create the AP vap then create the station VAP with nosbeacon on revs prior to r3476, and omit the nosbeacon after that. The order must be AP, then station, then optionally more APs, WDS and/or a monitor VAPs.
Autostarting a Station
Modprobe ath_pci automatically creates ath0 (see UserDocs/autocreate. Only one station per card is currently (2/06) permitted. You may want to destroy the station interface to re-acquire the resource for another VAP (wlanconfig ath0 destroy). You can control the autostarting behavior of modprobe ath_pci by argument. If you are using MadWifi releases prior to r1408, see UserDocs/Distro/Mandrake/interregnum_auto
Autostarting an AP
To 'autostart' ath0 as an AP, (vs the default Station) add the following lines to /etc/modprobe.conf:
- alias ath0 ath_pci
- install ath0 /sbin/modprobe ath_pci autocreate=ap
- remove ath0 /usr/local/bin/wlanconfig ath0 destroy; /sbin/modprobe -r ath_pci
- options ath_pci autocreate=ap
Now, when your machine restarts, you should have an AP on ath0 already running under madwifi.
See UserDocs/802.11i and UserDocs/WPA_PSK_on_Both_Ends if you want to set up WPA security on your madwifi interface. If the interface appears to exist but cannot connect or ping, check your firewall settings to assure it is not blocking ath0.
Mandriva Control Center Issues
Users with the old code or simple setups ( one or two network interfaces) can use the Mandrake Control Center to manage the ath0 wireless interface. If you are using the pre r1408 code, please see: UserDocs/Distro/Mandrake/interregnum_MCC
Issues with Prior Installations
Many Mandriva 2006 users will have a prior installation of the network drivers, as they are enabled upon detection. Other Mandrake/Mandriva versions may be similar. If you have a prior madwifi installation, you'll generally want to remove it first. You may want to first pull the card and restart the PC to let the hardware detection remove settings and scripts automatically. During the madwifi make install step (above), when prompted to R)emove prior madwifi files, say Yes. Re-install the card after you 'make install' the madwifi-ng drivers. To hand remove old madwifi files, see UserDocs/Distro/Mandrake/interregnum_Prior
- It is possible to install Mandriva without the neccesary tools (MCC doesn't have the tools cited here) by not checking the "Configuration" and "Development" groups during the initial installation. You'd best use your original installation media and choose 'upgrade' after starting to re-install.
- Different releases of the MadWifi code have written wlanconfig to either /usr/bin or /usr/local/bin. The Autostart examples above are set for /usr/local/bin. You can locate your explicit installation with which wlanconfig, and adjust the paths in the autostart examples accordingly.
- If you are using MadWifi releases prior to r1408, see UserDocs/Distro/Mandrake/interregnum_Trouble
- If you have EVER run the Mandriva Control Center Network tool after you've installed the madwifi drivers and set up ath0/wifi0 etc, see the section Mandriva Control Center Issues, above.