Create mobile access point using ConnMan, BlueZ, oFono and Yocto

A mobile access point can be created using ECA. ECA (Embedded Connectivity Appliance) is a platform for building network appliances. The meta-eca is a layer in Yocto that creates ECA. meta-eca has only networking related options activated so this Yocto generated distro does not contain graphics subsystem. With ECA you can tether wifi, bluetooth, USB gadget and ethernet connections. The uplink (=internet) connection can be wifi, bluetooth, ethernet and cellular.

The ECA have been tested with

but it will work with other hardware also, you just need to figure out what Yocto layers to activate.

The Beagleboard, Beaglebone and RaspberryPi devices do not have wlan chip so you need USB wifi dongle to enable wifi tethering. The Wifi dongle should support AP mode, otherwise the tethering will not work and you cannot connect to it using your phone etc. I have successfully used D-Link DWA-160 A2 and ASUS USB-N13 B1 wifi dongles.

Setting the environment for all targets

$ mkdir yocto
$ cd yocto
$ git clone git://git.yoctoproject.org/poky
$ cd poky
$ git clone git://git.openembedded.org/meta-openembedded
$ git clone git://git.yoctoproject.org/meta-eca
$ export YOCTO=`pwd`

Note that the poky and meta-openembedded repos should work just fine with head versions. If there is an error during distro building, check whether the meta-eca/README.md specifies the known working revision.

Update 06 Dec 2013:
Changed the image locations below as Yocto generated images are deployed to different directory than before.

Beagleboard xM

Update 06 Dec 2013:
Because of this and this Yocto bug, the ethernet networking does not work currently with Beagleboard xM and the latest Yocto. This means that ECA does not have networking in Beagleboard xM. The issue is only seen with kernel 3.10 so if you take version of Yocto that has older kernel, and then meta-openembedded and meta-eca layer versions from around end of August 2013, you should be able to build a working version for Beagleboard xM.

I have only tested this with Beagleboard xM device but the
instructions should probably work just fine with older Beagleboard
device.

$ cd $YOCTO
$ . oe-init-build-env build-beagleboard
$ cd conf

Edit bblayers.conf file and add these layers to BBLAYERS variable.

/home/user/yocto/poky/meta-eca/meta-eca
/home/user/yocto/poky/meta-eca/meta-eca-bsp
/home/user/yocto/poky/meta-openembedded/meta-oe
/home/user/yocto/poky/meta-openembedded/meta-systemd
/home/user/yocto/poky/meta-openembedded/meta-networking

If your name is not “user”, then fix the path above accordingly.
Edit local.conf file

  • set BB_NUMBER_THREADS and PARALLEL_MAKE accordingly to your machine capabilities
  • set your target to MACHINE ?= "beagleboard"
  • set DISTRO ?= "eca"
  • add BBMASK = "meta/recipes-connectivity/bluez/bluez4*|meta-openembedded/meta-systemd/oe-core/recipes-connectivity/bluez/bluez4*"

Then build the distro

$ cd $BUILDDIR
$ bitbake eca-image

If the build succeeds, the result image can be found at tmp-eglibc/deploy/images/beagleboard
Note that if the usb-modeswitch-data recipe fails, then just re-run the bitbake eca command (usually that helps).

Partition and format an SD card (these instructions are modified from poky/README.hardware file):

# fdisk -lu /dev/mmcblk0

Disk /dev/mmcblk0: 3951 MB, 3951034368 bytes
255 heads, 63 sectors/track, 480 cylinders, total 7716864 sectors
Units = sectors of 1 * 512 = 512 bytes

        Device Boot      Start         End      Blocks  Id System
/dev/mmcblk0p1   *          63      144584       72261   c Win95 FAT32
/dev/mmcblk0p2          144585      465884      160650  83 Linux

# mkfs.vfat -F 16 -n "boot" /dev/mmcblk0p1
# mke2fs -j -L "root" /dev/mmcblk0p2

The following assumes the SD card partition 1 and 2 are mounted at
/media/boot and /media/root respectively. Removing the card and reinserting
it will do just that on most modern Linux desktop environments.

