This post shows how to build Bluetooth support with Buildroot for a Raspberry Pi. You’ll need a Bluetooth adapter such as the Bluetooth 4.0 USB Module from Adafruit. That adapter is also Bluetooth Smart (LE) ready.
I recommend using Buildroot 2014.08 because bluez-tools such as bt-adapter and bt-agent work with its version of Bluez.
Enable Bluetooth subsystem support under Networking support
Enable RFCOMM protocol support under Bluetooth subsystem support, if you want Bluetooth SPP support. Enable BNEP protocol support, if you want support for networking over Bluetooth. Enable HIDP protocol support, if you want support for Bluetooth enabled keyboard and mice.
Since we’re using a USB adapter, enable HCI USB driver under Bluetooth subsystem support, Bluetooth device drivers
The Kernel Bluetooth stack is called BlueZ. BlueZ also provides a set of utilities that can be used from the command line. To add those, select bluez-utils under Target packages, Networking applications
If using Buildroot 2014.08, select bluez-utils 5.x package instead
make the Linux system and copy to SD card.
Look for interfaces
Bring up HCI interface
hciconfig hci0 up
Make the device discoverable
hciconfig hci0 piscan
Scan available devices
Ping a device
Browse capabilities of a device
sdptool browse C8:3E:99:C6:1B:F8
Run bluetooth daemon
If using Buildroot 2014.08
Browse local capabilities
sdptool browse local
Another means to discover available devices, using bluez-tools
Connect and pair with a device listed by the command above
bt-device -c 5C:0E:8B:03:6E:4E
Create a network connection and obtain IP address
bt-network -c C8:3E:99:C6:1B:F8 nap sudo dhclient bnep0
Create a serial port
sdptool add --channel=7 SP rfcomm connect /dev/rfcomm0 C8:3E:99:C6:1B:F8 7
Use screen with the above serial port
screen /dev/rfcomm0 115200
Bluetooth LE commands
Scan for Bluetooth LE devices
Access services and characteristics provided by an LE peripheral
gatttool -b 7F:AE:48:2B:00:0C -t random -I
gatttool prompt supports a set of commands to interact with the peripheral
connect primary char-desc char-read-hnd handle char-write-req handle data
Enable advertising as an iBeacon
hciconfig hci0 leadv hciconfig hci0 noscan hcitool -i hci0 cmd 0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 E2 0A 39 F4 73 F5 4B C4 A1 2F 17 D1 AD 07 A9 61 00
Bluetooth is big. Go ahead and do something with it.