Chinaunix

标题: 新手请教:编译内核的问题 [打印本页]

作者: morgin7    时间: 2012-02-07 10:22
标题: 新手请教:编译内核的问题
春节的时候开始研究这个,从网上搜集各种资料,gcc都以成功,到了最后了,开始make,在做make的时候,出现错误,不论make oldcomfig或者make menuconfig中怎么选择,都是一样的错误:

还请指教

make
  HOSTCC  scripts/genksyms/genksyms.o
  SHIPPED scripts/genksyms/lex.c
  SHIPPED scripts/genksyms/parse.h
  SHIPPED scripts/genksyms/keywords.c
  HOSTCC  scripts/genksyms/lex.o
scripts/genksyms/lex.c:1228: warning: ‘input’ defined but not used
  SHIPPED scripts/genksyms/parse.c
  HOSTCC  scripts/genksyms/parse.o
  HOSTLD  scripts/genksyms/genksyms
  CC      scripts/empty.o
  MKELF   scripts/elfconfig.h
  HOSTCC  scripts/file2alias.o
  HOSTCC  scripts/modpost.o
  HOSTLD  scripts/modpost
  SPLIT   include/linux/autoconf.h -> include/config/*
  CC      arch/x86_64/kernel/asm-offsets.s
In file included from include/linux/spinlock.h:16,
                 from include/linux/capability.h:45,
                 from include/linux/sched.h:7,
                 from arch/x86_64/kernel/asm-offsets.c:7:
include/asm/processor.h:80: error: array type has incomplete element type
In file included from include/asm/smp.h:18,
                 from include/linux/smp.h:17,
                 from include/linux/sched.h:23,
                 from arch/x86_64/kernel/asm-offsets.c:7:
include/asm/mpspec.h:79: warning: ‘packed’ attribute ignored for field of type ‘unsigned char[6]’
In file included from include/asm/smp.h:22,
                 from include/linux/smp.h:17,
                 from include/linux/sched.h:23,
                 from arch/x86_64/kernel/asm-offsets.c:7:
include/asm/apic.h: In function ‘apic_write_atomic’:
include/asm/apic.h:33: warning: value computed is not used
In file included from include/linux/topology.h:35,
                 from include/linux/mmzone.h:297,
                 from include/linux/gfp.h:4,
                 from include/linux/slab.h:15,
                 from include/linux/percpu.h:4,
                 from include/linux/sched.h:31,
                 from arch/x86_64/kernel/asm-offsets.c:7:
include/asm/topology.h: At top level:
include/asm/topology.h:15: error: conflicting types for ‘cpu_online_map’
include/asm/smp.h:39: note: previous declaration of ‘cpu_online_map’ was here
include/asm/topology.h: In function ‘pcibus_to_cpumask’:
include/asm/topology.h:26: error: invalid operands to binary & (have ‘cpumask_t’ and ‘long unsigned int’)
In file included from include/linux/mmzone.h:297,
                 from include/linux/gfp.h:4,
                 from include/linux/slab.h:15,
                 from include/linux/percpu.h:4,
                 from include/linux/sched.h:31,
                 from arch/x86_64/kernel/asm-offsets.c:7:
include/linux/topology.h: In function ‘__next_node_with_cpus’:
include/linux/topology.h:50: error: incompatible types when assigning to type ‘cpumask_t’ from type ‘long unsigned int’
make[1]: *** [arch/x86_64/kernel/asm-offsets.s] Error 1
make: *** [arch/x86_64/kernel/asm-offsets.s] Error 2

作者: wayling    时间: 2012-02-07 10:39
你.config用错 或是你编译环境用错都有可能, 请检查
作者: morgin7    时间: 2012-02-07 10:42
哦,谢谢,新手,请指点怎么检查呢?
作者: wayling    时间: 2012-02-07 12:48
你gcc ,kernel, 怎么来的,版本是多少, gcc 跟kernl版本太多了 有些不兼容或需要做修改,
config你怎么设的,我看你是想编x64的kernel ?你去找正确的config来用八

作者: morgin7    时间: 2012-02-07 14:10
嗯:以下是版本号:

gcc-4.6.12.tar.bz2,gmp-4.3.2.tar.bz2,mpc-0.8.1.tar.gz,mpfr-2.4.2.tar.bz2

kenel:linux-2.6.1.tar.xz

下载的地址是百度搜索的
gcc:Index of ftp://gcc.gnu.org/pub/gcc/infrastructure/
内核:http://www.kernel.org/

我是想看看相关qla2xxxx的驱动编译
作者: morgin7    时间: 2012-02-07 15:57
下了一个linux kernel :linux-3.2.2.tar.bz2

make一切顺利,真的是版本问题吗?新版本的gcc对数据类型检查特别严格吗?
作者: morgin7    时间: 2012-02-07 15:58
我需要用linux-2.6.1的。请问都要修改什么呢?望指教
作者: morgin7    时间: 2012-02-07 16:27
版本:linux-2.6.32.56.tar.bz2

也可以正常编译,就2.61的出错~~~~

需要改什么地方呢??请高手指教
作者: morgin7    时间: 2012-02-09 15:02
看来是过高的版本无法编译太低版本的。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2