Thursday, January 28, 2010

writting Helloworld example for Maemo 5 and run it on SDK and N900

here is the steps i did to write the famous Helloworld first example for maemo 5
compile it and test it in the SDK and finally compile it to run in N900
The original post is here

1- install Maemo 5 SDK from here
2- open terminal and run
Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac -kb &
3- open another terminal and run
/scratchbox/login
this is where you do all the coming steps
4- you should be working in the home
[sbox-FREMANTLE_ARMEL: ~] >pwd
/home/user
5-[sbox-FREMANTLE_ARMEL: ~] >vi helloworld.c
and add the following code:
#include  /* printf */
int main(int argc, char** argv) {
printf("Hello world\n");
return 0;
}

6- to test the code in the SDK you need to compile for PC this is done by
[sbox-FREMANTLE_ARMEL: ~] >sb-menu
choose "select" then "FREMANTLE_X86" then "OK"
7- [sbox-FREMANTLE_X86: ~] > gcc -Wall -g helloworld.c -o helloworld
8- [sbox-FREMANTLE_X86: ~] > ./helloworld
it will give you
Hello world

9- Now lets compile it for N900
10-[sbox-FREMANTLE_ARMEL: ~] >sb-menu
choose "select" then "FREMANTLE_ARMEL" then "OK"
if it complains from running process choose "killall" and try again
11-[sbox-FREMANTLE_X86: ~] > gcc -Wall -g helloworld.c -o helloworld
12- connect N900 as storage
13- copy the file helloworld to the N900
14- disconnect the N900 from the PC
15- open shell
16- type root
17- move the helloworld to the home of the root
18- add execute to the Helloworld file (chmod +x helloworld)
19- run it (./helloworld) you should get
Hello world

and that it i finished the first example

No comments: