We have a MIPS (ar71xx) based device which is similar in architecture to a TP-LINK MR3020 router, but has enlarged RAM (64MB) and FLASH (16MB). It's used to monitor energy meters and solar inverters. We have been successfully using OpenWrt 14 (Barrier Breaker) for some years on this device and now want to get OpenWrt 18 running on it. Most of the work is done; we can build and install firmware with the required packages (including our own "solarmon" package which implements our monitoring software) and the device boots and runs.
The issue is Bluetooth, caused by the way the Bluez package is structured and built. One of the functions of our device is to monitor SMA solar inverters via their Bluetooth interface. For that, we need bluez-lib and the hciconfig and hcitool utilities provided by Bluez.
If I configure the firmware build (via Menuconfig) to include bluez-utils, the resulting firmware image is huge (about 8MB) due to bluez-utils requiring GLib2. But the Bluetooth kernel modules, runtime library (libbluetooth) and hcitool/hciconfig utilities don't require the Glib2 runtime; I can delete that from the running system without causing any problems.
So I'm looking for any suggestions as to how I can include hcitool and hciconfig in our firmware image without having to also include Glib2. I noticed that the Bluez package builds hcitool and hciconfig even if bluez-utils is not selected in Menuconfig, and I can copy those two programs to our device and they work, without the GLib2 runtime being present.
Is there some way the Makefile for my own "solarmon" package to reference those files?
Split it into different packages? I don't think bluez offers a very granual way of specifying binaries that you want to compile so you should probably set glib as a build requirement and specify it per package.
If there's like only one binary or such that requires glib (haven't checked) I'd prefer if we all lump them together as one package instead of breaking it down for every file/binary.
I like the idea of splitting into separate packages.
The present bluez-utils builds 17 programs of which only 3 require Glib2.
I achieved the result I need by modifying the Bluez Makefile as described below.
I still have a couple of questions about the build process.
I noticed the Makefile defines PKG_HASH at the top, I assume this is for code signing or tamper detection purposes. How is it generated? (The build seemed to work fine with this commented out.)
What is the difference between using $(CP) and $(INSTALL_BIN) for copying executable programs to /usr/bin ?
Here are my changes to the Makefile.
I replaced the existing Package/bluez-utils definition by this:
I've not done a Pull Request for OpenWrt before but it looks straightforward enough.
Is there a naming convention for these, or would Bluez-extra be OK?
Clone your forked repo git clone https://www.github.com/jeremystx/packages.git
Create a branch (bluez-pkg-split is just an example) git checkout -b bluez-pkg-split
Edit files
Commit changes git commit -a -s -m "Short message" -m "Long message"
Typing long messages can be a bit of pain so I find it easier to just commit something and then use git commit --amend to edit it in a proper editor
Push your local branch to GitHub git push -u origin bluez-pkg-split
Don't forget to setup git before doing commits so you get proper automatic sign-off etc. git config --global user.name "My Real Name" git config --global user.email "valid.address@email.com" git config --global core.editor "nano" - Whatever you prefer
Hi, it's been pushed and fails to compile.... (see GitHub)
If you go to your PR --> buildpr --> details --> build (under Workflow) --> Hover pointer over the black "cli-like" window and you'll see an arrow appearing in the top right corner --> At the bottom you'll see "Download the full output as a file." --> Download --> Open --> Near the bottom
Package bluez-daemon is missing dependencies for the following libraries:
libglib-2.0.so.0
libgthread-2.0.so.0
libncursesw.so.6
libreadline.so.8