Welcome to Pengwyn SDK’s documentation!

Version:1.0.0A
Copyright:Architech
Date:06/11/13
_images/pengwyn.png

This documentation is about the Yocto based SDK v01.00.00 for the Pengwyn board. The SDK is provided by means of an already configured VirtualBox virtual machine, inside the virtual machine everything has already been configured for you so you don’t waste time trying to understand every single detail of every single software component from the beginning. If you are a new user of the Yocto based SDK we suggest you to read the

Quick start guide

otherwise, if you want to have a better understanding of specific topics, we suggest you to have a look to the documentation chapters:

Installing the Virtual Machine

The development environment is provided as a Virtual Machine image.

To be able to use it, you first need to install VirtualBox. The version must be the 4.2.10 or above.

_images/virtualboxlogo.png

Go to:

https://www.virtualbox.org/wiki/Downloads

and download the version that suits your host operating system. You need to download and install the Extension Pack as well.

Important

Make sure that the extension pack has the same version of VirtualBox.

Install the software with all the default options.

Launch the program and follow these steps:

Tip

If you are using Linux, double click directly on the .ova file from your file explorer, there will appear a window so click import button.

_images/importova.png

Jump to step 3.

  1. From the menu: File → Import Appliance
_images/importAppliance.png
  1. Click on “Open appliance…” button and select the .ova file “PengwynYocto-beta-2013-03-19.ova”.
  2. After opening the appliance, click on “Shared Folders” and select a folder to share with your host operating system. When edit shard folder select Auto-mount check box.
_images/vbSharedFolders.png
  1. The ethernet card must be attached to the LAN, not to the WLAN (to make some test you will connect the Pengwyn board to the PC with an ethernet point-to-point connection). To set the correct card, go to menu “machine -> Settings”. Click on “Network” tab and select your LAN card. Double check also that the field “Attached to” is set to “Bridged Adapter”. If you want to improve the performances of the virtual machine, please read How to setup the number of CPUs and the amount of RAM used by your virtual machine. Click on button “Ok” to apply your choices when you are done.
_images/ivs2.png

Important

The sudo password is pengwyn

  1. Click the icon “Start” button on the toolbar.
_images/vbStart.png

How to configure the network on the virtual machine

Another important thing to do is to set the IP address of the virtual machine as static. To do this follow the next steps inside the virtual machine:

  1. Right-click on network connection icon. Select Edit Connections....
_images/ip-1.png
  1. In Wired” tab, select “Auto eth0” and press *Edit... button.
_images/auto-eth0.png
  1. Click to IPv4 Settings, press on Add button and insert the following address:
  • Address: 192.168.0.20
  • Netmask: 255.255.255.0
  • Gateway: none
_images/edit-connection.png
  1. Click on Apply.

How to setup the number of CPUs and the amount of RAM used by your virtual machine

You can configure the system settings of the virtual machine. This is possible only if the virtual machine is off. First, select the Yocto based SDK virtual machine from the list of virtual machines, click on the Settings icon in the Oracle VM VirtualBox Manager window:

_images/setvm-1.png

In the left menu, click on System. In the Motherboard tab you can select how much RAM you want to assign to the vm.

_images/setvm-2.png

Select Processor tab to select how many CPUs you want to assign to the virtual machine:

_images/setvm-3.png

If you changed the number of processors, you might want to consider reading the guides on how to speedup the build process for Poky and HOB.

How to use Poky

Poky is a stable version of OpenEmbedded tailored for the Yocto Project. It consists of BitBake, that is a make-alike build tool, and a set of recipes (.bb files) and configuration files used to drive bitbake during the build process. A recipe is a collection of metadata used by BitBake to set variables or define additional build-time tasks. With the variables, a recipe can specify, for example, where to get the sources, which build process to use, the license of the package, an so on. There is a set of predefined tasks (the fetch task for example fetches the sources from the network, from a repository or from the local machine, than the sources are cached for later reuses), but a recipe can always adds custom ones or overrides/modifies existing ones. Yocto is an umbrella project that contains a few components, Poky is one of the largest components of Yocto. This document will focus on the most basic topics, for a full guide you are encouraged to read the official documentation of the Yocto Project.

How to prepare the environment

The virtual machine contains Denzil (version 7.0.1 of Poky, corresponding to Yocto version 1.2.1) already installed and configured to work with the Pengwyn board under /home/pengwyn/yocto/poky. To start using Poky, open a terminal (Ctrl+Alt+t or from Ubuntu’s menu: Applications→Accessories→Terminal) and type:

pengwyn@pengwyn-desktop:~$ cd yocto
pengwyn@pengwyn-desktop:~/yocto$ source poky/oe-init-build-env

### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
core-image-minimal
core-image-sato
meta-toolchain
meta-toolchain-sdk
adt-installer
meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'

pengwyn@pengwyn-desktop:~/yocto/build$

With the source command the environment has been prepared and, in the current shell, you are able to execute bitbake commands. The sourced script changed also the current directory, that now is ~/yocto/build. You are free to use another build directory, to do that, when you source the environment script, you can specify the name of the directory to use like in the following example:

pengwyn@pengwyn-desktop:~/yocto$ source poky/oe-init-build-env myBuilds
You had no conf/local.conf file. This configuration file has therefore been
created for you with some default values. You may wish to edit it to use a
different MACHINE (target hardware) or enable parallel build options to take
advantage of multiple cores for example. See the file for more information as
common configuration options are commented.

The Yocto Project has extensive documentation about OE including a reference manual
which can be found at:
   http://yoctoproject.org/documentation

For more information about OpenEmbedded see their website:
   http://www.openembedded.org/

You had no conf/bblayers.conf file. The configuration file has been created for
you with some default values. To add additional metadata layers into your
configuration please add entries to this file.

The Yocto Project has extensive documentation about OE including a reference manual
which can be found at:
   http://yoctoproject.org/documentation

For more information about OpenEmbedded see their website:
   http://www.openembedded.org/



### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
   core-image-minimal
   core-image-sato
   meta-toolchain
   meta-toolchain-sdk
   adt-installer
   meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'

pengwyn@pengwyn-desktop:~/yocto/myBuilds$

How to build your Linux distribution

To make a Linux distribution for the Pengwyn board you are going to need:

  • a bootloader,
  • the Linux Kernel (along with modules), and
  • a filesystem.

There is a set of recipes already prepared to generate all that. The pre-configured virtual machine supports the following subset of those recipes:

  • core-image-base.bb
  • core-image-basic.bb
  • core-image-core.bb
  • core-image-clutter.bb
  • core-image-minimal.bb
  • core-image-minimal-dev.bb
  • core-image-minimal-mtdutils.bb
  • core-image-lsb.bb
  • core-image-lsb-dev.bb
  • core-image-lsb-sdk.bb
  • qt4e-demo-image.bb
  • core-image-sato.bb

Each recipe generates the bootloader, the Linux Kernel, and a specific filesystem. We encourage you to read the official documentation for the details of the aforementioned images recipes. To tell BitBake to build one of those images, run bitbake with the image recipe name (without .bb) as argument, for example, to build the core-image-minimal.bb image run bitbake core-image-minimal like in the following example:

pengwyn@pengwyn-desktop:~/yocto/build$ bitbake core-image-minimal
Pseudo is not present but is required, building this first before the main build
Loading cache: 100% |#############################################| |ETA:  00:00:00
Loaded 1790 entries from dependency cache.

