cross-compilingpandaboardlinaro

Cross-compiling Hello World for Pandaboard Linaro Linux


I am trying to cross-compile a simple application for the Pandaboard running Linaro Android Linux, v13.04.

I am using the Linaro tool-chain in a Ubuntu 12.04 virtual machine. I can modify and cross-compile the kernel successfully, and compile working driver modules, but I cannot figure out where to get the libraries, etc. I need to build user-space applications (NOT Android, I want stuff to run in a console).

Any hints and/or examples? Sorry for the generic plea for help rather than a specific question, but I am desperately trying to create a command line tool to test my driver. I have a very limited amount of time to get this running and have already searched the web for hours. Eventually, I want to cross-compile the HIDAPI library, but just getting a user space application to work would be a great start!

I do not have (or don't know where to find) the stdio/stdlib libraries for user space programs. What I am hoping for is a simple command line (or makefile) example that would allow me to cross-compile on my Ubuntu system and create an executable that will run in a Linux shell on the Pandaboard Linaro Android build (13.04).

Again, I realize it is very basic, but I'm not able to do it, and would appreciate and example to jump start me.

Thanks, Lee


Solution

  • To build a console application for Android, you'll need NDK. Android has its special libc version called bionic, that's why you need NDK anyway.

    After downloading and extracting NDK, you'll find a samples folder there. Take a look at hello-jni example and create your own. Below an example for Android.mk file:

    LOCAL_PATH := $(call my-dir)
    
    include $(CLEAR_VARS)
    
    LOCAL_MODULE    := hello-jni
    LOCAL_SRC_FILES := hello-jni.c
    
    include $(BUILD_SHARED_LIBRARY)