2011-03-16 70 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