$ sudo -s
# cd tmp-eglibc/deploy/images/beagleboard
# cp MLO-beagleboard /media/boot/MLO
# cp u-boot-beagleboard.bin /media/boot/u-boot.bin
# cp uImage-beagleboard.bin /media/boot/uImage
# tar x -C /media/root -f eca-image-beagleboard.tar.bz2
# tar x -C /media/root -f modules-beagleboard.tgz
# sync

Then eject the SD card, insert it to Beagleboard and boot.

For this distro to be useful in Beagleboard, you need to have a USB WLAN dongle connected to Beagleboard.

Beaglebone Black

$ cd $YOCTO
$ git clone git://github.com/beagleboard/meta-beagleboard.git
$ . oe-init-build-env build-beaglebone
$ cd conf

Edit bblayers.conf file and add these layers to BBLAYERS variable

/home/user/yocto/poky/meta-eca/meta-eca
/home/user/yocto/poky/meta-eca/meta-eca-bsp
/home/user/yocto/poky/meta-beagleboard/common-bsp
/home/user/yocto/poky/meta-openembedded/meta-oe
/home/user/yocto/poky/meta-openembedded/meta-systemd
/home/user/yocto/poky/meta-openembedded/meta-networking

If your name is not “user”, then fix the path above accordingly.
Edit local.conf file

  • set BB_NUMBER_THREADS and PARALLEL_MAKE accordingly to your machine capabilities
  • set your target to MACHINE ?= "beaglebone"
  • set DISTRO ?= "eca"
  • add BBMASK = "meta/recipes-connectivity/bluez/bluez4*|meta-openembedded/meta-systemd/oe-core/recipes-connectivity/bluez/bluez4*"

Then build the distro

$ cd $BUILDDIR
$ bitbake eca-image

Partition and format an SD card:

# fdisk -lu /dev/mmcblk0

Disk /dev/mmcblk0: 3951 MB, 3951034368 bytes
255 heads, 63 sectors/track, 480 cylinders, total 7716864 sectors
Units = sectors of 1 * 512 = 512 bytes

        Device Boot      Start         End      Blocks  Id System
/dev/mmcblk0p1   *          63      144584       72261   c Win95 FAT32
/dev/mmcblk0p2          144585      465884      160650  83 Linux

# mkfs.vfat -F 16 -n "boot" /dev/mmcblk0p1
# mke2fs -j -L "root" /dev/mmcblk0p2

The following assumes the SD card partition 1 and 2 are mounted at
/media/boot and /media/root respectively. Removing the card and reinserting
it will do just that on most modern Linux desktop environments.

$ sudo -s
# cd tmp-eglibc/deploy/images/beaglebone
# cp MLO-beaglebone /media/boot/MLO
# cp u-boot-beaglebone.bin /media/boot/u-boot.bin
# cp uImage-beaglebone.bin /media/boot/uImage
# tar x -C /media/root -f eca-image-beaglebone.tar.bz2
# tar x -C /media/root -f modules-beaglebone.tgz
# sync

Then eject the SD card, insert it to your Beaglebone and boot.

Generic x86

Update 06 Dec 2013:
Changed the name of machine to genericx86 (was atom-pc).

$ cd $YOCTO
$ git clone git://git.yoctoproject.org/meta-intel
$ . oe-init-build-env build-pc
$ cd conf

Edit bblayers.conf file and add these layers to BBLAYERS variable

/home/user/yocto/poky/meta-eca/meta-eca
/home/user/yocto/poky/meta-eca/meta-eca-bsp
/home/user/yocto/poky/meta-intel
/home/user/yocto/poky/meta-openembedded/meta-oe
/home/user/yocto/poky/meta-openembedded/meta-systemd
/home/user/yocto/poky/meta-openembedded/meta-networking

If your name is not “user”, then fix the path accordingly.

Edit local.conf file

  • set BB_NUMBER_THREADS and PARALLEL_MAKE accordingly to your machine capabilities
  • set your target to MACHINE ?= "genericx86"
  • set DISTRO ?= "eca"
  • add BBMASK = "meta/recipes-connectivity/bluez/bluez4*|meta-openembedded/meta-systemd/oe-core/recipes-connectivity/bluez/bluez4*"

