1 |
On Tuesday 22 January 2008, Mike Auty wrote: |
2 |
> I've got some existing code for tying python to some system libraries, |
3 |
> and I was hoping to port it onto an embedded device, specifically an |
4 |
> ipod. I've managed to source myself three old ipods (one 3rd Gen |
5 |
> and two 4th gen). I've got ipodlinux happily running on one of them, |
6 |
> installed python, rebuilt the kernel using ipodlinux's pre-packaged |
7 |
> toolchain (which they seem to call arm-uclinux-elf/arm-elf). |
8 |
> |
9 |
> I went to build the system libraries I needed and noticed the toolchain |
10 |
> didn't seem able to support shared objects, and hence the python |
11 |
> C-extension modules probably wouldn't compile either. Attempting to |
12 |
> compile python natively also failed, so building the extension right in |
13 |
> to python looks difficult. |
14 |
|
15 |
i'm pretty sure the ipod lacks an mmu which means you can only use FLAT |
16 |
binaries. which means no shared libraries. the arm-elf toolchain is to |
17 |
build up code that will run without an operating system (like the kernel or a |
18 |
bootloader or a standalone app) while the arm-uclinux toolchain is used to |
19 |
build FLAT binaries which will run under Linux (with the mmu disabled). |
20 |
|
21 |
what this means is that you only get static libraries and when producing the |
22 |
final executable, you have to link with -elf2flt which will produce a FLAT |
23 |
binary from the statically linked ELF. |
24 |
|
25 |
you can test this theory by making a simple hello world app: |
26 |
$ cat <<EOF > hello.c |
27 |
#include <stdio.h> |
28 |
int main(){printf("hello\n");} |
29 |
EOF |
30 |
$ arm-uclinux-elf-gcc hello.c -elf2flt -o hello |
31 |
|
32 |
now get the "hello" binary onto the target and run it ... if it runs, it means |
33 |
what i said above is true. |
34 |
|
35 |
ive run python on a Blackfin as FLAT, but no dynamic extensions obviously. |
36 |
|
37 |
> So, I started investigating building the toolchain on Gentoo using |
38 |
> crossdev. So far I've successfully built arm-elf, but ipodlinux seems |
39 |
> to mention uclinux a lot and I haven't been able to build an |
40 |
> arm-unknown-uclinux target successfully. Also, there seemed to be a few |
41 |
> posts about the gentoo arm-elf toolchain not supporting elf2flt (which |
42 |
> seemed necessary to reuse any existing ipodlinux applications). I'm |
43 |
> also not certain if the arm-elf toolchain built on gentoo will let me |
44 |
> build shared objects or not. |
45 |
|
46 |
by default, elf2flt is not enabled in any toolchain. it's trivial to add: |
47 |
- roll a snapshot of the upstream elf2flt cvs |
48 |
- set ELF2FLT_VER in the binutils ebuild |
49 |
but i dont have any toolchains integrated into Gentoo where i care about FLAT |
50 |
binaries, so i havent done any work beyond the infrastructure |
51 |
-mike |