【嵌入式Linux】[内核编译]:内核编译时出现的问题:undefined reference to `__gnu_mcount_nc'

编译内核时出现了如下错误信息:linux

To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
  GEN     .version
  CHK     include/linux/compile.h
  UPD     include/linux/compile.h
  CC      init/version.o
  LD      init/built-in.o
  LD      .tmp_vmlinux1
init/built-in.o: In function `run_init_process':
/home/liuhui8989/Information/linux-2.6.31/init/main.c:827: undefined reference to `__gnu_mcount_nc'
init/built-in.o: In function `init_post':
/home/liuhui8989/Information/linux-2.6.31/init/main.c:837: undefined reference to `__gnu_mcount_nc'
init/built-in.o: In function `do_one_initcall':
/home/liuhui8989/Information/linux-2.6.31/init/main.c:741: undefined reference to `__gnu_mcount_nc'
init/built-in.o: In function `name_to_dev_t':
/home/liuhui8989/Information/linux-2.6.31/init/do_mounts.c:78: undefined reference to `__gnu_mcount_nc'
init/built-in.o: In function `rest_init':
/home/liuhui8989/Information/linux-2.6.31/init/main.c:451: undefined reference to `__gnu_mcount_nc'
init/built-in.o:/home/liuhui8989/Information/linux-2.6.31/init/calibrate.c:123: more undefined references to `__gnu_mcount_nc' follow
make: *** [.tmp_vmlinux1] 错误 1


查找了不少资料最后在整出来,记下来之后参考。ubuntu

首先参考:http://www.linuxidc.com/Linux/2012-02/53883.htmpost

这个基本就能够解决问题了,只不过一开始本身没有那么高的觉悟,操做失误的。ui

首先申明,这些文件的操做是针对你编译的内核源码包的,不要操做错误。
spa

如今开始写具体的解决步骤的:.net

须要补丁__gnu_mcount_nc_patch.patch.gzrest

免费下载地址在 http://linux.linuxidc.com/orm

用户名与密码都是www.linuxidc.comhtm

具体下载目录在 /2012年资料/2月/11日/Linux内核编译错误/blog

下载以后放在Linux内核根目录下,如个人是:/home/liuhui8989/Information/linux-2.6.31

从终端下进入根目录/home/liuhui8989/Information/linux-2.6.31下执行如下操做:

 gunzip -dc __gnu_mcount_nc_patch.patch.gz |patch -p1

 (注意:“__”为两个下划线连在一块儿,“p1”后面的是阿拉伯数字1,还要注意空格)

打印出如下信息即表示成功:

root@ubuntu:/home/liuhui8989/Information/linux-2.6.31# gunzip -dc __gnu_mcount_nc_patch.patch.gz |patch -p1
patching file arch/arm/include/asm/ftrace.h
patching file arch/arm/kernel/armksyms.c
patching file arch/arm/kernel/entry-common.S

注:解压__gnu_mcount_nc_patch.patch.gz的,命令:gunzip  -d __gnu_mcount_nc_patch.patch.gz


原文:http://blog.csdn.net/liuhui_8989/article/details/8105139