Difference between revisions of "CM-T3530: Linux: Building images"

From Compulab Mediawiki
Jump to: navigation, search
(Applying Patches)
(Building Graphics SDK outside of OE)
 
Line 1: Line 1:
The run-time Linux image for CM-T3530 was created using [http://www.openembedded.org OpenEmbedded] framework. The OpenEmbedded framework can be used for creation of custom Linux images for CM-T3530.
+
== Angstrom Linux images ==
 +
The run-time Angstrom Linux image for CM-T3530 is created using [http://www.openembedded.org OpenEmbedded] framework. The OpenEmbedded framework can also be used for building custom Linux images.
  
== OpenEmbedded setup ==
+
=== OpenEmbedded setup ===
Creation of custom Linux images for CM-T3530 requires installation of OpenEmbedded framework. [http://docs.openembedded.org/usermanual/usermanual.html#chapter_getting_oe Getting Started] section of [http://docs.openembedded.org/usermanual/usermanual.htm OpenEmbedded User Manual] describes the framework installation process.
+
Building custom Linux images for CM-T3530 requires installation of OpenEmbedded (OE) framework. The framework installation process is described in [http://docs.openembedded.org/usermanual/usermanual.html#chapter_getting_oe Getting Started] section of [http://docs.openembedded.org/usermanual/usermanual.html OpenEmbedded User Manual].
  
Here we assume that you followed the [http://docs.openembedded.org/usermanual/usermanual.html#chapter_getting_oe Getting Started] instructions, that you have the same directory structure and all the tools installed.
+
This article assumes that the [http://docs.openembedded.org/usermanual/usermanual.html#chapter_getting_oe Getting Started] instructions have been followed precisely and the same directory structure and all the tools were installed.
 +
Also this article will use the {{parameter|$OEBASE}} variable to denote the base directory of the OpenEmbedded framework.
  
The OpenEmbedded framework should be configured in order to build images for CM-T3530.
+
The OpenEmbedded framework must be configured prior to building images for CM-T3530.
Example configuration for creation of Angstrom Linux image for CM-T3530 can be found in {{filename|oe/local.conf}} file in [http://compulab.co.il/products/computer-on-modules/cm-t3530/#devres Linux package for CM-T3530]. To use it copy the {{filename|oe/local.conf}} file to {{filename|${OEBASE}/build/conf}} directory:
+
Example configuration for Angstrom Linux image creation for CM-T3530 can be found in {{filename|oe/local.conf}} file of the [http://compulab.co.il/products/computer-on-modules/cm-t3530/#devres CM-T3530 Linux package].
cp /path/to/t3530-linux/oe/local.conf ${OEBASE}/build/conf
+
The {{filename|oe/local.conf}} file must be copied to {{filename|${OEBASE}/build/conf}} directory:
 +
<pre>
 +
cp /path/to/cm-t3530-linux/oe/local.conf ${OEBASE}/build/conf
 +
</pre>
  
CM-T3530 is supported by OpenEmbedded and it is possible to build Linux images either with mainline OpenEmbedded or using baseline commit 33497aded7af7c5e6191e98d3083072da14c5945 in OpenEmbedded git tree with CM-T3530 patches. If you intend to use mainline OpenEmbedded, please skip the [[CM-T3530: Linux: Building images#Applying Patches|Applying Patches]] section.
+
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 ===
 
=== Applying Patches ===
* Create a branch for CM-T3530 development. CM-T3530 patches are generated vs. commit 33497aded7af7c5e6191e98d3083072da14c5945 in org.openembedded.dev branch of the OpenEmbedded git tree. It is recommended to use exactly the same baseline to avoid merge conflicts.  
+
* Create a branch for CM-T3530 development. CM-T3530 patches are generated vs. commit b50fde72d5789b3185f9a7c64924280bb063cfad in org.openembedded.dev branch of the OpenEmbedded git tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
cd $OEBASE/openembedded
+
<pre>
git branch cm-t35-dev 33497aded7af7c5e6191e98d3083072da14c5945
+
cd $OEBASE/openembedded
git checkout cm-t35-dev
+
git checkout -b cm-t3x30-dev b50fde72d5789b3185f9a7c64924280bb063cfad
* Apply CM-T3530 patches
+
</pre>
git apply /path/to/t3530-linux/oe/cm-t35.patch
+
* Apply CM-T3530 patches:
 +
<pre>
 +
git am /path/to/cm-t3530-linux/oe/patches/*
 +
</pre>
  
== Creating Angstrom Linux images ==
+
=== Building Angstrom Linux images ===
* Setup environment variables
+
* Setup environment variables:
export OEBASE=/path/to/oe
+
<pre>
cd $OEBASE
+
export OEBASE=/path/to/oe
export PATH=$OEBASE/bitbake/bin:$PATH
+
cd $OEBASE
export BBPATH=$OEBASE/build:$OEBASE/openembedded
+
export PATH=$OEBASE/bitbake/bin:$PATH
export BB_ENV_EXTRAWHITE="OEBASE"
+
export BBPATH=$OEBASE/build:$OEBASE/openembedded
* Build Angstrom Linux image
+
export BB_ENV_EXTRAWHITE="OEBASE"
bitbake beagleboard-demo-image
+
</pre>
 +
* Build Angstrom Linux image:
 +
<pre>
 +
bitbake cm-t3x30-demo-image
 +
</pre>
  
Once bitbake is finished, the image will be created and put into {{filename|${OEBASE}/build/arm/tmp/deploy/glibc/images/cm-t35}} directory. Default configuration creates two types of images: tar.bz2, and ubi. The ubi image can be copied to the CM-T3530 on-board NAND flash. The tar.bz2 archive can be extracted to a directory on the host workstation. This directory may be used as networked root filesystem for the device.
+
Once bitbake has finished, the image is created and placed into the {{filename|${OEBASE}/build/arm/tmp/deploy/eglibc/images/cm-t3x30}} directory.
 +
Default configuration creates two types of images: {{filename|.tar.bz2}}, and {{filename|.ubi}}.
 +
The {{filename|.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 [http://docs.openembedded.org/bitbake/html/ Bitbake user manual] and the [http://docs.openembedded.org/usermanual/usermanual.html#chapter_recipes Recipes] section in the [http://docs.openembedded.org/usermanual/usermanual.html OE user manual].
 +
 
 +
The [http://compulab.co.il/products/computer-on-modules/cm-t3530/#devres 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 {{filename|oe-sample-appl}} archive content to the {{filename|${OEBASE}/openembedded/recipes/}} directory:
 +
<pre>
 +
unzip /path/to/cm-t3530-linux/oe/extra/oe_sample_appl.zip -d ${OEBASE}/openembedded/recipes/
 +
</pre>
 +
Setup the environment variables as shown in [[CM-T3530:_Linux:_Building_images#Building_Angstrom_Linux_images|Building Angstrom Linux images]] chapter and build the sample application:
 +
<pre>
 +
bitbake oe-sample-appl
 +
</pre>
 +
Once the build is complete, copy the {{filename|oe-sample-appl}} package to the working root filesystem on CM-T3530:
 +
<pre>
 +
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/
 +
</pre>
 +
Install the package and run the application:
 +
<pre>
 +
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:~#
 +
root@cm-t3530:~# oe_sample_appl
 +
Hello World!
 +
root@cm-t3530:~#
 +
</pre>
 +
 
 +
=== 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: {{parameter|CC}} and {{parameter|PATH}} must be set to values suitable for cross-compiling.
 +
The OE [http://docs.openembedded.org/usermanual/usermanual.html#id320082 devshell addon] provides you with an interactive shell that has all the appropriate variables set for cross-compiling.
 +
To use the shell, build the {{filename|devshell}} recipe:
 +
<pre>
 +
bitbake devshell
 +
</pre>
 +
Extract the application source code from the {{filename|${OEBASE}/openembedded/recipes/oe-sample-appl/oe-sample-appl_0.0.1.tar.gz}} archive:
 +
<pre>
 +
tar xvf ${OEBASE}/openembedded/recipes/oe-sample-appl/oe-sample-appl_0.0.1.tar.gz -C /path/to/oe-sample-appl/source/
 +
</pre>
 +
Start the devshell and change directory to the {{filename|oe-sample-appl}} source code location and build the application:
 +
<pre>
 +
${OEBASE}/build/arm/tmp/deploy/eglibc/addons/arm-angstrom-linux-gnueabi-angstrom-cm-t3530-devshell
 +
[OE::arm-angstrom-linux-gnueabi-angstrom-cm-t3530]:/path/to/oe$cd /path/to/oe-sample-appl/source/
 +
[OE::arm-angstrom-linux-gnueabi-angstrom-cm-t3530]:/path/to/oe-sample-appl/source$make
 +
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
 +
[OE::arm-angstrom-linux-gnueabi-angstrom-cm-t3530]:/path/to/oe-sample-appl/source$
 +
</pre>
 +
Once the build is complete, copy the {{filename|oe-sample-appl}} application to the working root filesystem on CM-T3530:
 +
<pre>
 +
[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/
 +
</pre>
 +
Run the application on CM-T3530:
 +
<pre>
 +
root@cm-t3530:~#
 +
root@cm-t3530:~# ./oe_sample_appl
 +
Hello World!
 +
root@cm-t3530:~#
 +
</pre>
 +
Please refer to the [http://docs.openembedded.org/usermanual/usermanual.html#usage_devshell Devshell] section in the OE User Manual pages for more details.
 +
 
 +
 
 +
 
 +
== Graphics SDK ==
 +
The Graphics SDK version 4.05.00.03 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 ===
 +
* Download the [http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/4_05_00_03/index_FDS.html Graphics SDK 4.05.00.03].
 +
* Install the SDK on a Linux host machine. Please refer to the [http://processors.wiki.ti.com/index.php/Graphics_SDK_Quick_installation_and_user_guide#Install_steps installation guide] for more details.
 +
* Apply the patch from [http://compulab.co.il/products/computer-on-modules/cm-t3530/#devres CM-T3530 Linux package]:
 +
<pre>
 +
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
 +
</pre>
 +
* Setup the environment variables by editing the {{filename|Rules.make}} file. Set the following environment variables to appropriate values:
 +
** HOME=/path/to/Graphics/SDK/4/05/00/03/home/area. {{parameter|Note:}} This path does not include the {{filename|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 [http://processors.wiki.ti.com/index.php/Graphics_SDK_Quick_installation_and_user_guide#Build_steps build guide] for more details.
 +
 
 +
* Build the Graphics SDK:
 +
<pre>
 +
make OMAPES=3.x all
 +
</pre>
 +
For building graphics kernel modules only, please run the following command:
 +
<pre>
 +
make OMAPES=3.x all_km
 +
</pre>
 +
* Install the Graphics SDK into the CM-T3530 rootfs:
 +
<pre>
 +
sudo make OMAPES=3.x install
 +
</pre>
 +
To install graphics kernel modules only:
 +
<pre>
 +
sudo make OMAPES=3.x install_km
 +
</pre>
 +
* Boot up the CM-T3530 and run the SDK configuration script:
 +
<pre>
 +
root@cm-t3530:~# /etc/init.d/omap-demo
 +
</pre>
  
 
== See also ==
 
== See also ==
Line 37: Line 166:
 
* [[Linux Development for ARM modules]]
 
* [[Linux Development for ARM modules]]
 
* [http://www.openembedded.org OpenEmbedded]
 
* [http://www.openembedded.org OpenEmbedded]
 +
* [http://processors.wiki.ti.com/index.php/Graphics_SDK_Quick_installation_and_user_guide Graphics SDK Quick installation and user guide]
 +
  
 
[[Category:Linux|Building images]]
 
[[Category:Linux|Building images]]
 
[[Category:CM-T3530|Linux: Building images]]
 
[[Category:CM-T3530|Linux: Building images]]

Latest revision as of 12:13, 28 October 2013

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 org.openembedded.dev 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
cd $OEBASE
export PATH=$OEBASE/bitbake/bin:$PATH
export BBPATH=$OEBASE/build:$OEBASE/openembedded
export BB_ENV_EXTRAWHITE="OEBASE"
  • 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/oe_sample_appl.zip -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:~#
root@cm-t3530:~# oe_sample_appl 
Hello World!
root@cm-t3530:~#

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:

${OEBASE}/build/arm/tmp/deploy/eglibc/addons/arm-angstrom-linux-gnueabi-angstrom-cm-t3530-devshell
[OE::arm-angstrom-linux-gnueabi-angstrom-cm-t3530]:/path/to/oe$cd /path/to/oe-sample-appl/source/
[OE::arm-angstrom-linux-gnueabi-angstrom-cm-t3530]:/path/to/oe-sample-appl/source$make
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
[OE::arm-angstrom-linux-gnueabi-angstrom-cm-t3530]:/path/to/oe-sample-appl/source$

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:~#
root@cm-t3530:~# ./oe_sample_appl
Hello World!
root@cm-t3530:~#

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


Graphics SDK

The Graphics SDK version 4.05.00.03 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