loongson内核自带源码的编译

来源:互联网 发布:知新教育 编辑:程序博客网 时间:2024/05/16 10:29

loongson 2f机器自带源码为linux-source-2.6.18,中间默认为交叉编译,修改方法为:

(1)将arch/mips/Makefile中mipsel-linux- 选项取消

(2)将根目录下Makefile中CROSS_COMPILE注释掉,这样就会使用loongson本地的工具链编译


make过程的错误一:

pci.c:(.init.text+0x744): undefined reference to `pci_probe_only'
pci.c:(.init.text+0x754): undefined reference to `pci_probe_only'
pci.c:(.init.text+0x770): undefined reference to `register_pci_controller'
pci.c:(.init.text+0x770): relocation truncated to fit: R_MIPS_26 against `register_pci_controller'

修改:运行 make menuconfig,添加对pci的支持


错误二:arch/mips/math-emu/built-in.o: In function `ieee754dp_format':
(.text+0x2f00): undefined reference to `__ucmpdi2'
arch/mips/math-emu/built-in.o: In function `ieee754dp_format':
(.text+0x2f00): relocation truncated to fit: R_MIPS_26 against `__ucmpdi2'
arch/mips/math-emu/built-in.o: In function `ieee754dp_mul':
(.text+0x4968): undefined reference to `__ucmpdi2'
arch/mips/math-emu/built-in.o: In function `ieee754dp_mul':
(.text+0x4968): relocation truncated to fit: R_MIPS_26 against `__ucmpdi2'
arch/mips/math-emu/built-in.o: In function `ieee754dp_mul':
(.text+0x4eb4): undefined reference to `__ucmpdi2'
arch/mips/math-emu/built-in.o: In function `ieee754dp_mul':
(.text+0x4eb4): relocation truncated to fit: R_MIPS_26 against `__ucmpdi2'
arch/mips/math-emu/built-in.o: In function `ieee754dp_sub':
(.text+0x5320): undefined reference to `__ucmpdi2'
arch/mips/math-emu/built-in.o: In function `ieee754dp_sub':
(.text+0x5320): relocation truncated to fit: R_MIPS_26 against `__ucmpdi2'
arch/mips/math-emu/built-in.o: In function `ieee754dp_sub':
(.text+0x5664): undefined reference to `__ucmpdi2'
arch/mips/math-emu/built-in.o: In function `ieee754dp_sub':
(.text+0x5664): relocation truncated to fit: R_MIPS_26 against `__ucmpdi2'
arch/mips/math-emu/built-in.o:(.text+0x5ca8): more undefined references to `__ucmpdi2' follow
arch/mips/math-emu/built-in.o: In function `ieee754dp_add':
(.text+0x5ca8): relocation truncated to fit: R_MIPS_26 against `__ucmpdi2'
arch/mips/math-emu/built-in.o: In function `ieee754dp_add':
(.text+0x5f08): relocation truncated to fit: R_MIPS_26 against `__ucmpdi2'
make: *** [.tmp_vmlinux1] Error 1

修改:解决方法:
在最新的linux内核(我是从2.6.30)上找到arch/mips/lib/ucmpdi2.c 把它copy到自己编译的版本的一致路径下,而后修改arch/mips/lib/Makefile,修改方法是 在Makefile中添加一项 ucmpdi2.o,