Increase U-boot support for ubi

Source: Internet
Author: User

 

Address: http://blog.csdn.net/yuanlulu/archive/2010/08/31/5853676.aspx

 

Recently, U-boot needs to support UBI to easily download the ubi root file system.

Refer to online articles.

Software Version:
Linux Kernel: 2.6.27.8
U-boot: 201006
Lzo: LZO-2.03
Zlib: zlib-1.2.5
MTD-utils: mtd-utils-20090606

I'm using the smartarm3250 Development Board, first porting the u-boot-1.3.3 provided by the development board to the u-boot-201006. Because the old version of U-boot does not support ubifs, of course U-boot is transplanted first.

Then CD u-boot-2010.06/
Modify include/configs/smartarm3250.h

(1) Add the following macro definitions:
# If 1
# Define mtdids_default "nand0 = nandflash0"
// Define the default partition, which should be the same as the Linux kernel partition you are using, and do not skip any unused areas (for example, My Params partition actually only has 256 kb, it is followed by a reserved area of K. Since the offset of the subsequent partition is calculated based on the size of the previous partition, I merge the reserved partition into Params ). My partitions have five numbers ranging from 0 ~ 4.
# Define mtdparts_default "mtdparts = nandflash0:" 1536 K (bootloder )"/
"512 K (Params )"/
"4 m (kernel )"/
"16 m (safefs )"/
"-(Root )"
# Endif // end of YLL

# If 1 // YLL: ubi support
# Define config_mtd_device 1
# Define config_mtd_partitions 1
# Define config_assist_mtdparts
# Define config_cmd_ubifs
# Define config_assist_ubi
# Define config_lzo 1
# Define config_rbtree 1
# Endif // end of YLL

(2) modify the parameters passed to the Linux Kernel
# Define config_bootargs "Ubi. MTD = 4 root = ubi0: rootfs console = ttys0, 115200 mem = 64 m rootfstype = ubifs RW"
UBI In the last partition (the fourth partition), the root file system type is ubifs.

(3) modify the upper limit of malloc Space
# Define config_sys_malloc_len (1024*1024)
It turns out that the config_sys_malloc_len size must be at least 1 MB (1024*1024); otherwise, U-boot will report error 12.
By the way, the U-boot error code is defined in include/ASM-generic/error. h. The definition of error 12 is "# define enomem 12/* out of memory */". The memory is insufficient.

(4) ensure that config_mtd_nand_verify_write is not defined
If this macro is defined, comment out the Macro. Otherwise, error 5 (I/O error) may occur ).
In:
I get "ubi_io_write: Error-5 while writing 512 bytes to peb"
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.
Although Linux Kernel configuration is used, config_mtd_nand_verify_write is also available in U-boot. comment out the macro in smartarm3250.h to solve the problem. It seems to be a kernel problem. Since U-boot uses the Linux kernel driver to a large extent, it should be a ubi driver problem.

All right, I have made so many modifications to U-boot, and all the modifications are included in include/configs/smartarm3250.h.

You also need to modify the Kernel configuration.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.