vimwiki/tech/cross_toolchain.wiki

47 lines
1.7 KiB
Plaintext
Raw Normal View History

2021-10-11 03:22:53 +00:00
= Cross Toolchain =
Setting up the tool chain involves getting a compiler for a different
architechure compiled on your machine. With gentoo its pretty straight forward,
and thats what this are instructions for. This example uses avr, but can be
subsititued for arm if needbe
== Cross-compiler toolchain ==
Here is how to get the cross compiler toolchain setup, at least on gentoo
1) emerge sys-devel/crossdev
- Gentoo package for crossdev tools
2) mkdir -p /var/db/repos/portage-crossdev/{profiles,metadata} && echo 'crossdev'
> /var/db/repos/portage-crossdev/profiles/repo_name && echo 'masters =
gentoo' > /var/db/repos/portage-crossdev/metadata/layout.conf && chown -R
portage:portage /var/db/repos/portage-crossdev
- All of this sets up a local portage repo, for compiling tools for other
systems
3) have portage and crossdev use this new repo \
{{{
#/etc/portage/repos.conf/crossdev.conf
[crossdev]
location = /var/db/repos/portage-crossdev
priority = 10
masters = gentoo
auto-sync = no
}}}
- This tells portage about crossdev and that packages can be in it, but not
to try and update them with out our permission
4) Add the following to a new file
{{{
#/etc/portage/profile/package.use.force/avr-STRING_HERE
cross-avr/gcc -pie -pic
}}}
5) crossdev -s4 --stable --portage --verbose --target avr
- s4 means to build everything from binutils to a full compiler
- stable means to use latest stable versions
- portage tells what flas to pass to emerge
- target specifies our target, the avr arch.
- *For arm specificy arm, this also includes other things like pis*
6) If any errors are thrown, follow them and try again. Common errors include
- make package.mask a directory
[[index]]