您的位置:首页 > 运维架构 > Linux

mini6410基于linux2.6.36内核通过NFS启动根文件系统总结(五内核测试 二 VFS: Cannot open root device "ubi0:FriendlyARM-root" )

2012-04-23 17:20 1091 查看
本系列文章有本人yinjiabin制作,转载请注明出处:
http://blog.csdn.net/yinjiabin/article/details/7490226
step1:用tftp下载编译好的内核

tftp 通过网络下载文件

注意:使用tftp,需要先配置好网络

setenv serverip 192.168.1.100 (tftp服务器的地址)

tftp c0008000 uImage //把server(IP=环境变量中设置的serverip)中tftp服务目录 (我的是tftpboot)下的uImage通过TFTP读入到0xc0008000(内存地址)处

step2: 加载内核

bootm c0008000 //执行内存c0008000中的二进制代码

setp3:内核运行结果

mmc0: SDHCI controller on samsung-hsmmc [s3c-sdhci.0] using ADMA

s3c-sdhci s3c-sdhci.1: clock source 0: hsmmc (133000000 Hz)

s3c-sdhci s3c-sdhci.1: clock source 1: hsmmc (133000000 Hz)

s3c-sdhci s3c-sdhci.1: clock source 2: mmc_bus (24000000 Hz)

enter s3c64xx_setup_sdhci1_cfg_gpio

s3c6400_setup_sdhci_cfg_card: CTRL 2=c0004120, 3=80808080

mmc1: SDHCI controller on samsung-hsmmc [s3c-sdhci.1] using ADMA

usbcore: registered new interface driver usbhid

usbhid: USB HID core driver

asoc: AC97 HiFi <-> s3c-ac97 mapping ok

s3c6400_setup_sdhci_cfg_card: CTRL 2=c0004100, 3=00008080

mmc0: new high speed SDHC card at address 1234

mmcblk0: mmc0:1234 SA04G 3.65 GiB

mmcblk0: p1

s3c6400_setup_sdhci_cfg_card: CTRL 2=c0004120, 3=80808080

ALSA device list:

#0: SMDK (WM9713)

TCP cubic registered

lib80211: common routines for IEEE802.11 drivers

Registering the dns_resolver key type

s3c-rtc s3c64xx-rtc: setting system clock to 2000-10-30 06:50:40 UTC (972888640)

VFS: Cannot open root device "ubi0:FriendlyARM-root" or unknown-block(0,0)

Please append a correct "root=" boot option; here are the available partitions:

1f00 512 mtdblock0 (driver?)

1f01 5120 mtdblock1 (driver?)

1f02 2091520 mtdblock2 (driver?)

b300 3829760 mmcblk0 driver: mmcblk

b301 3825664 mmcblk0p1

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

[<c00368cc>] (unwind_backtrace+0x0/0xf4) from [<c049a85c>] (dump_stack+0x18/0x1)

[<c049a85c>] (dump_stack+0x18/0x1c) from [<c049a8c4>] (panic+0x64/0x188)

[<c049a8c4>] (panic+0x64/0x188) from [<c0009024>] (mount_block_root+0x174/0x244)

[<c0009024>] (mount_block_root+0x174/0x244) from [<c0009284>] (prepare_namespac)

[<c0009284>] (prepare_namespace+0x94/0x198) from [<c0008c5c>] (kernel_init+0x11)

[<c0008c5c>] (kernel_init+0x114/0x154) from [<c0031a3c>] (kernel_thread_exit+0x)

step 4: 解决VFS: Cannot open root device "ubi0:FriendlyARM-root" or unknown-block(0,0)的方法

进入linux2.6.36内核

1)vim arch/arm/mach-s3c64xx/mach-smdk6410.c
添加:(如果已有这些程序,对照是否相同,修改不同的地方)

#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <plat/nand.h>

/* Nand flash */
struct mtd_partition mini6410_nand_part[] = {
{
.name
= "Bootloader",
.offset
= 0,
.size
= (4 * 128 *SZ_1K),
.mask_flags= MTD_CAP_NANDFLASH,
},
{
.name
= "Kernel",
.offset
= MTDPART_OFS_APPEND,
.size
= (5*SZ_1M) ,
.mask_flags= MTD_CAP_NANDFLASH,
},
{
.name
= "File System",
.offset
= MTDPART_OFS_APPEND,
.size
= MTDPART_SIZ_FULL,
}
};

static struct s3c2410_nand_set mini6410_nand_sets[] = {
[0] = {
.name = "nand",
.nr_chips = 1,
.nr_partitions = ARRAY_SIZE(mini6410_nand_part),
.partitions = mini6410_nand_part,
},
};

static struct s3c2410_platform_nand mini6410_nand_info = {
.tacls = 25,
.twrph0 = 55,
.twrph1 = 40,
.nr_sets = ARRAY_SIZE(mini6410_nand_sets),
.sets = mini6410_nand_sets,
};

