Linux-2.6内核移植过程中常见问题及解决方法

来源:互联网 发布:c语言里main是什么意思 编辑:程序博客网 时间:2024/05/18 05:57
导读:
  1、内核启动后,出现如下提示后停住
  Uncompressing Linux........................................................... done, booting the kernel
  一般情况下,这个时候内核已经启动了,只不过在控制台console中没有打印信息而已。所以问题主要锁定在串口这一块。
  首 先确定你的板子包括硬件都是没有问题的。可以分以下几种情况,最常见的原因是在内核启动命令行这块cmdline,一般情况下linux-2.4内核中, console=ttyS0,而linux-2.6内核则用console=ttySAC0。还有一个原因,不多见,我当时用的是S3C2410的板子, bootloader用的是u-boot-1.0.0,内核移植的是linux-2.6.16,结果出现这个问题,在网上查了很多资料,最后找出来问题。 u-boot把S3C2410的时钟设置为202Mhz,而内核启动时使用的是200Mhz,修改U-Boot中的MPLLCON:
  clk_power->MPLLCON MPLLCON = 0x0005c040;//MPLL=200Mhz
  2、内核编译成功后,启动后出现如下提示后就停住了。。。。。。
  Freeing init memory: 72K
  Warning: unable to open an initial console.
  这 个也是控制台console的问题,linux-2.6.13以后的内核都支持devfs,而之后版本的内核就把devfs这块去掉了,虽然还能在内核源 码中找到对应的源码,你也可以把它加进内核,但是也不是太好用。2.6.13 后的版本改为支持udev了,udev这块我也没太弄懂,正在研究。因此如果你是linux-2.6.13版本一下的内核,编译的时候在Pseudo filesystems添加dev filesystem surpport选项,也就是添加devfs的支持,如果linux-2.6.13之后的版本,你就看看你的rootfs下有没有 /dev/console这个文件,没有的话,自己做一个就可以
  #mknod console c 5 1
  3、内核启动后,打印出一大堆提示信息
  Unable to handle kernel xxxx pointer dereference at virtual address xxxxxx
  ……
  r10: 00000000 r9 : 00000000 r8 : 00500001
  r7 : 00000001 r6 : c011ab50 r5 : c3726c00 r4 : c013e024
  r3 : 00000000 r2 : 00000000 r1 : 00000000 r0 : c3726c00
  ….
  <0>Kernel panic - not syncing: Attempted to kill init!
  这 个提示是内核启动加载驱动时出错,那就只有找到出错的驱动,不加载它,如果必须要用这个驱动,只有自己修改源代码,一般问题都在对硬件的地址操作有问题。 一般情况下,芯片出来的时候厂家都会给一个参考设计方案,主要是硬件电路,如果你是用的是开发板的话,大都是参考厂家的那个设计做的。而内核也按参考方案 设计的,但是每家的开发板并不能保证硬件电路一样,问题可能就出现了。
  Writing data without ECC to NAND-FLASH is not recommended
  Reading data from NAND FLASH without ECC is not recommended
  mkdir: Cannot create directory `aaaa': Cannot allocate memory
  我终于找到了问题,是在arch/arm/mach_s3c2410/devs.c中定义分区表时不能用
  MTD_WRITEABLE
  另外将driver/mtd/nand/s3c2410.c 中的NAND_ECC_NONE改NANE_ECC_SOFT
  "mount_devfs_fs(): unable to mount devfs, err: -2"一个困扰了我很久的问题,主要是ecc的问题。在此我把我的理解说一下好了:
  搞清楚你在driver/mtd/nand/s3c2410.c文件中有没有把NAND_ECC_SOFT改成NAND_ECC_NONE,这个 网上不少的人都会做(听说会与yaffs文件系统有冲突,但我发现反而和cramfs文件系统有冲突)。这个地方我那时候没有交代清楚,不好意思^_^
  假设你把NAND_ECC_SOFT改成NAND_ECC_NONE,那[*] Lets Yaffs do its own ECC 这一步是必需的。
  最后,如果你把NAND_ECC_SOFT改成NAND_ECC_NONE的话,那你下载yaffs文件系统的时候就不应该加上-e的参数了。
  这个东西我可是经历了无数次的"mount_devfs_fs(): unable to mount devfs, err: -2"才悟出来的,本来想不讲出来的,但实在太多人问这个问题了,实在不忍^_^
  最后给点建议:先让内核挂载cramfs试试看(记得把NAND_ECC_SOFT改成NAND_ECC_NONE哦),因为这个文件系统只要用下载内核的命令下载就行,成功挂载cramfs的话将会是你最大的鼓舞
  fs/Kconfig:766: syntax error, unexpected T_WORD, expecting T_EOL
  fs/Kconfig:767: invalid menu option
  fs/Kconfig:768: syntax error, unexpected T_DEFAULT
  fs/Kconfig:769: invalid menu option
  fs/Kconfig:773: syntax error, unexpected T_WORD, expecting T_EOL
  fs/Kconfig:774: invalid menu option
  fs/Kconfig:775: syntax error, unexpected T_DEFAULT
  fs/Kconfig:776: invalid menu option
  fs/Kconfig:777: syntax error, unexpected T_DEPENDS
  fs/Kconfig:778: invalid menu option
  make[1]: *** [menuconfig] 错误 1
  make: *** [menuconfig] 错误 2
  将符号切换成英文的就行了!
  2007.7.17
  hardware.h中没有找到sizes.h文件
  可以自己建一个
  /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
  /* DO NOT EDIT!! - this file automatically generated
  * from .s file by awk -f s2h.awk
  */
  /* Size defintions
  * Copyright (C) ARM Limited 1998. All rights reserved.
  */
  #ifndef __sizes_h
  #define __sizes_h 1
  /* handy sizes */
  #define SZ_1K 0x00000400
  #define SZ_4K 0x00001000
  #define SZ_8K 0x00002000
  #define SZ_16K 0x00004000
  #define SZ_64K 0x00010000
  #define SZ_128K 0x00020000
  #define SZ_256K 0x00040000
  #define SZ_512K 0x00080000
  #define SZ_1M 0x00100000
  #define SZ_2M 0x00200000
  #define SZ_4M 0x00400000
  #define SZ_8M 0x00800000
  #define SZ_16M 0x01000000
  #define SZ_32M 0x02000000
  #define SZ_64M 0x04000000
  #define SZ_128M 0x08000000
  #define SZ_256M 0x10000000
  #define SZ_512M 0x20000000
  #define SZ_1G 0x40000000
  #define SZ_2G 0x80000000
  #endif
  /* END */
  或者你干脆把hardware.h中的#include 注释掉,看能不能编译通过!
  推荐投诉

本文转自
http://blog.chinaunix.net/u/27204/showart_422891.html
原创粉丝点击