Google Groups Home
Help | Sign in
Message from discussion Native C "Hello World" working in emulator
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Ali Akbar  
View profile
 More options Nov 13 2007, 12:56 pm
From: Ali Akbar <ali.ak...@gmail.com>
Date: Tue, 13 Nov 2007 17:56:00 -0000
Subject: Re: Native C "Hello World" working in emulator
well done!  thx for posting

On Nov 13, 8:31 pm, TomCooksey <TomCook...@googlemail.com> wrote:

> I've managed to get a native C application working in the emulator.

> For those who are interested, here's how:

> 1) Create your hello world program:

> #include <stdio.h>

> int main(int argc, char** argv) {
>    printf("hello world\n");
>    return 0;

> }

> 2) Compile with an arm cross-compiler toolchain. I used a toolchain I
> built with gentoo's crossdev tool, but there are lots out there.
> Assuming your c file is hi.c and your cross compiler is called armv6-
> vfp-linux-gnueabi-gcc, you can compile using:

> armv6-vfp-linux-gnueabi-gcc hi.c -o hi -static

> Note the -static. I've not figured out the version of libc etc or the
> ABI used yet, so for now, link applications statically.

> 3) Copy to a running emulator:
> adb push hi /system/sbin/hi

> 4) Run it! From the emulator console:
> cd /system/sbin
> ./hi

> 5) Smile as you see "hello world" printed on the console. :-)

> Next, I'm going to try and get busybox up & running so we can have
> access to exciting programs such as "cp"! After that, perhaps dropbear
> for remote ssh access? Or maybe a small web server like boa so we can
> turn the android emulator into a webserver? Stay tuned.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google