joseluisjazz said:
Fabulous!
Could I ask you for the steps you made on setting up the environment? the configure commands, and environment variables needed for successfully cross-compiling? I'm trying to port some programs, but I'm still battling with the set up, specially with linking with the right libraries.
I had plan to write something, but I'm not good at this
First, I'm a debian/sid user for a long time but my coding skill are weak (I've written my first c code this week in more than 10 years...)
So when I find
cpasjuste guide I was quite pleased. He didn't document much because his stuff is obvious to use :
- copie the 3 files somewhere (I choosed ~/Projects/Pandora/setup)
- chmod 755 the 2 *.sh files
- run toolchain.sh and then pnd_libs.sh
Now you've a cross-compiling toolchain installed.
Now you need packaging scripts :
- a
script that will generate PXML.xml file for you
copy this script to : /usr/local/pandora/arm-2009q3/bin/genpxml with usual 755 file perm on it (toolchain.sh have added this to your PATH)
- a
script that create the pnd
copy this script to : /usr/local/pandora/arm-2009q3/bin/pnd_make with usual 755 file perm on it
you may need to tweak this one.
Finally, you'll need to set-up your target : sudo "mkdir -p /mnt/utmp;chown $USER /mnt/utmp"
I added this to my .bashrc too :
pndmake_auto(){
pnd_make -c -p ~/Projects/Pandora/PNDs/$1.pnd -d /mnt/utmp/$1 -i /mnt/utmp/$1/icon.png
}
Easy so far ?
Let's have a bit of shared knowledge :
/usr/local/pandora/arm-2009q3/bin/arm-none-linux-gnueabi-gcc is your compiler
libs are in : /usr/local/pandora/arm-2009q3/usr/lib
include : /usr/local/pandora/arm-2009q3/usr/include
Choose a simple package to port (I would recommand any SDL games that have no other deps), debian provide many of them at a little "apt-get source" away
I'll take lbreakout2 as example. But the others lgames should be as easy to port (easy, left some parts from that cake
).
Extract it to ~/Projects/Pandora, cd into it :
cd ~/Projects/Pandora/lbreakout2-2.6.1
Set up build variables :
export CPPFLAGS="-I/usr/local/pandora/arm-2009q3/usr/include" LDFLAGS="-L/usr/local/pandora/arm-2009q3/usr/lib -Wl,-rpath,/usr/local/pandora/arm-2009q3/usr/lib"
./configure --host=arm-none-linux-gnueabi --with-gnu-ld --with-sdl-prefix=/usr/local/pandora/arm-2009q3/usr --prefix=/mnt/utmp/lbreakout2
--host tell configure we are cross-compiling to target "arm-none-linux-gnueabi" (begining of our gcc binary)
As most code use predefined (at compile time) path for data-files, we set the prefix to where our pnd will be mounted on the system.
If you don't miss build dependencies on your system and in your target system (/usr/local/pandora/arm-2009q3/*) this should run fine
Now build and install (as a user, no sudo involved...) :
make install
Now build the PXML :
genpxml
Edit it to fit your needs (be sure to read
this before changing categories ; may want to remove the cpu-frenquency stuff) :
$EDITOR /mnt/utmp/lbreakout2/PXML.xml
Create an icon named /mnt/utmp/lbreakout2/icon.png
And finally build the pnd :
pndmake_auto lbreakout2
Test and enjoy your newly created games
Now, more advanced topic :
- when porting from debian, it's always a good idea to start with dpkg-buildpackage (even if this mean that you'll need to install all the build dependency on your x86 system) as you'll have debian patches applied and this will save you *hours* of hacking
- adding pandora control support :
this
thread is your friend. (don't forget that "sed -ibck" is your friend too)
- Missing a header in your target directory :
check that this lib is available on your pandora (opkg list-installed)
if so find
here your packages. add them to the library list, run pnd_lib.sh and make again
if not, you'll have to bundle that lib in your pnd (download its source, and install in the same prefix).
- Some libraries don't use standard include directory, let's have a look at my CPPFLAGS for audacious :
export CPPFLAGS="-I/usr/local/pandora/arm-2009q3/usr/include -I/usr/local/pandora/arm-2009q3/usr/include/gtk-2.0 -I/mnt/utmp/audacious/include -I/mnt/utmp/audacious/include/libmowgli -I/usr/local/pandora/arm-2009q3/usr/include/cairo -I/usr/local/pandora/arm-2009q3/usr/include/pango-1.0 -I/usr/local/pandora/arm-2009q3/usr/lib/gtk-2.0/include -I/usr/local/pandora/arm-2009q3/usr/include/atk-1.0 -I/usr/local/pandora/arm-2009q3/usr/include/glib-2.0 -I/usr/local/pandora/arm-2009q3/usr/lib/glib-2.0/include"
If you change this env variable, you'll need to reconfigure (as configure hard-code this in the Makefile)
- pkg_config don't find your package :
first be sure to use arm-none-linux-gnueabi-pkg-config
be sure that the *pc files are pointed out by PKG_CONFIG_PATH (ex : export PKG_CONFIG_PATH=/mnt/utmp/audacious/lib/pkgconfig)
- Save problem :
genpxml have already generated a script to set $HOME in the aufs fixing the nand write problem (which isn't one by the way...)
But some games save hiscores and such in a system wild allready existing file. This won't work because of an aufs bugs with FAT32.
To fix move these files in an other directory in /mnt/utmp/lbreakout2 and edit the launch script to copy them in the right place for the first run.
- Debugging on the pandy :
cd ~/Desktop
CMD=$(awk -F= '/Exec/{print $2}' lbreakout*desktop)
To mount your PND without executing it :
$CMD -m
Unmount with :
$CMD -u
pnd_run also generate a log in /tmp/
ready to see many new ports now