Phytec phyCORE-iMX35/Openembedded

Create Linux Distributions with Openembedded for Phytec phyCORE-i.MX35.

About this tutorial
This tutorial describes all the steps which are needed to create the linux kernel and different root file systems for the board Phytec phyCORE-i.MX35 with Openembedded, a build framework for embedded Linux. The Linux Distribution Angstrom, which is part of Openembedded, is used here to create the linux kernel and to create several root file systems:


 * a minimal-image for testing purposes,
 * OPIE (Open Palmtop Integrated Environment), a graphical user interface for PDAs,
 * GPE (GPE Palmtop Environment), a graphical user interface for PDAs and
 * Xfce, a lightweight desktop environment.

The minimal-image needs only about 14MB RAM at runtime on the Phytec phyCORE-i.MX35. OPIE needs about 28MB RAM at runtime. GPE needs about 50MB RAM at runtime. Xfce needs about 65MB RAM at runtime.

Openembedded
You can find further explanations for the following steps in the Openembedded wiki: http://wiki.openembedded.org/index.php/Main_Page.

How to install Openembedded on Gentoo Linux: http://www.openembedded.org/index.php/OEandYourDistro#Gentoo_instructions

How to get started: http://www.openembedded.org/index.php/Getting_started

Advanced configuration settings: http://www.openembedded.org/index.php/Advanced_configuration

User manual: http://docs.openembedded.org/usermanual/usermanual.html

Git Paths
The source code of the Openembedded project is saved in git-repositories: http://cgit.openembedded.org/cgit.cgi

The source code of the bitbake application: http://cgit.openembedded.org/cgit.cgi/bitbake/

You can look at each source file: http://cgit.openembedded.org/cgit.cgi/bitbake/tree/

The configuration files and the defintions of the software packages: http://cgit.openembedded.org/cgit.cgi/openembedded/

You can look at each file: http://cgit.openembedded.org/cgit.cgi/openembedded/tree

Config files for the supported hardware: http://cgit.openembedded.org/cgit.cgi/openembedded/tree/conf/machine

Patches for openembedded: http://patches.openembedded.org/project/oe/list/

Apply patches: http://wiki.openembedded.net/index.php/Patchwork

Folder Names
These folders are used for

Bitbake:

Openembedded:

Project configuration:

Build:

NFSRoot:

Source:

The application bitbake is installed into the folder.

The project definitions of openembedded are installed into the folder.

Source files are downloaded by bitbake into the folder.

The configuration files for the current project are created in the folder.

bitbake creates all files in the folder.

The created root file systems are extracted in the folder and can be mounted by the target via NFS.

The current project is just called test01.

Define environment variables:

Install Software for Openembedded
Before you can install and use openembedded, you need to install some software. At first set the use flags.

Emerge the software, which is missing.

It is possible that portage requests that some other use flags are set too. psyco is not available for gentoo amd64 i.e. x86_64.

Now you can check, if all needed applications exist

texi2pdf is part of the package texinfo.

Install Bitbake
Create folders and download the branch 1.12 of bitbake:

The size of this folder is about 3MB.

Install Openembedded
Create folders and download the branch master of openembedded:

The size of this folder is about 150MB.

Update
From time to time you need to update your local versions of openembedded and bitbake.

Update Openembedded

Update Bitbake

Support for Phytec phyCORE-i.MX35 in Openembedded
Support for the board Phytec phyCORE-i.MX35 has been added to Openembedded git://git.openembedded.org/openembedded on 2011-03-01.

Create the configuration file
For each project you should create a project folder with a configuration file. Here it is. Almost all settings for your project are defined in the file. At first use the file as template for the  file.

Then adjust the configuration file

Bitbake downloads source files into and creates md5 files in the folder which is specified by the environment variable DL_DIR. Portage and bitbake download the same source files. You can define DL_DIR to point to the source file repository of portage which is by default. This avoids downloading a file two times by portage and bitbake. Make sure that you have access permissions to this folder. If you don't want to use the same download folder, then choose some other folder name for DL_DIR.

