Active Topics

 


Reply
Thread Tools
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#1
Me being a Fedora person, the Debian orientation of everything from playing with the device to developing for it kind of killed my initial enthusiasm. But, as soon as I changed perspective and saw this as a challenge to stitch together my own development environment on my Fedora machine without the use of scratchbox or Ubuntu VMware images, things got better.

The result is a working toolchain with an x86 compiler that generates ARM code. Since this set-up is not for the faint of heart, I won't go into all the details since I butchered some of the Debian package mechanics just to get things to work, but I hope someone might find this interesting and experiment without feeling the need to use something just because you're told to.

The base of everything is the rootstrap that's available for download. There is an x86 and an ARM version and I installed them on my Fedora machine and my N900 respectively. Just from this you can chroot to it and play around with a working compiler.

Code:
chroot /path/to/rootstrap /bin/sh
This lets you compile applications on your N900, just like that, and I soon had my first "Hello world!" written to the XTerminal.

The rootstrap is very basic and leaves you with a /.dev directory thats empty so you need to at least create /dev/null.

Code:
mkdir /dev
mknod /dev/null c 1 3
This is all that is needed to get apt-get to fire up and work in your chroot:ed haven. If you're a tad more adventurous you can always mount the real /dev into the haven, from outside.

Code:
mount --bind /dev /path/to/rootstrap/dev
So, the rootstrap on my Fedora machine has an x86 compiler that generates x86 code. No fun. This is fixed by downloading the toolchain that's used by the Maemo 5 SDK. Since this arrives in a debian package, and I wasn't too sure how I'd use it, I used deb2targz to get to the yummy stuff and poured that into the rootstrap.

Now I need the contents of /lib and /usr/lib from my N900 to be able to link my applications and this is just a matter or copying from the device to my machine. The headers needed to compile are easily installed using apt-get.

Finally, the trickiest part, is to get the toolchain with its compiler and linker to work inside the chroot:ed haven. I tinkered a bit, got some suggestions from people and ended up with these variables in my Makefile:

Code:
TOOLCHAIN = /scratchbox/compilers/cs2007q3-glibc2.5-arm7

CC = ${TOOLCHAIN}/bin/arm-none-linux-gnueabi-gcc
LD = ${TOOLCHAIN}/bin/arm-none-linux-gnueabi-ld

TOOLCHAIN_LIBC = ${TOOLCHAIN}/arm-none-linux-gnueabi/libc
TOOLCHAIN_OBJS = ${TOOLCHAIN_LIBC}/usr/lib/crt1.o  ${TOOLCHAIN_LIBC}/usr/lib/crti.o ${TOOLCHAIN_LIBC}/usr/lib/crtn.o

LD_FLAGS = --dynamic-linker=/lib/ld-linux.so.3
LD_FLAGS += ${TOOLCHAIN_OBJS} -l:${TOOLCHAIN_LIBC}/usr/lib/libc.so
After that it's just a matter of writing the code in your favourite editor, update your Makefile and use make to build. Yay!

I'm sure I've overlooked some important step but this is how I remember it. Most things are solved either with Google, the nice people in #maemo-devel or just being curious.
 

The Following 4 Users Say Thank You to Joorin For This Useful Post:
Andre Klapper's Avatar
Posts: 1,665 | Thanked: 1,649 times | Joined on Jun 2008 @ Praha, Czech Republic
#2
Interesting. Anybody finding this might also be interested in http://talk.maemo.org/showthread.php?t=34924 for some info on Scratchbox on Fedora.
__________________
maemo.org Bugmaster
 

The Following User Says Thank You to Andre Klapper For This Useful Post:
Venemo's Avatar
Posts: 1,296 | Thanked: 1,773 times | Joined on Aug 2009 @ Budapest, Hungary
#3
This is very nice.
However, why did you bother?
Doesn't MADDE work with Fedora?
 

The Following User Says Thank You to Venemo For This Useful Post:
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#4
Originally Posted by Venemo View Post
This is very nice.
However, why did you bother?
Doesn't MADDE work with Fedora?
To explore and to learn, I'd say.

And after looking through the installer scripts that wanted me to disable SELinux, let the script modify my groups and, in general, boss me around and use magic to make things happen, almost any other solution felt more interesting.

I haven't looked at MADDE yet, in any environment, so I have no idea about its Fedora status.
 
Posts: 62 | Thanked: 97 times | Joined on Dec 2009 @ Finland, Kerava
#5
Originally Posted by Venemo View Post
This is very nice.
However, why did you bother?
Doesn't MADDE work with Fedora?
Yes it does. Most part of MADDE is developed at Fedore
 

The Following 2 Users Say Thank You to rontti For This Useful Post:
too's Avatar
Posts: 122 | Thanked: 135 times | Joined on Dec 2009 @ Helsinki
#6
And now you can build your own !

http://talk.maemo.org/showthread.php?p=628071
 
Posts: 62 | Thanked: 97 times | Joined on Dec 2009 @ Finland, Kerava
#7
 

The Following User Says Thank You to rontti For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 08:40.