Ubifs file system production process & problems encountered and solutions Summary-3 "ubifs image Production & burning"

Source: Internet
Author: User

I. Porting Environment

HOST: vmware-redhat5

§ Development Board: mini2440 -- 256 MB nandflash

§ Kernel: 2.6.29
Compiler: arm-linux-gcc-4.3.2.tgz

§ Uboot: u-boot-2008.10

 

Ii. Create an ubifs Image

Step 1: to make the file system into a ubifs image file, you need to use the mkfs. ubifs tool, which can be obtained after the MTD-utils toolkit source code compilation at: http://git.infradead.org/mtd-utils.git.

Install the following two software in the system before installing MTD-utils:

(Because I have read some blog posts for the address are not accessible, so I had to follow the name of the East and the West, and the compilation errors cannot be solved. I would like to remind you that I will look back later, in my previous file system, I found the following three compiled ubifs command tools that can be successfully generated (now available in my resources for you). Please feel free to download them)

 

A. Install libacl (in my resources): http://download.csdn.net/detail/yx_l128125/4243336

Input command: rpm-IVH libacl-2.2.23-5.4.e14.i386.rpm

B. Install lzo-2.05 (in my resources): http://download.csdn.net/detail/yx_l128125/4243343

Run the following command:

# Tar zxvf lzo-2.05.tar.gz

# Cd lzo-2.05

#./Configure

# Make

# Make install

C. Install mtd-utils.tar.gz (in my resources): http://download.csdn.net/detail/yx_l128125/4243333

# Tar zxvf mtd-utils.tar.gz

# Cd MTD-utils

#./Configur

# Make

# Make install

 

Step 2. after using the preceding installation command, mkfs. ubifs is installed in the/usr/local/usr/sbin directory. Run the following command: Export Path = $ path: /usr/local/usr/sbin include the path into the environment variable,

Then run the command: mkfs. ubifs-M 2048-C 2048-e 126976-r/nfsroot/rootfs-O rootfs. bin: Create the root file system directory rootfs as the ubifs image file rootfs. bin, copy the file to the/tftpboot/directory and wait for download and writing. (Note: Where do you execute this command? The generated. Bin image is generated in the current directory where the command is executed)

[Note: 1. The command parameters used in the above ubifs image file are based on the NAND
Flash to determine, my NAND Flash capacity is 256 MB, can adapt to the command: mkfs. ubifs
-H to view the meaning of each command option. Here I will briefly introduce it:

-R: Path of the root file system to be created as an image

-M: The minimum I/O operation size (that is, the NAND
The size of a page in Flash)

-E: size of the logically erased Block

-P: size of the physically erased Block

-C: Maximum number of logically erased Blocks

-O: name of the final root file Image

Note: 2. I used mkfs. ubifs-M 2048-C 2048-e 126976.
-R/nfsroot/rootfs-O rootfs. bin to make the image, the kernel startup error, I used to error phenomenon: http://www.arm9home.net/read.php? Tid-19717.html but this error message is printed when kernel startup is found:

UBI error: validate_ec_hdr: Bad vid header offset 512, expected 2048
UBI error: validate_ec_hdr: Bad EC Header
UBI error: ubi_io_read_ec_hdr: Validation failed for peb 556
UBI error: ubi_init: cannot attach mtd3
UBI error: ubi_init: ubi error: Cannot initialize ubi, error-22
Later found a similar solution: http://blog.chinaunix.net/space.php? Uid = 20632682 & Do = Blog & id = 82414 according to this post, the kernel is successfully started.

I still don't know why "-e 126976" is not the "-e 129024" written by most ubifs file systems. If you know this, please let me know. I am very grateful !]

 

Step 3. Burn the H-JTAG into norflash through jlink or u-boot.bin, then connect the serial line and network cable, start the development board from norflash.

Step 4. Set environment variables related to the network. The focus is to set ipaddr and serverip (because the TFTP protocol is used for downloading) and then use the SAV command to save the environment variables;

Use the command: TFTP 31000000 u-boot.bin
Download the uboot. BIN file to the memory address 31000000.

Step 5: run the NAND erase 0 60000 command to erase the first 0x60000 bytes of the NAND Flash. Run the following command: NAND write 31000000.
0 60000, the memory 31000000 u-boot.bin burned to the NAND Flash.

Step 6: run the command: TFTP 31000000 uimage and run the command: NAND erase 80000 300000 to erase the kernel partition of NAND Flash. Run the command: Nand
Write 31000000 80000 300000, write the uimage at 31000000 of the memory to the NAND Flash.

Step 7: Use the command mtdparts default to partition the NAND flash with the default partition. Run the NAND erase root command to erase the root partition. Command: ubi
Part root 2048, activate the root partition for ubi formatting. Finally, run the command ubi create rootfs to create a rootfs partition.

[Note: I used the command: ubi part root to activate the root partition for ubi formatting, but the kernel startup error message (see the red part), so according to this blog http://blog.chinaunix.net/space.php? Uid = 20632682 & Do = Blog & id = 82414 changed to: ubi
No error is reported after part root 2048.

UBI error: validate_ec_hdr: Bad vid header offset 512, expected 2048
UBI error: validate_ec_hdr: Bad EC Header
UBI error: ubi_io_read_ec_hdr: Validation failed for peb 556
UBI error: ubi_init: cannot attach mtd3
UBI error: ubi_init: ubi error: Cannot initialize ubi, error-22
]

Step 8: Use the command: TFTP 31000000 rootfs. bin to download rootfs to the default memory address 31000000, and use the command: ubi write
31000000 rootfs $ filesize: Burn the rootfs. bin with a memory size of $ filesize at 31000000 to NAND through ubi
In the corresponding flash partition.

Step 9:
Set the boot variable bootargs. (bootargs is the parameter that uboot sends to the kernel. Run the command set bootargs "Ubi. MTD = 3 root = ubi0: rootfs rootfstype = ubifs console = ttysac0 init =/linuxrc RW"

Set the startup command: bootcmd, (bootcmd
Run the set bootcmd "NAND read 31000000 $ filesize; bootm 80000" command to save the environment variables)

Step 10: Turn off the power and restart the Development Board from NAND Flash. We can see that the kernel has successfully loaded the ubifs file system we only do,

[NOTE 1: Set bootcmd
"NAND read 31000000 $ filesize;" 80000 "in bootm 31000000" is the address of the kernel to be started. During kernel startup, the address 31000000 is automatically found to start the kernel.
The "31000000" in 31000000 XXX is the address in the memory (the data stored in the memory address is lost after power loss)

NOTE 2: If bootm is not followed by the address, it is found at 30008000 by default and started in the kernel. If the bootcmd environment variable is written as: Set
Bootcmd "NAND read 31000000 $ filesize; bootm: (because it does not find the kernel at 80000, the kernel was read from the 30008000 memory address to the 80000 address)

 

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.