2) 在函数static void __init smdk6410_machine_init(void)()中
添加:
s3c_device_nand.name = "s3c6410-nand";
s3c_nand_set_platdata(&mini6410_nand_info);

3)在结构体static struct platform_device *smdk6410_devices[] __initdata中
添加:
&s3c_device_nand,

[b]4) 添加s3c_nand驱动[/b]
在driver/mtd/nand/目录下,添加s3c_nand.c这个驱动(如果已有对照看是否相同,然后修改不同的地方)

a. s3c_nand.c
cp s3c_nand.c driver/mtd/nand/
@driver/mtd/nand/Makefile line20:
obj-$(CONFIG_MTD_NAND_S3C) += s3c_nand.o
@driver/mtd/nand/Kconfig line230:
config MTD_NAND_S3C
tristate "NAND Flash support for S3C SoC"
depends on (ARCH_S3C64XX || ARCH_S5P64XX || ARCH_S5PC1XX) && MTD_NAND
help
This enables the NAND flash controller on the S3C.

No board specfic support is done by this driver, each board
must advertise a platform_device for the driver to attach.

config MTD_NAND_S3C_DEBUG
bool "S3C NAND driver debug"
depends on MTD_NAND_S3C
help
Enable debugging of the S3C NAND driver

config MTD_NAND_S3C_HWECC
bool "S3C NAND Hardware ECC"
depends on MTD_NAND_S3C
help
Enable the use of the S3C's internal ECC generator when
using NAND. Early versions of the chip have had problems with
incorrect ECC generation, and if using these, the default of
software ECC is preferable.

If you lay down a device with the hardware ECC, then you will
currently not be able to switch to software, as there is no
implementation for ECC method used by the S3C

make menuconfig
Device Driver
--->Memory Technology Device (MTD) support
--->NAND Device Support
--->< > NAND Flash support for Samsung S3C SoCs
[*] S3C NAND driver debug
[*] S3C NAND Hardware ECC
<*> NAND Flash support for S3C SoC

b.regs-nand.h
@arch/arm/plat-samsung/include/plat/regs-nand.h
add:
/* for s3c_nand.c */
#define S3C_NFCONF S3C2410_NFREG(0x00)
#define S3C_NFCONT S3C2410_NFREG(0x04)
#define S3C_NFCMMD S3C2410_NFREG(0x08)
#define S3C_NFADDR S3C2410_NFREG(0x0c)
#define S3C_NFDATA8 S3C2410_NFREG(0x10)
#define S3C_NFDATA S3C2410_NFREG(0x10)
#define S3C_NFMECCDATA0 S3C2410_NFREG(0x14)
#define S3C_NFMECCDATA1 S3C2410_NFREG(0x18)
#define S3C_NFSECCDATA S3C2410_NFREG(0x1c)
#define S3C_NFSBLK S3C2410_NFREG(0x20)
#define S3C_NFEBLK S3C2410_NFREG(0x24)
#define S3C_NFSTAT S3C2410_NFREG(0x28)
#define S3C_NFMECCERR0 S3C2410_NFREG(0x2c)
#define S3C_NFMECCERR1 S3C2410_NFREG(0x30)
#define S3C_NFMECC0 S3C2410_NFREG(0x34)
#define S3C_NFMECC1 S3C2410_NFREG(0x38)
#define S3C_NFSECC S3C2410_NFREG(0x3c)
#define S3C_NFMLCBITPT S3C2410_NFREG(0x40)
#define S3C_NF8ECCERR0 S3C2410_NFREG(0x44)
#define S3C_NF8ECCERR1 S3C2410_NFREG(0x48)
#define S3C_NF8ECCERR2 S3C2410_NFREG(0x4c)
#define S3C_NFM8ECC0 S3C2410_NFREG(0x50)
#define S3C_NFM8ECC1 S3C2410_NFREG(0x54)
#define S3C_NFM8ECC2 S3C2410_NFREG(0x58)
#define S3C_NFM8ECC3 S3C2410_NFREG(0x5c)
#define S3C_NFMLC8BITPT0 S3C2410_NFREG(0x60)
#define S3C_NFMLC8BITPT1 S3C2410_NFREG(0x64)

#define S3C_NFCONF_NANDBOOT (1<<31)
#define S3C_NFCONF_ECCCLKCON (1<<30)
#define S3C_NFCONF_ECC_MLC (1<<24)
#define S3C_NFCONF_ECC_1BIT (0<<23)
#define S3C_NFCONF_ECC_4BIT (2<<23)
#define S3C_NFCONF_ECC_8BIT (1<<23)
#define S3C_NFCONF_TACLS(x) ((x)<<12)
#define S3C_NFCONF_TWRPH0(x) ((x)<<8)
#define S3C_NFCONF_TWRPH1(x) ((x)<<4)
#define S3C_NFCONF_ADVFLASH (1<<3)
#define S3C_NFCONF_PAGESIZE (1<<2)
#define S3C_NFCONF_ADDRCYCLE (1<<1)
#define S3C_NFCONF_BUSWIDTH (1<<0)

