Skip to main content

DBus Cross-compilation

· 2 min read
Shreyas Atre

I have made a curated content on DBus cross-compilation on Ubuntu 20.04

Cross-compilation tools

  • Go through the best guide here
gcc-arm-linux-gnueabi:
Installed: (none)
Candidate: 4:9.3.0-1ubuntu2
Version table:
4:9.3.0-1ubuntu2 500
500 http://in.archive.ubuntu.com/ubuntu focal/universe amd64 Packages

binutils-arm-linux-gnueabi:
Installed: 2.34-6ubuntu1.1
Candidate: 2.34-6ubuntu1.1
Version table:
*** 2.34-6ubuntu1.1 500
500 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages
500 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages
100 /var/lib/dpkg/status
2.34-6ubuntu1 500
500 http://in.archive.ubuntu.com/ubuntu focal/universe amd64 Packages

Installing DBus for arm-linux-gnueabi

  • Note: The low-level libdbus reference library has no required dependencies; the reference bus daemon's only required dependency is an XML parser (expat).

1. Installing expat

  • Currently expat 2.4.1 is stable
  • Download expat 2.4.1 and tar xvfz expat-2.4.1.tar.gz
  • Configure expat
./configure  --without-tests --without-examples --prefix=/usr/arm-linux-gnueabi/ --host=arm-linux-gnueabi CC=/usr/bin/arm-linux-gnueabi-gcc-8 CXX=/usr/bin/arm-linux-gnueabi-g++-8
make -j8
sudo make install

2. Installing libdbus

  • Once completed download dbus from here
  • Currently 1.12.x are the stable ones
  • tar xvfz dbus-1.12.20.tar.gz
./configure --disable-doxygen-docs --disable-xml-docs --exec-prefix=/usr/arm-linux-gnueabi --host=arm-linux-gnueabi CC=/usr/bin/arm-linux-gnueabi-gcc-8 CXX=/usr/bin/arm-linux-gnueabi-g++-8 CFLAGS=-I/usr/arm-linux-gnueabi/include LDFLAGS=-L/usr/arm-linux-gnueabi/lib/ LIBS=-lexpat
make -j8
sudo make install
  • DBus with Connman - Link
# Connman Technology API examples: (Object Path: /net/connman/technology/<wifi/ethernet>, Interface: net.connman.Technology)
# GetProperties
dbus-send --system --dest=net.connman --print-reply /net/connman/technology/wifi net.connman.Technology.GetProperties

# Scan
dbus-send --system --dest=net.connman --print-reply /net/connman/technology/wifi net.connman.Technology.Scan

# Disable/Enable wifi
dbus-send --system --dest=net.connman --print-reply /net/connman/technology/wifi net.connman.Technology.SetProperty string:Powered variant:boolean:true

# Disable/Enable ethernet
dbus-send --system --dest=net.connman --print-reply /net/connman/technology/ethernet net.connman.Technology.SetProperty string:Powered variant:boolean:true

# Connman Manager API examples: (Object Path: /, Interface: net.connman.Manager)
dbus-send --system --dest=net.connman --print-reply / net.connman.Manager.GetProperties
dbus-send --system --dest=net.connman --print-reply / net.connman.Manager.GetTechnologies
dbus-send --system --dest=net.connman --print-reply / net.connman.Manager.GetServices

# See: http://git.kernel.org/?p=network/connman/connman.git;a=tree;f=doc;hb=HEAD
info
  • The best way to get to know dbus is from their own tutorial here.
  • This has done a great job of giving an overview of the API to get yourself quickly started.