Then build the distro.

$ cd $BUILDDIR
$ bitbake eca-image

If the build succeeds, the result image can be found at tmp-eglibc/deploy/images/genericx86

In this example, we use USB mass storage stick but you can install the
result image to hard drive or create VirtualBox image from the generated
hdd image.

Insert USB mass storage stick and figure out its device name (use dmesg
and see messages at the end). Lets assume the USB stick is at /dev/sdX

$ cd tmp-eglibc/deploy/images/genericx86
$ sudo dd if=eca-image-genericx86.hddimg of=/dev/sdX

Then eject the USB stick, insert it to PC and boot.

Virtualbox

You can run the generix86 image in VirtualBox. You must have VirtualBox installed. If you have any USB devices you want to connect to VirtualBox, then you also need to install “Oracle VM VirtualBox Extension Pack”.

After generating genericx86 image do following:

$ cd $BUILDDIR
$ cd tmp-eglibc/deploy/images/genericx86
$ vboxmanage convertfromraw --format=VDI eca-image-genericx86.hddimg eca-image-genericx86.vdi
$ vboxmanage createvm --register --name eca
$ vboxmanage hostonlyif create ipconfig vboxnet1  --ip 192.168.42.1 --netmask 255.255.255.0
$ vboxmanage modifyvm eca --ostype Linux --nic1 hostonly --hostonlyadapter1 vboxnet1
$ vboxmanage storagectl eca --name IDE --add ide --bootable on --controller PIIX4
$ vboxmanage storageattach eca --storagectl IDE  --port 0 --device 0 --type hdd --medium eca-image-genericx86.vdi
$ vboxmanage startvm eca

You might want to attach USB wifi dongle to the eca image so that wifi tethering can be enabled. You can setup the USB filters from Settings -> USB menu.

Intel NUC

$ cd $YOCTO
$ git clone git://git.yoctoproject.org/meta-intel
$ . oe-init-build-env build-pc
$ cd conf

Edit bblayers.conf file and add these layers to BBLAYERS variable

/home/user/yocto/poky/meta-eca/meta-eca
/home/user/yocto/poky/meta-eca/meta-eca-bsp
/home/user/yocto/poky/meta-intel
/home/user/yocto/poky/meta-intel/meta-nuc
/home/user/yocto/poky/meta-openembedded/meta-oe
/home/user/yocto/poky/meta-openembedded/meta-systemd
/home/user/yocto/poky/meta-openembedded/meta-networking

If your name is not “user”, then fix the path accordingly.

Edit local.conf file

  • set BB_NUMBER_THREADS and PARALLEL_MAKE accordingly to your machine capabilities
  • set your target to MACHINE ?= "nuc"
  • set DISTRO ?= "eca"
  • add BBMASK = "meta/recipes-connectivity/bluez/bluez4*|meta-openembedded/meta-systemd/oe-core/recipes-connectivity/bluez/bluez4*"

Then build the distro

$ cd $BUILDDIR
$ bitbake eca-image

If the build succeeds, the result image can be found at tmp-eglibc/deploy/images/nuc

Insert USB mass storage stick and figure out its device name (use dmesg
and see messages at the end). Lets assume the USB stick is at /dev/sdX

$ cd tmp-eglibc/deploy/images/nuc
$ sudo dd if=eca-image-nuc.hddimg of=/dev/sdX

Then eject the USB stick, insert it to PC and boot.

Intel FRI2

$ cd $YOCTO
$ git clone git://git.yoctoproject.org/meta-intel
$ . oe-init-build-env build-pc
$ cd conf

Edit bblayers.conf file and add these layers to BBLAYERS variable

/home/user/yocto/poky/meta-eca/meta-eca
/home/user/yocto/poky/meta-eca/meta-eca-bsp
/home/user/yocto/poky/meta-intel
/home/user/yocto/poky/meta-intel/meta-fri2
/home/user/yocto/poky/meta-openembedded/meta-oe
/home/user/yocto/poky/meta-openembedded/meta-systemd
/home/user/yocto/poky/meta-openembedded/meta-networking