Continue adjusting the local.conf file. Delete the last line of the file, otherwise you will get an error message. The value of the variable DISTRO is the name of a distribution. The allowed values are the file names without suffix in the folder.

The value of the variable MACHINE</tt> is the name of a target board or target system. The allowed values are the file names without suffix in the folder.

Define distribution and machine. Here fits best to Phytec phyCORE-i.MX35. Clean work folder after succesfully building.

Environment setup
Before you can call bitbake</tt>, you need to setup the environment. Because each project can have its own environment, you should create a script in the project folder.

Call the script file only once, before you start using bitbake. The prompt will indicate, if you have called it or not.

All the settings in and  are independent of the environment variables MY_OPENEMBEDDED, MY_BITBAKE, MY_SRC, MY_NFSROOT, MY_PROJECT</tt>. You don't need them to run bitbake.

Build Image
You can be in any folder you like. You should be logged in as a common user. You don't need root privileges most of the time. Start building an image

Build Configuration: BB_VERSION       = "1.12.0" METADATA_BRANCH  = "master" METADATA_REVISION = "46cc091" TARGET_ARCH      = "arm" TARGET_OS        = "linux-gnueabi" MACHINE          = "pcm043" DISTRO           = "angstrom-2008.1" DISTRO_VERSION   = "2010.7-test-20110228" TARGET_FPU       = "hard" At first all cross-tools (called native in openembedded), e.g. the cross-compiler are build and installed in the folder. Then the cross-tools are used to build all needed software packages. Root file images and the kernel images can be found in the folder

These are the files which are created: 5740 Angstrom-minimalist-image-glibc-ipk-2010.7-test-20110228-pcm043.rootfs.jffs2 9088 Angstrom-minimalist-image-glibc-ipk-2010.7-test-20110228-pcm043.rootfs.tar 5008 Angstrom-minimalist-image-glibc-ipk-2010.7-test-20110228-pcm043.rootfs.tar.gz  64 modules-2.6.31-r10-pcm043.tgz 1916 uImage-2.6.31-r10-pcm043.bin These are the links which are created: minimalist-image-pcm043.jffs2 -> Angstrom-minimalist-image-glibc-ipk-2010.7-test-20110228-pcm043.rootfs.jffs2 minimalist-image-pcm043.tar -> Angstrom-minimalist-image-glibc-ipk-2010.7-test-20110228-pcm043.rootfs.tar minimalist-image-pcm043.tar.gz -> Angstrom-minimalist-image-glibc-ipk-2010.7-test-20110228-pcm043.tar.gz zImage-pcm043.bin -> zImage-2.6.31-r10-pcm043.bin

Linux Kernel
The board is already shipped with a Linux kernel in flash. U-boot can load the kernel from a TFTP server or from flash. Here we load the kernel from a TFTP server.

Create the Root File System
Take the rootfs image and extract it into another folder. The extraction needs to be done with root privileges.

Extract the kernel modules into the root file system.

The rootfs can be now mounted via NFS.

nfs server
Configure the nfs server to export the rootfs

U-boot
Connect to the board through the serial port. Boot the board and enter the command line of u-boot. Change the config file. Define the IP address of the board, the IP address of the server and the path for nfsroot.

Save the new environment and boot the board again.

Target Log
Linux: Output when the board is booted and Linux kernel is started.

minimal-image: Output of the minimal-imagespecific part, when board is booted. .

Status
The image seems to work. You can login to the board also with ssh via Ethernet.

Image opie-image
Only the differences to are described.

Build Image opie-image
You can be in any folder you like. You should be logged in as a common user.Call the script only once.

Start building the image.

Root file images and the kernel images can be found in the folder

Create the Root File System
Take the rootfs image and extract it into another folder. The extraction needs to be done with root privileges.

