Add mobile broadband connectivity to Embedded Linux

  • 0

Add mobile broadband connectivity to Embedded Linux

In this article we will show how to extend an IoT Embedded Linux System with a broadband connection using 3G/4G networks.

Poky/Yocto is used as Linux distribution in combination with the mobile telephony application oFono.

As hardware example we have a raspberrypi, nevertheless the same setup was applied and verified on other standard development kits and custom boards.

For the broadband connectivity Huawei E173  3G USB stick is used:

If using a different modem, check first if it’s supported with oFono. Here is a list of supported hardware.

Kernel configuration

In order to support 3G USB modems, the following kernel configuration options
need to be enabled :

If those options are used, you should see the following in dmesg:

 

Yocto recipes

To support oFono, the image recipe should include the following packages:

To allow ofono integration with network manager connman, the following packages can be added:

Connman shall be then enabled with 3g support:

 

Ofono setup

oFono provides a mobile telephony (GSM/UMTS) application framework that includes consistent, minimal, and easy to use complete APIs. It offers a high-level D-Bus API for use and integrate with other applications.

The advantage of using oFono is that very simple to configure and you will not have to deal with any kind of AT commands.

Plug in your 3G modem and check if recognized by oFono:

Enable modem:

If SIM card is protected with pin, enter the code:

Depending on the country and Network provider, APN setting is to be configured:

Now the modem can be set online and activated:

That’s it! the modem is up and the broadband connection is enabled:

The cellular connection is also available in connman:

we can for example enable cellular connection tethering over wifi:

If having problem to connect with cellular network, you can use list-modem to check the connection status:

Those configuration steps above are persisted to /var/lib/ofono, so on the next reboot, it’s only required to enter the Pin code and activate the modem using online-modem.

 

 

 


  • 0

Setup a guest Wifi Hotspot using Yocto

In this tutorial we will show how to setup a guest Wifi hotspot and configure it to restrict the internet access to only web surfing.

We will showcase this setup using Poky/Yocto as Linux distribution and connman as network manager. As hardware we will use:

  • Raspberry-Pi
  • Beaglebone-black

For both boards we will use a Realtek RTL8192CU based Wifi USB dongle.

 

Yocto Layers Setup

First we clone Poky repository:

Add the meta-raspberrypi layer:

Enable it in bblayers.conf:

Beaglebone Black machine configuration is already contained in Poky so no need for other layers unless you want to build it for other hardware not supported in those layers.

 

Kernel Configuration

In order to support tethering, the following kernel configuration options
need to be enabled either as modules (m) or builtin (y):

For routing and statistic support , the following options need to be enabled as modules (m) or builtin (y):

Finally the RTL8192Cu driver option need to be enabled as modules (m) or builtin (y):

You can use kernel fragments to set the configurations above.

Also make sure that ip_tables module is autoloaded by setting in kernel recipe or local.conf:

 

Yocto Recipes

Your image recipe must include connman and connmanctl packages:

Rtl8192cu firmware package must be also included:

Ready to build an image either for the Bone or the Pi:

Now we can write the output image to an SD card and start the corresponding board to setup tethering in connman.
 

Connman Setup

Plug in a Network cable on Ethernet interface and configure NAT(Network Address Translation):

Enable Wifi:

Finally activate tethering for Wifi using EmbexuSpot as SSID and 12345678 as password:

 

Firewall Setup

To restrict guest to browse only internet (No bittorrent, No nasty stuffs) we configure the firewall with the following rules:

This will allow only http/https traffic and drop everything else.