Home Gumstix Gumstix Building Gumstix images with the Yocto Project

Building Gumstix images with the Yocto Project

Some notes on building custom BSP images for the Gumstix® small board computers using tools from the Yocto Project.

 

These are primarily developer images targeted at C/C++ and Qt developers.

We use the Qt images to develop and run Syntro on Gumstix COMs.

We use images similar to these as the starting point for Pansenti clients.

 

The Linux kernel and bootloader come from Steve Sakoman's repositories.

The Overo images use a 3.2 kernel. The Duovero images use a 3.6 kernel.

 

The jumpnow-console-image has C/C++ tools, git, vi, nano, openssh and a number of other utilities for development.

The jumpnow-qte-image adds Qt 4.7.4 embedded and OpenCV 2.4.5 headers and libraries.

 

The build workstations have been Ubuntu 64-bit 12.04, 12.10 and 13.04.

 

Setup

Ubuntu Packages

Install some tools on the workstation. The 'optional' installs are for doing development.

  • build-essential
  • git
  • pkg-config
  • libqt4-dev (optional)
  • qt4-qmake (optional)
  • qtcreator (optional)
  • libopencv-dev (optional)
  • diffstat
  • texi2html
  • texinfo
  • gawk
  • chrpath
  • subversion
  • libncurses5-dev (for menuconfig)
  • uboot-mkimage

 

I did the dpkg-reconfigure dash thing too, to change the default shell to bash. I'm not sure if that is still required.

 

Downloads

Clone poky

Clone the Yocto poky repository and checkout the [denzil] branch

scott@quad:~ git clone git://git.yoctoproject.org/poky.git
scott@quad:~$ cd ~/poky
scott@quad:~/poky$ git checkout -b denzil origin/denzil

 

Clone the Layer Repositories

meta-openembedded

Get the openembedded layer and checkout the [denzil] branch

scott@quad:~/poky$ git clone git://git.openembedded.org/meta-openembedded
scott@quad:~/poky$ cd meta-openembedded
scott@quad:~/poky/meta-openembedded$ git checkout -b denzil origin/denzil

 

meta-jumpnow

The jumpnow layer for my SDK console images and some kernel customization

scott@quad:~/poky$ git clone git://github.com/scottellis/meta-jumpnow

 

Or if you are using a Duovero

meta-jumpnow-duo

scott@quad:~/poky$ git clone git://github.com/scottellis/meta-jumpnow-duo

 

The README file holds the last commit I confirmed for the poky and meta-openembedded repositories. You can always checkout those commits explicitly.

 

Configure the Poky Environment

Generate the initial build environment

scott@quad:~/poky$ source ./oe-init-build-env


After running this you will be moved to the poky/build directory. You need to run this command every time you want to use Yocto. The script only builds the environment the first time. Thereafter it just sets your current environment for running bitbake commands.

 

Your resulting directory layout under poky should look like this

scott@quad:~/poky$ ls -l
total 80
drwxrwxr-x  6 scott scott  4096 May  3 11:18 bitbake
drwxrwxr-x  4 scott scott  4096 Jun  2 15:55 build
drwxrwxr-x 10 scott scott  4096 Jun  2 15:27 documentation
-rw-rw-r--  1 scott scott   545 May  3 11:18 LICENSE
drwxrwxr-x 20 scott scott  4096 May  3 11:18 meta
drwxrwxr-x  7 scott scott  4096 Jun  2 15:27 meta-demoapps
drwxrwxr-x  4 scott scott  4096 May  3 11:18 meta-hob
drwxrwxr-x  9 scott scott  4096 Jun  2 12:58 meta-jumpnow
drwxr-xr-x 12 scott scott  4096 Jun  2 15:27 meta-openembedded
drwxrwxr-x  5 scott scott  4096 May  3 11:18 meta-skeleton
drwxrwxr-x  9 scott scott  4096 May  3 11:18 meta-yocto
-rwxrwxr-x  1 scott scott  1531 May  3 11:18 oe-init-build-env
-rw-rw-r--  1 scott scott  1375 May  3 11:18 README
-rw-rw-r--  1 scott scott 17245 May  3 11:18 README.hardware
drwxrwxr-x  7 scott scott  4096 Jun  2 15:27 scripts

 