Extract the kernel modules into the root file system.

The rootfs can be now mounted via nfs.

NFS Server
Configure the NFS server to export the rootfs

Target Log
opie-image: Output of the opie-imagespecific part, when board is booted. .

Status
The GUI of OPIE appears on the screen and can be controlled by the touchscreen or an external USB keyboard. The image seems to work. You can login to the board via the upper serial port or with ssh via Ethernet.

Screenshots
A screenshot can be found at http://en.wikipedia.org/wiki/OPIE_user_interface.

Image x11-gpe-image
Only the differences to are described.

Build Image x11-gpe-image
You can be in any folder you like. You should be logged in as a common user.Call the script only once.

Start building the image.

Root file images and the kernel images can be found in the folder

Create the Root File System
Take the rootfs image and extract it into another folder. The extraction needs to be done with root privileges.

Extract the kernel modules into the root file system.

The rootfs can be now mounted via nfs.

NFS Server
Configure the NFS server to export the rootfs

Status
The GUI of GPE appears on the screen. The touchscreen works only during the calibration. The GUI can be controlled by an external USB mouse and keyboard. When the GPE desktop appears, the mouse cursor disappears and the mouse can no longer be used. After some minutes the Xorg process crashes. You can login to the board via the upper serial port or with ssh via Ethernet. The image seems to work but there are still some large problems. Very likely the pcm043.conf file is missing some definitions.

Screenshots
Screenshots can be found here http://gpe.linuxtogo.org/gallery/gallery/view_album.php?set_albumName=Applications.

Image xfce46-image
Only the differences to are described.

Build Image xfce46-image
You can be in any folder you like. You should be logged in as a common user.Call the script only once.

Start building the image.

Root file images and the kernel images can be found in the folder

Create the Root File System
Take the rootfs image and extract it into another folder. The extraction needs to be done with root privileges.

Extract the kernel modules into the root file system.

The rootfs can be now mounted via nfs.

NFS Server
Configure the NFS server to export the rootfs

Start Xfce
Login as root and start the GUI

Status
The GUI of Xfce appears, but it doesn' fit on the small screen. The GUI can be controlled by an external USB Mouse and Keyboard. You can login to the board via the upper serial port or with ssh via Ethernet. The image seems to work but there are some problems left. Very likely the pcm043.conf file is missing some definitions.

Workaround when fetch fails
When you use the portage distfiles folder for downloads and bitbake fails while fetching even when the file is there, this has helped usually:

Start bitbake again.

Workaround for cannot stat error
When you start bitbake the current date is saved in some folder names. When bitbake fails and you restart it on another day, the the folder names are different. You need to copy the files from the old folder to the new folder like in this example and then start bitbake again: install: cannot stat `/MyOE/tmp/test01/work/pcm043-angstrom-linux-gnueabi/angstrom-version-1_2010.7-test-20110228-r6/lsb_release': No such file or directory NOTE: package angstrom-version-1_2010.7-test-20110228-r6: task do_install: Failed

Bitbake Reports an Error
You are using the master branch of openembedded, which is constantly changing. This is the latest version of openembedded. If the latest version cannot be build, you can try to use the latest tested version. Currently this is the version with the tag tested_2011-02-28</tt>.

Save all your changes, which you don't want to lose, before you continue. Change to the tag tested_2011-02-28</tt>.

Save and remove tracked files.

Delete untracked files and directories dry-run

Delete untracked files and directories

Check the current status.

Now install the patches for pcm043 and try to build the images in an empty directory again.

Use the Phytec Linux Kernel
The patches which are used by the recipe linux_2.6.31.bb on the linux kernel 2.6.31.12 have been shipped for 2.6.31.6. At the moment it seems to work. If you encounter strange problems, you can try to use the kernel from the Phytec Linux BSP for phyCORE-i.MX35. You can also create a recipe linux-pcm043_2.6.31.bb, which uses the patches on linux 2.6.31.6.