Customize Buildroot to build bluez-tools


I am building Bluetooth support (more on that in a future post) into my custom embedded Linux system, but didn’t find basic command line tools that work with newer versions of BlueZ. That is when I came across bluez-tools, a GSoC project that is able to fill the gap.

To build bluez-tools requires adding my own package to Buildroot. What follows is a brief description of how to do that.

Download source code of bluez-tools. I did this outside of the buildroot folder, by cloning from the author’s GitHub repo

git clone https://github.com/khvzak/bluez-tools.git

Add an override rule to file local.mk, in the root folder of buildroot. That tells buildroot not to download package source from the internet, but to copy the source from the folder created above

BLUEZ_TOOLS_OVERRIDE_SRCDIR = /home/parallels/github/bluez-tools/

Create a folder for bluez-tools package

mkdir package/bluez-tools

Create package/bluez-tools/bluez-tools.mk file for the package with

################################################################################
#
# bluez-tools
#
################################################################################

BLUEZ_TOOLS_AUTORECONF = YES

$(eval $(autotools-package))

BLUEZ_TOOLS_AUTORECONF tells buildroot to generate configure script and Makefile.in by invoking autoconf et al.

Create configuration file package/bluez-tools/Config.in for the package with

config BR2_PACKAGE_BLUEZ_TOOLS
	bool "bluez-tools"
	help
	  This is a GSoC'10 project to implement a new command line tools for bluez (bluetooth stack for linux). The project implemented in C and uses the D-Bus interface of bluez. 

https://code.google.com/p/bluez-tools/

Add the package to package/Config.in

source "package/bluez-tools/Config.in"

Enter configuration menu and select the package

make menuconfig

bluez-tools

Note that bluez-tools package is under Networking applications because I added it to menu “Networking applications” in package/Config.in

Invoke make to perform the build

make

If you get any build errors try

make clean
make

make clean will delete Linux kernel config, either save the config, or do it all over again.

The bad news is a command such as

bt-adapter -l

Fails with

bt-adapter: bluez service is not found
Did you forget to run bluetoothd?

bluetoothd is running just fine. Got to figure that one out. Now, so have you…

Posted in Bluetooth, Linux, Raspberry Pi

Add python to embedded Linux for Raspberry Pi


I’m in need of python on my custom embedded Linux system for Raspberry Pi. This post shows how I enable it. For some reason python build was failing with errors such as

build error: unknown type name ‘wchar_t’

A clean build, as follows, resolved it

make clean
make

To add python to your Buildroot config, invoke

make menuconfig

Enable WCHAR support, under Toolchain

WCHAR support

Enable python or python3, under Target packages, Interpreter languages and scripting

Python

Posted in Linux, Python, Raspberry Pi

Boards for embedded Linux


In this post, I list some of the various boards that I have used with embedded Linux, or known others to have used. Some are also suitable for hosting Android.

Other boards that I have used in the past but use sparingly now…

  • BeagleBoard-xM by TI
  • PandaBoard ES by TI
Posted in Android, ARM, Hardware, Linux

Add wireless to custom embedded Linux system for Raspberry Pi


Raspberry Pi does not have Wi-Fi on board. You’ll need to use a Wi-Fi dongle and discover the driver to build into the kernel. One way to find the driver is to plug the dongle into a Raspberry Pi running Raspbian, and perform an lsmod to see which module gets loaded. The following text assumes you’re building a custom embedded Linux system using Buildroot.

Kernel Configuration

Invoke the Kernel configuration utility using make linux-menuconfig.

Enable Wireless Networking support under Networking support

Wireless

Enable cfg80211 – wireless configuration API, and Generic IEEE 802.11 Networking Stack (mac80211), under Networking Support, Wireless

cfg80211 and mac80211

Enable EEPROM 93CX6 support under Device Drivers, Misc devices, EEPROM support. Required for RTL8187 module in my Wi-Fi dongle, may not be needed for your particular adapter

EEPROM 93CX6 support

Enable Wireless LAN driver support under Device Drivers, Network device support

Wireless LAN

Enable Realtek 8187 and 8187B USB support under Device Drivers, Network device support, Wireless LAN. Select the driver appropriate for your adapter

Realtek 8187 and 8187B USB support

Package Configuration

Invoke make menuconfig within the buildroot folder from a command prompt.

Select package iw required to configure wireless networking, under Target packages, Networking applications. Enable iproute2 if you want to use the ip utility instead of ifconfig.

iw