Customize the build environment

Configuration files are found under ~/poky/build/conf

Sample local.conf and bblayer.conf files can be found in meta-jumpnow/conf/.

Edit local.conf

Here is an example, I have a 6-core machine

scott@quad:~/poky/build/conf$ cat local.conf
# Sample configuration for using the meta-jumpnow layer

PREFERRED_PROVIDER_jpeg = "libjpeg-turbo"
PREFERRED_PROVIDER_jpeg-native = "libjpeg-turbo-native"
PREFERRED_PROVIDER_udev = "udev"

BB_NUMBER_THREADS = "6"
PARALLEL_MAKE = "-j 6"

MACHINE ?= "overo"

#DL_DIR ?= "/oe-sources"

# [denzil] - meta-jumpnow, soft-fp 
# TMPDIR = "/oe1"

DISTRO ?= "poky"

PACKAGE_CLASSES ?= "package_ipk"

# Supported values are i686 and x86_64
SDKMACHINE ?= "x86_64"

USER_CLASSES ?= "image-mklibs image-prelink"

PATCHRESOLVE = "noop"

CONF_VERSION = "1"


Edit bblayers.conf

Here's an example, edit the paths for your machine.

BBLAYERS ?= " \
 /home/scott/poky/meta \
 /home/scott/poky/meta-yocto \
 /home/scott/poky/meta-openembedded/meta-oe \
 /home/scott/poky/meta-jumpnow \
 "

Replace meta-jumpnow with meta-jumpnow-duo if you are using that.

If you changed DL_DIR and TMPDIR then make sure they exist and you have permissions to read/write those directories

scott@quad:~$ sudo mkdir /oe-sources
scott@quad:~$ sudo chown -R scott:scott /oe-sources

The alternate TMPDIR is best on its own partition so you can wipe it quickly. Even better if its on a second fast disk.

scott@quad:~$ sudo mkdir /oe1
scott@quad:~$ sudo chown -R scott:scott /oe1

 

Build an image

Building the two images below required 36GB of space in TMPDIR. If you skipped the Qt image and only built the jumpnow-console-image it will probably take less then half of that. I didn't check.

scott@quad:~/poky/build$ bitbake jumpnow-console-image

and/or

scott@quad:~/poky/build$ bitbake jumpnow-qte-image

The jumpnow-qte-image includes the jumpnow-console-image, but the console image zip'd rootfs file won't be created unless you explicitly build it.

 

The finished binaries can be found under $OETMP/deploy/images

These are the files intended for your BOOT partition.

  • MLO
  • u-boot.img
  • uImage-overo.bin

 

These are the rootfs images to untar to the microSD card ROOT partition

  • jumpnow-console-image-overo.tar.bz2
  • or
  • jumpnow-qte-image-overo.tar.bz2

 

Copy the Files

 

There are some scripts in ~/poky/meta-jumpnow/scripts to assist copying the binaries to a microSD card.

The script mk2parts.sh can be used to partition your SD card. You only need to use this once per card.

Run it with sudo passing the device name where your microSD card appears on your system under /dev

sudo ./mk2parts.sh sdb

 

The copy scripts require an environment variable OETMP to be defined. It needs to point to the poky TMPDIR.

For this example, here is what I used

scott@quad:~/poky/meta-jumpnow/scripts$ export OETMP=/oe1

If you did not modify the layer.conf TMPDIR then your OETMP will be ~/poky/tmp

 

The copy scripts also use /media/card as the mount point to use when copying the files so make sure that exists or modify the scripts to use another mount point.

sudo mkdir /media/card

 

Running the copy scripts


Now assuming a properly partitioned microSD card is inserted and NOT mounted, the following scripts will copy the image.

( Unmount the microSD card first if it is mounted, i.e. sudo umount /dev/sdb1; sudo umount /dev/sdb2 )

My sd card shows up as /dev/sdb so I passed sdb as the script argument.

scott@quad:~/poky/meta-jumpnow/scripts$ ./copy_boot.sh sdb

