编译内核时遇到的问题 SEGMENT_SIZE undeclared
27
二
因为编译内核时开了多个线程,因此编译碰到错误停止时,错误信息可能在上面几十行信息里。
第一个可能碰到的错误是: SEGMENT_SIZE’ undeclared
fs/binfmt_aout.c: In function 'load_aout_binary':
fs/binfmt_aout.c:271: error: 'SEGMENT_SIZE' undeclared (first use in this function)
fs/binfmt_aout.c:271: error: (Each undeclared identifier is reported only once
fs/binfmt_aout.c:271: error: for each function it appears in.)
make[1]: *** [fs/binfmt_aout.o] 错误 1
解决方法, 打开Makefile,找到下面这一行
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
改成
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) -Dlinux
接着执行编译命令 and(and这个命令在上一节中讲过,为自定义的命令)
出现这个错误是因为在fs/binfmt_aout.c中,引用的宏SEGMENT_SIZE在include/linux/a.out.h中定义。
它的值取决于宏定义linux, 如果定义过linux才会有SEGMENT_SIZE
1 | 132 #ifdef linux |
解决方法出处:http://forum.xda-developers.com/archive/index.php/t-825611.html