Android Tablets Forum banner
1 - 3 of 3 Posts

·
Premium Member
Joined
·
784 Posts
Well it's time to get serious about hacking the tablet. But I've never done any programming under Linux, let alone Android and it's peculiarities. So it was time to take the plunge. I've done some programming Delphi, C, and Assembler(Dos days). I really don't make programs, just hack a few or make a few utilities for a given purpose.

Unlike Windows where you buy a package and everything is ready, Linux is more fragmented, requiring several packages to get things going.

First you need to install the normal programming libs and gnu tools. Most distros either install these or have packages available. But for Android you need to cross compile for an Arms proccessor. Since you need special libs for Android, your best to install Android NDK. It's design to allow native code for Android Java Apps, but can be used to build Kernels and executables.

http://developer.android.com/sdk/ndk/index.html

NDK tells you it is for building Dynamic or Static Libs for Java Apps, but I did find it has cmd-build-executable in Setup.mk. So I am sure an Android.mk would suffice for making an executable. However most of us are use to Make files for building apps.

After searching for week or so and trying things that are supposed to work, I built on that and info from cmd-build-executable to finally compile a basic Hello World exe and run it on my Tablet.

Code:
#include <stdio.h><br />
<br />
int main()<br />
{<br />
	printf("test 1.0 released Apr 17,2011\n");<br />
	return 1;<br />
} <br />
Android OS Particulars

  • Typical Arms CPU arm-eabi-gcc cross compiler
  • Uses smaller specific libc. Supplied by NDK and specific for different SDK versions
  • Android Elf Executables use a different CRT Startup and End.
  • Android Kernel does not support Dynamic Linking. Function supplied by a /system/bin/linker

Compiler Requirements to build Elf Executables

  • Supply directorys for Android SDK libraries and header files. Found under NDK
  • Use nostdlib flag. Supply crtbegin_dynamic.o and crtend_android.o Found under NDK
  • Use dynamic-linker=/system/bin/linker flag. Allows dynamically loading of libraries.

Just edit the NDK and SDK install directories to run the make file.
 

Attachments

·
Registered
Joined
·
1 Posts
Hi,

I'm trying to build a binary that can run on an Android device. I have Android SDK and NDK installed. I've downloaded the 2 zip files you've attached, but I'm not sure what I'm supposed to do with it. When I try to run cmd-build-executable, it doesn't seem to exist.
 
1 - 3 of 3 Posts
Top