This guide will show how to get ARM DS-5 support working on a production Samsung Galaxy Note 3 and Samsung Galaxy Note 10.1 (2014 edition) devices, with minimal modifications.
The resulting files generated will be a gatord, gator.ko and a boot.img.tar.md5 file.
This guide is written with Android version 4.3 (JellyBean MR2) in mind.
It is required that the Note 3 (SM-N900) and/or Note 10.1 2014 edition (SM-P600 or SM-P601) devices have root access.
This is required in order to install gator and to insert the kernel module.
You will also be flashing 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 Windows and Linux.
In addition, you will need the Android SDK (for adb) and Android NDK (for building gator daemon).
You will also need to use ODIN, which works under Windows, in order to flash the boot image.
Finally, you will need abootimg or equivalent scripts to modify the boot image.
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 set up your build environment to use this toolchain and to target cross compilation, do the following:
The kernel source code can be obtained from the following website:
For the Note 3, search for SM-N900. At time of writing, this was tested with SM-N900_JB_Opensource_Update2.zip.
For the Note 10.1 2014 edition, search for either SM-P600 (wifi only edition) or SM-P601. Either will work. At time of writing, this was tested with SM-P600_JB_Opensource.zip and SM-P601_JB_Opensource.zip.
To build the kernel, do the following:
make ha3g_00_defconfig # SM-N900 defconfig
make n1awifi_00_defconfig # SM-P600 defconfig
make n1a_00_defconfig # SM-P601 defconfig
In order to build the gator driver however, you will need to make modifications to the kernel.
Enable the following:
[*] Enable loadable module support -->
[*] Forced module loading
[*] Module unloading
[*] Forced module unloading
General setup -->
[*] Profiling support
Kernel Performance Events And Counters --> [*] Kernel performance events and counters
Device Drivers -->
Graphics Support -->
ARM GPU Configuration -->
Mali-T6XX support -->
[*] Streamline Debug support
Disable the following:
System Type --> SAMSUNG EXYNOS SoCs Support --> [ ] Dynamic cluster power control support [ ] Dynamic CPU Hotplug support
The above disabled features are necessary to prevent the device soft rebooting when entering a low power state. This is usually when the screen goes off when not plugged in.
If you wish to have the above enabled, then you can prevent the soft rebooting by either having the device always plugged in, or use an app to keep the screen awake even when not plugged in.
You can now build the kernel with make.
In order to get this modified kernel onto the device, you need to generate a boot.img.tar.md5 file for use with the ODIN Windows application.
This file is a special file that requires a signature 272 bytes, and md5sum generated on the end of a standard boot image.
You can obtain the original stock boot.img file directly off the device with the following command:
adb shell su -c 'cat /dev/block/platform/dw_mmc.0/by-name/BOOT > /sdcard/boot.img'
adb pull /sdcard/boot.img
There is a special 272 byte signature that is needed at the end of the boot image for it to be valid to ODIN.
Once you have the stock boot.img file you can extract this signature.
To do this, you need to run the following command onto an unmodified stock boot image you obtained from the previous step. This signature is device specific.
dd bs=1 count=272 skip=`echo "\`du -b boot.img | cut -f 1\`-272" | bc` if=boot.img of=boot.odin
This command will get the size of the boot image, subtract 272, and use that as the skip value in dd in order to output only the last 272 bytes from said boot image into a separate file which we call boot.odin.
You can store this file for future uses when generating images for this device.
Now we have the components, we can create the final image to use with ODIN.
First, generate a new boot.img with your newly built kernel by doing 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
Next, append the signature file to the end:
cat boot.odin >> boot.img
Finally, tar and then generate and append an md5sum to the end of the file:
tar cf boot.img.tar boot.img
md5sum boot.img.tar >> boot.img.tar
mv boot.img.tar boot.img.tar.md5
In order to use ODIN, you first need to boot the device into download/odin mode. This is easily done via adb:
adb reboot download
Alternatively, you can press and hold VOL_DOWN + HOME + PWR buttons. Press VOL_UP to continue when prompted.
Please download and run the Windows application ODIN, and then connect the device via USB.
Click the PDA or AP button, and browse to the boot.img.tar.md5 file created previously.
Then click Start.
Your device should now boot using the custom kernel.
This can be tested by looking at Settings -> About tablet -> Kernel version
When you upload this custom kernel to the device, you may find you can no longer connect to the wifi.
To fix this issue, you will need to do the following steps:
adb pull /system/build.prop
sed -i 's/ro.securestorage.support=true/ro.securestorage.support=false/g' build.prop
adb shell su -c 'mount -o remount /system'
adb push build.prop /sdcard/
adb shell su -c 'cp /sdcard/build.prop /system/'
You can obtain the driver and daemon source files from your DS-5 installation directory:
<DS-5 Installation Directory>/arm/gator/
Before you can build the driver, you need to disable IKS support in gator. This can be easily done by doing the following modification:
--- gator.h 2013-11-08 15:59:39.000000000 +0000
+++ gator.h 2014-01-23 18:21:34.324858230 +0000
@@ -18,7 +18,7 @@
#define GATOR_PERF_PMU_SUPPORT GATOR_PERF_SUPPORT && defined(CONFIG_PERF_EVENTS) && (!(defined(__arm__) || defined(__aarch64__)) || defined(CONFIG_HW_PERF_EVENTS))
#define GATOR_NO_PERF_SUPPORT (!(GATOR_PERF_SUPPORT))
#define GATOR_CPU_FREQ_SUPPORT (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)) && defined(CONFIG_CPU_FREQ)
-#define GATOR_IKS_SUPPORT defined(CONFIG_BL_SWITCHER)
+#define GATOR_IKS_SUPPORT 0 //defined(CONFIG_BL_SWITCHER)
// cpu ids
#define ARM1136 0xb36
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:
mv * jni/
Then build the daemon by doing the following from within the gator-daemon directory:
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:
This next step is required to temporarily disable SELinux:
adb shell su -c 'setenforce 0'
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.
Sometimes you will need to boot into recovery and wipe the cache and/or data. If in doubt, a factory reset helps.
If that doesnt resolve the bootloop, it may be because your bootloader has been updated since time of writing this document.
I noticed on other devices that the bootloader was upgraded between android OTA updates and that caused bootloops.
I have successfully tested the Note3 for the following android and kernel sources and confirm they work for me:
I have not tested on any other versions so cannot say whether they work or not.
I need to build a custom kernel for NOTE3.
I tried the above mentioned steps and was able to build a kernel image (zImage and uImage).
But when I flash this image onto the phone using ODIN, then doesn't boot up. It just continuously flashed the "Samsung Note3" logo and that's it.
When I flash the original image back, it works fine and boots up.
What can be the issue here.
Please note that if you are using DS-5.20 you will need to apply the following patch and change the MALI_T6xx to MALI_MIDGARD parameter.
Re: Gator with MALI-6xx
The patch is not needed if you use DS-5.20.1 however the parameter name change is needed.
You guys may be interested in this document.
Software Development Tools
There is a very similar document regarding the Google Nexus 10 device here: Using DS-5 Streamline with Mali on Google Nexus 10