[CentOS-docs] Broadcom's BCM4311-, BCM4312-, BCM4321-, and BCM4322-based hardware install manual

Wed Dec 23 12:44:45 UTC 2009
Mathieu Baudier <mbaudier at argeo.org>

> OK then, I'll take your sillence as an approval of the manual and remove
> the DRAFT tag and move it to *Making Wireless work on your laptop (or
> desktop)
> *So if anyone has any final suggestions or comments I'd be happy to hear
> it before this goes official.

Sorry, for not testing sooner.

I took some time this morning and could update my driver using the
latest kernel update!

Here are my comments:

1. There is a typo in: mkdir -P /usr/local/src/hybrid-wl
mkdir takes the -p option (lower case)

2. I could not perform: modprobe wl.ko
but:
insmod wl.ko
works

3. I did not need to define all the aliases, neither remove all b43
stuff (I'm on a CentOS x86_64)
Since I prefer not to diverge too much from the base system, I left it
like that.

4. Interestingly I tried to define TYPEDEF_BOOL via the command line
(which would avoid the modification of the files):
make -C /lib/modules/`uname -r`/build/ M=$BUILD_DIR MODFLAGS=-DTYPEDEF_BOOL
It builds without error, and the module can be inserted, but then it
is not working (wlan networks are not found)

More generally my question would be: if we would automate this
procedure in a RPM (including the download from Broadcom website),
would it count as redistribution??

Please find below for reference the script and patch I used for my testing.
(please note: that the module is built in a temporary directory in
order to keep the source directory read-only)

Thanks for the hard work!

Mathieu

##
## broadcom.sh
##
#!/bin/sh

WL_VERSION=v5.10.91.9.3
WL_ARCH=x86_64
SRC_DIR=/usr/local/src/broadcom-hybrid-wl-$WL_ARCH-$WL_VERSION
BUILD_DIR=/tmp/wlbuild

# Step 1: Prerequisites
sudo /sbin/lspci | grep Broadcom
sudo yum install kernel-headers kernel-devel gcc

# Step 2: Retrieve sources
sudo mkdir -p $SRC_DIR
sudo cp -v broadcom-wl.patch $SRC_DIR
cd /tmp && wget -N
http://www.broadcom.com/docs/linux_sta/hybrid-portsrc-$WL_ARCH-$WL_VERSION.tar.gz
cd $SRC_DIR && sudo tar -xzf /tmp/hybrid-portsrc-$WL_ARCH-$WL_VERSION.tar.gz

# Step 3: Build as unprivileged user
mkdir $BUILD_DIR
cp -r $SRC_DIR/* $BUILD_DIR
cd $BUILD_DIR
#make -C /lib/modules/`uname -r`/build/ M=$BUILD_DIR MODFLAGS=-DTYPEDEF_BOOL
patch -Np1 < $SRC_DIR/broadcom-wl.patch
make -C /lib/modules/`uname -r`/build/ M=`pwd`
strip --strip-debug $BUILD_DIR/wl.ko

# Step 4a: Check that the new module can be loaded
#sudo /sbin/rmmod bcm43xx
#sudo /sbin/rmmod b43
#sudo /sbin/rmmod b43legacy
#sudo /sbin/rmmod ndiswrapper
#sudo /sbin/modprobe ieee80211_crypt_tkip

#sudo /sbin/rmmod wl
sudo /sbin/insmod $BUILD_DIR/wl.ko
#sudo /sbin/service NetworkManager restart

# Step 4b: Install
sudo cp -v $BUILD_DIR/wl.ko /lib/modules/`uname -r`/extra/
sudo /sbin/depmod $(uname -r)
sudo /sbin/modprobe wl
#sudo /sbin/service NetworkManager restart

# Clean up
rm -vf /tmp/hybrid-portsrc-*.tar.gz
rm -rf $BUILD_DIR


##
## broadcom-wl.patch
##

diff -Naur hybrid-portsrc/src/include/typedefs.h
hybrid-portsrc-mod/src/include/typedefs.h
--- hybrid-portsrc/src/include/typedefs.h	2009-09-16 00:25:27.000000000 +0200
+++ hybrid-portsrc-mod/src/include/typedefs.h	2009-12-23
12:32:15.000000000 +0100
@@ -65,11 +65,11 @@

 #ifdef USE_TYPEDEF_DEFAULTS
 #undef USE_TYPEDEF_DEFAULTS
-
+/*
 #ifndef TYPEDEF_BOOL
 typedef	 unsigned char	bool;
 #endif
-
+*/
 #ifndef TYPEDEF_UCHAR
 typedef unsigned char	uchar;
 #endif