Sample Header Ad - 728x90

How is MTD partition layout detected/parsed in Linux?

0 votes
1 answer
648 views
I am working on an embedded Linux system, which uses kernel-5.10.24. There is a NAND FLASH used as storage in system, and it has 4 partitons. When the kernel boots up, there shows 4 partitions as follows,
[    0.499555] Creating 4 MTD partitions on "spi_nand":
[    0.499564] 0x000000000000-0x000000080000 : "uboot"
[    0.501099] 0x000000080000-0x000000900000 : "kernel"
[    0.510556] 0x000000900000-0x000007000000 : "filesys"
[    0.580413] 0x000007000000-0x000008000000 : "app"
How does the kernel know the NAND FLASH's MTD partions? **My main purpose is to speed up kernel booting by removing MTD partion scanning.** I found there is NAND partition definition in the device tree, but the layout is different from the real system.
nandflash@0 {
        partitions {
            compatible = "fixed-partitions";
            #address-cells = ;
            #size-cells = ;

            /* spi nand flash partition */
            partition@0 {
                label = "uboot";
                reg = ;
                /*read-only;*/
            };

            partition@E0000 {
                label = "kernel";
                reg = ;
            };

            partition@900000 {
                label = "filesys";
                reg = ;
            };
        };
    };
Is it possible to ask kernel to parse/get the partition infor from the device tree? If so, how to do that? Is it possible to speed kernel booting up by using the hard-coded partition info in device tree?
Asked by wangt13 (631 rep)
Apr 27, 2023, 08:51 AM
Last activity: May 9, 2023, 08:29 AM