OE Build Configuration:
BB_VERSION        = "1.15.2"
TARGET_ARCH       = "arm"
TARGET_OS         = "linux-gnueabi"
MACHINE           = "pengwyn"
DISTRO            = "poky"
DISTRO_VERSION    = "1.2.1"
TUNE_FEATURES     = "armv7a vfp neon cortexa8"
TARGET_FPU        = "vfp-neon"
meta
meta-yocto        = ":"
meta-efl
meta-gnome
meta-gpe
meta-initramfs
meta-multimedia
meta-oe
meta-xfce         = "(nobranch):e77646bc2cf905fd671fc5c19ab6fd17f9b94b3f"
meta-ti-amsdk     = "(nobranch):d8f257b275bbf2d573d66d823a118c765f7a26f9"
meta-silica       = ":"

NOTE: Resolving any missing task queue dependencies
NOTE: Preparing runqueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
...

Depending on your hardware and Internet characteristics, this task can take from less than one hour to several hours. Once it finishes, you are going to find bootloader, Linux kernel, kernel modules and filesystem under directory ~/yocto/tmp/deploy/images. If you were working under the default directory (build directory), for example, you are going to find all the following files under directory ~/yocto/build/tmp/deploy/images:

  • MLO (bootloader),
  • u-boot-pengwyn.img (bootloader),
  • uImage-pengwyn.bin (Linux Kernel),
  • modules-3.2.0-r0-pengwyn.tgz (Kernel modules), and
  • core-image-minimal-pengwyn.tar.gz (filesystem to be written onto the SD card, the NFS or the NAND memory),

that is the result of building your Linux system from the ground up. It might happen that a fetch task gives an error, if so, double check that the virtual machine has a proper network configuration. If the network configuration has been proved correct, the error might mean that the needed server is down for some reason, in that case the only option you have is to wait and try again later.

How to speedup the build process

When you imported the virtual machine, you might have choosen the number of processors to give to the virtual machine, if so, you can change the parallelism factors to speedup the build process. Once you sourced the environment script and it changed your current directory, you can find the file local.conf inside directory conf, use your preferred editor to open it and change BB_NUMER_THREADS variable value from 2 to <number of processors> * 2, and change PARALLEL_MAKE variable value from -j 2 to -j <number of processors> * 2. For example, if you gave 4 processors to the virtual machine, you could set:

  • BB_NUMBER_THREADS = 8, and
  • PARALLEL_MAKE = -j 8.

Those modifications are available to the current build directory alone, so if you create another build directory you should set again the same values in the corresponding local.conf file. To make such changes available anytime you create a new build directory, you can edit file ~/yocto/poky/meta-yocto/conf/local.conf.sample and change the value of the aforementioned variables, every time you create a new build directory local.conf.sample file will be used to create the project local.conf file, and the modification will be seen and used by your new projects.

Package management and class

Poky supports the generation of three types of packages:

  • ipk,
  • rpm, and
  • deb.

The default one is ipk, you can change that modifying the PACKAGE_CLASSES variable value inside conf/local.conf file in your build directory. Also in this case, you can make your preference permanent editing file ~/yocto/poky/meta-yocto/conf/local.conf.sample directly.

The tool used to manage the packages directly onto the target is going to be installed by default, to remove it and save space on the generated file system you can edit file local.conf and remove package-management value from EXTRA_IMAGE_FEATURES variable. As usual, if you want that modification to be permanent, change the value directly within file local.conf.sample.

Development accessories

To debug your code on the Pengwyn board you will need:

  • the tcf-agent service, and
  • gdbserver.

Both the utility have already been configured to be installed on the destination file system but, if you want a smaller file system and you already finished debugging your application, you can remove tcf-agent and gdbserver values from IMAGE_INSTALL_append inside local.conf file.

Another set of utilities that you might be insterested about is mtd-utils, with the programs installed by such a package you can manage the NAND memory and you can write your filesystem directly onto the NAND memory. By default the mtd-utils package is going to be installed onto your preferred filesystem, anyway, if you want to remove it from the build process you can delete mtd-utils value from IMAGE_INSTALL_append variable.

Kernel modules

Kernel modules are pieces of code that can be loaded and unloaded into the kernel space upon demand. They extend the functionality of the kernel without the need to reboot the system. If you want insert new modules into your distribution there are two ways to do this:

  • manually (after you have built the image):
  1. turn on Pengwyn board
  2. use minicom (refer to section Usb-Serial to know how to configure minicom) to uncompress the new module package from the root of the target file system.
  3. launch command:
depmod

This command handle dependency descriptions for the new loadable kernel modules. This dependency is written to modules.dep file that can be used by modprobe to automatically load the relevant modules.

  • automatically (before to build image):
  1. Before to use bitbake command to build a image, go to directory ~/yocto/build/conf and open the local.conf file with your preferred editor.
  2. Modify IMAGE_INSTALL_append variable value adding kernel-modules like in the following example:
IMAGE_INSTALL_append = " tcf-agent dgbserver kernel-modules"

In this way the modules dependencies will be resolved at build time and the kernel modules will be installed in the file system.

How to customize u-boot

To customize u-boot you need to modify the sources. First of all, you need to have two different directories, one that contains the exact sources that poky uses to build the system, and another one with your modifications. To explain how to setup those two directories, hereafter will be assumed that you will work inside directory ~/Documents. Open the terminal, than type:

