# [SOLVED] Problems adding B43 Firmware

## rhumbliner

i've just installed gentoo 3.8.13 onto an intel mac mini with a broadcom BCM4321 802.11a/b/g/n [14e4:4328] wireless chip.  everything is working fine with the exception of the wireless capability.  my kernel has the B43 configured as a module:

```
CONFIG_B43=m

CONFIG_B43_SSB=y

CONFIG_B43_PCI_AUTOSELECT=y

CONFIG_B43_PCICORE_AUTOSELECT=y

CONFIG_B43_PIO=y

CONFIG_B43_PHY_LP=y

CONFIG_B43_HWRNG=y

CONFIG_B43_DEBUG=y

CONFIG_B43LEGACY=m

CONFIG_B43LEGACY_PCI_AUTOSELECT=y

CONFIG_B43LEGACY_PCICORE_AUTOSELECT=y

CONFIG_B43LEGACY_HWRNG=y

CONFIG_B43LEGACY_DEBUG=y

CONFIG_B43LEGACY_DMA=y

CONFIG_B43LEGACY_PIO=y

CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y

# CONFIG_B43LEGACY_DMA_MODE is not set

# CONFIG_B43LEGACY_PIO_MODE is not set

# 
```

and it appears that i need to extract the firmware from the proprietary broadcom driver so i downloaded this driver and extracted the firmware:

```
{~/tmp} wget http://www.lwfinger.com/b43-firmware/broadcom-wl-5.100.138.tar.bz2

--2013-05-17 18:48:21--  http://www.lwfinger.com/b43-firmware/broadcom-wl-5.100.138.tar.bz2

Resolving www.lwfinger.com... 173.254.28.119

Connecting to www.lwfinger.com|173.254.28.119|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 13514651 (13M) [application/x-bzip2]

Saving to: 'broadcom-wl-5.100.138.tar.bz2'

{~/tmp} b43-fwcutter -w /lib/firmware broadcom-wl-5.100.138/linux/wl_apsta.o

This file is recognised as:

  filename   :  wl_apsta.o

  version    :  666.2

  MD5        :  e1b05e268bcdbfef3560c28fc161f30e

```

actually, there are 3 drivers from which to choose: wl_ap.o,  wl_apsta.o, and  wl_sta.o but another thread i was reading recommended wl_apsta.o.  unfortunately it probably doesn't matter cuz when i set up the kernel to accept the firmware:

```
CONFIG_PREVENT_FIRMWARE_BUILD=y

CONFIG_FW_LOADER=y

CONFIG_FIRMWARE_IN_KERNEL=y

CONFIG_EXTRA_FIRMWARE="b43"

CONFIG_EXTRA_FIRMWARE_DIR="/lib/firmware"

```

when i compile the kernel i constantly run out of memory:

```
  AS      firmware/b43.gen.o

gcc: internal compiler error: Killed (program as)

Please submit a full bug report,

with preprocessed source if appropriate.

See <http://bugs.gentoo.org/> for instructions.

make[1]: *** [firmware/b43.gen.o] Error 4

make: *** [firmware] Error 2

```

i presume i've made some mistake along the way so i'd appreciate any direction someone can give me here.

tiaLast edited by rhumbliner on Sat May 18, 2013 11:42 pm; edited 1 time in total

----------

## Gusar

The firmware isn't just one file, b43 is a directory containing 30+ files. Either list them all in the kernel config (b43/file1, b43/file2, ...), or better yet, don't compile the firmware into the kernel at all, you don't need to.

Another thing, you need bcma support in your kernel. So make sure you activate bcma and that CONFIG_B43_BCMA=y is set.

----------

## rhumbliner

yes, i realize the folder has many files, but my understanding was that i simply need to list the folder name.  in fact, /lib/firmware contains a whole bunch of sub-directories only one of which is my b43 folder.  

```
{~} ls /lib/firmware/

3com         av7110     cis     edgeport  keyspan      mts_edge.fw  r128    tigon         whiteheat.fw

acenic       b43        cpia2   emi26     keyspan_pda  mts_gsm.fw   radeon  ti_3410.fw    whiteheat_loader.fw

adaptec      b43legacy  cxgb3   emi62     korg         myricom      sb16    ti_5052.fw    yam

advansys     bnx2       dsp56k  ess       matrox       ositech      sun     ttusb-budget  yamaha

atmsar11.fw  bnx2x      e100    kaweth    mts_cdma.fw  qlogic       tehuti  vicam

{~} 

```

i thought when i configure the kernel i should enter

```
[*]   Include in-kernel firmware blobs in kernel binary

(b43) External firmware blobs to build into the kernel binary

(/lib/firmware) Firmware blobs root directory

```

am i wrong on this?  should the line actually contain 

```
b43/a0g0bsinitvals5.fw,b43/a0g0bsinitvals9.fw,...,b43/ucode33_lcn40.fw
```

if so, there are approx 120 .fw files in this folder that i would have to list manually.

thanks,

----------

## Gusar

 *rhumbliner wrote:*   

> am i wrong on this?

 

Yes.

 *rhumbliner wrote:*   

> that i would have to list manually.

 

No, you don't. It's not mandatory to put firmware into the kernel.

----------

## rhumbliner

then i'm really confused by this.  how is this firmware eventually loaded onto the card?  does modprobe do this?  if so, what mechanism must i enable to make this happen?

----------

## Gusar

Newest kernels load firmware themselves. If that fails, or if you're using a kernel older than 3.8, it will ask udev (or mdev if that's what you use) to do it.

----------

## rhumbliner

well, this has been a learning process.  i've since discovered that i didn't need to do all this firmware extraction manually.  it's all handled automatically with the b43-firmware package which i've since emerged.  now i'm having problems loading, but i'm a little further along.  i'll call this thread finished since emerging the package is the smart way to go and i'll start a new topic for the next step.

thanks!

----------

## sirnickity

FYI, the X Configuration Handbook page says to include /lib/firmware in kernel blobs directory.  If that's no longer the case, that doc might need to be changed.  (That's what brought me here... read the doc, edited .config, compiled kernel, gcc crashed, found related forum post, confirmed out of memory, found another similar post, confirmed it was due to /lib/firmware setting.)

Ref: https://wiki.gentoo.org/wiki/Xorg/Configuration under Kernel Modesetting, AMD/ATI settings.

----------

## 666threesixes666

out of memory will occur with swapoff and not enough ram also.  ensure you have swap space!

wifi wiki explains b43 pretty well also....  https://wiki.gentoo.org/wiki/Wifi

----------

## sirnickity

If you specify the /lib/firmware directory and don't specify particular firmware blobs to include, it will add everything in /lib/firmware, consuming multiple GB of RAM/swap.  (About 5GB combined on my system.)

It wasn't entirely clear how you're supposed to specify blobs by the link I posted previously, just a vague comment that makes more sense once you know what it is.  Once I specified only the files I cared about (radeon/R600_rlc.bin and friends, in my case), the kernel compiled successfully.

This has nothing to do with B43, but the same rules will apply for any kernel module that requires firmware.  Since I missed the part where you're supposed to specify blobs, I suspect others have/will too, so hopefully this will make good Google fodder...

----------

