#### Beyond Linux® From Scratch (systemd Edition) - Version 10.1

### Chapter 12. System Utilities

- Prev

  autofs-5.1.7

- Next

  Bubblewrap-0.4.1

- Up
- Home

# BlueZ-5.55

## Introduction to BlueZ

The BlueZ package contains the Bluetooth protocol stack for Linux.

This package is known to build and work properly using an LFS-10.1 platform.

### Package Information

- Download (HTTP): https://www.kernel.org/pub/linux/bluetooth/bluez-5.55.tar.xz

- Download MD5 sum: 94972b8bc7ade60c72b0ffa6ccff2c0a

- Download size: 1.9 MB

- Estimated disk space required: 68 MB (add 78 MB for tests)

- Estimated build time: 0.2 SBU (using parallelism=4; add 0.2 SBU for tests)

### Additional Downloads

- Required patch: http://www.linuxfromscratch.org/patches/blfs/10.1/bluez-5.55-upstream_fixes-1.patch

### BlueZ Dependencies

#### Required

dbus-1.12.20, GLib-2.66.7, and libical-3.0.9

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/bluez

## Kernel Configuration

If you are building this package to use bluetooth devices (rather than as a build dependency), enable the following options in the kernel configuration, also the options below the next paragraph if you intend to run the tests, and recompile the kernel if necessary:

    [*] Networking support --->                [CONFIG_NET]
      <*/M> Bluetooth subsystem support --->    [CONFIG_BT]
        <*/M> RFCOMM protocol support          [CONFIG_BT_RFCOMM]
        [*]   RFCOMM TTY support               [CONFIG_BT_RFCOMM_TTY]
        <*/M> BNEP protocol support            [CONFIG_BT_BNEP]
        [*]   Multicast filter support         [CONFIG_BT_BNEP_MC_FILTER]
        [*]   Protocol filter support          [CONFIG_BT_BNEP_PROTO_FILTER]
        <*/M> HIDP protocol support            [CONFIG_BT_HIDP]
            Bluetooth device drivers --->
              (Select the appropriate drivers for your Bluetooth hardware)

      <*/M> RF switch subsystem support ----   [CONFIG_RFKILL]

If you wish to run the testsuite (even if treating this package as a build dependency), you will need to enable the following options in the kernel configuration and recompile the kernel if necessary:

    -*- Cryptographic API --->                                      [CONFIG_CRYPTO]
      <*/M> User-space interface for hash algorithms                 [CONFIG_CRYPTO_USER_API_HASH]
      <*/M> User-space interface for symmetric key cipher algorithms [CONFIG_CRYPTO_USER_API_SKCIPHER]

## Installation of BlueZ

First, fix a segmentation fault that occurs when connecting to AD2P-based bluetooth devices:

    patch -Np1 -i ../bluez-5.55-upstream_fixes-1.patch

Install BlueZ by running the following commands:

    ./configure --prefix=/usr         \
                --sysconfdir=/etc     \
                --localstatedir=/var  \
                --enable-library      &&
    make

To test the results, issue: `make check`.

Now, as the `root` user:

    make install &&
    ln -svf ../libexec/bluetooth/bluetoothd /usr/sbin

Install the main configuration file as the `root` user:

    install -v -dm755 /etc/bluetooth &&
    install -v -m644 src/main.conf /etc/bluetooth/main.conf

If desired, install the API documentation as the `root` user:

    install -v -dm755 /usr/share/doc/bluez-5.55 &&
    install -v -m644 doc/*.txt /usr/share/doc/bluez-5.55

## Command Explanations

`--enable-library`: This switch enables building the BlueZ 4 compatibility library which is required by some applications.

ln -svf ../libexec/bluetooth/bluetoothd /usr/sbin: This command makes access to the bluetooth daemon more convenient.

## Configuring BlueZ

###

#### Configuration Files

`/etc/bluetooth/main.conf` is installed automatically during the install. Additionally, there are three supplementary configuration files. /etc/sysconfig/bluetooth is installed as a part of the boot script below. In addition, you optionally can install the following, as the `root` user:

    cat > /etc/bluetooth/rfcomm.conf << "EOF"
    # Start rfcomm.conf
    # Set up the RFCOMM configuration of the Bluetooth subsystem in the Linux kernel.
    # Use one line per command
    # See the rfcomm man page for options

    # End of rfcomm.conf
    EOF

    cat > /etc/bluetooth/uart.conf << "EOF"
    # Start uart.conf
    # Attach serial devices via UART HCI to BlueZ stack
    # Use one line per device
    # See the hciattach man page for options

    # End of uart.conf
    EOF

###

#### Systemd Bluez Services

To start the bluetoothd daemon at boot, enable the previously installed systemd unit by running the following command as the `root` user:

    systemctl enable bluetooth

To start the obexd daemon for a user session (to support some Bluetooth programs using it), enable the previously installed systemd unit for all users by running the following command as the `root` user:

    systemctl enable --global obex

### Note

Systemd will start the Bluetooth daemon only when a bluetooth device is detected on the system.

## Contents

Installed Programs: bccmd, bluemoon, bluetoothctl, bluetoothd (symlink), btattach, btmon, hex2hcd, l2ping, l2test, mpris-proxy, and rctest
Installed Library: libbluetooth.so
Installed Directories: /etc/bluetooth, /usr/{include,libexec}/bluetooth, and /usr/share/doc/bluez-5.55

### Short Descriptions

bccmd | is used to issue BlueCore commands to Cambridge Silicon Radio devices
bluemoon | is a Bluemoon configuration utility
bluetoothctl | is the interactive Bluetooth control program
bluetoothd | is the Bluetooth daemon
btmon | provides access to the Bluetooth subsystem monitor infrastructure for reading HCI traces
hex2hcd | is used to convert a file needed by Broadcom devices to hcd (Broadcom bluetooth firmware) format
l2ping | is used to send a L2CAP echo request to the Bluetooth MAC address given in dotted hex notation
l2test | is a L2CAP testing program
rctest | is used to test RFCOMM communications on the Bluetooth stack
`libbluetooth.so` | contains the BlueZ 4 API functions

Last updated on 2021-02-21 15:09:04 -0800

- Prev

  autofs-5.1.7

- Next

  Bubblewrap-0.4.1

- Up
- Home