If your name is not “user”, then fix the path accordingly.

Edit local.conf file

  • set BB_NUMBER_THREADS and PARALLEL_MAKE accordingly to your machine capabilities
  • set your target to MACHINE ?= "fri2-noemgd"
  • set DISTRO ?= "eca"
  • add BBMASK = "meta/recipes-connectivity/bluez/bluez4*|meta-openembedded/meta-systemd/oe-core/recipes-connectivity/bluez/bluez4*"

Then build the distro

$ cd $BUILDDIR
$ bitbake eca-image

If the build succeeds, the result image can be found at tmp-eglibc/deploy/images/fri2-noemgd

Insert USB mass storage stick and figure out its device name (use dmesg
and see messages at the end). Lets assume the USB stick is at /dev/sdX

$ cd tmp-eglibc/deploy/images/fri2-noemgd
$ sudo dd if=eca-image-fri2-noemgd.hddimg of=/dev/sdX

Then eject the USB stick, insert it to PC and boot.

Raspberry Pi

Update 06 Dec 2013:
Changed the git path from github.com to git.yoctoproject.org

$ cd $YOCTO
$ git clone git://git.yoctoproject.org/meta-raspberrypi
$ . oe-init-build-env build-rpi
$ cd conf

Edit bblayers.conf file and add these layers to BBLAYERS variable

/home/user/yocto/poky/meta-eca/meta-eca
/home/user/yocto/poky/meta-eca/meta-eca-bsp
/home/user/yocto/poky/meta-raspberrypi
/home/user/yocto/poky/meta-openembedded/meta-oe
/home/user/yocto/poky/meta-openembedded/meta-systemd
/home/user/yocto/poky/meta-openembedded/meta-networking

If your name is not “user”, then fix the path accordingly.

Edit local.conf file

  • set BB_NUMBER_THREADS and PARALLEL_MAKE accordingly to your machine capabilities
  • set your target to MACHINE ?= "raspberrypi"
  • set DISTRO ?= "eca"
  • add BBMASK = "meta/recipes-connectivity/bluez/bluez4*|meta-openembedded/meta-systemd/oe-core/recipes-connectivity/bluez/bluez4*"

Then build the distro

$ cd $BUILDDIR
$ bitbake eca-image

If the build succeeds, the result image can be found at tmp-eglibc/deploy/images/raspberrypi

Insert SD card and figure out its device name (use dmesg
and see messages at the end). Lets assume the SD card is at /dev/mmcblk0

$ cd tmp-eglibc/deploy/images/raspberrypi
$ sudo dd if=eca-image-raspberrypi.rpi-sdimg of=/dev/mmcblk0

Then sync and eject the card, insert it to the device and boot.

Connecting to created device

After you have booted the appliance, you can connect to it using ethernet or wifi. If you have wifi card or usb dongle installed in appliance, you should see access point called “eca-aabbccddeeff” (this is just an example) in your wifi scans. You can connect to that AP, the default passphrase in this case would be “aabbccddeeff”. You can change the passphrase in the web management UI. Connection can be done either via “ssh root@eca.local” or via browser http://eca.local.

The default password for root user is “root”. You should change that to something that only you know. If connecting to the host using browser (use http://eca.local/ address), the web-ui forces you to change the root password and it also asks you to set the username/password for the web management UI. If connecting to host using ssh, you need to set the root password manually using “passwd” command.

One thought on “Create mobile access point using ConnMan, BlueZ, oFono and Yocto

  1. Pingback: What If .........Slack needs Systemd (Slackbuilds) - Page 12

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

About

meta-eca is a Yocto layer that is concentrating on networking and it ties together various open source connectivity components like ConnMan for connection management,
oFono for cellular access, BlueZ for Bluetooth connectivity and neard for NFC support.
ECA (Embedded Connectivity Appliance) is a platform for prototyping networking technologies. A mobile access point is created here using the meta-eca layer.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s