Build Bluez 5.46 yourself for your Debian Jessie RPI3

Updated on 2017-08-13 Sunday – all working with 5.46-1 on RPI3.
All patches that were included as part of ‘stretch’ deb source Bluez 5.43 are now in 5.46-1

You can git the source package contents here;
git clone https://github.com/eSpecialized/bluez-5.46-rpi3.git

 

Pre-built packages ready to install;
https://github.com/eSpecialized/bluez-5.46-rpi3/releases/tag/5.46-1

Why would you want to do this?
-To get the latest BLE (Low Energy Features) of Bluez, its required.
-A lot of bug fixes were made since 5.23 that is available on RPI3 Jessie that are needed for BLE to work reliably.
-Using a debian package allows for a clean upgrade path. Files are guaranteed to upgrade as opposed to “make install” over a running bluetooth system which doesn’t work.
-Debian Stretch doesn’t include the latest bluez 5.46, it comes close but I found that (during May 2017) that BLE didn’t function correctly.

Note: This was built on a RPI3 with Jessie.

Steps are intentionally missing, you will need to make up the differences to get the new source into the old directory, update the changelog in the ./debian folders with dch -i and a few other things to get a new build.  In my source package all this done for convenience.

How I made it;
#Activate src in /etc/apt/sources.list
# Uncomment line below then ‘apt-get update’ to enable ‘apt-get source’


vi /etc/apt/sources.list

deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi

sudo apt-get install ccache  #configure this is required! ie Add to Path!
sudo apt-get install build-essential devscripts lintian diffutils patch patchutils
cd /usr/src
apt-get source bluez
apt-get build-depend bluez

#grab a version from bluez.org


cd bluez-5.23

#untar the source ball in the new directory

#How to build it;
#On the RPI3 it takes about 15 minutes without ccache
time dpkg-buildpackage -rfakeroot -uc -b

real 5m48.312s #<< using ccache
user 4m0.350s
sys 0m24.680s

How to clean it;

dpkg-buildpackage -rfakeroot -Tclean

Find what bluez packages you have installed now;

pi@billspi3:/usr/src $ dpkg -l | egrep -e '^\||blue'
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
ii bluej 3.1.7b all A simple but powerful Java IDE.
ii bluez 5.43-2 armhf Bluetooth tools and daemons
ii bluez-firmware 1.2-3+rpi1 all Firmware for Bluetooth devices
ii libbluetooth3:armhf 5.43-2 armhf Library to use the BlueZ Linux Bluetooth stack
ii pi-bluetooth 0.1.3 armhf Raspberry Pi 3 bluetooth
ii pulseaudio-module-bluetooth 5.0-13 armhf Bluetooth module for PulseAudio sound server

How to install only what you need;
sudo dpkg -i <package name>
#From the above list, you can see I only need bluez and libbluetooth3.
sudo dpkg -i bluez_5.46_armhf.deb libbluetooth3_5.46_armhf.deb

eSpecialized's Blog

Bill Thompson

I am a mobile smartphone and embedded Linux engineer. I love to tinker with electronics and fly drones in spare time when not geeking out in a developers world!

2 thoughts on “Build Bluez 5.46 yourself for your Debian Jessie RPI3

  • December 3, 2017 at 6:17 pm
    Permalink

    Hi Bill, nice job!
    I want to ask if you are planning to make bluez 5.47 version for the latest Raspbian Stretch.
    I want to update the current version of bluez (5.43 on Stretch) with the latest 5.47 to get the benefit of bug fixes on GATT BLE protocol.
    I have written a small java library to interact with bluez on dbus, for that I need an update..
    Unfortunately I have no much experience on linux package 🙁
    Can you help me in this issue?
    Thanks a lot.
    Bye

    Reply
    • December 8, 2017 at 4:08 pm
      Permalink

      I’ll put it on my list for this weekend! I still have all of my Rasbian stretch stuff so it should be fairly straight forward.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.