#define S3C_NFCONT_ECC_ENC (1<<18)
#define S3C_NFCONT_LOCKTGHT (1<<17)
#define S3C_NFCONT_LOCKSOFT (1<<16)
#define S3C_NFCONT_8BITSTOP (1<<11)
#define S3C_NFCONT_MECCLOCK (1<<7)
#define S3C_NFCONT_SECCLOCK (1<<6)
#define S3C_NFCONT_INITMECC (1<<5)
#define S3C_NFCONT_INITSECC (1<<4)
#define S3C_NFCONT_nFCE1 (1<<2)
#define S3C_NFCONT_nFCE0 (1<<1)
#define S3C_NFCONT_INITECC (S3C_NFCONT_INITSECC | S3C_NFCONT_INITMECC)

#define S3C_NFSTAT_ECCENCDONE (1<<7)
#define S3C_NFSTAT_ECCDECDONE (1<<6)
#define S3C_NFSTAT_BUSY (1<<0)

#define S3C_NFECCERR0_ECCBUSY (1<<31)

c. partitions.h
@include/linux/mtd/partitions.h
add:
int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
int del_mtd_partitions(struct mtd_info *);

经过如上修改,打印信息中有了MTD分区信息,但是报错还是一样,看来还有其它问题。

s3c6400-uart.0: s3c2410_serial0 at MMIO 0x7f005000 (irq = 16) is a S3C6400/10

s3c6400-uart.1: s3c2410_serial1 at MMIO 0x7f005400 (irq = 20) is a S3C6400/10

s3c6400-uart.2: s3c2410_serial2 at MMIO 0x7f005800 (irq = 24) is a S3C6400/10

s3c6400-uart.3: s3c2410_serial3 at MMIO 0x7f005c00 (irq = 28) is a S3C6400/10

S3C NAND Driver, (c) 2008 Samsung Electronics

S3C NAND Driver is using hardware ECC.

NAND device: Manufacturer ID: 0xec, Chip ID: 0xd5 (Samsung NAND 2GiB 3,3V 8-bit)

Creating 3 MTD partitions on "NAND 2GiB 3,3V 8-bit":

0x000000000000-0x000000080000 : "Bootloader"

0x000000080000-0x000000580000 : "Kernel"

0x000000580000-0x000080000000 : "File System"

PPP generic driver version 2.4.2

....... ....... ........ ........

VFS: Cannot open root device "ubi0:FriendlyARM-root" or unknown-block(0,0)

Please append a correct "root=" boot option; here are the available partitions:

1f00 512 mtdblock0 (driver?)

1f01 5120 mtdblock1 (driver?)

1f02 2091520 mtdblock2 (driver?)

b300 3829760 mmcblk0 driver: mmcblk

b301 3825664 mmcblk0p1

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

[<c00368cc>] (unwind_backtrace+0x0/0xf4) from [<c049a85c>] (dump_stack+0x18/0x1)

[<c049a85c>] (dump_stack+0x18/0x1c) from [<c049a8c4>] (panic+0x64/0x188)

[<c049a8c4>] (panic+0x64/0x188) from [<c0009024>] (mount_block_root+0x174/0x244)

[<c0009024>] (mount_block_root+0x174/0x244) from [<c0009284>] (prepare_namespac)

[<c0009284>] (prepare_namespace+0x94/0x198) from [<c0008c5c>] (kernel_init+0x11)

[<c0008c5c>] (kernel_init+0x114/0x154) from [<c0031a3c>] (kernel_thread_exit+0x)



5)添加对UBIFS文件系统的支持

第一、什么是ubifs?

由IBM、nokia工程师Thomas Gleixner,Artem Bityutskiy等人于2006年发起,致力于开发性能卓越、扩展性高的FLASH专用文件系统,以解决当前嵌入式环境下以FLASH作为MTD设备使用时的技术瓶颈。

第二、为何使用ubifs?

第三、如何得到ubifs?

2.6.22以后,ubifs活跃于git管理工程中:

git://git.infradead.org/ubi-2.6.git

2.6.27以后,ubifs被整合进内核树中,用户只需下载最新内核即可获取ubifs支持。

第四、如何使用ubifs?。

make menuconfig
Device Drivers --->
<*> Memory Technology Device (MTD) support --->
<*> Enable UBI - Unsorted block images --->

File systems --->
[*] Miscellaneous filesystems --->
<*> UBIFS file system support
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