移植uboot、内核出现的问题
2012-05-03 16:26
381 查看
UBIFS error (pid 446): ubifs_read_node: bad node type (255 but expected 1)
UBIFS error (pid 446): ubifs_read_node: bad node at LEB 47:99616
UBIFS error (pid 446): do_readpage: cannot read page 0 of inode 317, error -22
/bin/ash: ./fruidemo: Input/output error
#
#
看到这种UBI的错误,我就心慌!还是自己对UBI的文件系统太不了解了!
下面是网上找的一篇移植过程中出错的,解决办法,写的挺详细,转来看看!
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
自己最近在移植u-boot.201006到smartarm3250,后来又增加了ubi文件系统的移植。
移植过程中遇到N多问题,自己搞了N久才搞定。在此分享一下自己的错误,希望对各位同仁有用。
(1)u-boot启动后提示“*** Warning - bad CRC or NAND, using default environment”
这一般不是大问题,不理它也没事。它是提醒你在falsh中读不到环境变量,只能使用软件中定义的默认环境变量。如果要解决,只要在u-boot中输入saveenv就行了,下次启动应该不会再出现了,如果还出现,可能是你的nand驱动有问题,也可能是坏块。
u-boot默认使用flash中的环境变量,如果软件中修改了环境变量,最好saveenv一次。
(2)u-boot的12号错误。
这是我加入ubi支持后出现的错误。
UBI error: ubi_init: UBI error: cannot initialize UBI, error -12
UBI init error -12
查 阅include/asm-generic/error.h发现12号错误的定义为“#define ENOMEM 12 /* Out of memory */”。经过追踪,是在driver/mtd/ubi/build.c的ubi_attach_mtd_dev函数中第二次 vmalloc时死掉,因此修改smartarm3250.h(我的配置文件)中CONFIG_SYS_MALLOC_LEN,增大到 1M(1024*1024)。问题解决。
(3)u-boot的5号错误。
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 0:512, written 0 bytes
查阅include/asm-generic/error.h发现5号错误的定义为“#define EIO 5 /* I/O error */”。
在http://www.linux-mtd.infradead.org/faq/ubi.html#L_subpage_verify_fail有对这个问题的专门描述:
I get "ubi_io_write: error -5 while writing 512 bytes to PEB 5:512"
If you have a 2048 bytes per NAND page device, and have CONFIG_MTD_NAND_VERIFY_WRITE enabled in your kernel, you will need to turn it off. The code does not currently (as of 2.6.26) perform verification of sub-page writes correctly. As UBI is one of the few
users of sub-page writes, not much else seems to be affected by this bug.
虽然是说Linux内核配置,可是u-boot中同样有CONFIG_MTD_NAND_VERIFY_WRITE ,在smartarm3250.h中将这个宏注释掉,问题解决。看来是内核的问题,既然u-boot很大程度上使用了Linux内核的驱动,应该是ubi 驱动的问题。
(4)Cannot start volume update。
在common/cmd_ubi.c中的ubi_volume_write函数中找到打印这句话的地方,打印err发现仍然为12号错误。解决办法在上面第2条。
(5)启动时内核打印出ubi的19号错误(NO SUCH DEVICE)。
也就是内核找不到某个分区,一般应该是u-boot中定义的CONFIG_BOOTARGS不对。
我的正确定义是
#define CONFIG_BOOTARGS "ubi.mtd=4 root=ubi0:rootfs console=ttyS0,115200 mem=64M rootfstype=ubifs rw"
原来的错误写法是#define CONFIG_BOOTARGS "ubi.mtd=6 root=ubi0:rootfs console=ttyS0,115200 mem=64M rootfstype=ubifs rw"。其实原因在于u-boot对nand falsh的分区方式和你所用的Linux内核不一致 。
我的u-boot定义的分区如下:
#if 1
#define MTDIDS_DEFAULT "nand0=nandflash0"
#define MTDPARTS_DEFAULT "mtdparts=nandflash0:"1536k(bootloder)"\
"512k(params)"\
"4m(kernel)"\
"16m(safefs)"\
"-(root)"
#endif //end of yll
(6)linux内核启动时输出以下信息,并停住:
UBIFS error (pid 1): ubifs_read_node: bad node type (0 but expected 6)
UBIFS error (pid 1): ubifs_read_node: bad node at LEB 0:0
List of all partitions:
1f00 1536 mtdblock0 (driver?)
1f01 256 mtdblock1 (driver?)
1f02 4096 mtdblock2 (driver?)
1f03 16384 mtdblock3 (driver?)
1f04 239616 mtdblock4 (driver?)
No filesystem could mount root, tried: ubifs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
这个问题是由于写入命令错误引起的,原来的写入命令为ubi write 0x01600000 rootfs $(filesize),应该为ubi write 0x080008000 rootfs $(filesize)。
也就是说原来根本没有把文件系统写入flash。
如果你也有此类错误,要么是你的文件系统镜像没有写入(或者没正确写入),要么是你做的文件系统镜像有问题。其他问题可能不大。
(7)软件版本问题。
linux内核启动过程中出现以下信息并停住:
UBIFS error (pid 1): ubifs_check_node: bad CRC: calculated 0x9f186f96, read 0x3baee010
UBIFS error (pid 1): ubifs_check_node: bad node at LEB 0:0
UBIFS error (pid 1): ubifs_read_node: expected node type 6
VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0)
Please append a correct "root=" boot option; here are the available partitions:
1f00 1536 mtdblock0 (driver?)
1f01 256 mtdblock1 (driver?)
1f02 4096 mtdblock2 (driver?)
1f03 16384 mtdblock3 (driver?)
1f04 239616 mtdblock4 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
我的文件系统镜像使用mtd-utils2010做的,我后来改为mtd-utils2009,问题解决。
我的内核版本是2.6.27.8。我猜测因为我的内核版本比较旧,所以内核和mtd-utils2010中的crc算法有差异才会出现bad CRC。
如果你也碰到类似问题,请确保内核版本和mtd-utils版本匹配。看是否匹配只要看内核和mtd-utils是不是一年出的就行,或者时间接近。总之,两个出现时间较远的软件协同工作会有可能出错。
mtd-utils下载地址 http://ftp.debian.org/pool/main/m/mtd-utils/ (下载orig.tar.gz结尾的包)
UBIFS error (pid 446): ubifs_read_node: bad node at LEB 47:99616
UBIFS error (pid 446): do_readpage: cannot read page 0 of inode 317, error -22
/bin/ash: ./fruidemo: Input/output error
#
#
看到这种UBI的错误,我就心慌!还是自己对UBI的文件系统太不了解了!
下面是网上找的一篇移植过程中出错的,解决办法,写的挺详细,转来看看!
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
自己最近在移植u-boot.201006到smartarm3250,后来又增加了ubi文件系统的移植。
移植过程中遇到N多问题,自己搞了N久才搞定。在此分享一下自己的错误,希望对各位同仁有用。
(1)u-boot启动后提示“*** Warning - bad CRC or NAND, using default environment”
这一般不是大问题,不理它也没事。它是提醒你在falsh中读不到环境变量,只能使用软件中定义的默认环境变量。如果要解决,只要在u-boot中输入saveenv就行了,下次启动应该不会再出现了,如果还出现,可能是你的nand驱动有问题,也可能是坏块。
u-boot默认使用flash中的环境变量,如果软件中修改了环境变量,最好saveenv一次。
(2)u-boot的12号错误。
这是我加入ubi支持后出现的错误。
UBI error: ubi_init: UBI error: cannot initialize UBI, error -12
UBI init error -12
查 阅include/asm-generic/error.h发现12号错误的定义为“#define ENOMEM 12 /* Out of memory */”。经过追踪,是在driver/mtd/ubi/build.c的ubi_attach_mtd_dev函数中第二次 vmalloc时死掉,因此修改smartarm3250.h(我的配置文件)中CONFIG_SYS_MALLOC_LEN,增大到 1M(1024*1024)。问题解决。
(3)u-boot的5号错误。
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 0:512, written 0 bytes
查阅include/asm-generic/error.h发现5号错误的定义为“#define EIO 5 /* I/O error */”。
在http://www.linux-mtd.infradead.org/faq/ubi.html#L_subpage_verify_fail有对这个问题的专门描述:
I get "ubi_io_write: error -5 while writing 512 bytes to PEB 5:512"
If you have a 2048 bytes per NAND page device, and have CONFIG_MTD_NAND_VERIFY_WRITE enabled in your kernel, you will need to turn it off. The code does not currently (as of 2.6.26) perform verification of sub-page writes correctly. As UBI is one of the few
users of sub-page writes, not much else seems to be affected by this bug.
虽然是说Linux内核配置,可是u-boot中同样有CONFIG_MTD_NAND_VERIFY_WRITE ,在smartarm3250.h中将这个宏注释掉,问题解决。看来是内核的问题,既然u-boot很大程度上使用了Linux内核的驱动,应该是ubi 驱动的问题。
(4)Cannot start volume update。
在common/cmd_ubi.c中的ubi_volume_write函数中找到打印这句话的地方,打印err发现仍然为12号错误。解决办法在上面第2条。
(5)启动时内核打印出ubi的19号错误(NO SUCH DEVICE)。
也就是内核找不到某个分区,一般应该是u-boot中定义的CONFIG_BOOTARGS不对。
我的正确定义是
#define CONFIG_BOOTARGS "ubi.mtd=4 root=ubi0:rootfs console=ttyS0,115200 mem=64M rootfstype=ubifs rw"
原来的错误写法是#define CONFIG_BOOTARGS "ubi.mtd=6 root=ubi0:rootfs console=ttyS0,115200 mem=64M rootfstype=ubifs rw"。其实原因在于u-boot对nand falsh的分区方式和你所用的Linux内核不一致 。
我的u-boot定义的分区如下:
#if 1
#define MTDIDS_DEFAULT "nand0=nandflash0"
#define MTDPARTS_DEFAULT "mtdparts=nandflash0:"1536k(bootloder)"\
"512k(params)"\
"4m(kernel)"\
"16m(safefs)"\
"-(root)"
#endif //end of yll
(6)linux内核启动时输出以下信息,并停住:
UBIFS error (pid 1): ubifs_read_node: bad node type (0 but expected 6)
UBIFS error (pid 1): ubifs_read_node: bad node at LEB 0:0
List of all partitions:
1f00 1536 mtdblock0 (driver?)
1f01 256 mtdblock1 (driver?)
1f02 4096 mtdblock2 (driver?)
1f03 16384 mtdblock3 (driver?)
1f04 239616 mtdblock4 (driver?)
No filesystem could mount root, tried: ubifs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
这个问题是由于写入命令错误引起的,原来的写入命令为ubi write 0x01600000 rootfs $(filesize),应该为ubi write 0x080008000 rootfs $(filesize)。
也就是说原来根本没有把文件系统写入flash。
如果你也有此类错误,要么是你的文件系统镜像没有写入(或者没正确写入),要么是你做的文件系统镜像有问题。其他问题可能不大。
(7)软件版本问题。
linux内核启动过程中出现以下信息并停住:
UBIFS error (pid 1): ubifs_check_node: bad CRC: calculated 0x9f186f96, read 0x3baee010
UBIFS error (pid 1): ubifs_check_node: bad node at LEB 0:0
UBIFS error (pid 1): ubifs_read_node: expected node type 6
VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0)
Please append a correct "root=" boot option; here are the available partitions:
1f00 1536 mtdblock0 (driver?)
1f01 256 mtdblock1 (driver?)
1f02 4096 mtdblock2 (driver?)
1f03 16384 mtdblock3 (driver?)
1f04 239616 mtdblock4 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
我的文件系统镜像使用mtd-utils2010做的,我后来改为mtd-utils2009,问题解决。
我的内核版本是2.6.27.8。我猜测因为我的内核版本比较旧,所以内核和mtd-utils2010中的crc算法有差异才会出现bad CRC。
如果你也碰到类似问题,请确保内核版本和mtd-utils版本匹配。看是否匹配只要看内核和mtd-utils是不是一年出的就行,或者时间接近。总之,两个出现时间较远的软件协同工作会有可能出错。
mtd-utils下载地址 http://ftp.debian.org/pool/main/m/mtd-utils/ (下载orig.tar.gz结尾的包)
相关文章推荐
- u-boot移植随笔:关于u-boot引导内核出现“Error: unrecognized/unsupported machine ID (r1 = 0x33f4fee8)”的问题
- Linux内核移植过程中出现RTC驱动问题
- u-boot移植中出现的问题
- 内核移植时出现问题Failed to execute /linuxrc. Attempting defaults...
- Uboot学习:移植Uboot出现的问题以及解决
- mpc5121ads内核移植可能出现的问题
- 解决Ubuntu编译内核uImage出现问题“mkimage” command not found - U-Boot images will not be built问题
- 解决Ubuntu编译内核uImage出现问题“mkimage” command not found - U-Boot
- linux 解决Ubuntu编译内核uImage出现问题“mkimage” command not found - U-Boot images will not be built问题
- 解决Ubuntu编译内核uImage出现问题“mkimage” command not found - U-Boot
- u-boot移植出现的问题
- 解决ubuntu编译内核uImage出现问题"mkimage" command not found - U-Boot images will not be built问题
- 移植linux内核到s3c6410(板子u-boot网口link-down问题解决)
- 解决Ubuntu编译内核uImage出现问题“mkimage” command not found - U-Boot images will not be built问题
- 解决Ubuntu编译内核uImage出现问题“mkimage” command not found - U-Boot images will not be built问题
- S3C2440上移植内核之编译Linux2.6.31出现问题
- 移植linux内核到s3c6410(板子u-boot网口link-down问题解决)
- U-BOOT移植问题小结
- c#程序移植到其他电脑上连接数据库出现问题无法运行 最好有个实例 改怎么办
- u-boot-1.3.4移植问题点(一)