blob: 5354aa0537dcf16b3bbc6d0d18e26f1ef5c742bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
[[!meta title="Crosscompilation"]]
* [BuildingCrossCompilers - Debian Wiki](http://wiki.debian.org/BuildingCrossCompilers).
* [EmdebianToolchain - Debian Wiki](http://wiki.debian.org/EmdebianToolchain).
* [EmDebian/CrossDebootstrap - Debian Wiki](http://wiki.debian.org/EmDebian/CrossDebootstrap).
* [QemuUserEmulation - Debian Wiki](http://wiki.debian.org/QemuUserEmulation).
* [software development - How do I build a GCC 4.7 toolchain for cross-compiling? - Raspberry Pi Stack Exchange](http://raspberrypi.stackexchange.com/questions/1/how-do-i-build-a-gcc-4-7-toolchain-for-cross-compiling).
* [ARM cross-compiling howto - K's cluttered loft](http://www.ailis.de/~k/archives/19-arm-cross-compiling-howto.html).
* [Debian ARM Cross-compile - Manuals](http://wiki.micromint.com/index.php/Debian_ARM_Cross-compile).
* [How to cross-compile Git for ARM?](http://stackoverflow.com/questions/15516168/how-to-cross-compile-git-for-arm).
* [Allow to compile with Debian/Ubuntu ARM toolchain · Issue #34 · libopencm3/libopencm3](https://github.com/libopencm3/libopencm3/issues/34).
## Configuração básica
(0) [20130426 13:37:57] vagrant@vagrant-debian-wheezy:~ $ cat /etc/apt/sources.list.d/emdebian.list
#
# -- Emdebian cross toolchains
#
# deb http://www.emdebian.org/debian/ unstable main
# deb http://www.emdebian.org/debian/ testing main
deb http://www.emdebian.org/debian wheezy main
(0) [20130426 13:38:12] vagrant@vagrant-debian-wheezy:~ $
(0) [20130426 13:38:12] vagrant@vagrant-debian-wheezy:~ $ cat /etc/apt/sources.list.d/squeeze.list
deb http://http.debian.net/debian/ squeeze main contrib non-free
deb-src http://http.debian.net/debian/ squeeze main contrib non-free
(0) [20130426 13:38:44] vagrant@vagrant-debian-wheezy:~ $
## Exemplo: git
Instalando as dependências do git:
xapt -a armel -m asciidoc comerr-dev cvs cvsps docbook-xml docbook-xsl krb5-multidev libapr1 libaprutil1 libcurl4-gnutls-dev libdbd-sqlite3-perl libdbi-perl libexpat1-dev libgcrypt11-dev libgnutls-dev libgnutls-openssl27 libgnutlsxx27 libgpg-error-dev libidn11-dev libkadm5clnt-mit8 libkadm5srv-mit8 libkdb5-6 libkrb5-dev libldap2-dev libneon27-gnutls libnet-daemon-perl libp11-kit-dev libplrpc-perl librtmp-dev libssh2-1-dev libsvn-perl libsvn1 libtasn1-3-dev libxml2-utils libxslt1.1 libyaml-perl pkg-config sgml-data subversion xmlto xsltproc zlib1g-dev libssl-dev
Tentando compilar com a [seguinte instrução](https://www.olimex.com/forum/index.php?topic=496.0):
./configure --build=arm --host=arm-linux-gnueabi
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi install prefix=$(pwd)/../destdir/
## Criando um toolchain
Primeiro, como `root`, vamos criar o chroot:
mkdir -p /var/chroot
debootstrap --verbose --arch armel --foreign wheezy /var/chroot/wheezy-armel http://ftp.debian.org/debian
cp /usr/bin/qemu-arm-static /var/chroot/wheezy-armel/usr/bin/
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
LC_ALL=C LANGUAGE=C LANG=C chroot /var/chroot/wheezy-armel /debootstrap/debootstrap --second-stage
Opcionalmente, dê permissão ao usuário comum:
chown -R vagrant. /var/chroot/wheezy-armel
Como usuário comum:
cd /var/chroot/wheezy-armel
sb2-init -n -m emulate -c /usr/bin/qemu-arm wheezy-armel "arm-linux-gnueabi-gcc"
## Referências
Script [provision-chroot](https://git.fluxo.info/hydra/tree/share/hydractl/provision-chroot).
* [Set up sb2 with armel debootstrap - maemo.org - Talk](http://talk.maemo.org/showthread.php?t=83713).
* [Installing scratchbox 1 and 2 for ARM cross-compilation | Felipe Contreras](https://felipec.wordpress.com/2009/06/07/installing-scratchbox-1-and-2-for-arm-cross-compilation/).
* [MobileRead Wiki - Boox M92 Development with Scratchbox2](http://wiki.mobileread.com/wiki/Boox_M92_Development_with_Scratchbox2).
* [Cross Compile environment using debootstrap and scratchbox2 | Rogerio Moraes](http://rogeriomoraes.com/wp/?p=41).
* [Using scratchbox2 and Ubuntu 11.10 | Hamilton Vera](https://hvera.wordpress.com/2011/12/07/using-scratchbox2/).
* [Setting up Scratchbox2 to build software for zubuntu « Executing Gummiworms](http://russelldavis.org/2010/10/20/setting-up-scratchbox2-to-build-software-for-zubuntu/).
## Problemas encontrados
* [debootstrap --second-stage fails because of /dev/ mapping](http://comments.gmane.org/gmane.comp.compilers.scratchbox.user/1420).
|