Select package wpa_supplicant and its sub-packages for WPA/WPA2 support

wpa_supplicant

Perform the build by invoking make, copy the newly minted system to an SD card, and use it to boot up your Raspberry Pi.

Configure Wireless Networking

List your wireless interfaces

iw list

If you’ve selected the iproute2 package above, the following should list all network interfaces

ip link

Bring up the wlan0 interface

ifconfig wlan0 up

Find the access point you want to connect to

iw dev wlan0 scan

Assuming you’re using WPA/WPA2, invoke wpa_passphrase to create config file, and wpa_supplicant to connect to network

wpa_passphrase your_SSID your_passphrase > your_SSID.conf
wpa_supplicant -B -i wlan0 -c your_SSID.conf

Instead, if you want to connect to an open network

iw dev wlan0 connect your_SSID

Request IP address using DHCP

dhcpcd wlan0

Check link status

iw dev wlan0 link

Add nameserver entries to /etc/resolv.conf e.g.

nameserver 8.8.8.8
nameserver 8.8.4.4

Test internet connectivity using ping

ping www.google.com
Posted in Miscellaneous

Moto G 4G screen gone bad in less than a month of use


Besides the line artifacts on the screen, the display seems to be at a lower resolution, icons and fonts appear more pixelatedMoto G 4G screen gone bad

Just to be sure it was the screen and not the software, I took the screenshot below

Moto G 4G Screenshot

Unfortunately, I bought it on one of my U.S. trips. The local authorized service center will only service Moto G’s under warranty bought in Brazil. I didn’t even save any money buying it in the U.S. I’ll only buy Apple products when in the U.S. They’ve got an international warranty program.

Posted in Miscellaneous

Embedded Linux system for BeagleBoard-xM with Yocto Project


I’ve mostly abandoned a BeagleBoard-xM that I have, and am using Raspberry Pi for most of my embedded Linux hacks. I have built a Linux system for BeagleBoard-xM using Yocto Project though, so thought I’d put the instructions out there.

I’m performing the following build on an Ubuntu 14.04 Parallels Desktop 9 VM. The steps below were mostly discovered from the Yocto Project Quick Start. Look there if you need further help.

The following dependencies are required on the build machine before you proceed

sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath libsdl1.2-dev xterm

Next, clone the the dora branch from the git repo of Yocto Project, and prepare the build environment

git clone -b dora http://git.yoctoproject.org/git/poky
source poky/oe-init-build-env build

You’ll be in the the build folder when that is done.

Add the following to conf/local.conf

MACHINE ?= "beagleboard"

Go ahead and perform the build

bitbake core-image-minimal

After the build is done, grab and deploy the images from tmp/deploy/images/beagleboard.

Posted in ARM, Linux

Embedded Linux system for Raspberry Pi with Yocto Project


Yocto Project, and OpenEmbedded, have been making news lately as the toolchain to build custom embedded Linux systems. I decided to try and get a working Linux system up and running on a Raspberry Pi.

The procedure that follows uses the meta-raspberrypi BSP by David-John Willis, in tandem with Yocto Project poky.

Initialize the build by executing the following commands. I use an Ubuntu 14.04 VM with Parallels.

git clone http://git.yoctoproject.org/git/poky
git clone http://git.yoctoproject.org/git/meta-raspberrypi
git clone https://github.com/dv1/meta-gstreamer1.0.git
source poky/oe-init-build-env rpi-build
cd rpi-build

Append meta-raspberrypi and meta-gstreamer1.0 layers to BBLAYERS in conf/bblayers.conf. For example

BBLAYERS ?= " \
  /home/parallels/yocto/poky/meta \
  /home/parallels/yocto/poky/meta-yocto \
  /home/parallels/yocto/poky/meta-yocto-bsp \
  /home/parallels/yocto/poky/meta-gstreamer1.0 \
  /home/parallels/yocto/poky/meta-raspberrypi \
  "

Set MACHINE to raspberrypi in conf/local.conf. Complete the build by executing

bitbake rpi-hwup-image

That takes a while. After the build is complete, create an SD card with the following command. Remember to change /dev/sdb to the proper device name.

dd if=tmp/deploy/images/raspberrypi/rpi-hwup-image-raspberrypi.rpi-sdimg of=/dev/sdb

Boot Pi using the SD card. Command line output appears on the HDMI display, or the serial port on the expansion header. Login is root, with an empty password.

Posted in Raspberry Pi
Follow

Get every new post delivered to your Inbox.

Join 66 other followers

%d bloggers like this: