Intel® System Studio Developer Story: How to Configure, Build and Profile the Linux* Kernel of Android* by Using Intel® VTune™ Amplifier

By Jong Il Park, Jong Il Park, Published: 12/23/2014, Last Updated: 12/26/2014

Intel® System Studio Developer Story: How to configure, build, debug and optimize key parts of your mobile software stack for Android*

1. Set-up and configure a development environment.

(1) The target hardware environment

   In this article, a MinnowBoard MAX* is used for a hardware platform. The MinnowBoard is an Intel Atom® processor based board which introduces Intel® architecture to the small and low cost embedded market for the developer and maker community. It has exceptional performance, flexibility, openness and standards.

Specification Minnow Board Max
CPU 64-bit Intel Atom® E3815 (Single Core 1.46 GHz or E3825 Dual Core 1.33 GHz
Graphics Integrated Intel® HD Graphics
Memory 1~2 GB DDR3 RAM

Video : micro HDMI  / Micro SD / SATA2 / USB 3.0 (Host) / USB 2.0 (Host) /  Serial / Ethernet

OS Linux / Yocto Linux / Windows 8.1 / Android 4.4

* Please find more details in officially Minnow homepage :

(2) Software environment

 Host OS : Ubuntu 14.04 LTS / Window 7 64 bits

 IDE : Android Developer Tools / eclipse KEPLER

 Tools : Intel® System Studio 2015

 Target OS: Android 4.2.2

(3) Set up the Android SW development environment

  • Configure a workstation (Ubuntu Linux)    
sudo dpkg --assert-multi-arch
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer

sudo apt-get install git git-core gnupg flex bison gperf build-essential ccache squashfs-tools zip curl libc6-dev libncurses5-dev x11proto-core-dev g++-multilib mingw32 tofrodos  python-markdown libxml2-utils zlib1g-dev:i386 libx11-dev libreadline6-dev xsltproc

echo 'export USE_CCACHE=1' >> ~/.bashrc
ccache -M 16

mkdir ~ / bin
curl > ~/bin/repo
chmod a+x ~/bin/repo
  • Download the code
repo init -u
repo sync -j4 -q -c --no-clone-bundle
  • Build 
source build/
<select minnow-eng>
make -j4


  • Make an installer USB memory stick and install it to a micro SD card in the Minnow board

Copy android-ia/out/target/product/minnowboard_max/live.img and make a installer image to an USB memory stick.  In Windows you can make an android installer image by Win32diskimager to an USB memory stick.  And then  Insert an USB memory stick which has an Android installer image into the Minnow board which has a micro SD card. After boot up you can select the installing Android.

  • Connect the Android on the Minnow board to a host machine

After successful boot-up, connect the target via an Ethernet cable. And configure a connection.

adb connect
adb shell


2. Using a VTune.

The VTune is the performance analysis tool to find a hotspot which may utilize CPUs' inefficiency way both in applications and a system wide.

Links following are the useful documents you can refer for how to find out a hotspot in Android. 

In this article, we are focusing on the profiling an Android system. To profile a system - including Linux Kernel by using the system wide profiling feature of a VTune, some functions which can stop the VTune profiling will be added in the Linux Kernel layer of Android and the user-defined custom analysis feature of a VTune will be introduced as well. For the prerequisite of this kind of analysis,  the compiling an Android and updating a boot image by the fastboot and the logging and some ADB command of an Android are also explained.

(1) The example function of stopping VTune profiling

During poring or working on the Linux kernel layer of an Android, sometimes we need to stop the profiling at the time of any specific event or signal or exceptional cases such as a kernel panic. And we can start analysis the time which is just right after the specific debug point you want to check. And you can accomplish it by sending the QUIT signal to the VTune process which is started when you start analysis in a VTune GUI or a command line. The example function following is to find the VTune process and send QUIT signal to the process to stop profiling.

void stop_vtune_process (void)
	struct task_struct *p;
	int j;
	int flasg_to_skip_sh = 0;
	for_each_process(p) 	{
		for (j=0;j< (TASK_COMM_LEN-4);j++) {
			if (p->comm[j] == 'a' && p->comm[j+1] == 'm' && p->comm[j+2] == 'p' \
				&& p->comm[j+3] == 'l' && p->comm[j+4] == 'x') {
                                /* found the amplx ... in the process name. */ 
				printk ("[vtune] %d %s \n",task_pid_nr(p),p->comm);
				if (flasg_to_skip_sh) {
					printk("[vtune]Kill %d(%s)\n",task_pid_nr(p), p->comm);
					do_send_sig_info(SIGQUIT, SEND_SIG_PRIV, p, false);
				else	{
					printk("[vtune] skip sh for amplxe\n");

You can add and call this kind of function into your Linux kernel source codes such as kernel panic, an USB event function, a Key event function etc., whichever you want to stop profiling and start the analysis by a VTune.

(2) Some useful things - fastboot, ADB, kernel log (Minnow board MAX)

<build source codes>
make -j4

<download  kernel image by fastboot>
adb reboot bootloader
fastboot -t flash boot boot.img
fastboot -t continue

<logging kernel via adb>
adb shell cat /proc/kmsg | grep vtune

(3) Setting and using the VTune for the system profiling

To get the details of system data during profiling, we'd better use an Advanced hotspot with the system wide profile even it has little call stack information, but we can see a system wide processes and functions which is called during profiling.  

  • Project properties - Target type : Profile System 
  • New Analysis - Choose analysis type - advanced hotspot  , collection level : hotspot

<The screen shot of the result - example : Advanced hot spot>

advanced hotspot - system wide profileThis advanced hot spot is using 3 high frequent basic HW events - CPU_CLK_UNHALTED.CORE / CPU_CLK_UNHALTED_REF_TSC / INST_RETIRED_ANY. If your system codes which you want profiling are more delay-critical-codes or you want to use specific HW PMU event, use the custom analysis. Next example is the custom analysis.

  • Project properties - Attach process -select process
  • New Analysis - Custom Analysis - New Hardware Event-based sampling analysis
  • New Hardware Event-based sampling analysis- Edit - add events you want
  • New Hardware Event-based sampling analysis- Edit - Check the collect stacks or Analyze system-wide context switches

<The screen shot of result - example : custom analysis>

Hardware Event-based sampling analysis


You can analysis the process working in the time line as the picture above. And if you found any suspicious process which needs more investigation. Change the Vtune - Project  Properties - Target Type - Attach to Process and repeat testing above to do narrow down the issues.


Product and Performance Information


Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804