Installing Powertop

Powertop is a useful tool for profiling the various C-states, frequencies, and wakeup sources of a device. Here are the instructions for installing Powertop onto ICS after downloading the source code and checkout:

In the kernel
cd $YOUR_PATH/kernel/android-3.0 make menuconfig Under General setup->Kernel Performance Events and Counters, enable the option "Kernel performance events and counters" [*] Kernel performance events and counters Then Exit and save the config

Now build the kernel & kernel modules make uImage make modules

Building WLAN NOTE: If this step is skipped it may cause some runtime errors cd $MYDROID/hardware/ti/wlan/mac80211/compat export KERNEL_DIR=${YOUR_PATH}/kernel/android-3.0 export KLIB=${KERNEL_DIR} export KLIB_BUILD=${KERNEL_DIR} make ARCH=arm

In the filesystem
Download the source code for powertop cd $MYDROID/external

git clone git://git.linaro.org/people/amitdanielk/library/libnl.git cd libnl;git checkout -b libnl_android origin/libnl_android;cd .. git clone git://git.linaro.org/people/amitdanielk/library/ncurses.git cd ncurses;git checkout -b linaro origin/linaro;cd .. git clone git://git.linaro.org/tools/powertop.git cd powertop;git checkout -b linaro origin/linaro;cd .. Modify the main makefile cd $MYDROID vim build/core/main.mk Add these three lines to  subdirs :=\ external/libnl \ external/ncurses \ external/powertop \

Build the filesystem ./build/envsetup.sh lunch full_blaze-userdebug  #for Blaze -or- lunch blaze_tablet-userdebug #for Blaze Tablet make Follow the normal instructions for preparing android binaries

In myfs
Modify the init.rc file vim init.rc Make a small change to init.rc file service console /system/bin/sh class core console disabled group log
 * 1) 	user shell

Installing during runtime using adb
Boot the system and insert the musb cable

On the computer terminal cd $MYDROID/out/host/linux-x86/bin ./adb root ./adb remount ./adb shell mkdir /system/etc/terminfo ./adb push $MYDROID/external/ncurses/lib/terminfo /system/etc/terminfo/ ./adb push $MYDROID/out/target/product/generic/system/lib/libnl.so /system/lib/ ./adb push $MYDROID/out/target/product/generic/system/bin/powertop /data/ ./adb shell sync

Running Powertop
On the blaze terminal TERM=linux TERMINFO=/system/etc/terminfo /data/powertop Now powertop will be up and running.