CM-T3530: Linux: Building images

From Compulab Mediawiki
Jump to: navigation, search

Angstrom Linux images

The run-time Angstrom Linux image for CM-T3530 is created using OpenEmbedded framework. The OpenEmbedded framework can also be used for building custom Linux images.

OpenEmbedded setup

Building custom Linux images for CM-T3530 requires installation of OpenEmbedded (OE) framework. The framework installation process is described in Getting Started section of OpenEmbedded User Manual.

This article assumes that the Getting Started instructions have been followed precisely and the same directory structure and all the tools were installed. Also this article will use the $OEBASE variable to denote the base directory of the OpenEmbedded framework.

The OpenEmbedded framework must be configured prior to building images for CM-T3530. Example configuration for Angstrom Linux image creation for CM-T3530 can be found in oe/local.conf file of the CM-T3530 Linux package. The oe/local.conf file must be copied to ${OEBASE}/build/conf directory:

cp /path/to/cm-t3530-linux/oe/local.conf ${OEBASE}/build/conf

CM-T3530 is currently not supported by upstream OpenEmbedded. The CM-T3530 Linux package provides patch series that introduce the machine support for OE framework.

Applying Patches

  • Create a branch for CM-T3530 development. CM-T3530 patches are generated vs. commit b50fde72d5789b3185f9a7c64924280bb063cfad in branch of the OpenEmbedded git tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
cd $OEBASE/openembedded
git checkout -b cm-t3x30-dev b50fde72d5789b3185f9a7c64924280bb063cfad
  • Apply CM-T3530 patches:
