maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Maemo 5 development without scratchbox (https://talk.maemo.org/showthread.php?t=50693)

Joorin 2010-04-21 21:35

Maemo 5 development without scratchbox
 
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.

Andre Klapper 2010-04-21 21:43

Re: Maemo 5 development without scratchbox
 
Interesting. Anybody finding this might also be interested in http://talk.maemo.org/showthread.php?t=34924 for some info on Scratchbox on Fedora.

Venemo 2010-04-21 21:52

Re: Maemo 5 development without scratchbox
 
This is very nice.
However, why did you bother?
Doesn't MADDE work with Fedora?

Joorin 2010-04-21 22:00

Re: Maemo 5 development without scratchbox
 
Quote:

Originally Posted by Venemo (Post 621631)
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.

rontti 2010-04-22 06:46

Re: Maemo 5 development without scratchbox
 
Quote:

Originally Posted by Venemo (Post 621631)
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 :)

too 2010-04-28 06:50

Re: Maemo 5 development without scratchbox
 
And now you can build your own !

http://talk.maemo.org/showthread.php?p=628071

rontti 2010-04-28 07:34

Re: Maemo 5 development without scratchbox
 
Try this one

http://www.forum.nokia.com/Tools_Doc.../Nokia_Qt_SDK/


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

vBulletin® Version 3.8.8