At the end of the norflash driver load, there are several statements: If (ezkit561_mtd) {ezkit561_mtd-> owner = this_module; return handler (ezkit561_mtd, ezkit561_parts, ezkit561_part_count );} use add_mtd_partitions (Drivers/MTD/mtdpart. c) The function can add corresponding partitions to the partition table of the system. In this way, when you need to read and write the partitions, you can find the corresponding MTD and call its function to complete the corresponding operations. /** This function, given a master MTD object and a partition table, creates * and registers slave MTD objects which are bound to the master according to * The partition definitions. * (Q: shocould we register the master MTD object as well ?) */INT add_mtd_partitions (struct mtd_info * master, const struct mtd_partition * parts, int nbparts) {struct mtd_part * slave; u_int32_t cur_offset = 0; int I; printk (kern_notice "creating % d MTD partitions on/" % S/":/N", nbparts, master-> name); for (I = 0; I <nbparts; I ++) {/* allocate the partition structure */Slave = kmalloc (sizeof (* slave), gfp_kernel); If (! Slave) {printk ("Memory Allocation Error while creating partitions for/" % S/"/N", master-> name); del_mtd_partitions (master); Return-enomem ;} memset (slave, 0, sizeof (* slave);/* Add to partition list, however, the mtd_partitions linked list only deletes the allocated struct when the slave allocation fails. It does not affect other parts of the system! */List_add (& slave-> list, & mtd_partitions);/* set up the MTD object for this partition */slave-> MTD. type = Master-> type ;... If (parts [I]. MTDP) {/* store the Object Pointer (caller may or may not register it */* parts [I]. MTDP = & slave-> MTD; slave-> registered = 0;} else {/* register our partition */add_mtd_device (& slave-> MTD ); slave-> registered = 1 ;}} return 0 ;}at the end of the function, you can use add_mtd_device to add an MTD struct to the pointer array of mtd_table, in this way, you can see/dev/mtdblock0,/dev/mtdblock1 ,... This is a device. Because it is an array, the largest array element # define max_mtd_devices 16 is defined in the system, so it is only mtdblock15 at most.