Documenting flash layout. Is vertical view good too?

Hello. I have noticed there are several devices, which have boot logs available on the page, but flash layout is empty or missing completely.

  1. Does it make sense to edit a page and add flash layout if I only use information from the same device page?

  2. Do I need to use the template every time? I think it's good for multi-layer flash partitions, but the layout where rows correspond to partitions, and columns to data field, would be easier to read.

  3. If I have information but it's not 100% verified, is it better to add it or not? For example if I do not have actual device but I have found bootlogs in some blog post.

  4. Layout of original firmware. It could change between versions, but how do I know it?

Here is an example: https://openwrt.org/toh/asus/rt-ac58u#flash_layout
Can you comment?

Maybe there are article discussion pages, like in wikipedia, but I didn't find how to navigate to them.

Flash layout is critical. Bad information is worse then no information.

Iā€™d suggest the source code for the current release or master, preferably confirmed with device in hand.

What I saw there looks like UBI volume layouts, which is a layer up from the partitioning of the raw flash itself.

Yes, there are technically two layers, but I think two layered horizontal would look clumsy, compared to two vertical tables like I made.

Personal opinions

  • Offset should be offset and, along with size, and name are the primary information

    • Should include if the partition is marked r/o or not
  • Correspondence of OEM and OpenWrt partition locations, sizes and names should be very clear (both for underlying flash, as well as in this case where the UBI volumes change significantly)

  • The NOR flash and the NAND flash should be completely separate from each other

  • LEB, PEB count, at least for me, is "noise"

  • Be aware that chip types change, as do drivers. Interesting if, for example, chip 1 is "SPI NOR" and chip 2 is "SPI NAND" or the like. "m25p80" is not correct, even for the driver. "jedec,spi-nor" is the current driver.

1 Like

I have changed the layouts. How about now?
I do not know about r/o or how to check it.

"m25p80" is not correct

It was mentioned in the bootlog.

This is nice to have and appreciated, if you want to invest the time in creating this table:

This should most time be sufficient:
grafik

If you want to prepare a table that is equivalent to that suggested by tmomas in a vertical format on a "personal" page for suggestions (I didn't realize that you were live-editing the device page itself), that would be a good place for comments.

I'd stay away from making factual statements in areas that you may not be familiar with. Be very careful about things like the chips in use, drivers attaching, partitioning, boot sequence, the MTD subsystem in general, how both combined firmware partitions and UBI is handled by the boot loader and the kernel.

But there are a lot of routers, where physical order of partitions is different from mtd order, such as first partition might be listed as mtd5, second as mtd4. Some of those routers don't even have dmesg on stock firmware.

Then feel free to apply the detailed flash layout table as shown above.

So, what about my question: Is it OK to use my own representation instead of following the sample? Maybe something like pstree output would be better?

I think it would be valuable for you to gain some understanding on how the MTD subsystem in the Linux kernel works, the "auto-split" patches applied by OpenWrt, as well as the UBI subsystem.

Another valuable source of information on how OpenWrt deals with a specific router is the DTS for the router.

For example, target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4018-rt-ac58u.dts contains

        flash@0 {
                /*
                 * U-boot looks for "n25q128a11" node,
                 * if we don't have it, it will spit out the following warning:
                 * "ipq: fdt fixup unable to find compatible node".
                 */
                compatible = "jedec,spi-nor";
                reg = <0>;
                linux,modalias = "m25p80", "mx25l1606e", "n25q128a11";
                spi-max-frequency = <24000000>;

                partitions {
                        compatible = "fixed-partitions";
                        #address-cells = <1>;
                        #size-cells = <1>;

                        partition@0 {
                                label = "SBL1";
                                reg = <0x00000000 0x00040000>;
                                read-only;
                        };
                        partition@40000 {
                                label = "MIBIB";
                                reg = <0x00040000 0x00020000>;
                                read-only;
                        };
                        partition@60000 {
                                label = "QSEE";
                                reg = <0x00060000 0x00060000>;
                                read-only;
                        };
                        partition@c0000 {
                                label = "CDT";
                                reg = <0x000c0000 0x00010000>;
                                read-only;
                        };
                        partition@d0000 {
                                label = "DDRPARAMS";
                                reg = <0x000d0000 0x00010000>;
                                read-only;
                        };
                        partition@e0000 {
                                label = "APPSBLENV"; /* uboot env*/
                                reg = <0x000e0000 0x00010000>;
                                read-only;
                        };
                        partition@f0000 {
                                label = "APPSBL"; /* uboot */
                                reg = <0x000f0000 0x00080000>;
                                read-only;
                        };
                        partition@170000 {
                                label = "ART";
                                reg = <0x00170000 0x00010000>;
                                read-only;
                        };
                        /* 0x00180000 - 0x00200000 unused */
                };
        };

        spi-nand@1 {
                compatible = "spi-nand";
                reg = <1>;
                spi-max-frequency = <24000000>;

                /*
                 * U-boot looks for "spinand,mt29f" node,
                 * if we don't have it, it will spit out the following warning:
                 * "ipq: fdt fixup unable to find compatible node".
                 */

                partitions {
                        compatible = "fixed-partitions";
                        #address-cells = <1>;
                        #size-cells = <1>;

                        partition@0 {
                                /*
                                 * TODO: change to label = "ubi" once we drop 4.14.
                                 *       also drop the bootargs-append and all the
                                 *       userspace CI_UBIPART="UBI_DEV" remains.
                                 */
                                label = "UBI_DEV";
                                reg = <0x00000000 0x08000000>;
                        };
                };
        };