First you have to know two things: Which the chip-set is and the driver name. A WiFi card in order to work needs two pieces of software: firmware and driver ; usually the WiFi card’s firmware is excluded from the Linux kernel due to legal issues.
First get the driver name for searching it in Google, or for using any Linux livecd and then figuring out it with the next command:
Besides please consider reading this section in Gentoo wiki
Now that you know which driver to use, you can search it in the kernel menu configuration, just press / and type the driver name and it will help you a lot in finding out the most accurate options for you.
Gentoo’s wiki suggests you this setup:
Device Drivers ---> [*] Network device support ---> [*] Wireless LAN ---> Select the driver for your Wifi network device, e.g.: <M> Broadcom 43xx wireless support (mac80211 stack) (b43) [M] Support for 802.11n (N-PHY) devices [M] Support for low-power (LP-PHY) devices [M] Support for HT-PHY (high throughput) devices <M> Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi) <M> Intel Wireless WiFi DVM Firmware support <M> Intel Wireless WiFi MVM Firmware support <M> Intel Wireless WiFi 4965AGN (iwl4965) <M> Intel PRO/Wireless 3945ABG/BG Network Connection (iwl3945) <M> Ralink driver support ---> <M> Ralink rt27xx/rt28xx/rt30xx (USB) support (rt2800usb)
It is a good idea to select everything as a modules because it's easier, however you will learn here how to use drivers built into the kernel.
Now in the main menu options of the kernel enable the following -this is need for the WiFI’s networks that requires a password- .
-*- Cryptographic API ---> -*- AES cipher algorithms -*- AES cipher algorithms (x86_64) <*> AES cipher algorithms (AES-NI)
Also enable the WiFi capabilities in your kernel choosing the following options:
[*] Networking support ---> [*] Wireless ---> <*> cfg80211 - wireless configuration API [ ] nl80211 testmode command [ ] enable developer warnings [ ] cfg80211 regulatory debugging [ ] cfg80211 certification onus [*] enable powersave by default [ ] cfg80211 DebugFS entries [ ] use statically compiled regulatory rules database [ ] cfg80211 wireless extensions compatibility <*> Generic IEEE 802.11 Networking Stack (mac80211) [*] Minstrel [*] Minstrel 802.11n support [ ] Minstrel 802.11ac support Default rate control algorithm (Minstrel) ---> [ ] Enable mac80211 mesh networking (pre-802.11s) support -*- Enable LED triggers [ ] Export mac80211 internals in DebugFS [ ] Trace all mac80211 debug messages [ ] Select mac80211 debugging features ----
Please also install this tools unless you realize that you don’t need them (it’s most likely that you do):
[*] Networking support ---> [*] Wireless ---> [*] cfg80211 wireless extensions compatibility
Don’t forget to execute make modules_install if you chose compile the drivers as modules instead of building them into the kernel.
Installing the Firmware
Most of firmware is available in /lib/firmware when installing the following package in Gentoo, however you may need special firmware, and I have to said that the b43 was afwul for me, so I ended up using broadcom-sta, but it think b43 can be nice with some wifi cards. So be cautious when choosing a reverse engineered free driver.
emerge --ask sys-kernel/linux-firmware
Please check the following table from Gentoo wiki to be able to install your firmware.
Embeding your Firmware into the kernel
Sometimes the module approach for installing drivers can fail
You will need to tell the kernel which files you want and where they are located.
Under Generic Driver Options (kernel menuconfig) , you need something like this
(/sbin/hotplug) path to uevent helper
│ │ [ ] Maintain a devtmpfs filesystem to mount at /dev
│ │ [*] Select only drivers that don't need compile-time external firmware
│ │ [*] Prevent firmware from being built
│ │ -*- Userspace firmware loading support
│ │ [ ] Include in-kernel firmware blobs in kernel binary
│ │ (rtl_nic/rtl8168e-2.fw radeon/PALM_pfp.bin radeon/PALM_me.bin radeon/SUMO_rlc.bin) External firmware blobs to build into the kernel binary
│ │ (/lib/firmware/) Firmware blobs root directory
Look at the last tine. This tells the kernel where to look for the firmware that is to be included.
The linle above the last line is a space separated list of file names to include, relative to the
Firmware blobs root directory
As my chipset of WIFI is Antheros , I typed ath9k_htc/htc_9271-1.4.0.fw in the first entry of the kernel options, and always se last entry will be /lib/firmware ; therefore the full path is /lib/firmware/rtl_nic/rtl8168e-2.fw , but actually you will cut in two as the aforementioned examples.
And now install Network Manager, wicd or a command line method of your choice
If you compiled the drivers as modules don’t forget to add them in /etc/conf.d/module
If you use wicd please disable the daemon dhcpd.
Sometimes when wicd fails (because nothing is perfect) it will say you that was Connected, and immediately it will lost the connection; however notice that when you type the wrong password it won’t tell you that it was connected. I tell you this because don’t waste your time thinking that you misspelled the password in such case.
If your haven’t configured your consolekit or dbus properly only root will be able to control wicd, sometimes it is caused by starting a section with a simple startx which is not properly. Read it for more information
If your firmware is not loading you will not be able to see your internet interface with iwconfig or ifconfig.
Please review now the Gentoo wiki article about this: https://wiki.gentoo.org/wiki/Wifi
You will need to activate the wlan0 interface before you can use it:
ifconfig -v wlan0 up