2011-03-16 94 views
1

我想交叉編譯powerpc的內核。我已經嘗試在x86_64 Ubuntu 10.04和i386 Debian Lenny上做這件事,並且我遇到了完全相同的問題。我按照說明在http://wiki.debian.org/BuildingCrossCompilers,當我試圖通過給下面的命令來構建的binutils:在debian上構建交叉編譯器時出錯

fakeroot debian/rules binary-cross 

我得到這樣的結果:

[snip] 
make[3]: Entering directory `/home/anthony/cross-toolchain/binutils-2.20.1/builddir-powerpc-linux-gnu/libiberty' 
if [ x"-fpic" != x ]; then \ 
gcc -c -DHAVE_CONFIG_H -g -O2 -Wno-format-security -I. -I../../libiberty/../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic -fpic ../../libiberty/regex.c -o pic/regex.o; \ 
else true; fi 
In file included from /usr/include/stdlib.h:320, 
from ../../libiberty/regex.c:128: 
/usr/include/sys/types.h:100: error: two or more data types in declaration specifiers 
make[3]: *** [regex.o] Error 1 
[snip] 

(這是因爲types.h中嘗試的typedef然而,它已經被定義爲int了,如果我在types.h中通過#undef pid_t來解決這個問題,那麼在intptr_t的其他地方我會遇到類似的問題,等等等等。)

回答

0

If你所需要做的就是交叉編譯內核,你應該是abl e執行以下操作:

CROSS_COMPILE=<portion of command before gcc> make ARCH=powerpc menuconfig 
make ARCH=powerpc all 
#...other for modules, docs, etc. 

確保在路徑中有交叉編譯器。對於設置CROSS_COMPILE變量,如果您的gcc交叉編譯器指令是ppc_74xx-GCC你設置CROSS_COMPILE = ppc_74xx-

你可以看看這個鏈接獲取更多信息http://wiki.ppckernel.org/w/Cross_compiling_a_64-bit_PowerPC_Linux_Kernel

如果您正在從頭開始構建您自己的交叉工具鏈,請查看http://trac.cross-lfs.org/此網站向您展示如何從頭開始交叉編譯Linux,包括構建您自己的工具鏈,內核,用戶空間等。

+0

謝謝,但我對debian特定的解決方案感興趣,而不是通用的解決方案。 Debian包含了諸如dpkg-cross這樣的工具,但我找不到任何實際工作的分步說明。 – 2011-03-24 19:13:10

+0

你能發佈完整的錯誤日誌嗎? – 2011-03-24 23:31:23