Gentoo embedded

From ElphelWiki
Jump to: navigation, search

In order to get Embedded support somethings obviously need to be compiled. Now this is not yet going smoothly but I'll give some indication what can be done to fix it and where I am struggling.

Currently I have compiled a toolchain with gcc 4.3.1, uclibc-2008-09-06, a patch and patience. I am able to run code on the camera, if it is statically linked. Technically I could try to make a rootfs and see what happens. But currently I don't have the time to test that (and I don't want to break my cam before SoftwareFreedomDay.

Keep in mind that the 'native' cris memcpy.c is broken, I am positive I can get it into shape :) Please validate the code I write, I'm not an embedded professional :)

Howto do it

  • export USE="-iconv -nls -userlocales -fortran -mudflap -openmp nocxx minimal savedconfig"
  • crossdev --target crisv32-axis-linux-uclibc

However due to screwups in linux-headers you have to:

  • manually copy the linux kernel includes (gentoo has amnesia!)
  • symlink asm/arch-v32 to asm/arch
  • use the latest uclibc, patch it
  • use your own config of uclibc, for now disable platform specific strings
  • hope it works automatically, trust me it won't

In that case:

  • emerge crisv32-axis-linux-uclibc/gcc
  • emerge crisv32-axis-linux-uclibc/uclibc
  • emerge crisv32-axis-linux-uclibc/gcc

Output first tests

[1]

crisv32-axis-linux-uclibc-gcc --static -o /tmp/test2 /tmp/test2.c /mnt/dv/elphel/uClibc/lib/libpthread.a


[root@Elphel353 /mnt/flash/root/test]1157# ./test2 
Hello World from 0!
Hello World from 1!
Hello World from 2!
Hello World from 3!
Hello World from 4!


uclibc patch

--- libc/sysdeps/linux/cris/crti.S.orig 2008-09-06 23:51:14.017004350 +0200
+++ libc/sysdeps/linux/cris/crti.S      2008-09-06 23:54:28.477004350 +0200
@@ -10,8 +10,7 @@
        move    $srp,$r1
        subq    4,$sp
        move.d  $r0,[$sp]
-       move.d  $pc,$r0
-       sub.d   .:GOTOFF,$r0
+       lapc _GLOBAL_OFFSET_TABLE_,$r0
        .align  1
 
        .section        .fini
@@ -24,6 +23,5 @@
        move    $srp,$r1
        subq    4,$sp
        move.d  $r0,[$sp]
-       move.d  $pc,$r0
-       sub.d   .:GOTOFF,$r0
+       lapc _GLOBAL_OFFSET_TABLE_,$r0
       .align  1