在进行内核升级的过程中,出现编译错误
内核为Linux-2.6.34.7
执行make menuconfig配置内核,Processor type and feature ->Processor family ;CPU的类型选择为586/K5/5x86/6x86/6x86MX
LD arch/x86/mm/built-in.o
AS arch/x86/vdso/vdso32/int80.o
VDSO arch/x86/vdso/vdso32-int80.so.dbg
gcc: error: elf_i386: No such file or directory
make[2]: *** [arch/x86/vdso/vdso32-int80.so.dbg] Error 1
make[1]: *** [arch/x86/vdso] Error 2
make: *** [arch/x86] Error 2
root@ubuntu:/linux-2.6.34.14/linux-2.6.34.7#
编译内核时出现上述错误,
看一下gcc编译器版本:
root@ubuntu:/linux-2.6.34.14/linux-2.6.34.7# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
root@ubuntu:/linux-2.6.34.14/linux-2.6.34.7#
编译器是gcc-4.6.3的,编译器版本太高,对于gcc 4.6它 不再支持 linker-style 架构(网上是这么说的)
修改:
1.在内核目录arch/x86/vdso/Makefile中,大约在28,29行 找到 VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -Wl,-soname=linux-vdso.so.1 \ -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 把"-m elf_x86_64" 替换为 "-m64"
2然后再继续找,大约在72行左右,找到VDSO_LDFLAGS_vdso32.lds = -m elf_i386 -Wl,-soname=linux-gate.so.1中的 "-m elf_i386" 替换为 "-m32"
然后继续编译,就可以了。