# [Solved] BCM20702A1-0a5c-21e6.hcd failed with error -2

## ranumm

Hi everyone, 

I'm here again to a question.

A laptop uses a "Broadcom BCM20702" bluetooth chip, unfortunately the kernel (gentoo-sources-5.4.14) reports:

```
[    1.892211] bluetooth hci0: Direct firmware load for brcm/BCM20702A1-0a5c-21e6.hcd failed with error -2
```

I extracted the "BCM20702A1_001.002.014.0449.0462.hex" from the Lenovo[1] ".exe" file then I used hex2hcd to convert it in ".hcd" file; after I put this file in the "/lib/firmware/brcm/" directory as "BCM20702A1-0a5c-21e6.hcd". Same kernel problem!

Any suggestions?

__

[1] https://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles/g4wb12ww.exeLast edited by ranumm on Mon Jan 27, 2020 4:09 pm; edited 3 times in total

----------

## Jaglover

I see two possible reasons.

1. Driver attempts to load firmware before the root filesystem is mounted.

2. The firmware file you have is broken or otherwise invalid.

----------

## ranumm

 *Jaglover wrote:*   

> I see two possible reasons.
> 
> 1. Driver attempts to load firmware before the root filesystem is mounted.
> 
> 2. The firmware file you have is broken or otherwise invalid.

 

1. Interesting. How can I check?

2. I don't think so because I tried many time with different files also[1].

Anyway I have a bluetooth mouse connected, it works, but sometimes it freezes:

```
[   60.808701] Bluetooth: hci0: advertising data len corrected

[   60.813692] Bluetooth: hci0: advertising data len corrected
```

__

[1] https://wiki.gentoo.org/wiki/Lenovo_Thinkpad_T430#Bluetooth

----------

## Jaglover

 *Quote:*   

> 1. Interesting. How can I check?

 

You have to consult ranumm about this. Assuming ranumm was the individual who configured kernel. See, if (s)he built the bluetooth driver into kernel then it also loads with kernel. Kernel must be loaded before it can mount the root filesystem, unless you have some super secret time-travel kernel module ... OTOH, if the bluetooth driver was built as a module then it loads from root filesystem after it is mounted and has no problem accessing firmware.

----------

## Hu

If the driver is built-in, it will almost certainly load before the root filesystem is available.  If the driver is a module, and is in the initramfs, it will probably load before the root filesystem is available (depending on how the initramfs is designed).  If the driver is a module and is not in the initramfs, then it will be on the root filesystem and cannot have been loaded too early.

----------

## ranumm

 *Hu wrote:*   

> If the driver is built-in, it will almost certainly load before the root filesystem is available.  If the driver is a module, and is in the initramfs, it will probably load before the root filesystem is available (depending on how the initramfs is designed).  If the driver is a module and is not in the initramfs, then it will be on the root filesystem and cannot have been loaded too early.

 

Really interesting.

Previously I had a kernel with all the modules built into the kernel (make localyesconfig) and no initramfs (like now); I have set the "Bluetooth" driver as a module then I re-build/install the kernel and modules. No problems now!

My question now is:

- How can I build a kernel with all integrated modules and working bluetooth firmware?

Thank you.

----------

## Hu

The firmware must be available when the driver needs it.  Usually, that is done by listing it in CONFIG_EXTRA_FIRMWARE during the kernel build.  Note that this embeds the firmware in the kernel, which might cause licensing issues if you use non-free firmware and plan to redistribute the resulting kernel binary.

----------

## ranumm

 *Hu wrote:*   

> The firmware must be available when the driver needs it.  Usually, that is done by listing it in CONFIG_EXTRA_FIRMWARE during the kernel build.  Note that this embeds the firmware in the kernel, which might cause licensing issues if you use non-free firmware and plan to redistribute the resulting kernel binary.

 

I understand, thank you so much.

----------

## Azik

Hello.

For anyone who can stuck with this problem: https://wiki.gentoo.org/wiki/Broadcom_Bluetooth

----------

