Linux Tales of Woe: Part 1

Once upon a gloomy day, an innocent programmer (innocent? yeah, right...) stared at his Linux terminal in dismay only to find that the wifi card he installed wasn't supported, and he threw out the old one. This tale of woe documents my actual misadventures with the Linux kernel back in the days of Linux Kernel version 2.6 or so in 2004.

Tell-tale signs

I remember getting my old 2007 Dell XPS right when it came out from a third party seller and how he swapped the included WiFi card with one that was absolutely horrible for the time. Since a replacement card was cheap, I invested in a replacement card for the laptop, which was a Broadcom card.

After a bit of waiting and checking the mailbox constantly, it had arrived and I excitedly popped open the laptop and inserted the card... And threw out the old one- welcome to hell...

I booted my Ubuntu installation, complete with wobbly windows, and fired up bash and excitedly ran ping google.com. The happy smile quickly turned to an analytical frown, wondering why this could be. Running ifconfig didn't list the new wlan card either...

Google-Fu

Since I knew this was a Broadcom WiFi card, I plugged into Ethernet (which thankfully worked) and began a massive googling spree. After a couple hours of searching for “Broadcom Wifi not working Linux”, “Linux Broadcom support”, and so on it was discovered that I needed to utilize a package called ndiswrapper, which effectively allows the loading of Windows XP firmware for wireless card to be loaded under Linux through a wrapper.

NDISWrapper Hell

Excited that there was a solution, I downloaded the firmware for Windows XP and installed the ndiswrapper package. After adding blacklist bcm43xx blacklist b43 blacklist b43legacy blacklist ssb to /etc/modprobe.d/blacklist.conf, I was ready to install the driver. I installed the driver in a Windows XP virtual machine and obtained the .INF file that corresponded to the broadcom card. From there, I believed it to be a simple sudo ndiswrapper -i broadcom.inf to install the driver.

But lo and behold, the driver wasn't written for my CPU Architecture, and the installation failed every single time! Out of desperation, I even experimented with QEMU to see if I could just emulate the driver, to no avail.

After 3 days of banging my head against a desk, rebooting, restoring from a backup and more, I gave up entirely on NDISWrapper and turned back to Google.

The Discovery

After a couple more hours of Google-Fu, I stumbled upon a discovery- A developer was working on a patchset for the same WiFi card I had, and these changes weren't in the kernel! For those who are unaware, patchsets are groups of .patch files you can run the patch command on, to modify source code to look like what the developer made. Excitedly, I downloaded this and a fresh copy of the Linux Kernel source code.

Kernel Games

With everything downloaded, extracted the Linux kernel source code and cd'ed into it. Following this, I ran patch < 1.patch over and over again, but changing the name of the path of patch until I had applied the entire set. Then I executed cp /boot/config-uname -r.config to copy the stock Ubuntu kernel config to the .config file required for compiling a new kernel. After this, it was just a matter of running make menuconfig to customize the kernel and enable the Broadcom driver. After saving and exiting, it was time to compile the kernel.

After running make deb-pkg LOCALVERSION=-broadcom I sat and waited... For 18 hours. After waking up the next day, I noticed compilation completed. As expected according to the Debian manual, the .deb files were one directory up. So after verifying they were there, the kernel was then installed via dpkg and a reboot verified the custom kernel was installed.

It Works, But...

After installing the custom kernel, WiFi was finally working. However, the speed did not increase and the performance wasn't as advertised. This led me to believe it was due to a hardware limitation and I had wasted all this time over a stupid WiFi card...

I later would just install an Ethernet wall jack where I kept my laptop because I wanted the speed at the time, and this laptop would go on to last until 2012, when it gave off magical blue smoke.

Moral of the story: DON'T THROW AWAY GOOD HARDWARE BEFORE YOU TEST!