コンパイルlinux 2.6.24
本当にlinuxの小さなバージョンごとにコンパイルするときに異なる問題がありますね.
最近、「独自の道を切り開くコア」「linux 2.6コア標準チュートリアル」を見ています.
linux 2に使用します.6.24.コンパイルの問題をここにまとめる
環境
から
https://www.kernel.org/pub/linux/kernel/v2.6/
下の2.6.24
解凍後
menuconfig選択バグの設定
コンパイル開始:
問題:
エラー1
リファレンス
http://blog.sina.com.cn/s/blog_8f9cdbbd01014lxj.html
-m elf_x86_64を-m 64に変更
-----------------------------------------------
エラー2:
リファレンス
http://stackoverflow.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の2つの方法のstaticは取り除きます
__mutex_unlock_slowpathの2つの方法のstaticは取り除きます
-----------------------------------------
エラー4:
解決:
最近、「独自の道を切り開くコア」「linux 2.6コア標準チュートリアル」を見ています.
linux 2に使用します.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選択バグの設定
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を-m 64に変更
-----------------------------------------------
エラー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://stackoverflow.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の2つの方法のstaticは取り除きます
__mutex_unlock_slowpathの2つの方法の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;