linux内核编译错误记录

来源:互联网 发布:淘宝客服怎么转人工 编辑:程序博客网 时间:2024/04/29 08:00

1.ERROR: the symlink include/asm points to asm-x86 but asm-arm was expected
       set ARCH or save .config and run 'make mrproper' to fix it
     make: *** [include/asm] 错误 1

最后发现,将linux/include/asm 目录删除以后,该问题得以解决

原因:linux/include/asm 文件夹是内核编译过程中创建的,创建结果就是一个指向文件夹asm-arm 的链接,表明该系统的平台是arm 架构的,而编译系统内核之前,是没有asm 这个链接的,所以,在编译过程中,创建该链接时文件名字与asm 文件夹的名字发生冲突,报错了

参考文章:http://hi.baidu.com/percy_place/blog/item/7fc3fb7a7009e2e12f73b3c3.html

 

2.huang@ubuntu:~$ arm-linux-gcc -v
/usr/local/arm/4.3.2/bin/arm-linux-gcc: line 3: /usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi-gcc: 没有那个文件或目录
/usr/local/arm/4.3.2/bin/arm-linux-gcc: line 3: /usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi-gcc: 成功
这个问题高得我好苦呀,后来网友告诉我是arm-linux-gcc4.3.2是for 32位linux 的而我装的ubuntu10.04是amd64位的

解决办法:sudo apt-get install ia32-libs

后来编译的时候又遇到了问题:

init/built-in.o: In function `do_one_initcall':
/home/buery/workspace/linux-2.6.29/init/main.c:694: undefined reference to `__gnu_mcount_nc'
init/built-in.o: In function `run_init_process':
/home/buery/workspace/linux-2.6.29/init/main.c:781: undefined reference to `__gnu_mcount_nc'
init/built-in.o: In function `init_post':
/home/buery/workspace/linux-2.6.29/init/main.c:790: undefined reference to `__gnu_mcount_nc'
init/built-in.o: In function `name_to_dev_t':
/home/buery/workspace/linux-2.6.29/init/do_mounts.c:77: undefined reference to `__gnu_mcount_nc'
init/built-in.o: In function `rest_init':
/home/buery/workspace/linux-2.6.29/init/main.c:452: undefined reference to `__gnu_mcount_nc'
init/built-in.o:/home/buery/workspace/linux-2.6.29/init/calibrate.c:123: more undefined references to `__gnu_mcount_nc' follow

原因:这是因为内核版本太新造成的;

解决方法1:给内核打补丁__gnu_mcount_nc_patch.patch.gz (地址http://www.arm9home.net/read.php?tid-7318.html)

使用方法:$cd /home/huang/linux/linux-2.6.31.14
$gunzip -dc /path/to/__gnu_mcount_nc_patch.patch.gz |patch -p1

方法2.也可以直接下载 arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 交叉编译器(64位)

    地址http://www.codesourcery.com/downloads/public/gnu_toolchain/arm-none-linux-gnueabi


下面是网友遇到的几个问题,先记录下来以便查阅:

                                                           Relocation the generic ELF 问题

 

 这个连接问题是由于将两个使用不同编译器编译出的目标文件连接到一起而导致的,原因经常是因为没有在所有的Makefile中统一使用$(CC)代表编译器。

/* 是否相等 */
ifeq ($(PLATFORM), 目标硬件平台)
export CROSS_COMPILE := 编译器前缀  --------一定要导出这个,要不会出现Relocation the generic ELF (EM 40)的问题
endif

export CC:= $(CROSS_COMPILE)gcc /* 编译器 */
export AR:= $(CROSS_COMPILE)ar /* 生成.a文件 */
export AS:= $(CROSS_COMPILE)as /* 汇编器 */
export LD:= $(CROSS_COMPILE)ld /* 连接器 */
export NM:= $(CROSS_COMPILE)nm /* */
export RANLIB:= $(CROSS_COMPILE)ranlib /* */
export STRIP:= $(CROSS_COMPILE)strip /* 优化目标文件大小 */
export SIZE:= $(CROSS_COMPILE)size /* */

文章出处:http://www.diybl.com/course/3_program/c++/cppsl/200899/141297.html

                                           

                                                  error: `PCIMEM_BASE ' undeclared

drivers/video/console/vgacon.c:292:   error:   `PCIMEM_BASE '   undeclared   (first   use   in   this   function)

 
解决方法:
device drivers->
   Graphics support->
      Console display driver support->
         [ ]VGA text console

 

                                                                     TIP0
Enter your selection: b
Copy linux kernel from 0x00050000 to 0x30008000, size = 0x00200000 ... done
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0"
MACH_TYPE = 782
NOW, Booting Linux......
kernel启动停在Booting Linux.....没下文了。
以上情况:关闭kernel hacking 里的kernel debugging即可解决。
                                                             

 

                                                               TIP1
内核启动到printk.c里的初始化串口处之后就打不出信息,打出来一部分乱码的解决办法是修改mach-smdk.c里的串口波特率(就是MACHINE_START那里).板子的初始化东西都在那个.c里。
                                                               TIP2
无法用DNW通过usb下载新添加yaffs文件系统的问题是:新编出来的kernel大于2M,而分区只分给kernel 2M的空间所以会下载失败。
TIP3
出现
unable to open an initial console.
Failed to execute /linuxrc.  Attempting defaults...
Kernel panic - not syncing: No init found.  Try passing init= option to kernel.
只要重新烧写kernel和文件系统,让kernel的common-smdk.c中的nand的分区信息和vivi中的分区信息保持一致即可。

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/unbutun/archive/2009/08/15/4450436.aspx

 


4.