Porting Guide for Motorola A1200, A1600, ROKR E6 (motoezx) (En)
updated 01.12.2009
Requirement: OS - Linux
If you want to compile under windows use a coLinux based distro (andLinux, Topologilinux, Ulteo Virtual Desktop)
download motoezx-toolchain.tar.gz, megaupload-mirror and copy in (shared with andlinux) folder on computer
Install enviroment :
run 'Konsole' under andlinux
sudo mkdir /mmc sudo chown user -R /opt sudo chown user -R /home sudo chown user -R /mmc mkdir /opt/toolchains mkdir /home/a1200 mkdir /home/a1200/build mkdir /mmc/mmca1 tar -C /opt/toolchains -xzvf /mnt/win/motoezx-toolchain.tar.gz cp /opt/toolchains/motoezx/setenv-a1200.sh /home/a1200 cp /opt/toolchains/motoezx/setenv-a1200-2.sh /home/a1200
Note: If you use a Linux OS (Ubuntu, Mandriva, Debian, e.t.c.) that doesn't have KDE environment installed, then you can input all the commands under your linux console (Access it with the combination Ctrl+Alt+F1, return to your environment using Alt+F7)
now when we have installed the enviroment, we can try porting an application
run enviroment
cd /home/a1200 . setenv-a1200.sh
download any source for example newvox 1.0 extract in /home/a1200
cd /home/a1200 tar -xzvf /mnt/win/newvox-1.0.tar.gz
cd newvox-1.0 Configure it for your MotoLinux OS
./configure --host=arm-linux-gnu Compile the application
make
newvox.log.txt newvox.log.png
if everything was configured and compiled without errors we compiled an executable file 'newvox' and now we can test it in the phone. To do so, copy the executable file to your memory card and run under console
cd /mmc/mmca1 export LD_LIBRARY_PATH=/mmc/mmca1/games/lib:$LD_LIBRARY_PATH chmod +x newvox ./newvox
Note: to check your applications under windows access your start menu, click 'Run' and input cmd. After launching dos input telnet 192.168.16.2 Now under telnet input the commands written higher Info: export LD_LIBRARY_PATH means that you supply the folder where you have your SDL libs installed to (The folder may vary depending on the phone) if you don't have a configure file in your sources then you must manually edit your makefile - search and replace strings: CC:=gcc ---> CC:=arm-linux-gnu-gcc cc=gcc ---> CC=arm-linux-gnu-gcc cxx=g++ ---> CXX=arm-linux-gnu-g++ ld=ld ---> LD=arm-linux-gnu-ld ar=ar ---> AR=arm-linux-gnu-ar as=as---> AS=arm-linux-gnu-as oc=oc ---> OC=arm-linux-gnu-objcopy ranlib=ranlib ---> RANLIB=arm-linux-gnu-ranlib strip=strip ---> STRIP=arm-linux-gnu-strip
Solution for adding autohide app(s)
when you receive an incoming call (sms, flip, other phone events) with suspending
audio based on replacing procedure SDL_PollEvent with own
mySDL_PollEvent
-------------example.h----------------------- int mySDL_PollEvent(SDL_Event *event);
// audio use sdl-lib SDL_AudioSpec obtained; boolean _audioSuspended;
void suspendAudio(); int resumeAudio();
// audio use sdl-mixer lib
void suspendAudio(); int resumeAudio(); void closeAudio(void);
--------------example.cpp-------------------- int mySDL_PollEvent(SDL_Event *event) { int _r= SDL_PollEvent(event); if (!_r) return 0; if (event->type == SDL_ACTIVEEVENT) { if (event->active.state == SDL_APPINPUTFOCUS && !event->active.gain) { suspendAudio(); for (;;) { _r = SDL_WaitEvent(event); if (!_r) continue; if (event->type == SDL_QUIT) return 1; if (event->type != SDL_ACTIVEEVENT) continue; if (event->active.state == SDL_APPINPUTFOCUS && event->active.gain) { resumeAudio(); return 1; } } } } return _r; }
// if audio use sdl-lib void suspendAudio() { SDL_CloseAudio(); _audioSuspended = true; }
int resumeAudio() { if (SDL_OpenAudio(&obtained, NULL) < 0){ return -1; } SDL_PauseAudio(0); _audioSuspended = false; return 0; } // if audio use sdl-mixer-lib void suspendAudio() { Mix_SuspendAudio(); }
int resumeAudio() { int r = Mix_ResumeAudio(); if(r == -1){ closeAudio(); return -1; } }
void closeAudio(void) { Mix_CloseAudio(); }
Check the examples (sound use sdl-lib) hheretic-0.2.0-1200-lubomyr.patch and hhexen-1.6.0-1200-lubomyr.patch (sound use sdlmixer-lib) More info to come...
Monitoring "Segmentation fault" problem
Download gdb and unpack to phone /mmc/mmca1/games folder
application must be compiled with prefix '-g' and must not be stripped
ulimit -c unlimited
./<app>
Segmentation fault (core dumped)
<core> file will be created
../bin/gdb ./<app> <core>
utility strace
../bin/strace ./app
updated 31.10.2009 enviroment moved to /opt/toolchains/motoezx
rebuilded sdl, sdl-mixer and more other lib(s) made english language fixes
To be continued...
|