This guide will show how to get ARM® DS-5™ Streamline™ support working on a production Google Nexus 10 device, with minimal modifications.
The resulting files generated will be a gatord, gator.ko and a boot.img file.
This guide is written with both Android version 4.3 (JellyBean MR2) and 4.4.2 (KitKat MR1) in mind.
It is required that the Nexus 10 device has root access.
This is required in order to install gator and to insert the kernel module.
You will also be flashing and/or booting a custom kernel.
ARM DS-5 software is required to be installed. This is required in order to do any capturing of data and also contains the source code for gator.
The community edition of DS-5 can be obtained for free from the ds5 website.
This guide has been tested with DS-5 version 5.17 on Linux.
In addition, you will need the Android SDK (for adb and fastboot) and Android NDK (for building gator daemon).
Finally, you will need abootimg or equivalent scripts to modify the boot.img.
The toolchain to be used for building the kernel can be obtained from the following public git repository:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/
In order to setup your build environment to use this toolchain, and to target cross compilation, do the following:
export PATH=$PATH:$(pwd)/arm-eabi-4.6/bin export CROSS_COMPILE=arm-eabi- export ARCH=arm export SUBARCH=arm
The kernel source code can be obtained from the following public git repository:
git clone https://android.googlesource.com/kernel/exynos kernel cd kernel
Either checkout jb-mr2 (Android 4.3) or kitkat-mr1 (Android 4.4.2) branch depending on what version of Android your device is running:
git checkout android-exynos-manta-3.4-jb-mr2 git checkout android-exynos-manta-3.4-kitkat-mr1
Building
To build the kernel, do the following:
make manta_defconfig make
In order to build the gator driver however, you will need to make modifications to the kernel.
make menuconfig
[*] Enable loadable module support -->
[*] Forced module loading
[*] Module unloading
[*] Forced module unloading
General setup -->
[*] Profiling support
Device Drivers -->
Graphics Support -->
ARM GPU Configuration -->
Mali-T6XX support -->
[*] Streamline Debug support
If you are targeting Android 4.3, you will need to make the following modifications before you can successfully build:
diff --git a/drivers/gpu/arm/t6xx/kbase/src/Kbuild b/drivers/gpu/arm/t6xx/kbase/src/Kbuild index 584d5f2..e6eadd6 100644 --- a/drivers/gpu/arm/t6xx/kbase/src/Kbuild +++ b/drivers/gpu/arm/t6xx/kbase/src/Kbuild @@ -41,7 +41,7 @@ DEFINES = \ -DMALI_ERROR_INJECT_ON=$(MALI_ERROR_INJECT_ON) \ -DMALI_MOCK_TEST=$(MALI_MOCK_TEST) \ -DMALI_COVERAGE=$(MALI_COVERAGE) \ - -DMALI_KBASE_SRC_LINUX_PATH=$(src)/linux \ + -DMALI_KBASE_SRC_LINUX_PATH=../../$(src)/linux \ -DMALI_KBASE_THIRDPARTY_PATH=../../$(src)/platform/$(CONFIG_MALI_PLATFORM_THIRDPARTY_NAME) \ -DMALI_INSTRUMENTATION_LEVEL=$(MALI_INSTRUMENTATION_LEVEL) \ -DMALI_RELEASE_NAME=\"$(MALI_RELEASE_NAME)\" diff --git a/drivers/gpu/arm/t6xx/kbase/src/platform/manta/mali_kbase_platform.c b/drivers/gpu/arm/t6xx/kbase/src/p index 6140252..ad4adfe 100644 --- a/drivers/gpu/arm/t6xx/kbase/src/platform/manta/mali_kbase_platform.c +++ b/drivers/gpu/arm/t6xx/kbase/src/platform/manta/mali_kbase_platform.c @@ -220,7 +220,7 @@ int kbase_platform_cmu_pmu_control(struct kbase_device *kbdev, int control) spin_lock_irqsave(&platform->cmu_pmu_lock, flags); #ifdef CONFIG_MALI_GATOR_SUPPORT - kbase_trace_mali_timeline_event(GATOR_MAKE_EVENT(ACTIVITY_RTPM_CHANGED, ACTIVITY_RTPM) | control); +// kbase_trace_mali_timeline_event(GATOR_MAKE_EVENT(ACTIVITY_RTPM_CHANGED, ACTIVITY_RTPM) | control); #endif /* off */ if (control == 0) {
You can now build the kernel with make.
In order to get this modified kernel onto the device, you need to modify a boot.img file.
A boot image file consists (mainly) of a kernel and a ramdisk.
You can easily download this from google’s website:
https://developers.google.com/android/nexus/images#mantaray
Extract the files for either 4.3 or 4.4.2, and obtain the boot.img file.
In order to generate a new boot.img with your newly built kernel, do the following:
abootimg -u boot.img -k kernel/arch/arm/boot/zImage
Alternative scripts method:
./unpackbootimg -i boot.img ./mkbootimg --kernel kernel/arch/arm/boot/zImage --ramdisk boot.img-ramdisk.gz -o boot.img
At this stage, you can either flash the new boot image over the original stock boot image, or you can boot the image directly without flashing. With the latter option, after a reboot of the device, the original boot image will be used instead. This is useful for testing purposes.
In order to do either, you first need to boot the device into bootloader mode. This is easily done via adb:
adb reboot bootloader
To just boot directly, do:
fastboot boot boot.img
To flash the image, do:
fastboot flash boot boot.img
Your device should now boot using the custom kernel.
This can be tested by looking at Settings -> About tablet -> Kernel version
You can obtain the driver and daemon source files from your DS-5 installation directory:
<DS-5 Installation Directory>/arm/gator/
Build the driver by doing the following, from within the gator-driver directory:
GATOR_WITH_MALI_SUPPORT=MALI_T6xx make -C <path_to>/kernel M=`pwd` modules
You should now have gator.ko.
First, you will need to modify the structure of the gator-daemon directory in order to build for Android.
Create a folder called jni inside gator-daemon and move all files and folder to this location:
mkdir jni mv * jni/
Then, build the daemon by doing the following, from within the gator-daemon directory:
ndk-build
You should now have gatord.
Unfortunately you cannot simply push these two gator files directly into the system directory on the device, due to permission issues with a secure adb device.
The way around this is to do the following. First, remount the system partition as read/write access:
adb shell su -c 'mount -o remount /system'
Next, push the files to the sdcard:
adb push gator.ko /sdcard/ adb push gatord /sdcard/
Then copy these files from the sdcard to the system directory:
adb shell su -c 'cp /sdcard/gator* /system/bin/'
Finally, give full permissions to the daemon:
adb shell su -c 'chmod 777 /system/bin/gatord'
You are now ready to use the device with Streamline support.
The normal procedure for using gator is as follows – and is required to be done each time the device restarts:
Setup forwarding through usb instead of network (optional):
adb forward tcp:8080 tcp:8080
Launch the daemon from within an adb shell:
adb shell su -c 'gatord &'
Launch DS-5, and enter localhost (or the ip address if you didn’t do the forward command) in the connection box.
Select the counters you are interested in capturing, and you are now ready to begin capturing.
That looks like some of your files have picked up windows line-endings - did you extract the kernel tar using a windows program, or edit the files with a windows text editor?
I'd recommend using the tar command line in Cygwin - this avoids most issues.
Hi shabby26,
I do not believe the error is with the ini file. It should be based on the location of the cross compiler.
i.e. From $CROSS_COMPILE look for the exe...
Which is in your case "C:/Program Files/DS-5/bin/../sw/gcc/bin/arm-linux-gnueabihf-gcc.exe" which is correct.
This guide has only been tested under Linux, and not Windows with cygwin. Because of that, I am unfamiliar with your specific error and cannot at this time suggest a solution, other than trying it under Linux (a VM for example).
It could be an issue with cygwin, not Windows... in which case, you could use an alternative... for example gnuwin32... however I have not tested this either.
If you do find a solution, please come back to us, so others may find it useful.
Thank you for your interest.
Kind Regards
Michael McGeagh
Hi Peter, Thanks for replying.
I am using the 'using_arm_streamline[dot]pdf' file's Target Setup part to build the kernel before generating the gator[dot]ko. That file states using
export CROSS_COMPILE=${CROSS_TOOLS}/bin/arm-linux-gnueabihf-
Now I am making the $PATH to C:/Program Files/DS-5/ so that on running make -j5 uImage, one can enter bin directory and find arm-linux-gnueabihf-gcc[dot]exe file.
That is working. Then that file goes on to find arm-linux-gnueabihf-gcc[dot]ini file which is there inside DS-5/sw/info. That file contains the following statement:
exe=../sw/gcc/bin/arm-linux-gnueabihf-gcc[dot]exe
But ../ goes to info folder inside which there is no sw folder. This line should be exe=../../sw/gcc/bin/arm-linux-gnueabihf-gcc[dot]exe. The ini file is readonly and I am hence not able to modify that.
Thus on running make -j5 uImage to build the kernel, I get the following error!
C:\cygwin64\bin\arm-linux-gnueabihf-gcc[dot]exe wrapper: Error opening config file 'C:\cygwin64\bin\..\sw\info\arm-linux-gnueabihf-gcc[dot]ini' failed: <No such file or directory>
Is there something I am missing out here? I guess a built kernel is required to generate the gator[dot]ko file.
It also depends on which version of DS-5 (gator) you are using. Until recently, the gator.ko was a requirement... however with the latest version, there is the ability to use the gatord without a gator.ko if built in this manner. However the kernel still needs things such as profiling enabled. Do you see any errors when you run gatord? Have you checked dmesg output for error messages too?
Note. This guide was written for a version of gator that required gator.ko. Please refer to the documentation that comes with the latest DS-5 to find out how to do a similar thing without the need of gator.ko.
Thanks
I am not able to build the kernel on a Windows 8.1 machine using Cygwin64 terminal. A bunch of errors are coming up while using the makefile. Is it because of the absence of cross compilers?
If you don't tell us what the errors are, I'm not sure we can help here