An example of the mtd partition table is in arch/arm/mach-omap2/board-omap3beagle.c for the beagleboard http://lxr.free-electrons.com/source/arch/arm/mach-omap2/board-omap3beagle.c
static struct mtd_partition omap3beagle_nand_partitions[] = {
/* All the partition sizes are listed in terms of NAND block size */
{
.name = "X-Loader",
.offset = 0,
.size = 4 * NAND_BLOCK_SIZE,
.mask_flags = MTD_WRITEABLE, /* force read-only */
},
{
.name = "U-Boot",
.offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
.size = 15 * NAND_BLOCK_SIZE,
.mask_flags = MTD_WRITEABLE, /* force read-only */
},
{
.name = "U-Boot Env",
.offset = MTDPART_OFS_APPEND, /* Offset = 0x260000 */
.size = 1 * NAND_BLOCK_SIZE,
},
{
.name = "Kernel",
.offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
.size = 32 * NAND_BLOCK_SIZE,
},
{
.name = "File System",
.offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */
.size = MTDPART_SIZ_FULL,
},
};
Another link states this:
http://landley.net/kdocs/Documentation/DocBook/xhtml-nochunks/mtdnand.html
In this link Nand flash driver board_init function passes the mtd_partition structure is passed to
add_mtd_partitions(board_mtd, partition_info, NUM_PARTITIONS); function in file mtdcore.c file.
If I am right then does the mtdcores.c file create the mtd partitions?
Now I have two questions:
1> If I am right, then the omap3_beagle_init function in file /board-omap3beagle.c will call the omap_nand_flash_init function this will initialize the NAND & create /dev/mdtx nodes.
If I am not right then what creates the /dev/mtd0 nodes? Does the kernel create it or the NAND driver?
2> Also, is the omap3_beagle_init function the first function called by the kernel? Which file in the linux kernel is it called from?