Event Based Sampling on Yocto Project* based Platforms

Sampling Collector for Intel® VTuneTM Amplifier XE 2011 on Yocto Project* based target platform 


Using the Sampling Collector for Intel® VTuneTM Amplifier XE 2011 on a Yocto Project* based target platform follows the same basic steps as installing and running the sampling collector on any embedded custom Linux* target, that has limited access to a kernel module build environment and may require build of the sampling collector in a cross-build setting. Building the driver kernel module for the sampling collector requires kernel sources and kernel header files for the Yocto Project* to be available either on the target platform, or more likely in a jailroot/chroot or Poky-Linux* sysroot based build environment on the development host.

The article below outlines how to do this with the Sampling Collector for Intel® VTuneTM Amplifier XE 2011 as included in the Intel® Embedded Software Development Tool Suite for Intel® AtomTM Processor.

Setting up Yocto Project* Build Environment on Build Host

Please refer to the Yocto Project* homepage at http://www.yoctoproject.org and the Yocto Project* Developer Manual at http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html for the latest information and for details not covered in these release notes.

To build the driver module for the Sampling Collector for Intel® VTuneTM Amplifier XE 2011 requires the presence of a fully configured Yocto Project* kernel build environment.

The Yocto Project* Quick Start Guide at http://www.yoctoproject.org/docs/current/yocto-project-qs/yocto-project-qs.html outlines everything needed to create an OS kernel build environment using bitbake.

The steps below describe some of the key steps of this setup for Yocto Project* 1.1:

  1. Download the Yocto Project* 1.1 source package:

http://downloads.yoctoproject.org/releases/yocto/yocto-1.1/poky-edison-6.0.tar.bz2

       and unpack it under a non-root user account

2.    On a regular user command shell, run the following:

$ source <install_dir>/poky-edison-6.0/oe-init-build-env edison-6.0-build

This will create an "edison-6.0-build" folder in the current directory

3.     Go to the newly created folder and edit the local.conf file

$ cd edison-6.0-build

$ vi conf/local.conf

Ensure the following settings in local.conf:

                        POKY_EXTRA_INSTALL = "dropbear" // this installs SSH server/client

                        BB_NUMBER_THREADS = "N"  // where "N" is the number of physical cores

                        PARALLEL_MAKE = "-j N"         // where "N" is the number of physical cores

                        INHERIT += "rm_work"          // set this if you have less than 50GB free space available

4.      Get latest GIT configurations for Intel® Architecture based platforms.

$ cd $HOME/yocto

$ git clone git://git.yoctoproject.org/meta-intel/

            This will create a "meta-intel" folder in the current directory

5.      Configure GIT to use Edison build

$ cd meta-intel

$ git checkout edison

6.      Configure bitbake to use Intel® Architecture specific configurations.

$ cd edison-6.0-build

$ vi conf/bblayers.conf

Add "meta-intel/meta-XYZ" (XYZ=machinetype) to BBLAYERS variable

  

Installing the Sampling Driver

Installing the sampling driver may require using a development and target system:

  • The development system is the system you use to develop your application. This system has full binutils and a compiler.
  • The target system is the system for which the application is targeted.

These are the steps for installing the Sampling driver:

  1. Go to the /sepdk source directory:

$ cd <install-dir>/sepdk/src

  1. Build the sampling driver.
    • Compile the driver on your development system, with the settings for your target system:
      1. Customize the cc-sep3-driver script, included in the installation, for your kernel, compiler and other system settings.
      2. Run the customized script to build the driver on your development system.
      3. Copy the newly-built driver to the target system.
  2. If the driver was built successfully, go to the directory where it was installed:

$ cd <install-dir>/sepdk/prebuilt

  1. To load the sampling driver, use the following command:

$ ./insmod-sep3 -r -g [user_group]

where [user_group] is the name of the group that can perform sampling collection on the system.  To find which group you are a member of, run the command:

groups

  1. To have the system automatically load the sampling driver at boot time, run the following command:

$ ./boot-script -i -g [user_group]

  1. To check whether sampling driver successfully loaded, run the command:

$ ./insmod-sep3 -q

  1. To unload the driver, use the command:

$ ./rmmod-sep3  

Customizing the Driver Script for Yocto Project* Targets

This topic explains the process for customizing the cc-sep3-driver script for your kernel, compiler and other system settings:

  1. Open the cc-sep3-driver script in a text editor.
  2. Edit the lines to set the various variables according to your development and target system. Below are example settings for Yocto Project* 1.1:

Development system settings:

Base directory

BASE=$HOME/yocto/edison-6.0-build/tmp

Tool directory where the compiler and linker reside

TOOLS=$BASE/work/core2-poky-linux/gcc-4.6.1+svnr175454-r10/package/usr/bin

Name of the compiler that compiles the driver

CC=gcc

Target system settings:

Platform architecture

PLATFORM=x32

kernel arity

ARITY=smp

kernel version

KERNEL_VERSION=3.0.4-yocto-standard+

kernel directory

KERNEL_DIR=$BASE/sysroots/fri2-noemgd/kernel

  1. Save the customized script.
  2. Running "./cc-sep3-driver" in the sepdk/src  directory built the SEP drivers using the kernel toolchain.
  3. Continue Installing the Sampling Driver.

Setting Up the SEP Runtime Environment

Set up the SEP runtime environment by completing the following steps:

  1. Run the following command-line:

cd <install-dir>/bin

sh

source setup_sep_runtime_env.sh

  1. Start using SEP:

cd $HOME

sep -version

sep -el

sep -start -d 20 -info 4 -verbose -out foo

sfdump5 foo.tb5 -processes

如需更全面地了解编译器优化,请参阅优化注意事项.