Gentoo Wiki


Merge-arrows.gifIt has been suggested that this article be Merged into one article with NDISwrapper.    (Discuss)


Mini HowTo

This is just a mini-howto to get a Linksys WMP54GS wireless workling under linux, no WEP. This guide should work for any card not directly supported by linux. Note; I have only done this on a 2.6.x kernel. For 2.4.x kernels it should be the same.

We'll work first with a gentoo system already installed and a working internet connection via dial-up, DSL or cable.

Make sure you have wireless support in you kernel!

Linux Kernel Configuration: kernel config
Device Drivers  --->
   Networking Support  --->
      Wireless LAN (non-hamradio)  --->
         [*] Wireless lan (non hamradio)

Recompile the kernel, copy the kernel over to boot, you know, the stuff you should know by now ;) If you don't have it already, emerge dhcp. When that's all done proceed to the next step.

The Windows drivers and ndiswrapper

Ok, you'll need the windows CD that came with the card for the windows drivers ndiswrapper needs to install. If you don't have the drivers, you may need to download them from the manufacturer. For the WMP54GS, the drivers consist of three files; bcmwl5.sys,, and lsbcmnds.inf. They may also be named Rt2500.INF, and rt2500.sys if your wmp54g contains the RaLink (rather than the broadcom) chip.

We'll go on as if you have the CD.

First step, we need to emerge the ndiswrapper package. Don't forget, you need to be root to do all this.

emerge -v ndiswrapper (-v is for verbose, I love verbose :) )

Ok, assuming everything went well, you'll need to mount the CD. (If you downloaded the drivers, copy them to / for convience.)

mount /dev/cdrom /mnt/cdrom

Now we need to tell ndiswrapper where to find the drivers for it to install.

ndiswrapper -i /mnt/cdrom/Drivers/lsbcmnds.inf (subsitute path/file for downloaded drivers.)

The ndiswrapper module must be probed to use your card.

modprobe ndiswrapper

There, the drivers are all installed now. We need to tell gentoo to load the ndismodule at boot time.

If you recive "FATAL:Module ndiswrapper not found" Try the following.

depmod -a
modprobe ndiswrapper

If that still fails and you had to recompile the kernel, reboot and try modprobe ndiswrapper again.

Adding the ndiswrapper module

Alright, we'll be using the ever handy nano.

nano -w /etc/modules.autoload.d/kernel-2.x (x being your either 4, for 2.4.x kernels or six, for 2.6.x kernels.)

If you want to feel leet, we can do this with the echo command :) What this does, is append text to the end of a file.

echo "ndiswrapper" >> /etc/modules.autoload.d/kernel-2.x

The kernel-2.x file should look something like this;

File: /etc/modules.autoload.d/kernel-2.6
# /etc/modules.autoload.d/kernel-2.6:  kernel modules to load when system boots.
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/modules.autoload.d/kernel-2.6,v 1.1 2003/07$
# Note that this file is for 2.6 kernels.
# Add the names of modules that you'd like to load when the system
# starts into this file, one per line.  Comments begin with # and
# are ignored.  Read man modules.autoload for additional details.

Setting up the network

What we need to do next, is edit /etc/conf.d/net. We need to add wlan0, disable gateway, and any other interface you don't need. Should look something like this;

File: /etc/conf.d/net
# /etc/conf.d/net:
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/net,v 1.7 2002/11/18 19:39:22 azarah Exp $

# Global config file for net.* rc-scripts

# This is basically the ifconfig argument without the ifconfig $iface
#iface_eth0=" broadcast netmask"
#iface_eth1=" broadcast netmask"

# For DHCP set iface_eth? to "dhcp"
# For passing options to dhcpcd use dhcpcd_eth?

# For adding aliases to a interface

# NB:  The next is only used for aliases.
# To add a custom netmask/broadcast address to created aliases,
# uncomment and change accordingly.  Leave commented to assign
# defaults for that interface.

# For setting the default gateway

Now thats all done, we need to setup a symlink for net.wlan0 and add it to the boot script.

ln -s /etc/init.d/net.lo /etc/init.d/net.wlan0

After that, we'll add it to rc-update

rc-update add net.wlan0 default (Delete any interfaces you dont need. ie. rc-update del net.eth0)

Finishing up

Ok, we're all done now, if you had to compile your kernel, reboot and you should have wireless, unless you screwed something up :) If you didn't have to recompile your kernel, just modprobe ndiswrapper && /etc/init.d/net.wlan0 start and it should work.

64 Bit Platforms

If you are using a native 64 bit system and used /etc/portage/package.keywords entries to emerge the ndiswrapper package, your Windows drivers need to be 64 bit compatible in order for boot-time installation of ndiswrapper to succeed.

If your windows drivers are not 64 bit compatible, you may recieve messages such as these upon start-up.

ndiswrapper (check_nt_hdr:158): Windows driver is not 64-bit; bad magic: 010B
ndiswrapper (load_sys_files:459): couldn't prepare driver 'rt2500'

You can get 64 bit drivers for many cards from LinuxAnt

Fresh Gentoo Install

This step is a little bit harder, since we only have the wireless card and no internet access. Before you do anything, you need to download the ndiswrapper from sourceforge.

Save it to a USB drive (or other removable media), or a CD if you have two cd-roms (one will be used for the gentoo install CD). You will need to download the stage3 file from a Gentoo mirror and have this accessible from your system as well as the Windows drivers. Be easier if you have two cd-roms here, if not, copy the three driver files and the stage3 BZIP file to your removable media.

Continue with your Gentoo install. You will need to access the stage3 from your media.

mount /dev/sda1 /mnt/media (if /mnt/media does not exist, create it: mkdir /mnt/media)

Also copy the ndiswrapper file and Windows network driver to the /mnt/gentoo directory

mkdir /mnt/gentoo/ndiswrapper
cp /mnt/media/ndiswrapper-1.1.tar.gz /mnt/gentoo/ndiswrapper
cp /mnt/media/your_windows_driver /mnt/gentoo/ndiswrapper

Continue your installation from Installing the Gentoo Installation Files

Go into your chrooted envrionment: chroot /mnt/gentoo /bin/bash

We need to copy the ndiswrapper-1.1.tar.gz over to /usr/portage/distfiles

cp /ndiswrapper/ndiswrapper-1.1.tar.gz /usr/portage/distfiles

To make sure the ebuild will reconize the file with the proper file size and checksum we'll run ebuild (take a look in the directory for the proper ebuild of the ndiswrapper you have. its in the /usr/portage/net-wireless/ndiswrapper directory)

ebuild /usr/portage/net-wireless/ndiswrapper/ndiswrapper-1.1.ebuild digest

Now we are ready to emerge ndiswrapper.

emerge ndiswrapper

Now continue to the beginning of this page on how to install the drivers and setup the network. Subsitute /dev/cdrom for the floppy location if you have the drivers on a floppy and not a cdrom.

I have used both these ways to get my card installed and working. Hopefully it will work out for you.

Last modified: Tue, 19 Aug 2008 05:04:00 +0000 Hits: 20,447