内核编译问题

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
ubuntubirduser
帖子: 6
注册时间: 2016-05-26 8:54
系统: ubuntu16.04

内核编译问题

#1

帖子 ubuntubirduser » 2016-06-08 10:14

root@zhang-ThinkPad-T60p:/usr/src/linux-2.6.38# make zImage
CHK include/linux/version.h
UPD include/linux/version.h
CHK include/generated/utsrelease.h
UPD include/generated/utsrelease.h
Generating include/generated/mach-types.h
CC kernel/bounds.s
gcc: error: unrecognized argument in option ‘-mabi=aapcs-linux’
gcc: note: valid arguments to ‘-mabi=’ are: ms sysv
gcc: error: unrecognized command line option ‘-mlittle-endian’
gcc: error: unrecognized command line option ‘-mapcs’
gcc: error: unrecognized command line option ‘-mno-sched-prolog’
gcc: error: unrecognized command line option ‘-mno-thumb-interwork’
/usr/src/linux-2.6.38/./Kbuild:35: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:956: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
root@zhang-ThinkPad-T60p:/usr/src/linux-2.6.38#


以上是编译时产生的错误。
电脑系统:ubuntu16.04 ;
菜鸟初学
系统内核是linux-4.4.0;
要编译的内核是linux2.6.38;
工具:arm-none-linux-gnueabi-gcc,~ -v测试版本显示正常,说明安装没问题;
改了makefile的ARCH ?=arm;
CROSS_COMPILR ?=arm-linux-;
其他没变,然后make menuconfig配置了一点内容一变产生.config文件。
然后直接make zImage就出错;
但是我编译linux4.4.0不会出错。且可以生存zImage镜像。
请问大神们,究竟错在哪了?
头像
astolia
论坛版主
帖子: 6703
注册时间: 2008-09-18 13:11

Re: 内核编译问题

#2

帖子 astolia » 2016-06-08 10:52

CROSS_COMPILE 而非 CROSS_COMPILR
ubuntubirduser
帖子: 6
注册时间: 2016-05-26 8:54
系统: ubuntu16.04

Re: 内核编译问题

#3

帖子 ubuntubirduser » 2016-06-08 10:59

这个错找到了,是arm-none-linux-gnueabi-gcc不是默认的gcc工具,用update-alternatives设置就好了,可有有新的错误。
scripts/mod/mk_elfconfig: 1: scripts/mod/mk_elfconfig: Syntax error: word unexpected (expecting ")")
/usr/src/linux-2.6.38/scripts/mod/Makefile:14: recipe for target 'scripts/mod/elfconfig.h' failed
make[2]: *** [scripts/mod/elfconfig.h] Error 2
scripts/Makefile.build:385: recipe for target 'scripts/mod' failed
make[1]: *** [scripts/mod] Error 2
Makefile:487: recipe for target 'scripts' failed
make: *** [scripts] Error 2

在scripts/mod/文件夹下明明有elfconfig.h文件,但打开是空文件,什么也没写
回复