Version 4 (modified by 12 years ago) (diff) | ,
---|
Cross-compiling Synapse for raspberry (ARM) and other architectures
This is a quick howto on how i cross compiled synapse for the raspberrypi, using qemu to emulate the arm cpu architecture. This is the least tricky methode to cross compile, but also the slowest.
I used arch linux on my host system and debian on the rasp.
Learn your host system how to handle arm binaries
1. Steal a statically compiled qemu-arm from some distro:
its a shame archlinux doesnt have a static qemu :(
[root@lab1 tmp]# cd /tmp [root@lab1 tmp]# mkdir qemu [root@lab1 tmp]# cd qemu [root@lab1 qemu]# dpkg -x /home/psy/Downloads/qemu-user-static_1.1.2+dfsg-2_amd64.deb . [root@lab1 qemu]# cp usr/bin/qemu-*-static /usr/bin
2. learn your kernel how to handle arm binaries
[root@lab1 binfmts]# cat /usr/share/binfmts/qemu-arm package qemu interpreter /usr/bin/qemu-arm-static magic \x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00 mask \xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff [root@lab1 binfmts]# update-binfmts --import
Set up the build environment
1. copy the rootfilesystem from your raspberry
We just copy the whole rootfs, so we have an exact copy of the environment we want to cross compile for:
[root@lab1 psy]# rsync -ax root@192.168.13.238:/ rasprootfs root@192.168.13.238's password: ....
2. entering the build environment
The only thing you have to do to be able to enter the environent is copy qemu-arm-static into it:
[root@lab1 psy]# cp /usr/bin/qemu-arm-static rasprootfs/usr/bin/ [root@lab1 psy]# chroot rasprootfs/ root@lab1:/# uname -a Linux lab1 3.6.5-1-ARCH #1 SMP PREEMPT Wed Oct 31 20:57:39 CET 2012 armv7l GNU/Linux }}}} w000h...now we can chroot to the local raspberry environment and start to compile stuff!