Cross Toolchain on Gentoo Prefix
Introduction
- Gentoo Prefix is ideal as a secondary package management system.
- With Gentoo portage, a tool called crossdev is available. Crossdev is actually a shell script to prepare portage for building cross compilation toolchain.
Tutorial: Starting from gcc-4.1
We are going to build a toolchain for powerpc-unknown-linux-gnu.
- Make a new category called cross-powerpc-unknown-linux-gnu in PORTDIR_OVERLAY.
- Create a soft link of binutils, gcc, linux-headers and glibc from Gentoo portage tree to inside cross-powerpc-unknown-linux-gnu.
- glibc is not in Gentoo Prefix portage tree. Copy it from gentoo x86 with ecopy and also manually copy files/ebilts from gentoo-x86. Then make glibc Prefix compatable by replacing ${D} with ${ED} in files/ebilts/src_install.eblit.
- Add cross-powerpc-unknown-linux-gnu in ${EROOT}/etc/portage/categories.
- emerge cross-powerpc-unknown-linux-gnu/linux-headers.
- emerge cross-powerpc-unknown-linux-gnu/gcc-4.1with only "nocxx" USE.
- emerge cross-powerpc-unknown-linux-gnu/glibcwith no USE set. (optional, USE=crosscompile_opts_headers-only)
- emerge cross-powerpc-unknown-linux-gnu/gcc with the latest version.
- emerge cross-powerpc-unknown-linux-gnu/glibc, again.
Tutorial: Starting from gcc-4.7
We are going to build a toolchain for armv7a-hardfloat-linux-gnueabi.
- Make a new category called cross-armv7a-hardfloat-linux-gnueabi in PORTDIR_OVERLAY.
- Create a soft link of binutils, gcc, linux-headers and glibc from Gentoo portage tree to inside cross-armv7a-hardfloat-linux-gnueabi.
- glibc is not in Gentoo Prefix portage tree. Copy it from gentoo x86 with ecopy and also manually copy files/ebilts from gentoo-x86. Then make glibc Prefix compatable by replacing ${D} with ${ED} in files/ebilts/src_install.eblit.
- Add armv7a-hardfloat-linux-gnueabi in ${EPREFIX}/etc/portage/categories.
- emerge cross-armv7a-hardfloat-linux-gnueabi/linux-headers.
- env USE=crosscompile_opts_headers-only emerge cross-armv7a-hardfloat-linux-gnueabi/glibc
- put
cross-armv7a-hardfloat-linux-gnueabi/gcc -boundschecking -d -gtk -gcj -libffi -mudflap -objc -objc++ -objc-gc
into ${EPREFIX}/etc/portage/package.use
- env USE="-* nocxx" emerge cross-armv7a-hardfloat-linux-gnueabi/gcc. It will pull in binutils.
- emerge cross-armv7a-hardfloat-linux-gnueabi/glibc, again.
- emerge cross-armv7a-hardfloat-linux-gnueabi/gcc, again.
Last modified: Thu Mar 14 08:04:18 JST 2013