ubuntu编译linux kernel v2.6.30 各种错误排除
一、資源準(zhǔn)備
1、下載一個(gè)較穩(wěn)定的老版本,2.6.30, 并解壓源碼:
1 wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.tar.xz 2 tar Jxf linux-2.6.30.tar.xz 3 cd linux-2.6.30/2、生成基本的配置信息:
make defconfig二、工具配置
接下來(lái)要對(duì)內(nèi)核默認(rèn)配置文件進(jìn)行修改,有3中方式,gconfig、xconfig和menuconfig, 分別依賴與gtk+2.0、qt3和libncurses5-dev。 通過(guò)相應(yīng)命令安裝依賴的包后,就可一進(jìn)行配置了;
1、使用menuconfig進(jìn)行配置
1 sudo apt-get install libncurses5-dev 2 make menuconfig2、使用gconfig進(jìn)行配置
make gconfig * * Unable to find the GTK+ installation. Please make sure that * the GTK+ 2.0 development package is correctly installed... * You need gtk+-2.0, glib-2.0 and libglade-2.0. * make[1]: *** No rule to make target `scripts/kconfig/.tmp_gtkcheck', needed by `scripts/kconfig/gconf.o'. Stop. make: *** [gconfig] Error 2需要安裝以下軟件包,然后重新開始:
1 sudo apt-get install libgtk2.0-dev libglib2.0-dev libglade2-dev 2 make gconfig3、使用xconfig進(jìn)行配置
這個(gè)對(duì)qt3依賴,已經(jīng)安裝了qt3-dev-tools也不行呢,沒有找到解決方案,所以放棄折騰了;誰(shuí)有好方法解決請(qǐng)告知哇。
$make gconfigHOSTCC scripts/kconfig/gconf.o In file included from /usr/include/gtk-2.0/gtk/gtk.h:236:0,from /usr/include/libglade-2.0/glade/glade-xml.h:26,from /usr/include/libglade-2.0/glade/glade.h:28,from scripts/kconfig/gconf.c:16: /usr/include/gtk-2.0/gtk/gtkitemfactory.h:47:1: warning: function declaration isn’t a prototype scripts/kconfig/gconf.c: In function ‘text_insert_help’: scripts/kconfig/gconf.c:469:3: warning: format not a string literal and no format arguments scripts/kconfig/gconf.c: In function ‘on_introduction1_activate’: scripts/kconfig/gconf.c:754:6: warning: format not a string literal and no format arguments scripts/kconfig/gconf.c: In function ‘on_about1_activate’: scripts/kconfig/gconf.c:772:6: warning: format not a string literal and no format arguments scripts/kconfig/gconf.c: In function ‘on_license1_activate’: scripts/kconfig/gconf.c:791:6: warning: format not a string literal and no format arguments scripts/kconfig/gconf.c: At top level: scripts/kconfig/images.c:6:20: warning: ‘xpm_load’ defined but not used scripts/kconfig/images.c:36:20: warning: ‘xpm_save’ defined but not used scripts/kconfig/images.c:66:20: warning: ‘xpm_back’ defined but not used scripts/kconfig/images.c:175:20: warning: ‘xpm_symbol_no’ defined but not used scripts/kconfig/images.c:192:20: warning: ‘xpm_symbol_mod’ defined but not used scripts/kconfig/images.c:209:20: warning: ‘xpm_symbol_yes’ defined but not used scripts/kconfig/images.c:226:20: warning: ‘xpm_choice_no’ defined but not used scripts/kconfig/images.c:243:20: warning: ‘xpm_choice_yes’ defined but not used scripts/kconfig/images.c:277:20: warning: ‘xpm_menu_inv’ defined but not used scripts/kconfig/images.c:294:20: warning: ‘xpm_menuback’ defined but not used scripts/kconfig/gconf.c:957:13: warning: ‘renderer_toggled’ defined but not usedHOSTLD scripts/kconfig/gconf scripts/kconfig/gconf arch/x86/Kconfig三、錯(cuò)誤排除
1、出現(xiàn)錯(cuò)誤syscall_trace_leave
arch/x86/include/asm/ptrace.h:146:13: note: previous declaration of 'syscall_trace_leave' was here make[2]: *** [arch/x86/kernel/ptrace.o] Error 1 make[1]: *** [arch/x86/kernel] Error 2 make: *** [arch/x86] Error 2解決方案參考這個(gè)補(bǔ)丁:?https://patchwork.kernel.org/patch/1301031/
Patch--- linux-2.6.32.59/arch/x86/include/asm/ptrace.h +++ fix_ptrace.o_compile_error/arch/x86/include/asm/ptrace.h @@ -130,6 +130,7 @@ #ifdef __KERNEL__#include <linux/init.h> +#include <linux/linkage.h>struct cpuinfo_x86;struct task_struct; @@ -142,8 +143,8 @@ int error_code, int si_code);void signal_fault(struct pt_regs *regs, void __user *frame, char *where);-extern long syscall_trace_enter(struct pt_regs *); -extern void syscall_trace_leave(struct pt_regs *); +extern asmregparm long syscall_trace_enter(struct pt_regs *); +extern asmregparm void syscall_trace_leave(struct pt_regs *);static inline unsigned long regs_return_value(struct pt_regs *regs){2、錯(cuò)誤gcc不識(shí)別-m參數(shù)
gcc: error: unrecognized command line option ‘-m’ gcc: error: elf_i386: No such file or directory make[1]: *** [arch/x86/vdso/vdso32-int80.so.dbg] Error 1由于我現(xiàn)在用的是ubuntu 12.10 使用的是gcc-4.7,發(fā)現(xiàn)了一個(gè)新版本的移植的問題,所以安裝gcc-4.5,然后重新鏈接就搞定了,可以繼續(xù)編譯:
sudo apt-get install gcc-4.5 cd /usr/bin sudo ln -s -f gcc-4.5 gcc繼續(xù)編譯中:
#使用-j4指定4個(gè)線程編譯 make -j4四、編譯成功
基本使用的默認(rèn)設(shè)置,就是第一步的make defconfig后的配置參數(shù),然后make -j4,好像編譯的挺快的,后面在詳細(xì)研究以下各種參數(shù),已經(jīng)如何啟用這個(gè)自己編譯的內(nèi)核 :)。
CHK include/linux/version.hCHK include/linux/utsrelease.hSYMLINK include/asm -> include/asm-x86CALL scripts/checksyscalls.shCHK include/linux/compile.hVDSOSYM arch/x86/vdso/vdso32-int80-syms.ldsVDSOSYM arch/x86/vdso/vdso32-sysenter-syms.ldsVDSOSYM arch/x86/vdso/vdso32-syms.ldsLD arch/x86/vdso/built-in.oLD vmlinux.oMODPOST vmlinux.o WARNING: modpost: Found 3 section mismatch(es). To see full details build your kernel with: 'make CONFIG_DEBUG_SECTION_MISMATCH=y'GEN .versionCHK include/linux/compile.hUPD include/linux/compile.hCC init/version.oLD init/built-in.oLD .tmp_vmlinux1KSYM .tmp_kallsyms1.SAS .tmp_kallsyms1.oLD .tmp_vmlinux2KSYM .tmp_kallsyms2.SAS .tmp_kallsyms2.oLD .tmp_vmlinux3KSYM .tmp_kallsyms3.SAS .tmp_kallsyms3.oLD vmlinuxSYSMAP System.mapSYSMAP .tmp_System.mapOBJCOPY arch/x86/boot/compressed/vmlinux.binGZIP arch/x86/boot/compressed/vmlinux.bin.gzLD arch/x86/boot/compressed/piggy.oLD arch/x86/boot/compressed/vmlinuxOFFSETS arch/x86/boot/offsets.hAS arch/x86/boot/header.oCC arch/x86/boot/version.oLD arch/x86/boot/setup.elfOBJCOPY arch/x86/boot/setup.binOBJCOPY arch/x86/boot/vmlinux.binBUILD arch/x86/boot/bzImage Root device is (8, 11) Setup is 10060 bytes (padded to 10240 bytes). System is 3539 kB CRC d3a625ec Kernel: arch/x86/boot/bzImage is ready (#2)Building modules, stage 2.MODPOST 2 modules總結(jié)
以上是生活随笔為你收集整理的ubuntu编译linux kernel v2.6.30 各种错误排除的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【笔记】知行合一王阳明:1472~152
- 下一篇: HTC Z710t解锁 获取root权限