编译linux2.6.24

真是每个linux的小版本编译的时候都有不同的问题啊,
最近在看《独辟蹊径品内核》《linux2.6内核标准教程》
用到linux2.6.24.编译的问题汇总到这里
环境
[code="java"]
# gcc --version
gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
#
[/code]

[url]https://www.kernel.org/pub/linux/kernel/v2.6/[/url]
下的2.6.24

解压后
设置menuconfig 选debug


make O=/home/haoning/rtclinux/websocket/web/jslinux/tmp/linux2.6.24.build/kernel/ menuconfig


开始编译:

time make O=/home/haoning/rtclinux/websocket/web/jslinux/tmp/linux2.6.24.build/kernel/ -j10

[b][color=red]遇到问题:[/color][/b]

[b]错误1[/b]
参考
[url]http://blog.sina.com.cn/s/blog_8f9cdbbd01014lxj.html[/url]

arch/x86/vdso/Makefile
19 quiet_cmd_syscall = SYSCALL $@
20 cmd_syscall = $(CC) -m elf_x86_64 -nostdlib $(SYSCFLAGS_$(@F)) \
21 -Wl,-T,$(filter-out FORCE,$^) -o $@


[color=red]-m elf_x86_64 换成 -m64[/color]

-----------------------------------------------
[b]错误2:[/b]
/tmp/cct0Bawg.s: Assembler messages:
/tmp/cct0Bawg.s: Error: .size expression for copy_user_generic_c does not evaluate to a constant
make[2]: *** [arch/x86/lib/copy_user_64.o] Error 1
make[1]: *** [arch/x86/lib] Error 2
make: *** [sub-make] Error 2


参考
[url]http://stackoverflow.com/questions/23194840/linux-2-6-24-kernel-compilation-error-size-expression-for-copy-user-generic-c-d[/url]

arch/x86/lib/copy_user_64.S
347 END(copy_user_generic_c)
348
349 .section __ex_table,"a"
350 .quad 1b,3b
351 .quad 2b,5b
换成
347 END(copy_user_generic_c)
348
349 .section __ex_table,"a"
350 .quad 1b,3b
351 .quad 2b,5b


-----------------------------
[b]错误3:[/b]

kernel/built-in.o: In function `mutex_lock':
/home/haoning/rtclinux/websocket/web/jslinux/tmp/linux-2.6.24/kernel/mutex.c:92: undefined reference to `__mutex_lock_slowpath'
kernel/built-in.o: In function `mutex_unlock':
/home/haoning/rtclinux/websocket/web/jslinux/tmp/linux-2.6.24/kernel/mutex.c:118: undefined reference to `__mutex_unlock_slowpath'
make[1]: *** [.tmp_vmlinux1] Error 1
make: *** [sub-make] Error 2


kernel/mutex.c
这个好使,其他的都是扯淡,什么该config参数,什么加__used都不行,需要把static去掉,加锁和解锁的
[url]https://github.com/socketpair/jslinux_reversed/blob/master/contrib/patches/2.6.20_common_fixes.patch[/url]
__mutex_lock_slowpath的两个方法的static去掉
__mutex_unlock_slowpath的两个方法的static去掉

-----------------------------------------
[b]错误4:[/b]
/scripts/unifdef.c:70:0:
/usr/include/stdio.h:678:20: note: previous declaration of ‘getline’ was here


解决:
scripts/unifdef.c
207 static int findsym(const char *);
208 static void flushline(bool);
209 //static Linetype getline(void);
210 static Linetype mygetline(void);
211 static Linetype ifeval(const char **);
212 static void ignoreoff(void);

511 Linetype lineval;
512
513 for (;;) {
514 linenum++;
515 //lineval = getline();
516 lineval = mygetline();
517 trans_table[ifstate[depth]][lineval]();
518 debug("process %s -> %s depth %d",
519 linetype_name[lineval],
520 ifstate_name[ifstate[depth]], depth);
521 }
522 }
523
524 /*
525 * Parse a line and determine its type. We keep the preprocessor line
526 * parser state between calls in the global variable linestate, with
527 * help from skipcomment().
528 */
529 static Linetype
530 //getline(void)
531 mygetline(void)
532 {
533 const char *cp;
534 int cursym;
535 int kwlen;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值