您的位置:首页 > 编程语言 > PHP开发

关于mini2440无法启动yaffs2的问题

2016-03-16 20:21 639 查看
     为了可以更好的说明问题,我把我的所有启动信息都贴了出来,有点长,见谅!

     之前也是碰到这个问题,跟着人家的视频一点一点做,结果人家的正常启动,我的却停在这里了,网上一搜,好家伙,好多朋友都出现过这个问题,但是解决的方法都各不相同我也说说我的吧,虽然好简单,好傻,但也希望为这个圈子奉献一点经验吧,希望和我一样的小菜鸟们可以节约时间做更多的事,等有时间再把一些解决方案都整理下,供大家参考,废话不说了,看信息:

Booting Linux ...

NAND read: device 0 offset 0x60000, size 0x400000

Reading data from 0x45f800 -- 100% complete.

 4194304 bytes read: OK

## Booting image at 30007fc0 ...

   Image Name:   Linux-2.6.22

   Created:      2016-03-13  11:48:29 UTC

   Image Type:   ARM Linux Kernel Image (uncompressed)

   Data Size:    1849484 Bytes =  1.8 MB

   Load Address: 30008000

   Entry Point:  30008000

   Verifying Checksum ... OK

   XIP Kernel Image ... OK

Starting kernel ...

Uncompressing Linux...................................................................................................................... done, booting the kernel.

Linux version 2.6.22 (root@bogon) (gcc version 3.4.5) #1 Sun Mar 13 04:48:19 PDT 2016

CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177

Machine: SMDK2440

Memory policy: ECC disabled, Data cache writeback

CPU S3C2440A (id 0x32440001)

S3C244X: core 400.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz

S3C24XX Clocks, (c) 2004 Simtec Electronics

CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on

CPU0: D VIVT write-back cache

CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets

CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets

Built 1 zonelists.  Total pages: 16256

Kernel command line: root=/dev/mtdblock3 init=linuxrc rw console=ttySAC0,115200

irq: clearing subpending status 00000003

irq: clearing subpending status 00000002

PID hash table entries: 256 (order: 8, 1024 bytes)

timer tcon=00500000, tcnt a2c1, tcfg 00000200,00000000, usec 00001eb8

Console: colour dummy device 80x30

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)

Memory: 64MB = 64MB total

Memory: 60976KB available (3256K code, 467K data, 140K init)

Mount-cache hash table entries: 512

CPU: Testing write buffer coherency: ok

NET: Registered protocol family 16

S3C2410 Power Management, (c) 2004 Simtec Electronics

S3C2440: Initialising architecture

S3C2440: IRQ Support

S3C2440: Clock Support, DVS off

S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics

DMA channel 0 at c4800000, irq 33

DMA channel 1 at c4800040, irq 34

DMA channel 2 at c4800080, irq 35

DMA channel 3 at c48000c0, irq 36

SCSI subsystem initialized

usbcore: registered new interface driver usbfs

usbcore: registered new interface driver hub

usbcore: registered new device driver usb

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 2048 (order: 2, 16384 bytes)

TCP bind hash table entries: 2048 (order: 1, 8192 bytes)

TCP: Hash tables configured (established 2048 bind 2048)

TCP reno registered

NetWinder Floating Point Emulator V0.97 (double precision)

Registering GDB sysrq handler

JFFS2 version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.

yaffs Mar 13 2016 04:46:16 Installing. 

io scheduler noop registered

io scheduler anticipatory registered (default)

io scheduler deadline registered

io scheduler cfq registered

Console: switching to colour frame buffer device 30x40

fb0: s3c2410fb frame buffer device

lp: driver loaded but no devices found

ppdev: user-space parallel port driver

S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics

Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled

s3c2440-uart.0: s3c2410_serial0 at MMIO map 0x50000000 mem 0xf0400000 (irq = 70) is a S3C2440

s3c2440-uart.1: s3c2410_serial1 at MMIO map 0x50004000 mem 0xf0404000 (irq = 73) is a S3C2440

s3c2440-uart.2: s3c2410_serial2 at MMIO map 0x50008000 mem 0xf0408000 (irq = 76) is a S3C2440

RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize

loop: module loaded

cs89x0:cs89x0_probe(0x0)

cs89x0: no cs8900 or cs8920 detected.  Be sure to disable PnP with SETUP

dm9000 Ethernet Driver

eth%d: Invalid ethernet MAC address.  Please set using ifconfig

Now use the default MAC address: 08:90:90:90:90:90