git am /path/to/cm-t3530-linux/oe/patches/*

Building Angstrom Linux images

  • Setup environment variables:
export OEBASE=/path/to/oe
export PATH=$OEBASE/bitbake/bin:$PATH
export BBPATH=$OEBASE/build:$OEBASE/openembedded
  • Build Angstrom Linux image:
bitbake cm-t3x30-demo-image

Once bitbake has finished, the image is created and placed into the ${OEBASE}/build/arm/tmp/deploy/eglibc/images/cm-t3x30 directory. Default configuration creates two types of images: .tar.bz2, and .ubi. The .tar.bz2 archive should be extracted to the rootfs (third) partition of the CM-T3530 MMC/SD card. Alternatively, it can be extracted to a directory on the host workstation. This directory may be used as networked root filesystem for CM-T3530.

User Application

There are multiple ways to build user space applications that can run on the CM-T3530. This article will focus on building user application with OE framework.

Building user application using OE

Once the OpenEmbadded framework is properly set up and configured on your host machine it can be used for building any kind of applications targeted for CM-T3530. This task requires creating a new Bitbake recipe. For more details about Bitbake options as well as writing Bitbake recipes please refer the Bitbake user manual and the Recipes section in the OE user manual.

The CM-T3530 Linux package provides a sample Bitbake recipe that allows building a basic "Hello World!" application. This chapter assumes that the OpenEmbadded framework has been properly setup and configured on your Linux host machine. Extract the oe-sample-appl archive content to the ${OEBASE}/openembedded/recipes/ directory:

unzip /path/to/cm-t3530-linux/oe/extra/ -d ${OEBASE}/openembedded/recipes/

Setup the environment variables as shown in Building Angstrom Linux images chapter and build the sample application:

bitbake oe-sample-appl

Once the build is complete, copy the oe-sample-appl package to the working root filesystem on CM-T3530:

cp ${OEBASE}/build/arm/tmp/deploy/eglibc/ipk/armv7a/oe-sample-appl_0.0.1-r0.9_armv7a.ipk /path/to/cm-t3530/rootfs/home/root/

Install the package and run the application:

root@cm-t3530:~# opkg install /home/root/oe-sample-appl_0.0.1-r0.9_armv7a.ipk
Installing oe-sample-appl (0.0.1-r0.9) to root...
Configuring oe-sample-appl.
root@cm-t3530:~# oe_sample_appl 
Hello World!

Building user application using OE Devshell

Although creating a new Bitbake recipe is quite simple task, sometimes avoiding it seems more preferred. However in this case various environment variables have to be set manually. For example: CC and PATH must be set to values suitable for cross-compiling. The OE devshell addon provides you with an interactive shell that has all the appropriate variables set for cross-compiling. To use the shell, build the devshell recipe:

bitbake devshell

Extract the application source code from the ${OEBASE}/openembedded/recipes/oe-sample-appl/oe-sample-appl_0.0.1.tar.gz archive:

tar xvf ${OEBASE}/openembedded/recipes/oe-sample-appl/oe-sample-appl_0.0.1.tar.gz -C /path/to/oe-sample-appl/source/

Start the devshell and change directory to the oe-sample-appl source code location and build the application:

[OE::arm-angstrom-linux-gnueabi-angstrom-cm-t3530]:/path/to/oe$cd /path/to/oe-sample-appl/source/
NOTE: make
arm-angstrom-linux-gnueabi-gcc -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mthumb-interwork -mno-thumb --sysroot=/path/to/oe/build/arm/tmp/sysroots/armv7a-angstrom-linux-gnueabi
-fexpensive-optimizations -fomit-frame-pointer -frename-registers -O2 -ggdb2  -c -o sample_appl.o oe_sample_appl.c
arm-angstrom-linux-gnueabi-gcc -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mthumb-interwork -mno-thumb --sysroot=/path/to/oe/build/arm/tmp/sysroots/armv7a-angstrom-linux-gnueabi
-o oe_sample_appl oe_sample_appl.o

Once the build is complete, copy the oe-sample-appl application to the working root filesystem on CM-T3530:

[OE::arm-angstrom-linux-gnueabi-angstrom-cm-t3530]:/path/to/oe-sample-appl/source$cp ./oe_sample_appl /path/to/cm-t3530/rootfs/home/root/

Run the application on CM-T3530:

root@cm-t3530:~# ./oe_sample_appl
Hello World!

Please refer to the Devshell section in the OE User Manual pages for more details.

Graphics SDK

The Graphics SDK version includes the Linux graphics (SGX) drivers, OpenGLES1.1, OpenGLES2.0 and OpenVG demos for all TI platforms. The CM-T3530 Linux package contains pre-built graphics kernel modules and graphics demo applications that were built outside of OpenEmbedded framework. If a custom Linux kernel must be created, the graphics kernel modules must be re-built in order to avoid versioning issues.

Building Graphics SDK outside of OE

cd /path/to/Graphics/SDK/4/05/00/03/
patch -p1 < /path/to/cm-t3530-linux/extra/Graphics_SDK_4_05_00_03/graphics_sdk_04_05_00_03-cm-t3x30.patch
  • Setup the environment variables by editing the Rules.make file. Set the following environment variables to appropriate values:
    • HOME=/path/to/Graphics/SDK/4/05/00/03/home/area. Note: This path does not include the Graphics_SDK_4_05_00_03 directory.
    • CSTOOL_DIR=/path/to/cross-compiler
    • CSTOOL_PREFIX=<cross-compiler-name-prefix>
    • KERNEL_INSTALL_DIR=/path/to/cm-t3530/linux/kernel
    • TARGETFS_INSTALL_DIR=/path/to/cm-t3530/rootfs

Please refer to the build guide for more details.

  • Build the Graphics SDK:
make OMAPES=3.x all

For building graphics kernel modules only, please run the following command:

make OMAPES=3.x all_km
  • Install the Graphics SDK into the CM-T3530 rootfs:
sudo make OMAPES=3.x install

To install graphics kernel modules only:

sudo make OMAPES=3.x install_km
  • Boot up the CM-T3530 and run the SDK configuration script:
root@cm-t3530:~# /etc/init.d/omap-demo

See also