Solution to incorrect flash partition after VIVI IS BURNED

Source: Internet
Author: User

The experiment environment needs to be changed to the Linux 2.6 kernel, but the Linux kernel installed on the arm2410s Development Board in the lab is 2.4, so you have to re-burn all the development boards to the kernel!

As the kernel image and root file system change, you need to modify the flash partition, that is, modify the VIVI source code smdk. in the c file, mtd_partition_t default_mtd_partitions [], re-compile Vivi, and then burn Vivi to the Development Board. However, some development board partitions are incorrect after VIVI is written. Among them, Vivi is correct, because the same VIVI is successfully burned on some boards; but it does not work for the partitions modified on some boards, whether you re-burn Vivi n times, the Flash partition is still incorrect. In this way, we can only use the "Bon part" command in vivi to re-partition flash (the usage of the Bon part command is shown below ). After partitioning, you can run the "Bon part Info" command to view the list of new bon partitions (the original MTD partition list is displayed in the "part show" command ). After the flash partition is correct, re-burn Vivi. Run Vivi to start Vivi. In this case, the partition information displayed in "part Show" is the correct partition information. Finally, it is OK to write the Linux kernel image and the root file system to the Development Board.

 

 

 

1. The part add command is used to add an MTD partition.
The detailed command format is as follows:
Part Add name offset size flag
The parameter name is the name of the partition to be added;
The offset parameter is the offset of the partition to be added (relative to the start address of the entire MTD device)
In the armer9 system, whether configured with nor flash or NAND flash
Register an mtd_info structure, that is, there is only one MTD device logically.
The start address of the device is 0x00000000 );
The parameter size is the size of the partition to be added, in bytes;
The parameter flag is the identifier of the partition to be added. The parameter flag can only be the following string (please note
Must be capitalized) or use the connector "|" to combine the following strings.
This flag indicates the purpose of the partition.
"Bonfs" -- used as a partition of the bonfs file system;
"Jffs2" -- used as the partition of the jffs2 file system;
"Lock" -- the partition is locked;
"Ram" -- this partition is used as Ram. 2. The Bon part command is used to create a system's Bon partition table.
The Bon Partition Table is saved to the last 0X4000 bytes of nandflash, that is, 0x03ffc000 ~ Within the range of 0x33ffffff, the partition table starts from 0x03ffc000 (Note: The Bon partition is only
A simple partition management method for NAND Flash devices ).
The detailed command format is as follows:
Bon part offsets1 [flag] offsets2 [flag] offsets3 [flag] {⋯
The offsetsn parameter is the starting address of each bon partition;
Flag is the identifier next to the starting address of each bon partition. This identifier is used for the Unit of the preceding value. 'k'' or 'K' indicates Kilo and Kilo; 'M' or 'M' indicates mega, Mb.
If ':' is followed by 'M' or 'M', the partition is marked as MTD,
If ':' and the following letter 'M' or 'M' are not displayed, the partition is marked as a bon partition.
The Bon part command checks whether there are bad blocks in each partition when creating the System's Bon partition table.
(Samsung's NAND flash chip k9s1208u0m. One block contains 32 pages and one
The page contains 512 bytes, and a block contains 16 K bytes, that is, 0X4000). If a bad block is found
In the partition table, the partition size is reduced by the bad capacity to get the actual available
Partition capacity. Number_of_badblock
It indicates the number of Bad blocks in the partition. Example: Bon part 0 128 K 1 M 4 M 24 m representation (64 m without bad blocks) Partition Number (No .) start address (offset) size (size) 0 0x0000 0000 0x0002 0000 128 (0002 K) 1 0x0000 0000 0x000e 896 (k) 2 0x0010 0000 0x0030 0000 (3 m) 3 0x0040 0000 0x0140 0000 (20 m) 4 0x0180 0000 0x0280 0000 (40 m) from: Workshop:

Fat: unable to read Boot Sector
Kernel panic: VFS: Unable to mount root FS on 61: 01 use part show:

vivi> part show
mtdpart info. (5 partitions)
name offset size flag
------------------------------------------------
vivi : 0x00000000 0x00020000 0 128k
param : 0x00020000 0x00010000 0 64k
kernel : 0x00030000 0x00100000 0 1M
root : 0x00130000 0x01400000 4 20M
usr : 0x01530000 0x02acc000 8 42M+816k

Vivi, kernel, and root file images are downloaded normally. Why can't I find them?

View Vivi parameters: Param show

vivi> param show
Number of parameters: 9
name : hex integer
-------------------------------------------------------------
mach_type : 000000c1 193
media_type : 00000003 3
boot_mem_base : 30000000 805306368
baudrate : 0001c200 115200
xmodem_one_nak : 00000000 0
xmodem_initial_timeout : 000493e0 300000
xmodem_timeout : 000f4240 1000000
ymodem_initial_timeout : 0016e360 1500000
boot_delay : 00020000 131072
Linux command line: noinitrd root=/dev/bon/1 init=/linuxrc console=ttyS0

It is also normal here, where is the problem?

Bon part show is shown as follows:

vivi> bon part show
BON info. (3 partitions)
No: offset size flags bad
---------------------------------------------
 0: 0x00000000 0x00030000 00000000 0 192k
 1: 0x00030000 0x00100000 00000000 0 1M
 2: 0x00100000 0x03ecc000 00000000 0 62M+816k

Now we know that the root address in part show in vivi is 0x00130000, while the root address in Bon is 0x0010000. In this way, although the parameter passed to the kernel is root =/dev/bon/2, the address of the third partition of Bon is different from that of the actual Vivi root file image, of course, the file system cannot be found.

Here, how can we explain two different partitions? The difference between part show And bon part show is that part show in vivi displays the actual MTD partition of NAND, in vivi, there are generally five MTD partitions, which are used to store Vivi, kernel, root, Param, and USR. In vivi's load flash Vivi/kernel/root x/y, these commands write the input to the corresponding partition of MTD, So execute

After loading flash root X, the actual root file system is actually written to the root partition of MTD, and the address of this partition is 0x00130000, the parameter passed by Vivi to the kernel is Bon/2. The address is 0x0010000. Of course, the file system cannot be found. In the source code of Vivi, The MTD partition is defined in the file:In ARCH/S3C2410/smdk. C, the Code is as follows:

#ifdef CONFIG_S3C2410_NAND_BOOT
mtd_partition_t default_mtd_partitions[] = {
    {
        name:        "vivi",
        offset:        0,
        size:        0x00020000,
        flag:        0
    }, {
        name:        "param",
        offset:        0x00020000,
        size:        0x00010000,
        flag:        0
    }, {
        name:        "kernel",
        offset:        0x00030000,
        size:        0x000C0000,
        flag:        0
    }, {
        name:        "root",
        offset:        0x00100000,
        size:        0x00140000,
        flag:        MF_BONFS
    }
};
#endif

Here is the MTD partition information.

So what is the Bon partition? Here, we need to clarify the concept that MTD partition is only useful when downloading files. It is similar to a computer that stores files on that disk. Note that we store data in NAND Flash, in kernel, there are several files. You can see three or two devices under/dev/bon. This is related to the number of your partitions. We have three partitions, therefore, there are three Device Files 0 1 2, and the parameters passed to the kernel by VIVI are:
Linux Command Line: noinitrd root =/dev/bon/2 init =/linuxrc console = ttys0

This sentence provides four pieces of information. I don't know about noinitrd, root =/dev/bon/2 indicates that the kernel file system is on the/dev/bon/2 device, the essence is to tell the first address of the Kernel File System in the NAND Flash area. init =/linuxrc tells the kernel that the first script to be executed to start is linuxrc. from the above we can see that the address of Bon/2 in the Bon partition is different from the root address in the MTD, so the kernel cannot find the file system, and the prompt is:

Fat: unable to read Boot Sector
Kernel panic: VFS: Unable to mount root FS on 61: 01

 

 

How to solve this problem:

It is very easy to re-partition the NAND Flash, Bon part 0 XX, the address here must correspond to the corresponding partition in Vivi,

vivi> bon part show
BON info. (3 partitions)
No: offset size flags bad
-------------------------------------------
 0: 0x00000000 0x00030000 00000000 0 192k

 1: 0x00030000 0x00100000 00000000 0 1M
 2: 0x00100000 0x03ecc000 00000000 0 62M+816k

 

vivi> part show
mtdpart info. (5 partitions)
name offset size flag
-------------------------------------
vivi : 0x00000000 0x00020000 0 128k
param : 0x00020000 0x00010000 0 64k
kernel : 0x00030000 0x00100000 0 1M
root : 0x00130000 0x01400000 4 20M
usr : 0x01530000 0x02acc000 8 42M+816k

We need to make the first address of the root partition of the Bon partition correspond to the root address of the MTD partition. In MTD, the first root address is 0x00130000, which is converted to decimal: 1245184. Therefore, for the Bon partition: Bon part 0 192 K 1245184, and then Param save, under the VIVI kernel root file system, everything is OK!

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.