0

I was wondering if I need to build the Android source for an application that I am developing. I need to develop an application to control a device using the I2C driver in the Kernel. Can I do this simply using the SDK and NDK? Should I instead use the SDK and NDK from my Android build?

I noticed The SDK does not have a tools directory, and when I try to run ndk/ndk-build I get the following errors.

/ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: Command not found
/ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-g++: Command not found.

Naturally there are two specific Android sites: source.android.com and developer.android.com and I understand the guides provided in these. There doesn't appear to be anything that advises what to do with your build or why you would build the source rather than using the downloaded SDK.

gobernador
  • 5,659
  • 3
  • 32
  • 51
user1400716
  • 1,126
  • 5
  • 13
  • 32

2 Answers2

0

One would rebuild android (variously meaning the kernel, userland, runtime system, system apps, and toolchains) if desired to add support for something not supported in the existing build, and not easily supported by modifications to the pre-built files short of rebuilding them.

i2c support/configuration is likely to be a feature of the kernel and some aspects of runtime configuration such as permissions, module loading, etc. You may well be able to achieve this on a rooted device without re-building the android runtime/userland by simply modifying some system files, though you may end up having to compile a new kernel or at least a kernel module.

It is unlikely that adding i2c support would require changing the sdk or ndk, unless you want to try to make a formal API for your task as an integrated part of android itself. Most likely whatever capabilities you end up adding to the android installation can be referenced from an app using reflection or app-supplied stub components and constants, rather than needing to change the build system's idea of what is supported.

Chris Stratton
  • 39,853
  • 6
  • 84
  • 117
  • Thanks very much for the helpful info. For me to use i2c from user space, I need to install i2c-tools, which is not currently available in my android build. Can I do this by modifying some system files or will I need to rebuild the system? – user1400716 Jun 20 '12 at 18:31
  • Also, if I was to use the SDK and NDK built within my android build, rather than the downloaded versions how would I go about this? As mentioned above, I can't point eclipse to the SDK folder because there is no tools folder and I get errors when I try to run the NDK. – user1400716 Jun 20 '12 at 18:38
0

you are using cygwin or linux os to compile your driver?

if you are using cygwin: c/c++ compilers must be install: open cygwin setup.exe check all component under devel branch and click next .... but total devel tools occupy about 4 GB. if you dont need them search web fr neccessary ones. (you need only about 10 components)