Raspberry Pi Zero W Bluetooth

Hi all,

I've been configuring openwrt on a RPi Zero W (old version, not the V2) to create a small hotspot for a boat to link together a number of NMEA peripherals and that has been working really well. However some of the apps I'm using on the boat would benefit from having internet access as well for things like updates and live weather/tide information and the logical answer was to tether to my phone when aboard.

I could use a usb cable for this but the most convenient thing would be to use bluetooth so that it tethers just like my car does when I turn everything on, however, whilst I can make this work using a usb bluetooth dongle I have not been able to make it work using the Pi Zeros onboard bluetooth and that appears to be because the kernel support for it isn't compiled in to the standard builds (correct me if I'm on wrong on this but I can't get openwrt to detect it but it works fine on raspbian).

So I've downloaded and setup the build environment (cross compiling on Devuan 4.0 on an X86_64 Virtual machine on top of kvm) and I can happily sucessfully build an image, include all the packages I want in it etc but I cannot for the life of me get what I believe to be the required broadcom drivers compiled in. They don't seem to be supported in make menuconfig and seem to be deliberately marked as no in ~/packages/kernel/linux/modules/other.mk so my understanding is that I need to also run make kernel_menuconfig to select them where currently I am selecting them to be compiled in rather than as modules.

However, whenever I do that I seem to end up with an unbootable image. So my question is - is what I am trying to do even possible ? I mean that as in are the required drivers mapped out for a reason/do they need patching in some way before they can work ?

I'm quite happy to keep plugging away to make them work but if anyone else already has done or can tell me it's not possible currently due to reasons then it'll save me pain down the road!

(and yes I could simply use a usb bluetooth dongle but that seems counterproductive when there is the capability onboard!)



install bluez and manually add the hcd blobs to a stock image... afaik, these are yet to be bundled for opkg

also double check btooth is not disabled in /boot/distroconfig.txt

Hi and thanks.

Apologies as I might not have been clear - it's my understanding (and again please correct me if I am wrong) that to make the onboard bluetooth controller work on the pi zero W you need the btbcm kernel module loaded (or compiled in) so that the hci_bcm protocol is present which translate to the config options CONFIG_BT_BCM and CONFIG_BT_HCIUART_BCM. so I can add a blob to bluez but right now the kernel won't even compile with the right protocol support in place to talk to the bluetooth controller.

It looks like the relevant kernel files are patched as part of the build process (btbcm.c and hci_bcm.c) but I cannot seem to get it to compile the kernel as part of the build with those features compiled in - every time I try and force the options in somehow the make process overwrites them and I've not been able to track down where and why that's happening.

thats two things;

  1. kernel wont compile
  2. kernel wont honour kconfig option

without 1 working... not sure how you arrive at 2...

for adding options... the simplest way is probably to add them to;

alternatively/additionally you can try hacking up the selections here

###$ cat package/kernel/linux/modules/other.mk | grep -C23 HCIUART_BCM

define KernelPackage/6lowpan/description
  Shared 6lowpan code for IEEE 802.15.4 and Bluetooth.

$(eval $(call KernelPackage,6lowpan))

define KernelPackage/bluetooth
  TITLE:=Bluetooth support
  DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-crypto-hash +kmod-crypto-ecb +kmod-lib-crc16 +kmod-hid +kmod-crypto-cmac +kmod-regmap-core +kmod-crypto-ecdh
  $(call AddDepends/rfkill)
  FILES:= \
	$(LINUX_DIR)/net/bluetooth/bluetooth.ko \
	$(LINUX_DIR)/net/bluetooth/rfcomm/rfcomm.ko \
	$(LINUX_DIR)/net/bluetooth/bnep/bnep.ko \
	$(LINUX_DIR)/net/bluetooth/hidp/hidp.ko \
	$(LINUX_DIR)/drivers/bluetooth/hci_uart.ko \
	$(LINUX_DIR)/drivers/bluetooth/btusb.ko \
  AUTOLOAD:=$(call AutoProbe,bluetooth rfcomm bnep hidp hci_uart btusb)

define KernelPackage/bluetooth/description
 Kernel support for Bluetooth devices

ok - imprecise language on my part - I've got to the point since the initial post where the kernel will compile (I was using the master tree and not 21.02.01), it just won't compile those options in, ignored them every time so I end up with a compiled kernel without the relevant drivers.

I've also since my last post already tried editing both the files you mention - what happens is during the build process it throws an error

"warning: menuconfig statement without prompt"

and then runs through what looks like the old text mode kernel config routing and asks for a prompt on some options (typically relating to RPi GPIO stuff - haven't noted it fully) at which point if I go and look at the kernel .config file in the appropriate target location it's been overwritten. Seems I'm on the right track so I will keep preservering.

What's really interesting is the options don't even appear in make kernel_menuconfig so something is patching them out - just need to find what that is.