内核版本为linux-2.6.32.2,自己构建了一个文件系统,使用友善之臂下载的mkyaffs2image-128M制作根文件系统(我是1GB的mini2440)。显示信息如下:
yaffs: dev is 32505859 name is "mtdblock3" rw
yaffs: passed flags ""
VFS: Mounted root (yaffs filesystem) on device 31:3.
Freeing init memory: 124K
Failed to execute /linuxrc. Attempting defaults...
Kernel panic - not syncing: No init found. Try passing init= option to kernel.
从上述信息看,没有“Warning: unable to open an initial console. ”警告,是不是说明内核认出了我文件系统中的/dev/console设备文件??
也就是说,我的根文件分区被内核正确找到了,根文件系统挂载失败是因为文件系统制作的问题??
我的u-boot的mini2440.h文件片段:
//#define CONFIG_JFFS2_NAND 1
//#undef CONFIG_JFFS2_CMDLINE
//#define CONFIG_JFFS2_DEV "nand0"
//#define CONFIG_JFFS2_PART_SIZE 0x480000
//#define CONFIG_JFFS2_PART_OFFSET 0x80000
//#define CONFIG_JFFS2_CMDLINE 1
//#define ENABLE_CMD_NAND_YAFFS_SKIPFB 1
/* 分区参数 */
#define MTDIDS_DEFAULT "nand0=nandflash0"
#define MTDPARTS_DEFAULT "mtdparts=nandflash0:256k(bootloader)," \
"128k(params)," \
"5m(kernel)," \
"-(root)"
我的linux内核中的common-mini2440.c文件中有:
static struct mtd_partition faye2440_default_nand_part[] = {
[0] = {
.name = "bootloader",
.offset = 0,
.size = 0x40000, /* 256KB */
},
[1] = {
.name = "param",
.offset = 0x40000,
.size = 0x20000, /* 128KB */
},
[2] = {
.name = "kernel",
.offset = 0x60000,
.size = 0x500000, /* 5MB */
},
[3] = {
.name = "root",
.offset = 0x560000,
.size = 1024 * 1024 * 1024, /* 1GB */
},
[4] = {
.name = "nand", /* 此分区代表整个nand flash,以后可通过读取/dev/mtdblock4读取 */
.offset = 0,
.size = 1024 * 1024 * 1024, /* 1GB */
},
};
按照上面2段代码,u-boot和linux内核的分区应该是一致的吧?
为何就挂载不上根文件系统呢??