pengwyn@pengwyn-desktop:~/Documents$ mkdir /home/pengwyn/Documents/u-boot-configuration
pengwyn@pengwyn-desktop:~/Documents$ cd /home/pengwyn/Documents/u-boot-configuration
pengwyn@pengwyn-desktop:~/Documents/u-boot-configuration$ cp ../../yocto/poky/meta-silica/recipes-bsp/u-boot/u-boot-pengwyn-2013.01/* .
pengwyn@pengwyn-desktop:~/Documents/u-boot-configuration$ tar -xzf u-boot-pengwyn-2013.01.tar.gz
pengwyn@pengwyn-desktop:~/Documents/u-boot-configuration$ mv u-boot-pengwyn-2013.01 a
pengwyn@pengwyn-desktop:~/Documents/u-boot-configuration$ patch -p1 -d a/ < u-boot-pengwyn-2013.01.patch
patching file arch/arm/cpu/armv7/am33xx/board.c
patching file arch/arm/include/asm/arch-am33xx/cpu.h
patching file arch/arm/include/asm/arch-am33xx/omap_gpmc.h
patching file board/silica/pengwyn/Makefile
patching file board/silica/pengwyn/mux.c
patching file boards.cfg
patching file common/miiphyutil.c
patching file common/spl/spl_nand.c
patching file drivers/mtd/nand/nand_base.c
patching file drivers/mtd/nand/nand_bbt.c
patching file drivers/mtd/nand/nand_ids.c
patching file drivers/mtd/nand/omap_gpmc.c
patching file drivers/net/cpsw.c
patching file drivers/net/phy/Makefile
patching file drivers/net/phy/phy.c
patching file drivers/net/phy/ti.c
patching file include/configs/pengwyn.h
patching file include/linux/mtd/mtd-abi.h
pengwyn@pengwyn-desktop:~/Documents/u-boot-configuration$ cp -r a/ b/

Directory b contains the sources that you can modify. Typically, you will want to modify u-boot settings, in which case you should edit file ~/Documents/u-boot-configuration/ b /include/configs/pengwyn.h with your preferred editor. When you are done with your modifications, type:

pengwyn@pengwyn-desktop:~/Documents/u-boot-configuration$ diff -Naur a/ b/ > u-boot-pengwyn-2013.01.mine.patch
pengwyn@pengwyn-desktop:~/Documents/u-boot-configuration$ cp u-boot-pengwyn-2013.01.mine.patch /home/pengwyn/yocto/poky/meta-silica/recipes-bsp/u-boot/u-boot-pengwyn-2013.01/

Create a file named u-boot-pengwyn_2013.01.bbappend inside directory /home/pengwyn/yocto/poky/meta-silica/recipes-bsp/u-boot/ and write the following text inside the .bbappend file:

SRC_URI += "file://u-boot-pengwyn-2013.01.mine.patch \
"

You are now ready to build (actually, rebuild) your customized version of u-boot:

pengwyn@pengwyn-desktop:~/yocto/build$ bitbake u-boot-pengwyn -c cleanall

...

pengwyn@pengwyn-desktop:~/yocto/build$ bitbake u-boot-pengwyn

Once the build process finished, the output files (MLO and u-boot-pengwyn.img) will be placed under tmp/deploy/images/ inside your build directory, so, if you are building your system from the default directory, the destination directory will be /home/pengwyn/yocto/build/tmp/deploy/images.

How to customize the Linux Kernel

From menuconfig

The most frequent way of customization of the Linux Kernel is to change the .config file that contains the Kernel options. Setup the environment and run:

pengwyn@pengwyn-desktop:~/yocto/build$ bitbake linux-pengwyn -c cleanall

...

pengwyn@pengwyn-desktop:~/yocto/build$ bitbake linux-pengwyn -c menuconfig

...

a new window, like the following one, will pop-up

_images/menuconfig.png

follow the instructions, save and exit, than you ready to generate your preferred image based on your customized kernel. If you prefer, you can build just the kernel running:

pengwyn@pengwyn-desktop:~/yocto/build$ bitbake linux-pengwyn

...

At the end of the build process, the output file (uImage.bin), along with the built kernel modules (modules-3.2.0-r0-pengwyn.tgz), will be placed under tmp/deploy/images/ inside your build directory, so, if you are building your system from the default directory, the destination directory will be /home/pengwyn/yocto/build/tmp/deploy/images.

From sources

If you want to modify the Linux kernel sources instead, insert the following commands to create an image of the actual used sources:

pengwyn@pengwyn-desktop:~$ mkdir -p /home/pengwyn/Documents/linux-kernel
pengwyn@pengwyn-desktop:~$ cd /home/pengwyn/Documents/linux-kernel
pengwyn@pengwyn-desktop:~/Documents/linux-kernel$ cp /home/pengwyn/yocto/poky/meta-silica/recipes-kernel/linux/linux-pengwyn-3.2/linux-pengwyn* .
pengwyn@pengwyn-desktop:~/Documents/linux-kernel$ tar -xzf linux-pengwyn_3.2.tar.gz
pengwyn@pengwyn-desktop:~/Documents/linux-kernel$ mv linux-pengwyn_3.2 a
pengwyn@pengwyn-desktop:~/Documents/linux-kernel$ patch -p1 -d a/ < linux-pengwyn_3.2.patch
patching file ...
...
pengwyn@pengwyn-desktop:~/Documents/linux-kernel$ cp -r a/ b/

Modify the sources contained inside directory b, than create your patch

pengwyn@pengwyn-desktop:~/Documents/linux-kernel$ diff -Naur a/ b/ > linux-pengwyn_3.2.mine.patch
pengwyn@pengwyn-desktop:~/Documents/linux-kernel$ cp linux-pengwyn_3.2.mine.patch /home/pengwyn/yocto/poky/meta-silica/recipes-kernel/linux/linux-pengwyn-3.2/

Create a file named linux-pengwyn_3.2.bbappend inside directory /home/pengwyn/yocto/poky/meta-silica/recipes-kernel/linux/ and write the following text inside the .bbappend file:

SRC_URI += "file://linux-pengwyn_3.2.mine.patch \
"

Clean and build:

bitbake linux-pengwyn -c cleanall
bitbake linux-pengwyn

How to create the SD card

This section describes the steps to be followed to create a standalone bootable system on SD card.

Prerequisites

Ensure that the following is available:

  • An SD memory card reader/programmer to copy files from the Linux Host. The SD card reader must be accessible from VirtualBox.

Warning

Not all computer built-in readers can be used, use USB connected devices instead.

  • An SD card

Warning

Your sd-card will be formatted and all the data contained in it will be lost forever!

  • A Linux host with fdisk, sfdisk, mkfs.ext3 and mkfs.vfat utilities. If you are running the VM with Ubuntu pre-installed and the environment already in place, all the packages are already available.
  • The files MLO, u-boot-pengwyn.img, uImage.bin, (optionally) the kernel modules (modules-3.2.0-rX-pengwyn.tgz, where X is the revision number for the kernel modules, without any modification to the kernel configuration it should be 0) and the root file system with name ending with -pengwyn.tar.gz are available inside the images deploy directory (<build directory>/tmp/deploy/images/, if your build directory is the default one, then the deploy directory is /home/pengwyn/yocto/build/tmp/deploy/images). The scripts will get the latest files from folder /home/pengwyn/yocto/build/tmp/deploy/images. If you want to specify a custom directory enter the path directly after the script name, e.g.:
run_sdcard /home/pengwyn/custom-dir

Otherwise you can run it with run_sdcard command or use the icon on desktop:

_images/run_sd.png

How to build the SD card

  • Run the VM on VirtualBox
  • Connect your SD card reader to your computer than to the virtual machine, from VirtualBox menu select Devices → USB Devices → “your SDcard reader”.
  • Insert the SD card into the adapter (in this example we are inserting an SD card already partitioned with a FAT and an EXT2 partition, that is the basic configuration for the Pengwyn board).
  • Run the following command
pengwyn@pengwyn-desktop:~$ sudo fdisk -l

Disk /dev/sdb: 1971 MB, 1971322880 bytes
255 heads, 63 sectors/track, 239 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x9bfa2153

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1           9       72261    c  W95 FAT32 (LBA)
/dev/sdb2              11         239     1839442+  83  Linux
  • Find the device name from fdisk command output, in this example is /dev/sdb.
  • Run the script that will prepare the SD card with all the needed files to run the system, you can either:

1 ) double click on desktop icon:

_images/run_sd.png

2 ) execute the following script:

run_sdcard

3 ) click on the splash screen sd card icon, after having clicked the develop icon.

_images/developSelection.png _images/sdCardSelection.png
When the script starts asks for the sudo password, type pengwyn followed by enter-key.
The list of available devices will be shown: the SD card should be the number 1 of the list with name sdb. Check the size shown on the table to be sure that the device is the correct one. Enter the device number 1 followed by enter-key.
+------------------------------------------------------------------------------+
|                                                                              |
| This script will create a bootable SD card.                                  |
| The script must be run with root permissions.                                |
|                                                                              |
+------------------------------------------------------------------------------+


+------------------------------------------------------------------------------+
| LIST OF AVAILABLE DRIVES:                                                    |
+------------------------------------------------------------------------------+

#  major   minor    size   name
1:   8       16    1927168 sdb

Enter Device Number #:
The script will create two partitions on the SD card: the first one is a FAT32 with the boot files (MLO, u-boot-pengwyn.img, uImage.bin will be renamed to MLO, u-boot.img and uImage), the second one is an ext3 with the target file system.
The operations will take few minutes.
[sudo] password for pengwyn:


+------------------------------------------------------------------------------+
|                                                                              |
| This script will create a bootable SD card.                                  |
| The script must be run with root permissions.                                |
|                                                                              |
+------------------------------------------------------------------------------+


+------------------------------------------------------------------------------+
| LIST OF AVAILABLE DRIVES:                                                    |
+------------------------------------------------------------------------------+

#  major   minor    size   name
1:   8       16    1927168 sdb

Enter Device Number #: 1

sdb was selected

sdb1  sdb2
72261 1839442

Mount the partitions
Emptying partitions
Syncing....

+------------------------------------------------------------------------------+
|      Copying files now... will take minutes                                 |
+------------------------------------------------------------------------------+

Copying boot partition
Copying file system partition
Copying modules
Syncing....
Un-mount the partitions
Remove created temp directories
Operation Finished

Press ENTER to finish
  • Remove the SD card

How to write the NAND memory

This section will explain how to transfer the data from the sd card to the Pengwyn board flash memory.

Follow these steps:

_images/pengwynJ1.png
  • Insert the already prepared SD card in the Pengwyn board socket
  • Reset the board by means of button S1
_images/pengwynS1.png
  • Press any key when U-Boot says Hit any key to stop autoboot
_images/ubootStop.png
  • Erase and upload the FLASH memory with the commands
nand erase.chip
run nandupdate
  • Wait until the NAND write completes, than restart the board with the command
reset
  • Wait until U-Boot and Linux initialize the system, than insert root as login when required (there is no password)
  • Create the flash file system with the automated script:
./create-nand-fs.sh
  • When UBIFS is unmounted, shutdown linux with the command:
shutdown -h now
  • When the system has been halted, remove the SD card, insert the jumper in J1 and reset the board with button S1.

The system will now restart from NAND flash with the new operating system.

How to use HOB

HOB is a graphical interface for bitbake. To run it, prepare the environment than run run_hob command or click icon from desktop,

_images/run_hob.png

HOB window will appear.

_images/hob-welcome.png

How to speedup the build process

When you imported the virtual machine you might have changed the number of processors made available to the virtual machine itself. If you did that, you can optimize the build time in this way:

  • Click on Settings, a new window will appear. Select on Build environment tab.
_images/hob-parallelism.png
  • Change BB number threads value from 2 to <number of processors used by the virtual machine> * 2, set Parallel make to the same value. Click on save.

This modification will be available just for the current build directory, to make it permanent please refer to Poky’s guide on How to speedup the build process.

How to change the root file system package format

It is possible to choose between the following formats:

  • ipk,
  • rpm, and
  • deb,

by clicking on SettingsOutput

_images/hob-package-manager.png

choosing your preferred package format, and saving.

How to build a predefined image

Select pengwyn from the combo-box, after the recipes have been parsed the section Select a base image will appear and you can choose your preferred image.

_images/hob-image-selection.png

Click on Build image

_images/hob-build-predefined-image.png

than the build process will start.

_images/hob-building-predefined-image.png

Please note that the build process can last several hours till it finishes.

_images/hob-predefined-image-build-completed.png

It might happen that a fetch task gives an error, if so, double check that the virtual machine has a proper network configuration. If the network configuration has been proved correct, the error might mean that the needed server is down for some reason, in that case the only option you have is to wait and try again later.

How to build a custom image

There are two possible ways to customize an image to build:

  • modify a predefined image,
  • create a new image from scratch.

Once you selected a predefined image, you can click on View recipes to add/remove recipes and tasks or you can click on View packages to add/remove previously built packages. After the image has been customized you can build your image. If you want to customize every detail you can choose Create your own image from the drop down menu of section Select a base image, than, as previously stated, you can customize the content of your file system and build it.

How to configure the remote boot

Remote boot can work like in the following figure:

_images/remote.png

To boot from remote the host machine must share the kernel image through a tftp server and the root filesystem through an NFS server. Since the target will look for a dhcp during the boot, the host machine needs to have a dhcp server up and running as well.

This guide will present an example of configuration for booting the pengwyn board with a remote kernel and a remote filesystem. To make things work you need to be sure the target can reach the host machine and all the required services (dhcp, tftp, NFS) are properly configured and up and running.

How to set the network

The operating system that runs the needed network services (like dhcp, tftp and NFS) will be named host machine, the board that downloads from the host machine the kernel image and the root file system will be named target machine. When the target machine power on, the first program that runs is the bootloader u-boot. First, u-boot reads uEnv.txt which contains information about the server IP address, the name of the kernel image and where is located the root file system, after that downloads through tftp the kernel image and runs it with the arguments loaded before. When Linux boots it sends DHCP requests to acquire his IP address before to load the network filesystem (NFS) and runs the boot manager (systemd or init) found in root file system.

Host Machine

The target must know the host ip address, so it is suggestible to assign a fixed IP address to the host machine (in this example we will use 192.168.0.20).

DHCP

You need configure your DHCP server to return a fixed IP address for the target board. Set the correct IP addresses in /etc/dhcp3/dhcpd.conf:

subnet X.Y.Z.0 netmask 255.255.255.0 {
 interface eth0;
 range X.Y.Z.T X.Y.Z.T;
 option subnet-mask 255.255.255.0;
 option broadcast-address X.Y.Z.255;
 option routers X.Y.0.1;
}
by replacing X.Y.Z with the correct IP address space (e.g. 192.168.0), and T with the address used by target board. (e.g. 101).
If you are not using the interface eth0, replace eth0 with the correct interface name.

Finally, the dhcp demon must be restarted:

/etc/init.d/dhcp3-server restart

SD-CARD & uEnv.txt

You need to have a bootable SD-CARD with u-boot and MLO installed in the FAT partition. Refer to How to create the SD card page on how to create the SD card.

Copy uEnv.txt file located in /home/pengwyn/yocto/remote/uEnv.txt to the boot partition. The file has the following structure:

ipaddr=X.Y.Z.T
serverip=X.Y.Z.H
gatewayip=X.Y.Z.G
netmask=255.255.255.0
hostname=pengwyn
rootpath=/home/pengwyn/yocto/remote/nfs-eclipse-rootfs
bootfile=uImage
net_args=run bootargs_defaults;setenv bootargs ${bootargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=${ipaddr}:${serverip}::${netmask}:${hostname}:${nfsdevice};
tftp_nfs_boot=echo Booting from network...; tftp ${loadaddr} ${serverip}:${bootfile}; run net_args; bootm ${loadaddr};
uenvcmd=run tftp_nfs_boot;
Replace X.Y.Z with correct IP address space (e.g. 192.168.0).
Replace X.Y.Z.T with the IP address used by the Target board (e.g. 101).
Replace X.Y.Z.H with the IP address used by the Host (e.g. 20).
The gatewayip is not actually used.

Files to share

Use ref poky or ref hob to build your preferred root file system and the kernel image. You can find more detailed information on how to do that in the official documentation provided by the the Yocto Project

Root FS

To make the NFS service work, you have to provide a root filesystem. After you built your preferred filesystem with the Yocto toolchain, you need to extract the corresponding .tar.gz into a predefined directory:

~/yocto/remote/nfs-eclipse-rootfs

Assuming you are working inside directory ~/yocto/build/ you can setup the root filesystem copying the proper .tar.gz from directory ~/yocto/build/tmp/deploy/images/ to directory ~/yocto/remote/nfs-eclipse-rootfs and than decompressing and untarring (with superuser privileges) the .tar.gz file.

For example, if you were interested to the filesystem image LSB SDK, after the build process you get the file core-image-lsb-sdk-pengwyn.tar.gz::, so you can copy that file in the directory where the NFS service expects it:

cp ~/yocto/build/tmp/deploy/images/core-image-lsb-sdk-pengwyn.tar.gz ~/yocto/remote/nfs-eclipse-rootfs

and finally you can decompress and untar it with superuser privileges like with the following commands:

cd ~/yocto/remote/nfs-eclipse-rootfs
sudo tar -zxf core-image-lsb-sdk-pengwyn.tar.gz

Remember, the password of user pengwyn is: pengwyn

Kernel Image

To run the kernel image onto the target board, uboot will download it from the tftpboot directory on the host machine. In the same directory were you have the rootfs images (if you are building the images with bitbake/hob from ~/yocto/build directory, then the directory containing the images will be ~/yocto/build/tmp/deploy/images) there is the kernel image as well named uImage.bin. Copy it in ~/yocto/remote/tftpboot and rename it in uImage.

sudo cp ~/yocto/build/tmp/deploy/images/uImage.bin ~/yocto/remote/tftpboot/uImage

Boot up

You must connect target and host machines together by means of a network interface, one possible network schema is to connect both of them with the same ethernet cable through a point to point connection, the other possible schema is to connect them to the same LAN. With the last connection schema, double check that the IP addresses specified within file1, file2, file3 are compliant with your network address space. To get all the console messages at boot and, at the end of the boot process, a command prompt, connect the Pengwyn board via USB to your computer.

Usb-Serial

On your Host Operating System (not on guest operating system running with the Virtual Machine) you need to have a serial communication program like minicom (for Linux as host operating systems) or HyperTerminal (for Windows as host operating system). In this document only the setup of minicom program will be treated.

The required steps to get the usb-serial link work are:

  1. clean the kernel messages buffer with the following command:
sudo dmesg -c
  1. connect the Pengwyn board to the PC with mini-USB cable near DVI connector.
  2. determine the serial device name with this command:
dmesg | grep ttyUSB

on the standard output you will see something like:

[11401.006607] usb 1-1.1: FTDI USB Serial Device converter now attached to ttyUSB0

In such an example, ttyUSB0 is the serial device name, and /dev/ttyUSB0 is the serial device

3. run command (sudo password is pengwyn)

sudo minicom -w -s
  1. select select port setup and press enter.
  2. setup the port with the following configuration:
A -    Serial Device      : /dev/ttyUSB0
B - Lockfile Location     : /var/lock
C -   Callin Program      :
D -  Callout Program      :
E -    Bps/Par/Bits       : 115200 8N1
F - Hardware Flow Control : No
G - Software Flow Control : No
  1. once you are done configuring the serial port, you are back to minicom main menu and you can select exit.
  2. Control that the SD card is in the slot of Pengwyn board if is in it, you can press the reset button.
  3. if everything has been properly configured, the target board will download the kernel image
Booting from network...
link up on port 0, speed 100, full duplex
link up on port 1, speed 100, full duplex
Using cpsw device
TFTP from server 192.168.0.20; our IP address is 192.168.0.101
Filename 'uImage'.
Load address: 0x80200000
Loading: #################################################################
  1. and the Linux kernel will mount the root filesystem by means of NFS:
[    5.791564] Sending DHCP and RARP requests . OK
[    5.802032] IP-Config: Got DHCP answer from 192.168.0.20, my address is 192.168.0.101
[    5.813079] IP-Config: Complete:
[    5.816436]      device=eth0, addr=192.168.0.101, mask=255.255.255.0, gw=255.255.255.255,
[    5.824951]      host=pengwyn, domain=, nis-domain=(none),
[    5.830657]      bootserver=126.126.126.136, rootserver=192.168.0.20, rootpath=
[    5.848632] VFS: Mounted root (nfs filesystem) on device 0:16.
  1. finally, the login will appear:
Yocto (Built by Poky 7.0.1) 1.2.1
 ttyO0

pengwyn login:

Login with username root, no password is required.

How to write a software application for the Pengwyn board

Hereafter, the operating system that runs the IDE/debugger will be named host machine, and the board being debugged will be named target machine. The host machine could be running as a virtual machine guest operating system, anyway, the documentation for the host machine running as a guest operating system and as host operating system is exactly the same.

Pay attention before to start writing your application you need:

  • a filesystem (you can use bitbake/hob to build your preferred filesystem) with develop support (that is, it must include all the necessary header files, the tcf-agent program and gdbserver)
  • an SD card already partitioned, with the bootloader in the FAT partition, and
  • a network connect between the host machine and the target machine.

Creating the Project

You can create two types of projects: Autotools-based, or Makefile-based. This section describes how to create Autotools-based projects from within the Eclipse IDE. Launch Eclipse using Architech Launcher or use run_eclipse command or just click on the desktop icon.

_images/run_eclipse.png

To create a project based on a Yocto template and then display the source code, follow these steps:

  • Select File→New→Project...
  • Under C/C++, double click on C Project to create the project.
  • Expand Yocto ADT Project.
  • Select Hello World ANSI C Autotools Project. This is an Autotools-based project based on a Yocto Project template.
_images/newproject.png
  • Put a name in the Project name: field. Do not use hyphens as part of the name.
  • Click Next.
  • Add information in the Author and Copyright notice fields.
  • Be sure the License field is correct.
  • Click Finish.

Note: If the “open perspective” prompt appears, click Yes so that you enter in the C/C++ perspective. The left-hand navigation pane shows your project. You can display your source by double clicking the project’s source file.

_images/projectexplorer.png

Building the Project

To build the project, select Project→Build Project. The console should update with messages from the cross-compiler. To add more libraries to compile:

  • Click on Project→Properties.
  • Expand the box next to Autotools.
  • Select Configure Settings.
  • In CFLAGS field, you can add the path of includes with -Ipath_include
  • In LDFLAGS field, you can specify the libraries you use with -lname_library and you can also specify the path where to look for libraries with -Lpath_library

Note: All libraries are located in ~/yocto/remote/nfs-eclipse-rootfs subdirectories.

_images/autotools.png

Deploying and Debugging the Application

Connect the Pengwyn board to the PC by means of a usb cable to power the board and to have the serial console

_images/pengwyn-power.jpg

Once you built the project and the board is running the image, use minicom (refer to section Usb-Serial to know how to configure minicom) to run tcf-agent program in target board:

Yocto (Built by Poky 7.0.1) 1.2.1
 ttyO0

pengwyn login: root
root@pengwyn:~# /etc/init.d/tcf-agent restart

On the Host machine, follow these steps to let Eclipse deploy and debug your application:

  • Select Remote System Explorer perspective.
_images/tcf.png
  • In Remote System area right-click TCF icon and select Property.
_images/tcf2.png
  • In Host tab, insert in Host Name and Connection Name fields the IP address of the target board. (e.g. 192.168.0.101)
_images/tcf3.png
  • Then press OK.
  • Select Run→Debug Configurations...
  • In the left area, expand C/C++Remote Application.
  • Locate your project and select it to bring up a new tabbed view in the Debug Configurations Dialog.
_images/debugform.png
  • Use the drop-down menu now in the Connection field and pick the IP Address you entered earlier.
  • Enter the absolute path on the target into which you want to deploy the application. Use the Browse button near Remote Absolute File Path for C/C++Application: field. No password is needed.
_images/remotepath.png
  • Enter also in the path the name of the application you want to build. (e.g. HelloWorld)
_images/debug.png
  • Click Debug to bring up a login screen and login.
  • Accept the debug perspective.

Important

If debug does not works, check if tcf-agent is running on the board and gdbserver is present.

Qt SDK

_images/qt-0.png
Qt is a cross-platform application framework that is used for developing application software with a graphical user interface (GUI).
Qt Creator is a cross-platform C++ IDE, it includes a visual debugger and an integrated GUI layout and forms designer.
The versions used in this SDK are Qt SDK 4.7.4 and Qt Creator 2.4.0.
It is possible to compile applications for x86 and ARM processors.
You can debug the program on the virtual machine or on Pengwyn Board.

Note

Before reading this Chapter you should be able to use HOB, bitbake, NFS and minicom (or a similar program).

Build image with qt

  1. With HOB or bitbake build qt4e-demo-image. To see how to do this, refer to How to use HOB and/or How to use Poky Chapters.
  2. Once the image has been built (and assuming your current build directory is /home/pengwyn/yocto/build/), run the following commands:
cd /home/pengwyn/yocto/remote/nfs-eclipse-rootfs/
sudo rm -rf *
cp /home/pengwyn/yocto/build/tmp/deploy/images/qt4e-demo-image-pengwyn.tar.gz .
sudo tar -xzf qt4e-demo-image-pengwyn.tar.gz
  1. Open file /home/pengwyn/yocto/remote/nfs-eclipse-rootfs/etc/inittab and comment line 41:
# 1:2345:respawn:/sbin/getty 38400 tty1

this allows a USB keyboard to be seen by your Qt application.

  1. We don’t need the qt demo application to start at boot, run the following command:
sudo rm /home/pengwyn/yocto/remote/nfs-eclipse-rootfs/etc/init.d/qt4demo
  1. Turn on Pengwyn board.

Hello World!

The purpose of this example project is to generate a form with an “Hello World” label in it, at the beginning on the x86 virtual machine and than on the Pengwyn board.

To create the project follow these steps:

  1. Launch Qt Creator either from the Welcome Screen (Develop->IDEs->Qt Creator)
_images/qtCreatorStart.png

or from the Desktop icon

_images/run_qt.png

or from the command line

run_qtcreator
  1. Go to File -> Open File or Project to open QtHelloWorld.pro file located in ~/workspace/qt/QtHelloWorld/ directory.
  2. Click on “QtHelloWorld” icon to open project menu.
_images/qt-1.png
  1. Select the build configuration: Qt 4.7.4 (Qt-4.7.4) Debug.
_images/qt-2.png
  1. To build the project, click on the bottom-left icon.
_images/qt-3.png
  1. Once you built the project, click on the green triangle to run it.
_images/qt-4.png
  1. Congratulations! You just built your first Qt application for x86.
_images/qt-5.png

In the next section we will debug our Hello World! application directly on Pengwyn.

Debug Hello World project on pengwyn board

  1. Select build configuration: Qt 4.7.4 (Qt-4.7.4-arm) Debug and build the project.
_images/qt-10.png
  1. Copy the generated executable to ~/yocto/remote/nfs-eclipse-rootfs/home/root.
sudo cp ~/workspace/qt/QtHelloWorld-build-desktop-Qt_4_7_4__Qt-4_7_4-arm__Debug/QtHelloWorld ~/yocto/remote/nfs-eclipse-rootfs/home/root
  1. Use minicom to launch gdbserver application on the target board:
gdbserver :10000 QtHelloWorld -qws
  1. In Qt Creator, open the source file main.cpp and set a breakpoint at line 6.
    To do this go with the mouse at line 6 and click with the right button to open the menu, select Set brackpoint at line 6
_images/qt-6.png
  1. Go to Debug→Start Debugging→Attach To Remote Debug Server, a form named “Start Debugger” will appear, insert the following data:
_images/qt-7.png
  • Debugger: /opt/poky/1.2.1/sysroots/i686-pokysdk-linux/usr/bin/armv5te-poky-linux-gnueabi/arm-poky-linux-gnueabi-gdb
  • Local executable: /home/pengwyn/workspace/qt/QtHelloWorld-build-desktop-Qt_4_7_4__Qt-4_7_4-arm__Debug/QtHelloWorld
  • Host and port: 192.168.0.101:10000
  • Architecture: arm
  • GNU target: auto
  • Sysroot: /home/pengwyn/yocto/remote/nfs-eclipse-rootfs

Press OK button to start the debug.

_images/qt-8.png
  1. The hotkeys to debug the application are:
  • F10: Step over
  • F11: Step into
  • Shift + F11: Step out
  • F5: Continue, or press this icon:
_images/qt-9.png
  1. To successfully exit from the debug it is better to close the graphical application from the target board with the mouse by clicking on the ‘X’ symbol.

Hardware

Jumper settings

  boot sequence
J1 J2 J3 1st 2nd 3rd 4th
open open open UART0 SPI0 XIP MUX2 MMC0
open open close EMAC1 MMC0 XIP MUX2 NAND
open close open USB0 NAND SPI0 MMC0
open close close Fast ext UART0 EMAC1 reserved
close open open NAND NANDI2C MMC0 UART0
close open close MMC0 SPI0 UART0 USB0
close close open XIP MUX2 UART0 SPI0 MMC0
close close close Fast ext EMAC1 UART0 reserved

Link to Assembly

Link to BOM

Link to Schematic

Opkg Basics

_images/opkg.png

Opkg (Open PacKaGe Management) is a lightweight package management system. It is written in C and resembles apt/dpkg in operation. It is intended for use on embedded Linux devices and is used in this capacity in the OpenEmbedded and OpenWrt projects.


Useful commands:

  • command to know what packages are installed on the file system:
opkg list-installed
  • show where are the files installed of the packet:
opkg search name_packet
  • show what packets depend on the “name_packet” package:
opkg whatdepends name_packet
  • remove packages:
opkg remove name_packet

for this command there are important options:

  1. This option will force the removal of the package but will leave any packages that depend on this package installed:
-force-depends
  1. This option will go up the dependency list and remove all packages in the dependency chain:
-force-removal-of-dependent-packages
  • install the packages:
opkg install name_packet

How to add a repository

Install a web server in the virtual machine, e.g.:

sudo apt-get install apache2

Copy the built packages inside the web server directory, e.g.:

::
sudo cp -r /home/pengwyn/yocto/build/tmp/deploy/ipk /var/www

Create a file named <something>.conf (e.g. mine-repositories.conf) under /etc/opkg/ of the Pengwyn file system and fill it with the following lines:

src/gz arm     http://192.168.0.20/ipk/armv7a-vfp-neon
src/gz all     http://192.168.0.20/ipk/all
src/gz pengwyn http://192.168.0.20/ipk/pengwyn

Note

192.168.0.20 is the server IP where there is the web server with repository

after that run the following command from Pengwyn’s shell:

opkg update

Now you are ready to download and install the packages from the network.

Tip

With “opkg list | wc -l” you can know approximately how many packets there are in repository

opkg list | wc -l
opkg update
opkg list | wc -l

If the updating got success with the last command you see the number of packets incremented.

How to add 3”5 display with touch screen

This procedure will guide you to the installation of the display on the Pengwyn board and the configuration of the software to test it.

_images/display-1.png

Installing the board

  1. switch off the board
  2. connect display
_images/display-2.png
  1. switch on the board

Installing the software

  1. run VirtualBox and start Pengwyn Yocto virtual machine
  2. download the display patch (ref. linux-pengwyn_3.2.display.patch.tar.gz ) and save the file to /home/pengwyn folder
  3. open terminal and decompress patch
cd /home/pengwyn
tar xvf linux-pengwyn_3.2.display.patch.tar.gz
  1. change kernel configuration, adding TI touch screen driver
cd yocto
source poky/oe-init-build-env
bitbake linux-pengwyn -c cleanall
bitbake linux-pengwyn -c menuconfig
_images/touch-cfg-1.png _images/touch-cfg-2.png _images/touch-cfg-3.png _images/touch-cfg-4.png
  1. compile the kernel
bitbake linux-pengwyn
  1. run HOB
  2. select Pengwyn target and qt4demo
  3. build
  4. run SD card creator
  5. insert SDcard on Pengwyn board and wait Linux start-up
  6. first time, the touch screen calibration is needed, than qt4 demo will start

Quick start guide

This document will guide you from importing the virtual machine to the debugging of an Hello World! example on a customized Linux distribution that you will generate with the Yocto toolchain.

Installing the Virtual Machine

The development environment is provided as a Virtual Machine image.

To be able to use it, you first need to install VirtualBox. The version must be 4.2.10 or above.

_images/virtualboxlogo.png

Go to:

https://www.virtualbox.org/wiki/Downloads

and download the version that suits your host operating system. You need to download and install the Extension Pack as well.

Important

Make sure that the extension pack has the same version of VirtualBox.

Install the software with all the default options.

Run VirtualBox and follow these steps:

Tip

If you are using Linux double click directly on the .ova file from your file explorer and jump to step 3.

  1. From the menu: File → Import Appliance
_images/importAppliance.png
  1. Click on “Open appliance…” button and select the .ova file “PengwynYocto-beta-2013-03-19.ova”.
  2. After opening the appliance, click on “Shared Folders” and select a folder to share with your host operating system.
_images/vbSharedFolders.png
  1. The ethernet card must be attached to the LAN, not to the WLAN (within this guide you will be asked to connect the Pengwyn board to the PC with an ethernet point-to-point connection). To set the correct card, go to menu “machine -> Settings”. Click on “Network” tab and select your LAN card. Double check also that the field “Attached to” is set to “Bridged Adapter”. If you want to improve the performances of the virtual machine, please read How to setup the number of CPUs and the amount of RAM used by your virtual machine. Click on button “Ok” to apply your choices when you are done.
_images/ivs2.png
  1. Click the icon “Start” button on the toolbar.
_images/vbStart.png

How to configure the network on the virtual machine

Another important thing to do is to set the IP address of the virtual machine as static. To do this follow the next steps inside the virtual machine:

  1. Right-click on network connection icon. Select Edit Connections....
_images/ip-1.png
  1. In Wired” tab, select “Auto eth0” and press *Edit... button.
_images/auto-eth0.png
  1. Click to IPv4 Settings, press on Add button and insert the following address:
  • Address: 192.168.0.20
  • Netmask: 255.255.255.0
  • Gateway: none
_images/edit-connection.png
  1. Click on Apply.

How to setup the number of CPUs and the amount of RAM used by your virtual machine

You can configure the system settings of the virtual machine. This is possible only if the virtual machine is off. First, select the Yocto based SDK virtual machine from the list of virtual machines, click on the Settings icon in the Oracle VM VirtualBox Manager window:

_images/setvm-1.png

In the left menu, click on System. In the Motherboard tab you can select how much RAM you want to assign to the vm.

_images/setvm-2.png

Select Processor tab to select how many CPUs you want to assign to the virtual machine:

_images/setvm-3.png

If you changed the number of processors, you might want to consider reading the guides on how to speedup the build process for Poky and HOB.

The welcome screen

The first time you boot the virtual machine you are asked to accept the licence agreement, than you can use the GUI of the welcome screen to easily access to toolchain and documentation.

_images/welcomeScreen.png

If you close this application you can relaunch it with the icon on the desktop

_images/run_architech.png

The first screen is composed of three icons, if you click on Docs you will be redirected to the documentation page while WebSite will show you a web page where you can find more information about hardware and software tools of ArchiTech. Clicking on Develop will open a second screen also composed of three icons.

_images/toolsScreen.png

From that screen, you can:

  • start HOB (the graphic interface for bitbake) to customize and build your preferred Linux distribution,
  • select your preferred editor to write your application, that means the Eclipse IDE or Qt Creator,
  • start the scripts to create an SD card with your customized Linux distribution

By clicking IDEs you will be brought to the last screen where you can finally choose between Eclipse or Qt Creator.

_images/idesScreen.png

Let’s build the system

First of all you need to build a system, in this section you will build a predefined Linux image.

Click on HOB icon and wait until the GUI will show.

Important

To run HOB you need a working Internet connection. If internet connection doesn’t work you have to follow this instructions:

  1. Click with the right button of the mouse on the ethernet icon on the top right of the screen
  2. Select Edit Connections...
_images/ip-1.png
  1. In the wired tab select “wired connection” and press Edit button
  2. With another PC go to this web page: http://www.opendns.com/opendns-ip-addresses and copy the two IPs
  3. Go in the IPv4 Settings tab and write in DNS Servers text box the two IPs that you have copied

If required the sudo password is pengwyn

Select pengwyn as current machine from the drop-down menu.

_images/hob-pengwyn-selection.png

Select core-image-minimal-dev as base image.

_images/hob-minimal-dev-selection.png

Click on Build image button.

_images/hob-minimal-dev-build.png

Important

The build process can last hours.

Wait until it finishes.

_images/hob-minimal-dev-completed.png

At the end of the build the images will be automatically saved in /home/pengwyn/yocto/build/tmp/deploy/images folder.

Create your SD card

Important

You must have an SD card reader/programmer to build the SD card. The SD card must be at the least 1GB size. VirtualBox will see only USB connected SD card reader/programmer. This guide will assume you have a USB device for such a purpose.

To create your SD card, please follow these steps:

  • Connect your SD card reader to your computer than to the virtual machine, from VirtualBox menu select Devices → USB Devices → “your SDcard reader”.
  • Insert the SD card into the adapter (in this example we are inserting an SD card already partitioned with a FAT and an EXT2 partition, that is the basic configuration for the Pengwyn board).
  • Run the following command
pengwyn@pengwyn-desktop:~$ sudo fdisk -l

Disk /dev/sdb: 1971 MB, 1971322880 bytes
255 heads, 63 sectors/track, 239 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x9bfa2153

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1           9       72261    c  W95 FAT32 (LBA)
/dev/sdb2              11         239     1839442+  83  Linux
  • Find the device name from fdisk command output, in this example is /dev/sdb.
  • Run the script that will prepare the SD card with all the needed files by clicking on the splash screen sd card icon, after having clicked the develop icon.
_images/developSelection.png _images/sdCardSelection.png
When the script starts asks for the sudo password, type pengwyn followed by enter-key.
The list of available devices will be shown: the SD card should be the number 1 of the list with name sdb. Check the size shown on the table to be sure that the device is the correct one. Enter the device number 1 followed by enter-key.
+------------------------------------------------------------------------------+
|                                                                              |
| This script will create a bootable SD card.                                  |
| The script must be run with root permissions.                                |
|                                                                              |
+------------------------------------------------------------------------------+


+------------------------------------------------------------------------------+
| LIST OF AVAILABLE DRIVES:                                                    |
+------------------------------------------------------------------------------+

#  major   minor    size   name
1:   8       16    1927168 sdb

Enter Device Number #:
The script will create two partitions on the SD card: the first one is a FAT32 with the boot files, the second one is an ext3 with the target file system.
The operations will take few minutes.
[sudo] password for pengwyn:


+------------------------------------------------------------------------------+
|                                                                              |
| This script will create a bootable SD card.                                  |
| The script must be run with root permissions.                                |
|                                                                              |
+------------------------------------------------------------------------------+


+------------------------------------------------------------------------------+
| LIST OF AVAILABLE DRIVES:                                                    |
+------------------------------------------------------------------------------+

#  major   minor    size   name
1:   8       16    1927168 sdb

Enter Device Number #: 1

sdb was selected

sdb1  sdb2
72261 1839442

Mount the partitions
Emptying partitions
Syncing....

+------------------------------------------------------------------------------+
|      Copying files now... will take minutes                                 |
+------------------------------------------------------------------------------+

Copying boot partition
Copying file system partition
Copying modules
Syncing....
Un-mount the partitions
Remove created temp directories
Operation Finished

Press ENTER to finish
  • Remove the SDcard

Run your first Application on Pengwyn board!

_images/eclipseStart.png

From the splash screen select Develop->IDEs and open Eclipse. Once the IDE is started, the project HelloWorld is opened by default. To build it click Project→Build All. To debug the application connect your Host PC to Pengwyn Board with an Ethernet cable. Connect the Pengwyn board to the PC by means of a usb cable to power the board and to have the serial console

_images/pengwyn-power.jpg

On your Host Operating System open a terminal console (ctrl+alt+t) and run command:

minicom -w -s

choose select port setup and press Enter. Setup the port with the following configuration:

A -    Serial Device      : /dev/ttyUSB0
B - Lockfile Location     : /var/lock
C -   Callin Program      :
D -  Callout Program      :
E -    Bps/Par/Bits       : 115200 8N1
F - Hardware Flow Control : No
G - Software Flow Control : No

once you are done configuring the serial port, you are back to minicom main menu and you can select exit. press the reset button on the Pengwyn board. The login will appear inside the terminal of the Pengwyn board:

Yocto (Built by Poky 7.0.1) 1.2.1
ttyO0

pengwyn login:

Note

sometimes you need press enter to view the login

Insert root and press enter. run command:

ifconfig eth0 192.168.0.101
ping 192.168.0.20

If the output is similar to this one:

64 bytes from 192.168.0.20: icmp_req=1 ttl=64 time=0.946 ms
64 bytes from 192.168.0.20: icmp_req=2 ttl=64 time=0.763 ms
64 bytes from 192.168.0.20: icmp_req=3 ttl=64 time=0.671 ms
64 bytes from 192.168.0.20: icmp_req=4 ttl=64 time=0.793 ms

the ethernet connection is ok, then run command:

/etc/init.d/tcf-agent restart
Now the target is ready to debug your application.
Return in the virtual machine with eclipse. Go to Run→Debug Configurations.
Enter the absolute path into which you want to deploy the application. Use the Browse button near Remote Absolute File Path for C/C++Application: field. No password is needed.
_images/remotepath.png

Enter also in the path the name of the application you want to build. (e.g. HelloWorld)

_images/debug.png
Click Debug to bring up a login screen and login as root.
Accept the debug perspective.
_images/debug1.png

With F6 key you can execute the application step by step. You can see the target output in the eclipse console view

_images/debug2.png

FAQ

What is the password of user pengwyn?

pengwyn

What is sudo?

sudo is a program for Unix-like computer operating systems that allows users to run programs/commands with the security privileges of another user, normally the superuser or root. Not all the users can call sudo, only the sudoers, pengwyn user is a sudoer. When you run a command preceeded by sudo Linux will ask you the user password, for pengwyn user the password is pengwyn.

What is the password for user root?

By default, Ubuntu 10.04 comes with no password defined for roor user, to set it run the following command:

sudo passwd root

Linux will ask you (twice, the second time is just for confirmation) to write the password for user root.

When should I use an external power supply?

Pengwyn Board can be powered directly from the USB connector, the power consumption is about 250mA without any option installed. When powered from USB, the board can supply enough current to a USB keyboard (or a USB mouse) and to the DVI interface. If you want to connect something more power hungry to the USB port, we suggest you to power the board with an external power supply or to use externally powered USB devices.

My build is taking too long, what can I do to optimize?

Please, refer to:

When I try to create the SD card with one of the provided scripts something goes wrong, what can I do?

The simplest reason could be that the SD card is write protected or locked, please double check that.

How do I enable commercially licensed recipes?

Commercially licensed recipes are disabled by default. Your conf/local.conf file, contained in your build directory (by default is /home/pengwyn/yocto/build/), has a (commented) line starting with:

# LICENSE_FLAGS_WHITELIST

uncomment it (delete # symbol).

For the details, please refer to the official Yocto Project documentation.

How can i know what driver are included?

  • If you have built an image then you can go in ~/yocto/build/tmp/work/pengwyn-poky-linux-gnueabi/linux-pengwyn-3.2-r0/linux-pengwyn_3.2/drivers. In this directory there are all kernel linux drivers.
  • If you haven’t build an image then use following commands:
pengwyn@pengwyn-desktop:~$ mkdir -p /home/pengwyn/Documents/linux-kernel
pengwyn@pengwyn-desktop:~$ cd /home/pengwyn/Documents/linux-kernel
pengwyn@pengwyn-desktop:~/Documents/linux-kernel$ cp /home/pengwyn/yocto/poky/meta-silica/recipes-kernel/linux/linux-pengwyn-3.2/linux-pengwyn* .
pengwyn@pengwyn-desktop:~/Documents/linux-kernel$ tar -xzf linux-pengwyn_3.2.tar.gz
pengwyn@pengwyn-desktop:~/Documents/linux-kernel$ patch -p1 -d linux-pengwyn_3.2 < linux-pengwyn_3.2.patch
patching file ...
pengwyn@pengwyn-desktop:~/Documents/linux-kernel$ cd linux-pengwyn_3.2/drivers

In this directory there are all kernel linux drivers.

  • Another metod is using the menuconfig of linux. In linux-pengwyn_3.2 directory use the command:
make menuconfig

Once opened go in Device Drivers.

I have problems to create a patch for the kernel. How can I do that?

If you have already built the kernel before modify it, you need purge all file objects. To do this use the following command:

make ARCH=arm mrproper

will cleanup totally the sources. See How to customize the Linux Kernel for details.

Kernel doesn’t load NFS root

If you have modified the options in the kernel then assure that it is enabled “NFS client support” option in File System → Network File Systems

How can I include QWebView widget in my project? The compiling fails.

Open your .pro project file and add a new line under QT += core gui:

QT += webkit

I have problem with ethernet connection

If yuor company uses proxy then read this page to configure correctly yocto: Working Behind a Network Proxy page.

Furthermore, we encourage you to read: