QEMU Emulator for BitBake Gumstix

To test Linux Image builds without flashing every time on the Gumstix board,
emulator needs to be set up. 

The bash script makeimage.sh provided by Gumstix
has to be modified such that the extensions of u-boot, uImage and Root File
System(rootfs) are to represented same as the Yocto build system provides. 

QEMU command as follows:

$ qemu-system-arm -M overo -m 256 -sd ./test.img -clock unix -serial stdio -usb -device usb-host,hostbus=2,hostaddr=1

Gumstix Overo WiFi unstable

The reason for wifi drop is the Network manager. By disabling it we can run ifconfigiwconfigwithout any interference from the NetworkManager.
or Another workaround is this which is quite successful:
After creating SD card with proper Image on, do not unmount the partitions.
Install a Custom systemd Service
To bring up the wireless interface on boot, you will need to create and install a custom systemd service on the microSD card.
  • In the rootfs partition, create a new service script:
    $sudoedit /media/rootfs/etc/systemd/system/network-wireless@.service
  • Copy and paste the following into the file:
    Description=Wireless network connectivity (%i)


    ExecStart=/sbin/ifconfig %i up
    ExecStart=/usr/sbin/wpa_supplicant -B -i %i -c /etc/wpa_supplicant.conf
    ExecStart=/sbin/dhclient %i

    ExecStop=/sbin/ifconfig %i down


Save this file.
  • Because we are editing these files on a development machine, the normal systemd method of enabling services (systemctl) will not work. To enable our new service:
    ~ Change into the multi-user.target.wants directory on the root filesystem:
    $cd /media/rootfs/etc/systemd/system/multi-user.target.wants/
    ~ Create a symbolic link to enable the service:
    Overo Series COMs
    $sudo ln -s ../network-wireless@.service network-wireless@wlan0.service
Finally, edit the wpa_supplicant configuration file:
$sudoedit /media/rootfs/etc/wpa_supplicant.conf
Change it to look like the following:
    ssid="Your Network's SSID"
    psk="Your WPA2 Passkey"
Save the file.
Unmount the partitions on the microSD card.
SSH Into Your System
1) If you don't know the ip $ssh root@overo.local
2) If you know the IP address $ssh root@192.xx.xx.xx.local

CMake with BitBake recipe

When writing BitBake recipes that use CMake build system, you need to inherit CMake package config or else BitBake simply downloads the src and CMakeLists.txt file and does not compile.

Following is a simple recipe to capture some images from camera.

 BitBake CMake recipe:

DESCRIPTION = "cameracapture application" 
SECTION = "examples" 
PR = "r0" 

DEPENDS = "opencv"

SRC_URI = "git://github.com/zafrullahsyed/cameracapture.git;protocol=https;tag=v0.1"

S = "${WORKDIR}/git"

inherit pkgconfig cmake

do_install() {
    install -d ${D}${bindir}
    install -m 0755 cameracapture ${D}${bindir}
If you didn't add  do_install Yocto downloads the recipe but does not include it Image.

CMakeLists.txt file:
cmake_minimum_required(VERSION 2.8)
find_package( OpenCV REQUIRED )
add_executable( cameracapture cameracapture.cpp )
target_link_libraries( cameracapture ${OpenCV_LIBS} )

AprilTags recipe with Bitbake Yocto

What are AprilTags?

AprilTags are 2D barcodes developed for robotics applications by Ed Olson. The library detects any April tags in a given image, provides the unique ID of the tag as well as its location in the image. If the camera is calibrated and the physical size of the tag known, also provides the relative transform between tag and camera.¹

AprilTags bitbake  

AprilTags has bad dependencies that are according to PC in AprilTags/cmake/pods.cmake such as Eigen3(default), whereas for OE eigen3 package is libeigen. Hard coded the requires, Libs and Cflags and also removed python pod packages which are not required.

$ "Name: ${pc_name}\n"
        "Description: ${pc_description}\n"
        "Requires: ${libeigen}\n"
 #      "Version: ${pc_version}\n"
        "Libs: -L\${bindir} ${pc_libs}\n"
        "Cflags: -I\${bindir} ${pc_cflags}\n")
AprilTags bitbake recipe:
[I am not sure about what the license field should be, so just wrote closed.]  
$ DESCRIPTION = "Apriltags application" 
SECTION = "examples" 
PR = "r5" 

DEPENDS = "opencv"

SRC_URI = "git://github.com/zafrullahsyed/apriltags.git;protocol=https;tag=v0.3"

S = "${WORKDIR}/git"

inherit pkgconfig autotools

