原文地址: http://blog.csdn.net/yuanlulu/archive/2010/08/31/5853676.aspx
最近需要让u-boot支持ubi,方便下载ubi根文件系统。
由于参照网上的文章http://blog.chinaunix.net/u3/96428/showart_2275685.html做还是有一些错误,所以总结一下自己的移植。
我使用的是smartarm3250开发板,首先移植开发板提供的u-boot-1.3.3到u-boot-201006。因为旧版本的u-boot不支持ubifs,当然是先移植u-boot了。
然后 cd u-boot-2010.06/
修改 include/configs/smartarm3250.h
(1)增加以下宏定义:
(2)修改传给Linux内核的参数
(3)修改malloc空间上限
(4)保证没有定义CONFIG_MTD_NAND_VERIFY_WRITE
如果定义了这个宏,请注释掉,否则会有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驱动的问题。
好了,我对u-boot的修改就这么多,而且所有的修改都在include/configs/smartarm3250.h中。
下面还需要修改内核配置。