關於我

我的相片

在此提供一些有關你的資訊,以便其他人確認你是他們要找的Fai。

2009/02/27

Loongson cross compile toolchain

To help compiling programs for Loongson CPU on my many x86 boxes, I need a cross compile toolchain.
In gentoo, it can be done by using crossdev program, first "emerge crossdev" and then "crossdev -t mips64el-unknown-linux-gnu --g 4.4.0_pre9999 --l 2.9_p20081201-r2 --k 2.6.27-r2"
This will build a cross compile toolchain on x86/amd64 boxes for cross compiling Loongson box (with the help of distcc). Problem occurs in the building of glibc, as the toolchain is built in the order:
binutils -> kernel-headers -> glibc -> gcc
But at the stage when it is going to compile glibc, it requires a compiler which supports the target architecture, it is not a problem if we just make for existing platforms, but for Loongson, it requires a latest gcc, which is not there yet.

Workaround is to skip some steps and rearrange the order of making, as described here.
http://forums.gentoo.org/viewtopic-p-5147128.html?sid=99c56c7a5b05b2bb66a08bbdbf548a46#5147128

Finally I got a distcc node with cross compiler for Loongson, running as a guest system under RHEL 5.3 :-)