do_install() {
    install -d ${D}${bindir}
    install -m 0755 ${WORKDIR}/git/build/bin/apriltags_demo ${D}${bindir}

Yocto Project environment for Gumstix development

To create a custom Linux distribution for Embedded systems independent of architecture, including Gumstix-based systems, follow instructions given here:

1. Install Repo:
Repo is a tool that Google built on top of Git to manage many Git repositories. If you are curious more to know about repo follow this Link

Download the Repo script:

$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > repo
In order to have correct permissions, we need to make it executable:
$ chmod a+x repo
Move it on to your system path:
$ sudo mv repo /usr/local/bin/
Check whether repo is correctly installed. You can do it by the following command which gives you  a Usage message when invoked with the help flag.
$ repo --help
2. Initialize a Repo client.
Create an empty directory to hold your working files:
$ mkdir yocto
$ cd yocto
Tell Repo where to find the manifest:
$ repo init -u git://github.com/gumstix/Gumstix-YoctoProject-Repo.git 
A successful initialization will end with a message stating that Repo is initialized in your working directory. Your directory should now contain a .repo directory. This .repo is hidden file. You can check it by ctrl+h command in that directory
To get the known stable version:
$ repo init -u git://github.com/gumstix/Gumstix-YoctoProject-Repo.git -b master
$ repo sync
3. Fetch all the repositories:
$ repo sync
Sync command download the whole Yocto to your local disk. This might take some time depending on your Internet connection.
4. Initialize the Yocto Project Build Environment.
$ TEMPLATECONF=meta-gumstix-extras/conf source ./poky/oe-init-build-env
This copies default configuration information into the poky/build/conf directory and sets up some environment variables for the build system. According to Official source, this configuration directory is not under revision control; you may wish to edit these configuration files for your specific setup but I would not recommend to change Environmental variables unless you know what you are doing. In particular, change the MACHINE variable if you are not building for the Overo (default).
5. Build an image:
This process downloads several gigabytes of source code and then proceeds to do an awful lot of compilation so make sure you have plenty of space (25GB minimum), and expect a day or so of build time depending on your network connection. Don't worry---it is just the first build that takes a while.
$ bitbake gumstix-console-image

If everything goes well, you should have a compressed root file system(tar.bz2) tarball as well as kernel and bootloader binaries available in your  ~/yocto/build/tmp/deploy/images directory.
What if something is broke?
There are several degrees of starting fresh: individual packages can be rebuilt or the whole system can be reconstructed.
  1. clean a package: bitbake -c cleansstate
  2. re-download package: bitbake -c cleanall
  3. destroy everything but downloads: rm -rf build (or whereever your sstate and work directories are)
  4. destroy it all (not recommended): rm -rf build && rm -rf sources
 If you want to build a new image, you can check in ~/poky/meta-gumstix-extras/recipes-images/gumstix directory for other Image options.

Source: Gumstix-YoctoProject-Repo

Getting started with Yocto Project

What is Yocto Project?

The Yocto Project is an open source collaboration project that provides templates, tools and methods to help you create custom Linux-based systems for embedded products regardless of the hardware architecture.

Check this video to get a fast understanding of what Yocto project is all about:

It was founded in 2010 as a collaboration among many hardware manufacturers, open-source operating systems vendors, and electronics companies to bring some order to the chaos of embedded Linux development.

What are the advantages of using Yocto Project?

It's a complete embedded Linux development environment with tools, metadata, and documentation - everything you need. There are many free free tools easy to get started with, powerful to work with (including emulation environments, debuggers, an Application Toolkit Generator, etc.). You are not required to be a geek to get started with Yocto, just a guys who knows how to use a Computer and that's it. You can use HOB .

What is Bitbake:

Bitbake is a tool to compile, configure, install and build packages and distributions. BitBake recipes specify how a particular package is built. It includes all the package dependencies, source code locations, configuration, compilation, build, install and remove instructions.

For more information you can read about:
Yocto Project Manual
Yocto Project Development Manual

Happy building!!

About Me

Aadaab!  I am Zafrullah Syed. I am studying Master in Computer Science at Universit├Ąt Paderborn, Germany. I am from Hyderabad, India and I feel privileged to be a Hyderabadi.

I was born and brought up in Jaggayyapet a beautiful small town located on the banks of Paleru river. My house is on the outskirts of the town and just some meters away from the river. I still remember summer holidays when I, with my cousins used to go to Dhanambod when the river dried up. It was best days of my life. If I ever wish to live any place in the world it would be my hometown Jaggayyapet. I finished my schooling and Matriculation here and moved to Hyderabad for Bachelor studies.

My Dad has been my inspiration throughout my whole life. My wish is to live like him. Other than my Dad, I look up to my brother and my cousin Haani, to be successful and work hard like them.

My passion is Linux, Cooking, Travel and exploring new things. I am technology freak. I do not bother about shopping but want to try out every gadget and new technology in the market.

I am very Impulsive in nature and thought of writing my experiences and journey I come across.

I read lots of books. I read all types of books, from fiction to Philosophy. I love Indian history. Currently I am reading 'The Last Mughal'.

I watch tolly and bollywood movies. Full on Indian masala and romance. I rarely watch any English movies. I watch Tv just for local news which I regularly follow.