Porting Guide for Motorola Z6, V8, E8, EM30, U9, ZN5 (Motomagx)
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 motomagx-toolchain.tar.gz, megaupload-mirror and unpack it to a linux shared folder
Install enviroment:
run 'Konsole' under andlinux
Input:
sudo mkdir /mmc sudo chown user -R /opt sudo chown user -R /home sudo chown user -R /mmc mkdir /opt/toolchains mkdir /home/z6 mkdir /home/z6/build mkdir /mmc/mmca1 tar -C /opt/toolchains -xzvf /mnt/win/motomagx-toolchain.tar.gz cp /opt/toolchains/motomagx/setenv-z6.sh /home/z6 cp /opt/toolchains/motomagx/setenv-z6-2.sh /home/z6
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/z6 . setenv-z6.sh
download any source for example newvox 1.0 extract to /home/z6
cd /home/z6 tar -xzvf /mnt/win/newvox-1.0.tar.gz
cd newvox-1.0
Configure it for your MotoLinux OS
./configure --host=arm-linux-gnueabi
Compile the application
make
newvox-z6.log.txt newvox-z6.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/.system/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-gnueabi-gcc cc=gcc ---> CC=arm-linux-gnueabi-gcc cxx=g++ ---> CXX=arm-linux-gnueabi-g++ ld=ld ---> LD=arm-linux-gnueabi-ld ar=ar ---> AR=arm-linux-gnueabi-ar as=as---> AS=arm-linux-gnueabi-as oc=oc ---> OC=arm-linux-gnueabi-objcopy ranlib=ranlib ---> RANLIB=arm-linux-gnueabi-ranlib strip=strip ---> STRIP=arm-linux-gnueabi-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
To be continued...
|