Building Linux from Yocto

Overview

The following text describes the process required to build a Linux image for the TW range of display modules using Yocto 1.7 (Dizzy). The result of this process will be an SD card image that will contain the Linux Kernel 2.6.35 on a Freescale i.MX28 processor. 

Preparing the Host

The steps in this guide were tested using a Virtual Machine running 64 bit Ubuntu 15.04. 

VMware Player can be used to emulate a Linux PC. It can be downloaded from https://my.vmware.com/web/vmware/downloads
Download and install VMware Player then create a new virtual machine using Ubuntu 15.04 64 bit Desktop which can be downloaded from http://releases.ubuntu.com/15.04/
Yocto is very demanding during its build process so we recommend that you allocate as many resources as possible for the fastest build time. The virtual machine that we used had the following configuration.

  • 4GB RAM
  • 4 Cores
  • 100GB Disk Space

Initial Setup

To ensure that the repositories for Ubuntu 15.04 work, edit /etc/apt/sources.list and replace the lines 'us.archive.ubuntu.com' and 'security.ubuntu.com' with 'old-releases.ubuntu.com'.

$ sudo sed -i 's/us.archive.ubuntu.com/old-releases.ubuntu.com/g' sources.list

$ sudo sed -i 's/security.ubuntu.com/old-releases.ubuntu.com/g' sources.list

Before we can build with Yocto we must first install some packages, open Terminal and run the following command to update all packages.

$ sudo apt-get update

Install the required packages.

$ sudo apt-get install gawk wget git diffstat unzip texinfo build-essential chrpath socat xterm libglu1-mesa-dev

Configure Git with your email address and name. Replace the example details with your own.

$ git config --global user.email "john.smith@example.com" 
$ git config --global user.name "John Smith"

Install Repo

Repo must first be installed to enable us to download Yocto.

$ cd 
$ git clone https://gerrit.googlesource.com/git-repo
$ mkdir bin
$ cp git-repo/repo bin/
$ chmod 755 bin/repo
$ export PATH=~/bin:$PATH

Install Yocto

We can now use repo to download Yocto, the Freescale community layers and the Poky toolchain.

$ cd 
$ mkdir fsl-community-bsp
$ cd fsl-community-bsp
$ repo init -u https://github.com/freescale/fsl-community-bsp-platform -b dizzy
$ repo sync

Download Files

Download itron_build_files.tar.gz and copy into /tmp then extract.

$ cd /tmp 
$ wget http://noritake-itron.com/downloads/itron_build_files.tar.gz
$ tar xvf itron_build_files.tar.gz

Install the Itron Layer

Copy the Itron layer into the Yocto sources directory. This contains all of the patches and files required to configure Linux for Itron TW boards.

$ cd ~/fsl-community-bsp/sources 
$ tar xvf /tmp/itron_build_files/meta-fsl-itron.tar.gz

The layer contains everything needed to configure Linux for the TW display, it can be customised to your specific board requirements. The files found in the layer are explained below:

meta-fsl-itron/conf/layer.conf
This file contains a list of programs to install under ‘IMAGE_INSTALL_append’, any additional programs can be included here and they will be copied into the Linux build.

meta-fsl-itron/recipes-kernel/linux/linux-imx-2.6.35.3/itron-config.inc
The configuration for the target display resides here. You can enable any one of the display sizes by uncommenting the desired size.

meta-fsl-itron/recipes-kernel/linux/linux-imx-2.6.35.3/
This directory contains all of the linux code patches for TW displays. Any additional code patches can be added to this directory and must be included in one of the display files located in /meta-fsl-itron/recipes-kernel/linux/ to ensure that they are applied during the build process.

meta-fsl-itron/recipes-itron/itron-bootscripts/itron-config.inc
This contains the TW display’s bootscript configuration. From here you can change the touch screen type that is loaded during the display’s boot process.
Using default settings we are building for a 4.3 inch 480x272 size display with resistive touchscreen. 

Install Kernel Configuration

The defconfig file contains the Kernel configuration as defined by Itron, it must replace the existing default configuration file.

$ cp /tmp/itron_build_files/defconfig ~/fsl-community-bsp/sources/meta-fsl-arm/recipes-kernel/linux/linux-imx-2.6.35.3/imx28evk/defconfig

Build Target Image

Configure environment ready for bitbake.

$ cd ~/fsl-community-bsp/ 
$ MACHINE=imx28evk source ./setup-environment build-qt5-1

The file bblayers.conf includes the meta-fsl-itron layer into the build process. local.conf includes any packages that we need along with configuration for the target. Both of these files need to be copied into the Yocto directory.

$ cp /tmp/itron_build_files/local.conf /tmp/itron_build_files/bblayers.conf ~/fsl-community-bsp/build-qt5-1/conf/ 

We can now start the build, it will take some time on the first build depending on your computer’s speed and requires an internet connection so that the package sources can be downloaded.

$ bitbake core-image-minimal

Copy Image to SD Card

The target files can be found in:
~/fsl-community-bsp/build-qt5-1/tmp/deploy/images/imx28evk
The file named core-image-minimal-imx28evk.sdcard is formatted for use on an SD card. Use the dd command to copy this onto an SD card.
Note, before running the dd command check which device is the correct location for the SD card otherwise you can corrupt your hard disk. In the case of this example the SD card was located at /dev/sdb/

$ cd ~/fsl-community-bsp/build-qt5-1/tmp/deploy/images/imx28evk 
$ sudo dd if=core-image-minimal-imx28evk.sdcard of=/dev/sdb bs=1M

Terminal Console

Once writing to the SD card is complete you should be able to insert this card into your board and boot. Using the debug port you can access the terminal console. On a standard display the console can be accessed via port J1 on the back of the display. RXD and TXD are available at 3.3V. A cable (RS232INT4) to connect this to a PC at RS232 levels is available. 

Debug Pinout

The debug connector is available on J1 for displays with the TW480x272 prefix, and is available on DB1 for displays with the TW800x480 or TW640x480 prefix. The debug connector has the the following pinout.

PinFunction
1 3.3V
2 TX
3 RX
4 GND

 

Communication

Communication with the display can be achieved using a terminal program for example HyperTerminal or Putty http://www.chiark.greenend.org.uk/~sgtatham/putty. The following communication settings must be used.

Baud Rate: 115200 

Parity: None 

Handshaking: None

When Linux has booted the login prompt will appear as in the screenshot below, login as 'root' with no password.

 

 

 

 

 

Print Email