编译linux2.6.24 博客分类: linux linux内核
程序员文章站
2024-03-19 23:45:16
...
真是每个linux的小版本编译的时候都有不同的问题啊,
最近在看《独辟蹊径品内核》《linux2.6内核标准教程》
用到linux2.6.24.编译的问题汇总到这里
环境
从
https://www.kernel.org/pub/linux/kernel/v2.6/
下的2.6.24
解压后
设置menuconfig 选debug
开始编译:
遇到问题:
错误1
参考
http://blog.sina.com.cn/s/blog_8f9cdbbd01014lxj.html
-m elf_x86_64 换成 -m64
-----------------------------------------------
错误2:
参考
http://*.com/questions/23194840/linux-2-6-24-kernel-compilation-error-size-expression-for-copy-user-generic-c-d
-----------------------------
错误3:
kernel/mutex.c
这个好使,其他的都是扯淡,什么该config参数,什么加__used都不行,需要把static去掉,加锁和解锁的
https://github.com/socketpair/jslinux_reversed/blob/master/contrib/patches/2.6.20_common_fixes.patch
__mutex_lock_slowpath的两个方法的static去掉
__mutex_unlock_slowpath的两个方法的static去掉
-----------------------------------------
错误4:
解决:
最近在看《独辟蹊径品内核》《linux2.6内核标准教程》
用到linux2.6.24.编译的问题汇总到这里
环境
[root@centos140_11 boot]# 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. [root@centos140_11 boot]# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core) [root@centos140_11 boot]#
从
https://www.kernel.org/pub/linux/kernel/v2.6/
下的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
遇到问题:
错误1
参考
http://blog.sina.com.cn/s/blog_8f9cdbbd01014lxj.html
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 $@
-m elf_x86_64 换成 -m64
-----------------------------------------------
错误2:
/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
参考
http://*.com/questions/23194840/linux-2-6-24-kernel-compilation-error-size-expression-for-copy-user-generic-c-d
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
-----------------------------
错误3:
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去掉,加锁和解锁的
https://github.com/socketpair/jslinux_reversed/blob/master/contrib/patches/2.6.20_common_fixes.patch
__mutex_lock_slowpath的两个方法的static去掉
__mutex_unlock_slowpath的两个方法的static去掉
-----------------------------------------
错误4:
/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;
推荐阅读
-
openssl常用命令 博客分类: 常用命令 openssl shell linux apns aes base64
-
观察内核所捕获到的网卡信息 博客分类: Linux网络 dmesglspci网卡内核
-
Linux内核的并发控制 博客分类: Linux kernelLinux driver 内核并发Linux
-
编译linux2.6.24 博客分类: linux linux内核
-
openssl常用命令 博客分类: 常用命令 openssl shell linux apns aes base64
-
Apache HTTP和Nginx Web服务器Linux系统安装 博客分类: web apachenginx
-
一个 Ubuntu获取铁通独立 IP 的脚本 博客分类: Linux 脚本UbuntuLinuxRubySocket
-
securecrt+winscp key 登录ssh(ubuntu 8.04) 博客分类: Linux学习
-
使用nohup让程序在远程主机后台运行 博客分类: Linux学习 MySQLPHPLinuxUnixHTML
-
为什么经常提示You have new mail in /var/spool/mail/root 博客分类: linux