Lines 152-175
Link Here
|
152 |
</p> |
152 |
</p> |
153 |
|
153 |
|
154 |
<pre caption="Using SH4 cross-compiler"> |
154 |
<pre caption="Using SH4 cross-compiler"> |
155 |
$ <i>sh4-unknown-linux-gnu-gcc --version</i> |
155 |
# <i>sh4-unknown-linux-gnu-gcc --version</i> |
156 |
sh4-unknown-linux-gnu-gcc (GCC) 4.2.0 (Gentoo 4.2.0 p1.4) |
156 |
sh4-unknown-linux-gnu-gcc (GCC) 4.2.0 (Gentoo 4.2.0 p1.4) |
157 |
Copyright (C) 2007 Free Software Foundation, Inc. |
157 |
Copyright (C) 2007 Free Software Foundation, Inc. |
158 |
This is free software; see the source for copying conditions. There is NO |
158 |
This is free software; see the source for copying conditions. There is NO |
159 |
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
159 |
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
160 |
$ <i>echo 'int main(){return 0;}' > sh4-test.c</i> |
160 |
# <i>echo 'int main(){return 0;}' > sh4-test.c</i> |
161 |
$ <i>sh4-unknown-linux-gnu-gcc -Wall sh4-test.c -o sh4-test</i> |
161 |
# <i>sh4-unknown-linux-gnu-gcc -Wall sh4-test.c -o sh4-test</i> |
162 |
$ <i>file sh4-test</i> |
162 |
# <i>file sh4-test</i> |
163 |
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 |
163 |
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 |
164 |
</pre> |
164 |
</pre> |
165 |
|
165 |
|
166 |
<p> |
166 |
<p> |
167 |
If the crossdev command failed, you have the log file which you can review to |
167 |
If the crossdev command failed, you are told the log file which you can review to |
168 |
see if the problem is local. If you're unable to fix the issue, you're welcome |
168 |
see if the problem is local. If you're unable to fix the issue, you're welcome |
169 |
to file a bug in our bugzilla. See the <uri |
169 |
to file a bug in our bugzilla. See the <uri |
170 |
link="communication.xml">Communication page</uri> for more information. |
170 |
link="communication.xml">Communication page</uri> for more information. |
171 |
</p> |
171 |
</p> |
172 |
|
172 |
|
|
|
173 |
<p> |
174 |
To find out which tuple you should use, look over the output from the following |
175 |
command: |
176 |
</p> |
177 |
|
178 |
<pre caption="crossdev Tuples"> |
179 |
# <i>crossdev -t help</i> |
180 |
</pre> |
181 |
|
182 |
<p> |
183 |
You can now find a newly compiled cross-compiler in the sysroot at |
184 |
<path>/usr/CTARGET/</path>. It's a good idea to create pre-built binary packages |
185 |
so you don't end up waiting another two to three hours every time you want to |
186 |
reinstall this toolchain. |
187 |
</p> |
188 |
|
189 |
<pre caption="Create binpkgs"> |
190 |
# <i>quickpkg --include-unmodified-config=y cross-sh4-unknown-linux-gnu/gcc</i> |
191 |
# <i>quickpkg --include-unmodified-config=y cross-sh4-unknown-linux-gnu/glibc</i> |
192 |
# <i>quickpkg --include-unmodified-config=y cross-sh4-unknown-linux-gnu/binutils</i> |
193 |
# <i>quickpkg --include-unmodified-config=y cross-sh4-unknown-linux-gnu/linux-headers</i> |
194 |
</pre> |
195 |
|
196 |
<note> |
197 |
If quickpkg warns you about excluded files, please follow its prompts to include |
198 |
all files. |
199 |
</note> |
200 |
|
201 |
<p> |
202 |
In the future you can reinstall your sysroot by executing the following simple |
203 |
portage command: |
204 |
</p> |
205 |
|
206 |
<pre caption="Emerge binpkgs"> |
207 |
# <i>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</i> |
208 |
</pre> |
209 |
|
173 |
</body> |
210 |
</body> |
174 |
</subsection> |
211 |
</subsection> |
175 |
|
212 |
|
Lines 179-186
Link Here
|
179 |
|
216 |
|
180 |
<p> |
217 |
<p> |
181 |
To uninstall a toolchain, simply use the <c>--clean</c> option. If you modified |
218 |
To uninstall a toolchain, simply use the <c>--clean</c> option. If you modified |
182 |
the sysroot by hand, you'll be prompted to delete things inside of it, so you |
219 |
the sysroot by hand, you'll be prompted to delete every file inside, so you will |
183 |
may want to pipe <c>yes |</c> into the command. |
220 |
want to prepend <c>yes |</c> to this command <b>if</b> you are sure. |
184 |
</p> |
221 |
</p> |
185 |
|
222 |
|
186 |
<pre caption="Uninstalling cross-compiler"> |
223 |
<pre caption="Uninstalling cross-compiler"> |
Lines 194-210
Link Here
|
194 |
|
231 |
|
195 |
</body> |
232 |
</body> |
196 |
</subsection> |
233 |
</subsection> |
197 |
<subsection> |
|
|
198 |
<title>Options</title> |
199 |
<body> |
200 |
|
201 |
<p> |
202 |
Obviously crossdev can do a lot more, so to find out more, simply run |
203 |
<c>crossdev --help</c>. |
204 |
</p> |
205 |
|
206 |
</body> |
207 |
</subsection> |
208 |
</section> |
234 |
</section> |
209 |
|
235 |
|
210 |
<section> |
236 |
<section> |
Lines 220-235
Link Here
|
220 |
meant to cover/document/whatever the myriad of build failures you are likely |
246 |
meant to cover/document/whatever the myriad of build failures you are likely |
221 |
to see along the way. If you need such help, see the |
247 |
to see along the way. If you need such help, see the |
222 |
<uri link="the-more-you-know.xml">Beyond section</uri> in the handbook for |
248 |
<uri link="the-more-you-know.xml">Beyond section</uri> in the handbook for |
223 |
some pointers. You certainly should not bug me or anyone else in Gentoo. |
249 |
some pointers. |
224 |
</warn> |
250 |
</warn> |
225 |
|
251 |
|
226 |
<warn> |
252 |
<warn> |
|
|
253 |
Let's be very clear: we do <b>not</b> support toolchains which are built by hand! |
254 |
</warn> |
255 |
|
256 |
<note> |
227 |
If you're still reading, you should really check out the crosstool project |
257 |
If you're still reading, you should really check out the crosstool project |
228 |
(refer to the <uri link="the-more-you-know.xml">Beyond section</uri>) as |
258 |
(refer to the <uri link="the-more-you-know.xml">Beyond section</uri>) as |
229 |
that provides a distribution independent method for generating cross-compilers. |
259 |
that provides a distribution independent method for generating cross-compilers. |
230 |
While it does kind of suck (imo), it is certainly the best (and really only) |
260 |
While it does kind of suck (imo), it is certainly the best (and really only) |
231 |
option out there for creating cross-compilers. |
261 |
option out there for creating cross-compilers. |
232 |
</warn> |
262 |
</note> |
233 |
</body> |
263 |
</body> |
234 |
</subsection> |
264 |
</subsection> |
235 |
|
265 |
|
Lines 349-361
Link Here
|
349 |
</p> |
379 |
</p> |
350 |
|
380 |
|
351 |
<pre caption="configure and build binutils"> |
381 |
<pre caption="configure and build binutils"> |
352 |
$ <i>./configure \ |
382 |
# <i>./configure \ |
353 |
--target=$CTARGET \ |
383 |
--target=$CTARGET \ |
354 |
--prefix=/usr \ |
384 |
--prefix=/usr \ |
355 |
--with-sysroot=/usr/$CTARGET \ |
385 |
--with-sysroot=/usr/$CTARGET \ |
356 |
--disable-werror</i> |
386 |
--disable-werror</i> |
357 |
$ <i>make</i> |
387 |
# <i>make</i> |
358 |
$ <i>make install DESTDIR=$PWD/install-root</i> |
388 |
# <i>make install DESTDIR=$PWD/install-root</i> |
359 |
</pre> |
389 |
</pre> |
360 |
|
390 |
|
361 |
<p> |
391 |
<p> |
Lines 366-372
Link Here
|
366 |
</p> |
396 |
</p> |
367 |
|
397 |
|
368 |
<pre caption="cleaning binutils"> |
398 |
<pre caption="cleaning binutils"> |
369 |
$ <i>rm -rf install-root/usr/{info,lib,man,share}</i> |
399 |
# <i>rm -rf install-root/usr/{info,lib,man,share}</i> |
370 |
</pre> |
400 |
</pre> |
371 |
|
401 |
|
372 |
<p> |
402 |
<p> |
Lines 395-401
Link Here
|
395 |
</note> |
425 |
</note> |
396 |
|
426 |
|
397 |
<pre caption="building/installing unsanitized headers"> |
427 |
<pre caption="building/installing unsanitized headers"> |
398 |
$ <i>yes "" | make ARCH=$ARCH oldconfig prepare</i> |
428 |
# <i>yes "" | make ARCH=$ARCH oldconfig prepare</i> |
399 |
# <i>mkdir -p /usr/$CTARGET/usr/include</i> |
429 |
# <i>mkdir -p /usr/$CTARGET/usr/include</i> |
400 |
# <i>cp -a include/linux include/asm-generic /usr/$CTARGET/usr/include/</i> |
430 |
# <i>cp -a include/linux include/asm-generic /usr/$CTARGET/usr/include/</i> |
401 |
# <i>cp -a include/asm-$ARCH /usr/$CTARGET/usr/include/asm</i> |
431 |
# <i>cp -a include/asm-$ARCH /usr/$CTARGET/usr/include/asm</i> |
Lines 416-424
Link Here
|
416 |
</p> |
446 |
</p> |
417 |
|
447 |
|
418 |
<pre caption="building/installing glibc headers"> |
448 |
<pre caption="building/installing glibc headers"> |
419 |
$ <i>mkdir build</i> |
449 |
# <i>mkdir build</i> |
420 |
$ <i>cd build</i> |
450 |
# <i>cd build</i> |
421 |
$ <i>../configure \ |
451 |
# <i>../configure \ |
422 |
--host=$CTARGET \ |
452 |
--host=$CTARGET \ |
423 |
--prefix=/usr \ |
453 |
--prefix=/usr \ |
424 |
--with-headers=/usr/$CTARGET/usr/include \ |
454 |
--with-headers=/usr/$CTARGET/usr/include \ |
Lines 455-463
Link Here
|
455 |
</p> |
485 |
</p> |
456 |
|
486 |
|
457 |
<pre caption="building gcc stage 1"> |
487 |
<pre caption="building gcc stage 1"> |
458 |
$ <i>mkdir build</i> |
488 |
# <i>mkdir build</i> |
459 |
$ <i>cd build</i> |
489 |
# <i>cd build</i> |
460 |
$ <i>../configure \ |
490 |
# <i>../configure \ |
461 |
--target=$CTARGET \ |
491 |
--target=$CTARGET \ |
462 |
--prefix=/usr \ |
492 |
--prefix=/usr \ |
463 |
--with-sysroot=/usr/$CTARGET \ |
493 |
--with-sysroot=/usr/$CTARGET \ |
Lines 468-475
Link Here
|
468 |
--disable-libmudflap \ |
498 |
--disable-libmudflap \ |
469 |
--disable-libssp \ |
499 |
--disable-libssp \ |
470 |
--disable-libgomp</i> |
500 |
--disable-libgomp</i> |
471 |
$ <i>make</i> |
501 |
# <i>make</i> |
472 |
$ <i>make install DESTDIR=$PWD/install-root</i> |
502 |
# <i>make install DESTDIR=$PWD/install-root</i> |
473 |
</pre> |
503 |
</pre> |
474 |
|
504 |
|
475 |
<p> |
505 |
<p> |
Lines 477-483
Link Here
|
477 |
</p> |
507 |
</p> |
478 |
|
508 |
|
479 |
<pre caption="cleaning gcc stage 1"> |
509 |
<pre caption="cleaning gcc stage 1"> |
480 |
$ <i>rm -rf install-root/usr/{info,include,lib/libiberty.a,man,share}</i> |
510 |
# <i>rm -rf install-root/usr/{info,include,lib/libiberty.a,man,share}</i> |
481 |
</pre> |
511 |
</pre> |
482 |
|
512 |
|
483 |
<p> |
513 |
<p> |
Lines 499-512
Link Here
|
499 |
</p> |
529 |
</p> |
500 |
|
530 |
|
501 |
<pre caption="building/installing glibc"> |
531 |
<pre caption="building/installing glibc"> |
502 |
$ <i>rm -rf build</i> |
532 |
# <i>rm -rf build</i> |
503 |
$ <i>mkdir build</i> |
533 |
# <i>mkdir build</i> |
504 |
$ <i>cd build</i> |
534 |
# <i>cd build</i> |
505 |
$ <i>../configure \ |
535 |
# <i>../configure \ |
506 |
--host=$CTARGET \ |
536 |
--host=$CTARGET \ |
507 |
--prefix=/usr \ |
537 |
--prefix=/usr \ |
508 |
--without-cvs</i> |
538 |
--without-cvs</i> |
509 |
$ <i>make</i> |
539 |
# <i>make</i> |
510 |
# <i>make install install_root=/usr/$CTARGET</i> |
540 |
# <i>make install install_root=/usr/$CTARGET</i> |
511 |
</pre> |
541 |
</pre> |
512 |
</body> |
542 |
</body> |
Lines 521-527
Link Here
|
521 |
</p> |
551 |
</p> |
522 |
|
552 |
|
523 |
<pre caption="building/installing gcc stage 2"> |
553 |
<pre caption="building/installing gcc stage 2"> |
524 |
$ <i>./configure \ |
554 |
# <i>./configure \ |
525 |
--target=$CTARGET \ |
555 |
--target=$CTARGET \ |
526 |
--prefix=/usr \ |
556 |
--prefix=/usr \ |
527 |
--with-sysroot=/usr/$CTARGET \ |
557 |
--with-sysroot=/usr/$CTARGET \ |
Lines 529-535
Link Here
|
529 |
--enable-shared \ |
559 |
--enable-shared \ |
530 |
--disable-checking \ |
560 |
--disable-checking \ |
531 |
--disable-werror</i> |
561 |
--disable-werror</i> |
532 |
$ <i>make</i> |
562 |
# <i>make</i> |
533 |
# <i>make install</i> |
563 |
# <i>make install</i> |
534 |
</pre> |
564 |
</pre> |
535 |
</body> |
565 |
</body> |