eth0: dm9000 at c486a000,c486c004 IRQ 51 MAC: 08:90:90:90:90:90

Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2

ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx

S3C24XX NAND Driver, (c) 2004 Simtec Electronics

s3c2440-nand s3c2440-nand: Tacls=3, 30ns Twrph0=7 70ns, Twrph1=3 30ns

NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)

Scanning device for bad blocks

Bad eraseblock 440 at 0x03700000

Bad eraseblock 619 at 0x04d60000

Bad eraseblock 850 at 0x06a40000

Bad eraseblock 878 at 0x06dc0000

Bad eraseblock 1001 at 0x07d20000

Bad eraseblock 1023 at 0x07fe0000

Bad eraseblock 1235 at 0x09a60000

Bad eraseblock 1356 at 0x0a980000

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

0x00000000-0x00200000 : "kernel"

0x00200000-0x00a00000 : "jffs2"

0x00a00000-0x10000000 : "yaffs"

s3c2410-ohci s3c2410-ohci: S3C24XX OHCI

s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1

s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000

usb usb1: configuration #1 chosen from 1 choice

hub 1-0:1.0: USB hub found

hub 1-0:1.0: 2 ports detected

Initializing USB Mass Storage driver...

usbcore: registered new interface driver usb-storage

USB Mass Storage support registered.

mice: PS/2 mouse device common for all mice

S3C24XX RTC, (c) 2004,2006 Simtec Electronics

s3c2440-i2c s3c2440-i2c: slave address 0x10

s3c2440-i2c s3c2440-i2c: bus frequency set to 390 KHz

s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter

mapped channel 0 to 0

s3c2440-sdi s3c2440-sdi: powered down.

s3c2440-sdi s3c2440-sdi: initialisation done.

s3c2440-sdi s3c2440-sdi: running at 0kHz (requested: 0kHz).

s3c2440-sdi s3c2440-sdi: running at 196kHz (requested: 195kHz).

s3c2440-sdi s3c2440-sdi: running at 196kHz (requested: 195kHz).

s3c2440-sdi s3c2440-sdi: running at 196kHz (requested: 195kHz).

usbcore: registered new interface driver hiddev

s3c2440-sdi s3c2440-sdi: CMD[TIMEOUT] #2 op:UNKNOWN(8) arg:0x000001aa flags:0x0875 retries:0 Status:nothing to complete

s3c2440-sdi s3c2440-sdi: CMD[TIMEOUT] #3 op:APP_CMD(55) arg:0x00000000 flags:0x0875 retries:0 Status:nothing to complete

usbcore: registered new interface driver usbhid

drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver

TCP cubic registered

NET: Registered protocol family 1

s3c2440-sdi s3c2440-sdi: CMD[TIMEOUT] #4 op:APP_CMD(55) arg:0x00000000 flags:0x0875 retries:0 Status:nothing to complete

s3c2440-sdi s3c2440-sdi: CMD[TIMEOUT] #5 op:APP_CMD(55) arg:0x00000000 flags:0x0875 retries:0 Status:nothing to complete

s3c2440-sdi s3c2440-sdi: CMD[TIMEOUT] #6 op:APP_CMD(55) arg:0x00000000 flags:0x0875 retries:0 Status:nothing to complete

s3c2440-sdi s3c2440-sdi: CMD[TIMEOUT] #7 op:ALL_SEND_OCR(1) arg:0x00000000 flags:0x0861 retries:0 Status:nothing to complete

drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.

s3c2440-sdi s3c2440-sdi: powered down.

VFS: Cannot open root device "mtdblock3" or unknown-block(2,0)

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

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

    如上边的红色的错误提醒,身为菜鸟的我,看着这个信息完全懵了,什么跟什么嘛,跟人一步一步抄下来的,我的为什么不对呢,网上的所有解决方案基本都看了一遍,没想法 了,完全不行,因为是烧录yaffs2后才这样,首先就先去看busybox做的对不对,看了几遍,又去对比config,还是不行,看到网上好多朋友都是这样,没方向,我也快要放弃了,但是身为屌丝的我深知这个搞不定,这辈子还能干啥,继续吧,于是乎抛开视频,抛开百度,自己看吧

    先看错误提示,Cannot open root device "mtdblock3",无法打开mtdblock3,但是我明明有创建啊,就是yaffs2的文件系统啊,这就说明文件系统没有被挂载,也就不会是yaffs2制作的问题,前边就是kernel和u-boot了,往前看启动信息吧,别说,还真看出写问题

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

