CM-T3730: Linux: Building images

From Compulab Mediawiki
Jump to: navigation, search

Angstrom Linux images

The run-time Angstrom Linux image for CM-T3730 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-T3730 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-T3730. Example configuration for Angstrom Linux image creation for CM-T3730 can be found in oe/local.conf file of the CM-T3730 Linux package. The oe/local.conf file must be copied to ${OEBASE}/build/conf directory:

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

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

Applying Patches

  • Create a branch for CM-T3730 development. CM-T3730 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-t3730-dev b50fde72d5789b3185f9a7c64924280bb063cfad
  • Apply CM-T3730 patches:
git am /path/to/cm-t3730-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-t3730-demo-image

Once bitbake has finished, the image is created and placed into the ${OEBASE}/build/arm/tmp/deploy/eglibc/images/cm-t3730 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-T3730 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-T3730.

User Application

There are multiple ways to build user space applications that can run on the CM-T3730. 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-T3730. 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-T3730 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-t3730-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-T3730:

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

Install the package and run the application:

root@cm-t3730:~# 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-t3730:~# 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-t3730]:/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-T3730:

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

Run the application on CM-T3730:

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

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

Digital Video SDK

The Digital Video SDK (DVSDK) version includes Linux kernel modules, multimedia and digital signal processing (DSP) packages and ready to run DSP functionality demos. The DVSDK for CM-T3730 was built outside of OpenEmbedded framework and tested with Linux kernel version 3.0.38. If a custom Linux kernel must be used on CM-T3730, the DVSDK must be re-built in order to avoid compatibility issues.

Building DVSDK outside of OE

At each stage the Software Developers Guide can be refered for more details.

  • Download the Digital Video SDK Note that the download requires registration.
  • Install the SDK on a Linux host machine. The DVSDK supports Ubuntu 10.04 LTS 32-bit host only.
  • Setup the DVSDK by executing the script:
export DVSDK=/path/to/dvsdk
cd ${DVSDK}
  • Manually edit the Rules.make file. Set the following environment variables to appropriate values:
    • LINUXKERNEL_INSTALL_DIR=/path/to/cm-t3730/linux/kernel
    • EXEC_DIR=/path/to/cm-t3730/rootfs
Admolition note.png Please make sure the libx11-6 package is installed in the CM-T3730 root filesystem.
  • Apply CM-T3730 patches:
patch -p1 < /path/to/cm-t3730-linux/extra/dvsdk_04_03_00_06/dvsdk_04_03_00_06-cm-t3730-6.patch
  • Build the DVSDK:
make clean
make all
  • Install the DVSDK into the CM-T3730 root filesystem:
sudo make install

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-T3730 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-t3730-linux/extra/Graphics_SDK_4_05_00_03/graphics_sdk_04_05_00_03-cm-t3730-6.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-t3730/linux/kernel
    • TARGETFS_INSTALL_DIR=/path/to/cm-t3730/rootfs

Please refer to the build guide for more details.

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

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

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

To install graphics kernel modules only:

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

WL1271 Linux SDK

The CM-T3730 Linux package contains pre-built demo applications and scripts that demonstrate the initializing procedure and simple use cases of the Bluetooth module. The CM-T3730 Linux package Bluetooth support is based on the TI WL1271 SDK version

This section describes the step-by-step build process of the TI WL1271 SDK.

Building WL1271 Linux SDK

  • Extract sources:
export WL1271_SDK=/path/to/wl1271/sdk
cd $WL1271_SDK/software
tar xf OMAP35x_WL1271_6.
cd OMAP35x_WL1271_6.
patch -p1 < /path/to/cm-t3730-linux/extra/WL1271_Linux_SDK_3_00_01_06/wl1271_linux_sdk-cm-t3730-4.patch
  • Setup the environment variables by editing the file. Set the following environment variables to appropriate values:
    • ARM_TOOLCHAIN_PATH=/path/to/cross-compiler
    • EXTRA_FILES=/path/to/cm-t3730-linux/extra/WL1271_Linux_SDK_3_00_01_06/extra_files
    • TARGETFS_INSTALL_PATH=/path/to/cm-t3730/rootfs
  • Make sure the CM-T3730 rootfs has Python header files installed (e.g. python-dev package).
  • Build the Bluetooth module:
cd Sources
./ build bluetooth
  • Install WL1271 Linux SDK into the CM-T3730 rootfs, e.g. into the /opt directory:
sudo mkdir -p /path/to/cm-t3730-linux/opt/
sudo cp	-r image/WL1271_demo_01/ /path/to/cm-t3730/rootfs/opt/
  • Boot up the CM-T3730 and run the SDK configuration script:
root@cm-t3730:~# cd /opt/WL1271_demo_01/
root@cm-t3730:/opt/WL1271_demo_01# ./

See also