From 8e14f0a4425ac86f25429ce2c474c5ecf6b61f86 Mon Sep 17 00:00:00 2001 From: Jacob Godserv Date: Wed, 20 Jan 2010 21:02:06 -0500 Subject: [PATCH 5/9] Lots of cleanups and additions for cross-compiler.xml --- .../en/base/embedded/handbook/cross-compiler.xml | 106 +++++++++++++++----- 1 files changed, 81 insertions(+), 25 deletions(-) diff --git a/xml/htdocs/proj/en/base/embedded/handbook/cross-compiler.xml b/xml/htdocs/proj/en/base/embedded/handbook/cross-compiler.xml index f3ef99a..a3a9a88 100644 --- a/xml/htdocs/proj/en/base/embedded/handbook/cross-compiler.xml +++ b/xml/htdocs/proj/en/base/embedded/handbook/cross-compiler.xml @@ -47,19 +47,43 @@ stage3 chroot. (This is the same chroot you used to install Gentoo.)
-crossdev +Compiling a Cross-Compiler - Intro + crossdev

Generating a cross-compiler by hand was a long and painful process. This is why it has been fully integrated into Gentoo! Our frontend called - crossdev (which you can install with emerge crossdev) will - run emerge with all of the proper environment variables and install - all the right packages to generate arbitrary cross-compilers based on your - needs. + crossdev will run emerge with all of the proper environment + variables and install all the right packages to generate arbitrary + cross-compilers based on your needs. Install crossdev now if you haven't: +

+# emerge crossdev
+
+ +Be sure to install the ~keyworded version of crossdev for all the latest fixes. + + +If you are upgrading from an older version of crossdev, and have crossdev-wrappers +installed, please uninstall crossdev-wrappers first. All your existing cross-toolchains +will remain intact. + +

+

+ We only cover the basic usage of crossdev here, but crossdev can customize + the process fairly well for most needs. Execute the following command to + get more information about crossdev usage: +

+# crossdev --help
+
+ Here are some examples with some of the most useful options: +
+# crossdev --g [gcc version] --l [(g)libc version] --b [binutils version] --k [kernel headers version] -P -v -t [tuple] # use specific versions
+# crossdev -S -P -v -t [tuple] # use stable only
+

+
@@ -110,6 +134,42 @@ stage3 chroot. (This is the same chroot you used to install Gentoo.) temporarily change your profile. +

+ To find out which tuple you should use, look over the output from the + following command: +

+
+# crossdev -t help
+
+ +

+ When you are done (after a few hours), you find a newly compiled cross-compiler + in the sysroot at /usr/CTARGET/. We highly recommend you + package this up so you don't end up waiting another two to three hours + every time you mess up your sysroot and need to reinstall. +

+ +
+# quickpkg --include-unmodified-config=y cross-sh4-unknown-linux-gnu/gcc
+# quickpkg --include-unmodified-config=y cross-sh4-unknown-linux-gnu/glibc
+# quickpkg --include-unmodified-config=y cross-sh4-unknown-linux-gnu/binutils
+# quickpkg --include-unmodified-config=y cross-sh4-unknown-linux-gnu/linux-headers
+
+ + + If quickpkg warns you about excluded files, please follow its prompts + to include all files. + + +

+ In the future you can reinstall your sysroot by executing the following + simple portage command: +

+ +
+# emerge -k cross-sh4-unknown-linux-gnu/gcc cross-sh4-unknown-linux-gnu/glibc cross-sh4-unknown-linux-gnu/binutils cross-sh4-unknown-linux-gnu/linux-headers
+
+ @@ -117,23 +177,23 @@ stage3 chroot. (This is the same chroot you used to install Gentoo.)

If everything goes as planned, you should have a shiny new compiler on your - machine. Give it a spin! + machine. Give it a spin!

-$ sh4-unknown-linux-gnu-gcc --version
+# sh4-unknown-linux-gnu-gcc --version
 sh4-unknown-linux-gnu-gcc (GCC) 4.2.0 (Gentoo 4.2.0 p1.4)
 Copyright (C) 2007 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-$ echo 'int main(){return 0;}' > sh4-test.c
-$ sh4-unknown-linux-gnu-gcc -Wall sh4-test.c -o sh4-test
-$ file sh4-test
+# echo 'int main(){return 0;}' > sh4-test.c
+# sh4-unknown-linux-gnu-gcc -Wall sh4-test.c -o sh4-test
+# file sh4-test
 sh4-test: ELF 32-bit LSB executable, Renesas SH, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), not stripped
 

- If the crossdev command failed, you have the log file which you can review + If the crossdev command failed, you are told the log file which you can review to see if the problem is local. If you're unable to fix the issue, you're welcome to file a bug in our bugzilla. See the Communication page for more information. @@ -146,8 +206,9 @@ sh4-test: ELF 32-bit LSB executable, Renesas SH, version 1 (SYSV), for GNU/Linux

To uninstall a toolchain, simply use the --clean option. If you - modified the sysroot by hand, you'll be prompted to delete things inside - of it, so you may want to pipe yes | into the command. + modified the sysroot by hand, you'll be prompted to delete every file + inside, so you will want to prepend yes | to this command if + you are sure.

@@ -162,15 +223,6 @@ sh4-test: ELF 32-bit LSB executable, Renesas SH, version 1 (SYSV), for GNU/Linux
 	
 	
 
-	
-	Options
-	
-	

- Obviously crossdev can do a lot more, so to find out more, simply run - crossdev --help. -

- -
@@ -186,16 +238,20 @@ binutils/(glibc|uclibc)/gcc all by themselves. This section is not meant to cover/document/whatever the myriad of build failures you are likely to see along the way. If you need such help, see the Beyond section in the handbook for -some pointers. You certainly should not bug me or anyone else in Gentoo. +some pointers. +Let's be very clear: we do not support toolchains which are built by hand! + + + If you're still reading, you should really check out the crosstool project (refer to the Beyond section) as that provides a distribution independent method for generating cross-compilers. While it does kind of suck (imo), it is certainly the best (and really only) option out there for creating cross-compilers. - + -- 1.6.4.4