0x00000000-0x00200000 : "kernel"

0x00200000-0x00a00000 : "jffs2"

0x00a00000-0x10000000 : "yaffs"

    什么意思3个分区?还有个jffs2,这是个什么东西,来客串什么的而且为什么只有3个分区,0~3应该是4个分区啊,难怪找不到mtdblock3,修改分区去吧,在哪修改,如何修改呢,先看u-boot中的定义一般在u-boot/include/configs/xxx.h
也就是你的开发板对于的.h文件入什么s3c2440.h等,里边有如下一句话

#define MTDPARTS_DEFAULT "mtdparts=nandflash0:256k@0(bootloader)," \

                            "128k(params)," \

                            "4m(kernel)," \

                            "-(root)"

看,这就是我们告诉u-boot,我们这个nand flash的分区定义,但是这只是我们告诉u-boot的,用于u-boot在下载内核和文件系统时用的,但是真正的分区是不是这样呢?不一定,真正说了算的是人家内核,所以还要求人家内核也要这么定义才行,所以根据u-boot中定义的分区修改内核中的nand分区,在arch/arm/plat-s3c24xx(你自己的arm)/common-smdk.c中,看

static struct mtd_partition smdk_default_nand_part[] = {

        [0] = {

        .name   = "kernel",

        .size   = SZ_2M,

                .offset = 0,

        },

        [1] = {

        .name   = "jffs2",

        .offset = MTDPART_OFS_APPEND,  

        .size   = SZ_8M,

        },

        [2] = {

        .name   = "yaffs",

        .offset = MTDPART_OFS_APPEND,   

        .size   = MTDPART_SIZ_FULL,

        }

};
修改前是这样子的,所以即使u-boot的配置对了没用,内核不高兴,人家内核说了算的东西凭什么你和u-boot就觉得完了呢,那就报错吧,你难受去吧……

所有修改他

static struct mtd_partition smdk_default_nand_part[] = {

        [0] = {

        .name   = "bootloader",

        .size   = SZ_256K,

        .offset = 0,

        },

        [1] = {

        .name   = "params",

        .offset = MTDPART_OFS_APPEND,

        .size   = SZ_128K,

        },

        [2] = {

        .name   = "kernel",

        .offset = MTDPART_OFS_APPEND,

        .size   = SZ_2M,

        },

        [3] = {

        .name   = "yaffs",

        .offset = MTDPART_OFS_APPEND,

        .size   = MTDPART_SIZ_FULL,

        }

};

重新编译内核,烧写,ok啦!

对于有基础的朋友,这个问题太菜了,是的我也觉得,所以以后遇到问题不要依赖视频,还是自己看看启动信息再去问吧……

开开心心的等着启动文件系统,结果又是一盆冷水……

UDF-fs: No VRS found

yaffs: dev is 32505859 name is "mtdblock3"

yaffs: passed flags ""

yaffs: Attempting MTD mount on 31.3, "mtdblock3"

yaffs: auto selecting yaffs2

block 422 is bad

block 601 is bad

block 832 is bad

block 860 is bad

block 983 is bad

block 1005 is bad

block 1217 is bad

block 1338 is bad

VFS: Mounted root (yaffs filesystem).

Freeing init memory: 140K
Warning: 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.

天哪,我一个小菜鸟得罪哪路神仙了,哎,继续吧。看着人家视频中跑得那么欢快,直接删掉,就是这么任性!!

但是这个真没有头绪,至少yaffs2挂着上了,说明内核和u-boot应该没问题了(嗯,至少我这么认为的),那么问题就应该出在yaffs2文件系统了,但是就这么几步,而且几乎不需要改动什么,不会是配置上出错的,还是求助百度吧(谁让咱们google不能用呢),结果发现好像是只做yaffs2的工具有问题,因为友善之臂提供的mkyaffs2image-128M只能用在fedora
9下,而我用的是redhat6,应为该工具在redhat下货有浮点运算问题,所以编译出的文件系统也是有问题的,于是乎看到了这个哥们儿的文章http://www.arm9home.net/read.php?tid=3919,里边提供了redhat的mkyaffs2image,下载源码,编译,烧写,成功启动!!!感谢这位哥们儿的分享,同时也证明了,别人给的东西只能信一半,还是要靠自己的,有了大概的印象,下一步准备自己修改u-boot,内核了,小的成功也算是给自己一点信息,至少以后遇到问题有信心迎着困难走下去.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息