And the root filesystem using the copy_rootfs.sh script.

scott@quad:~/poky/meta-jumpnow/scripts$ ./copy_rootfs.sh sdb

Edit the copy_rootfs.sh script to copy either the console or qte image.

 

Boot the Image

Put the card in the Gumstix and boot it. Most of the Gumstix COM expansion boards have a USB serial console.

There is no password for the root account and no password logins are allowed in /etc/ssh/sshd_config.

root@overo:~# uname -a
Linux overo 3.2.0 #1 PREEMPT Thu Dec 20 18:55:19 EST 2012 armv7l GNU/Linux

root@overo:~# cat /etc/issue
Yocto (Built by Poky 7.0.1) 1.2.1 \n \l

root@overo:~# lsmod
Module                  Size  Used by
mt9v032                 5990  4294967295 
omap3_isp             125222  0 
v4l2_common             9139  2 mt9v032,omap3_isp
videodev               84633  3 mt9v032,omap3_isp,v4l2_common
media                  12513  3 mt9v032,omap3_isp,videodev
libertas_sdio          16208  0 
libertas               99103  1 libertas_sdio
cfg80211              165642  1 libertas
lib80211                5017  1 libertas
firmware_class          6797  2 libertas_sdio,libertas
ads7846                10347  0 
rfcomm                 55142  0 
hidp                   16412  0 
bluetooth             210041  4 rfcomm,hidp
rfkill                 17069  2 cfg80211,bluetooth
ipv6                  240138  10 


root@overo:~# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:15:C9:28:FD:AC  
          inet addr:192.168.10.109  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::215:c9ff:fe28:fdac/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:9 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2032 (1.9 KiB)  TX bytes:914 (914.0 B)
          Interrupt:80 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 00:19:88:43:48:EB  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

 

Testing the compiler and Qt

The Qt embedded and tslib environment variables are setup for you automatically and assume a Gumstix LCD43 display.

Look at the scripts in /etc/profile.d/ if you need to modify this.

You'll need to run ts_calibrate once before you can run a Qt GUI app.

 

Creating a boot.scr

If you are using a Gumstix COM without NAND and you want to change the default parameters passed from u-boot to the kernel then you'll need a boot.scr.

If your COM has NAND then you do not require this. You can save u-boot environment changes in NAND.

As an example, if I had an Overo Tide COM and wanted to use one of the Gumstix 4.3" touchscreen LCD expansion boards and display, then I could use the provided lcd43-boot.cmd file to feed to make-boot-script.sh to generate a boot.scr.

scott@hex:~/poky/meta-jumpnow/scripts$ cat lcd43-boot.cmd 
setenv bootargs "console=ttyO2,115200n8 mpurate=720 vram=12M omapdss.def_disp=lcd43 
  root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait"
setenv loadaddr 0x82000000
fatload mmc 0 ${loadaddr} uImage
bootm ${loadaddr}

scott@hex:~/poky/meta-jumpnow/scripts$ ./make-boot-script.sh lcd43-boot.cmd 
Image Name:   lcd43-boot.cmd
Created:      Fri Dec 21 07:40:10 2012
Image Type:   ARM Linux Script (uncompressed)
Data Size:    219 Bytes = 0.21 kB = 0.00 MB
Load Address: 00000000
Entry Point:  00000000
Contents:
   Image 0: 211 Bytes = 0.21 kB = 0.00 MB

 

Copy the boot.scr to the deploy directory $OETMP/deploy/images

scott@quad:~/poky/meta-jumpnow/scripts$ cp boot.scr $OETMP/deploy/images

If you copy the source file (lcd43-boot.cmd) to the deploy/images directory renamed as boot.cmd then it will also get copied to the SD card BOOT partition with the copy_boot.sh script. This is not required, but only for reference.

 

Hard Floating Point

You can enable hard-floating point by uncommenting the following line

#DEFAULTTUNE ?= "cortexa8hf-neon"

in this file

meta-jumpnow/conf/machine/include/overo-jumpnow.inc

or the equivalent line in duovero-jumpnow.inc for the Duovero.

You should do this before your first build.