Source code files involved:Drivers/MTD/maps/alchemy-flash.c
10: # include <Linux/config. h>
Note: In include/Linux/config. h, there is only one sentence # include <Linux/Autoconf. h>, while in include/Linux/Autoconf. h, there are the following:
59: # UNDEF config_mips_pb1000
60: # UNDEF config_mips_pb1100
61: # UNDEF config_mips_pb1500
62: # UNDEF config_mips_pb1550
63: # UNDEF config_mips_pb1200
64: # UNDEF config_mips_db1000
65: # UNDEF config_mips_db1100
66: # UNDEF config_mips_db1500
67: # UNDEF config_mips_db1550
68:
# Define config_mips_db1200 1
Therefore, the 82-row definition corresponding to the alchemy-flash.c is valid.
# Ifdef config_mips_db1200
# Define board_map_name "db1200 flash"
# Define board_flash_size 0x00800000/* 8 Mb */
# Define board_flash_width 2/* 16-bits */
# Endif
Where
Board_flash_size
The capacity of norflash used in the embedded system,
Board_flash_width
Represents the norflash data bus width (in byte ).
Define struct in include/Linux/MTD/Partitions. h
Struct mtd_partition {
Char * Name;/* identifier string */
U_int32_t size;/* partition size */
U_int32_t offset;/* offset within the master MTD space */
U_int32_t mask_flags;/* master MTD flags to mask out for this partition */
Struct nand_oobinfo * oobsel;/* out of band layout for this partition (NAND only )*/
Struct mtd_info ** MTDP;/* pointer to store the MTD object */
};
Alchemy-flash.c
Of
The definition starting from line 1 corresponds to the partition scheme in norflash:
Static struct mtd_partition alchemy_partitions [] = {
{
. Name = "User FS ",
. Size = board_flash_size-0x00400000, -- macro is used here
Board_flash_size
. Offset = 0x0000000
},
{
. Name = "yamon ",
. Size = 0x0100000,
. Offset = mtdpart_ofs_append,
//. Mask_flags = mtd_writeable
-- The macro used here
Mtd_writeable
Indicates that the starting offset of the MTD partition follows the Ending position of the previous partition.
},
{
. Name = "raw kernel ",
. Size = (0x300000-0x40000),/* Last 256kb is yamon env */
. Offset = mtdpart_ofs_append,
}
};
In this norflash partitioning scheme, yamon started at the start of the last 4 MB of norflash, and the entire kernel and yamon occupied
The last 4 MB space of norflash, which can be from "User FS". size =
Board_flash_size-0x00400000
Therefore, after the norflash type is changed, you need to modify it according to the capacity and data width of the new norflash.
Macro definition starting with 82 rows of alchemy-flash.c
Board_flash_size
And
Board_flash_width