Android Hacking

I have spent the last couple of weeks building various custom images for Android. There are a few useful tutorials:

While the above tutorials give you a pretty good idea of what to do, they are terrible at providing guidelines on what to do when something goes wrong. Here are a few common issues:

  • Wrong source version: make sure that you checkout the right version of the software. If you are going to rebuilt the kernel make sure to use the checkout using the sha1 hash. The hash of the kernel currently running on your device is included in the kernel name. For example, my kernel version was 3.4.0-gfe3bd61[more stuff]. You can checkout the kernel sources used to build the kernel version using the fe3bd61 hash.
  • Build environment: I am a happy mac user. At the time of writing this post, the current Xcode toolchain (v 6.4), cannot be used to compile the android sources. I have used Ubuntu under Parallels to do much of the development. This solution worked mostly okay. However, if you are not careful you might run out of memory and Ubuntu will kill your compilation process. You can tweak either the amount of RAM dedicated for your VM or configure the lower the number of threads used to compile the source (i.e., make -j N).
  • Kernel Sins: I spent an entire day trying to figure out why my devices was rebooting after running the boot loader (the device was stuck in an infinite reboot loop). Since adb demon was not loaded yet, it was impossible to get the log to see what was happening. Luckily, Android saves the previous kmesg logs in /proc/last_kmesg that can be retrieved by booting a working kerning image (e.g., the factory images of Android). Inspecting the kmesg, I was able to determine that I was running the incorrect version on my toolchain. Note to self, use the version specified in the documentation (RFM!).


Tagged with: ,
Posted in Android, Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: