移植内核可能遇到的问题

 原帖地址:http://blog.chinaunix.net/u2/74702/showart_1118787.html

 

出现问题:
## Starting application at 0x30008000 ...
Uncompressing Linux.............................................................
解决方案:
setenv bootargs console=ttySAC0,115200 mem=64M ;console明令在哪暂时还没解决???
setenv

TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "<NULL>" or unknown-block(2,0)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

解决方法:把

08.05.11、<*> RAM disk support

09.27.07、<*> Compressed ROM file system support (cramfs) 

 

1. 问题一

  下载内核到flash中,运行到如下即停止没有下文:

Uncompressing Linux……………………done,booting the kernel

卡在这里不动了

原因分析:可能是内核的启动参数传递时没有填写正确,也可能是在linux内核中没对flash分区,还有另一可能原因是在内核编译配置时没将串口驱动勾选。

解决办法:

如果是命令参数问题,则作如下修改:注释掉arch/arm/kernel/setup.c文件中的parse_tag_cmdline()函数中的strlcpy()函数,这样就可以使用默认的CONFIG_CMDLINE了,在.config文件中它被定义为"root=/dev/mtdblock2 ro init=/linuxrc console=ttySAC0,115200"(视具体情况而定),在内核配置文件的Boot options中填入也可。

如果是内核NAND flash分区的问题,则作如下修改:

1. 1 修改文件arch/arm/mach-s3c2410/devs.c,添加如下信息

#include <linux/mtd/partitions.h>

#include <asm/arch/nand.h>

#include <linux/mtd/nand.h>

static struct mtd_partition partition_info[]=

{

{

name:"bootloader",

size:0x00040000,

offset:0,

},

{

name:"kernel",

size:0x001c0000,

offset:0x00040000,

},

{

name:"rootfs",

size: 0x01e00000,

offset:0x00200000,

},

{

name:"ext-fs1",

size: 0x01000000,

offset:0x02000000,

},

{

 

name:"ext-fs2",

size: 0x01000000,

offset:0x03000000,

},

};

//以上分区和NAND flash物理分区一样,分区不一样没试过,根据自己板子情况而定

struct s3c2410_nand_set nandset=

{

nr_partitions:5,

partitions:partition_info,

};

struct s3c2410_platform_nand s3c_nand_info=

{

tacls:0,

twrph0:30,

twrph1:0,

sets:&nandset,

nr_sets:1,

};

以上分区和NAND flash物理分区一样,分区不一样没试过,根据自己板子情况而定

struct s3c2410_nand_set nandset=

{

nr_partitions:5,

partitions:partition_info,

};

struct s3c2410_platform_nand s3c_nand_info=

{

tacls:0,

twrph0:30,

twrph1:0,

sets:&nandset,

nr_sets:1,

};

struct platform_device s3c_device_nand={

.name="s3c2410-nand",

.id = -1,

.num_resources = ARRAY_SIZE(s3c_nand_resources),

.resource = s3c_nand_resource, /*黑体为新加内容*/

.dev = {

.platform_data=&s3c_nand_info

}

};

1.2 在arch/arm/mach-s3c2410/mach-smdk2410.c文件中添加&s3c_device_nand,如下所示:

static struct platform_device * smdk2410_device[] _initdata=

{

&s3c_device_usb,

&s3c_device_lcd,

&s3c_device_wdt,

&s3c_device_i2c,

&s3c_device_iis,

&s3c_device_nand,

};

配置好以上内容后重新编译内核即可。

如果是串口驱动没有勾选,则一定记住将勾上如下选项:

Character devices

-> Serial Drivers下的项勾上.

2. 出现如下错误:VFS:Cannot open root device "mtdblock/2" or unknown-block(0,0)

Please append a correct "root=" boot option.

Kernel panic not syncing,VFS Unable to mount root fs on unknown-block(0,0)

原因分析:出现这种情况一般有两种情况:没有文件系统或boot options参数不正确,如我的系统文件系统为cramfs格式,存放文件系统的分区为第三个分区,启动参数为:

"noinitrd root=/dev/mtdblock2 ro init=/linuxrc console=ttySAC0,115200 rootfstype=cramfs mem=64M"

其中文件系统使用busybox-1.10.1制作

重新编译即可。

3. 系统启动后出现如下错误:

Kernel panic -not syncing:VFS:Unable to mount root fs on unknown-block(31,2)

或者类似的错误。

原因分析:我在这里耗了大量的时间,这种情况一般是NAND flash分区未能分正确,或者所在的分区上没有文件系统,当启动中出现类似如下信息时表明分区正确了

Scanning device for bad blocks

 

Creating 5 MTD partitions on "NAND 64MiB 3,3V 8-bit":

 

0x00000000-0x00040000 : "boot"

 

mtd: Giving out device 0 to boot

 

0x00040000-0x00200000 : "kernel"

 

mtd: Giving out device 1 to kernel

 

0x00200000-0x02000000 : "rootfs"

 

mtd: Giving out device 2 to rootfs

 

0x02000000-0x03000000 : "ext-fs1"

 

mtd: Giving out device 3 to ext-fs1

 

0x03000000-0x04000000 : "ext-fs2"

 

mtd: Giving out device 4 to ext-fs2

从上面看出我的文件系统放在第三个分区rootfs上,其设备号为2,启动后文件系统能挂上,如下所示

Reading data from NAND FLASH without ECC is not recommended

the error code is:0,name=/dev/root,fs=cramfs,flags=32769

VFS: Mounted root (cramfs filesystem) readonly.

Freeing init memory: 104K

Reading data from NAND FLASH without ECC is not recommended


init started: BusyBox v1.10.1 (2008-04-23 23:20:41 CST)

starting pid 229, tty '': '/etc/init.d/rcS'

Reading data from NAND FLASH without ECC is not recommended

the error code is:0,name=/dev/root,fs=cramfs,flags=32769

VFS: Mounted root (cramfs filesystem) readonly.

Freeing init memory: 104K

Reading data from NAND FLASH without ECC is not recommended


init started: BusyBox v1.10.1 (2008-04-23 23:20:41 CST)

starting pid 229, tty '': '/etc/init.d/rcS'

Please press Enter to activate this console.

4. 系统启动到到如下语句即停止不前,停在那里:

VFS:Mounted root (cramfs filesystem) readonly.

Freeing init memory:104

卡在这里没有下文

原因分析:系统在启用init函数时有这么一句,粗体所示

static int init(void * unused)

{

if(execute_command)

{

run_init_process(execute_command);

}

………………

在这句里面出错就会没有下文

解决办法:在配置内核时少选了几句,将如下选择全选上

Floating Point emulation

->At least one emulation must be selected:

NWFPE math emulation

Support extended precision

FastFPE math emulation(EXPERIMENTAL)

5. 关于文件系统问题:在有些资料上提到在配置内核时选上devfs,如果不存在时则手动在文件里加上。但我在内核里面和busybox-1.10.1中都未加devfs支持,文件系统运行正常。在linux-2.6.14.1及以后版本中已去掉devfs。

6. linux-2.6.15.4这个版本也能成功在s3c2410上运行.


内核编译成功后,启动后出现如下提示后就停住了。。。。。。 矩阵通信网-通信.IT人的精神家园 n4}I?QR{` t7sJ
Freeing init memory: 72K 矩阵通信网-通信.IT人的精神家园%Eq"w-?0~;{8rTm
Warning: unable to open an initial console.矩阵通信网-通信.IT人的精神家园8`9Pjq&_/N

!C+Q7f W ][0
这个也是控制台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这个文件,没有的话,自己做一个就可以矩阵通信网-通信.IT人的精神家园3O/` N tOL

f5l+K b / d0#mknod console c 5 1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值