GL-S1300: using EMMC for overlayfs when using NOR flash is expected

An odd problem with the GL-S1300 when running 22.03 compared to 21.02 was reported here.

I acquired one of these so I've been trying to ascertain what is going on (I also note that the GL-S1300 isn't being built for 23.05 and snapshot for lack of DSA conversion which I'd like to rectify).

So far it appears to me that 22.03 is actually mounting the overlayfs from the EMMC "rootfs_data" partition rather than the NOR flash "rootfs_data" partition as for 21.02 (and as documented on the TOH page, even though the underlying rootfs has been mounted from the NOR flash.

21.02 mounted filesystems:

root@OpenWrt:~# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 3840      3840         0 100% /rom
tmpfs                   254644       232    254412   0% /tmp
tmpfs                   254644        88    254556   0% /tmp/root
tmpfs                      512         0       512   0% /dev
/dev/mtdblock11           7424       368      7056   5% /overlay
overlayfs:/overlay        7424       368      7056   5% /

22.03 mounted filesystems:

root@OpenWrt:~# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 4352      4352         0 100% /rom
tmpfs                   253920       248    253672   0% /tmp
/dev/mmcblk0p3          499284       104    462484   0% /overlay
overlayfs:/overlay      499284       104    462484   0% /
tmpfs                      512         0       512   0% /dev

From the boot logs it seems that for 22.03 the EMMC file systems are visible to mount_root and as both sets of flash partitions get a "rootfs_data" named partition, the later visible EMMC partition is found first and used for the overlay.

21.02 boot log excerpt:

Mon Apr 17 13:15:46 2023 kern.info kernel: [    0.000000] Booting Linux on physical CPU 0x0
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.000000] Linux version 5.4.238 (builder@buildhost) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r16847-f8282da11e)) #0 SMP Mon Apr 17 13:15:36 2023
{...}
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.000000] Kernel command line: rootfsname=rootfs rootwait
{...}
Mon Apr 17 13:15:46 2023 kern.info kernel: [    0.623956] spi_qup 78b5000.spi: IN:block:16, fifo:64, OUT:block:16, fifo:64
Mon Apr 17 13:15:46 2023 kern.info kernel: [    0.636607] spi-nor spi0.0: w25q128 (16384 Kbytes)
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.636692] 9 fixed-partitions partitions found on MTD device spi0.0
Mon Apr 17 13:15:46 2023 kern.err kernel: [    0.640325] OF: Bad cell count for /soc/spi@78b5000/flash@0/partitions
Mon Apr 17 13:15:46 2023 kern.err kernel: [    0.646870] OF: Bad cell count for /soc/spi@78b5000/flash@0/partitions
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.653356] Creating 9 MTD partitions on "spi0.0":
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.659655] 0x000000000000-0x000000040000 : "SBL1"
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.665388] 0x000000040000-0x000000060000 : "MIBIB"
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.669989] 0x000000060000-0x0000000c0000 : "QSEE"
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.674853] 0x0000000c0000-0x0000000d0000 : "CDT"
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.679638] 0x0000000d0000-0x0000000e0000 : "DDRPARAMS"
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.684478] 0x0000000e0000-0x0000000f0000 : "APPSBLENV"
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.689415] 0x0000000f0000-0x000000170000 : "APPSBL"
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.694717] 0x000000170000-0x000000180000 : "ART"
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.699869] 0x000000180000-0x000001000000 : "firmware"
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.704959] 2 fit-fw partitions found on MTD device firmware
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.708694] Creating 2 MTD partitions on "firmware":
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.714571] 0x000000000000-0x0000003a0000 : "kernel"
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.720387] 0x0000003928d4-0x000000e80000 : "rootfs"
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.725246] mtd: device 10 (rootfs) set to be root filesystem
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.729566] 1 squashfs-split partitions found on MTD device rootfs
Mon Apr 17 13:15:46 2023 kern.notice kernel: [    0.735049] 0x000000740000-0x000000e80000 : "rootfs_data"
Mon Apr 17 13:15:46 2023 kern.info kernel: [    0.742500] spi_qup 78b6000.spi: IN:block:16, fifo:64, OUT:block:16, fifo:64
{...}
Mon Apr 17 13:15:46 2023 kern.info kernel: [    1.630031] sdhci: Secure Digital Host Controller Interface driver
Mon Apr 17 13:15:46 2023 kern.info kernel: [    1.630316] sdhci: Copyright(c) Pierre Ossman
Mon Apr 17 13:15:46 2023 kern.info kernel: [    1.636654] sdhci-pltfm: SDHCI platform and OF driver helper
Mon Apr 17 13:15:46 2023 kern.info kernel: [    1.641465] sdhci_msm 7824900.sdhci: Got CD GPIO
Mon Apr 17 13:15:46 2023 kern.info kernel: [    1.684172] mmc0: SDHCI controller on 7824900.sdhci [7824900.sdhci] using ADMA 64-bit
{...}
Mon Apr 17 13:15:46 2023 kern.info kernel: [    1.749876] VFS: Mounted root (squashfs filesystem) readonly on device 31:10.
Mon Apr 17 13:15:46 2023 kern.info kernel: [    1.751499] Freeing unused kernel memory: 1024K
Mon Apr 17 13:15:46 2023 kern.info kernel: [    1.786512] Run /sbin/init as init process
Mon Apr 17 13:15:46 2023 kern.info kernel: [    1.829510] mmc0: new HS200 MMC card at address 0001
Mon Apr 17 13:15:46 2023 kern.info kernel: [    1.830631] mmcblk0: mmc0:0001 H8G4a� 7.28 GiB
Mon Apr 17 13:15:46 2023 kern.info kernel: [    1.834130] mmcblk0boot0: mmc0:0001 H8G4a� partition 1 4.00 MiB
Mon Apr 17 13:15:46 2023 kern.info kernel: [    1.838303] mmcblk0boot1: mmc0:0001 H8G4a� partition 2 4.00 MiB
Mon Apr 17 13:15:46 2023 kern.info kernel: [    1.843906] mmcblk0rpmb: mmc0:0001 H8G4a� partition 3 4.00 MiB, chardev (246:0)
Mon Apr 17 13:15:46 2023 kern.info kernel: [    1.852372]  mmcblk0: p1 p2 p3 p4
{...}
Mon Apr 17 13:15:46 2023 user.notice kernel: [   11.055585] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
{...}
Mon Apr 17 13:16:11 2023 kern.warn kernel: [   48.540534] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
Mon Apr 17 13:16:11 2023 kern.warn kernel: [   48.540640] jffs2_build_filesystem(): unlocking the mtd device...
Mon Apr 17 13:16:12 2023 kern.warn kernel: [   48.552482] jffs2_build_filesystem(): erasing all blocks after the end marker...
{...}
Mon Apr 17 13:16:41 2023 kern.warn kernel: [   78.483012] done.
Mon Apr 17 13:16:41 2023 kern.notice kernel: [   78.483262] jffs2: notice: (1711) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
{...}

22.03 boot log excerpt:

Sat Nov 25 18:19:07 2023 kern.info kernel: [    0.000000] Booting Linux on physical CPU 0x0
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.000000] Linux version 5.10.201 (builder@buildhost) (arm-openwrt-linux-muslgnueabi-gcc (OpenWrt GCC 11.2.0 r20265-f85a79bcb4) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 SMP Sat Nov 25 18:18:57 2023
{...}
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.000000] Kernel command line: rootfsname=rootfs rootwait
{...}
Sat Nov 25 18:19:07 2023 kern.info kernel: [    0.779749] spi_qup 78b5000.spi: IN:block:16, fifo:64, OUT:block:16, fifo:64
Sat Nov 25 18:19:07 2023 kern.info kernel: [    0.781973] spi-nor spi0.0: w25q128 (16384 Kbytes)
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.788004] 9 fixed-partitions partitions found on MTD device spi0.0
Sat Nov 25 18:19:07 2023 kern.err kernel: [    0.792637] OF: Bad cell count for /soc/spi@78b5000/flash@0/partitions
Sat Nov 25 18:19:07 2023 kern.err kernel: [    0.799081] OF: Bad cell count for /soc/spi@78b5000/flash@0/partitions
Sat Nov 25 18:19:07 2023 kern.err kernel: [    0.806029] OF: Bad cell count for /soc/spi@78b5000/flash@0/partitions
Sat Nov 25 18:19:07 2023 kern.err kernel: [    0.811962] OF: Bad cell count for /soc/spi@78b5000/flash@0/partitions
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.818592] Creating 9 MTD partitions on "spi0.0":
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.824957] 0x000000000000-0x000000040000 : "SBL1"
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.830350] 0x000000040000-0x000000060000 : "MIBIB"
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.835125] 0x000000060000-0x0000000c0000 : "QSEE"
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.839848] 0x0000000c0000-0x0000000d0000 : "CDT"
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.844667] 0x0000000d0000-0x0000000e0000 : "DDRPARAMS"
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.849385] 0x0000000e0000-0x0000000f0000 : "APPSBLENV"
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.854500] 0x0000000f0000-0x000000170000 : "APPSBL"
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.859605] 0x000000170000-0x000000180000 : "ART"
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.864931] 0x000000180000-0x000001000000 : "firmware"
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.869838] 2 fit-fw partitions found on MTD device firmware
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.874011] Creating 2 MTD partitions on "firmware":
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.879787] 0x000000000000-0x0000002c0000 : "kernel"
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.885276] 0x0000002b9824-0x000000e80000 : "rootfs"
Sat Nov 25 18:19:07 2023 kern.warn kernel: [    0.889680] mtd: partition "rootfs" doesn't start on an erase/write block boundary -- force read-only
Sat Nov 25 18:19:07 2023 kern.info kernel: [    0.895245] mtd: setting mtd10 (rootfs) as root device
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.904025] 1 squashfs-split partitions found on MTD device rootfs
Sat Nov 25 18:19:07 2023 kern.notice kernel: [    0.908784] 0x0000006e0000-0x000000e80000 : "rootfs_data"
Sat Nov 25 18:19:07 2023 kern.info kernel: [    0.920450] spi_qup 78b6000.spi: IN:block:16, fifo:64, OUT:block:16, fifo:64
{...}
Sat Nov 25 18:19:07 2023 kern.info kernel: [    1.788622] sdhci: Secure Digital Host Controller Interface driver
Sat Nov 25 18:19:07 2023 kern.info kernel: [    1.789000] sdhci: Copyright(c) Pierre Ossman
Sat Nov 25 18:19:07 2023 kern.info kernel: [    1.795311] sdhci-pltfm: SDHCI platform and OF driver helper
Sat Nov 25 18:19:07 2023 kern.info kernel: [    1.800321] sdhci_msm 7824900.sdhci: Got CD GPIO
{...}
Sat Nov 25 18:19:07 2023 kern.info kernel: [    1.844453] mmc0: SDHCI controller on 7824900.sdhci [7824900.sdhci] using ADMA 64-bit
Sat Nov 25 18:19:07 2023 kern.info kernel: [    1.875107] VFS: Mounted root (squashfs filesystem) readonly on device 31:10.
Sat Nov 25 18:19:07 2023 kern.info kernel: [    1.877086] Freeing unused kernel memory: 1024K
Sat Nov 25 18:19:07 2023 kern.info kernel: [    1.931941] Run /sbin/init as init process
Sat Nov 25 18:19:07 2023 kern.debug kernel: [    1.931970]   with arguments:
Sat Nov 25 18:19:07 2023 kern.debug kernel: [    1.931976]     /sbin/init
Sat Nov 25 18:19:07 2023 kern.debug kernel: [    1.931981]   with environment:
Sat Nov 25 18:19:07 2023 kern.debug kernel: [    1.931986]     HOME=/
Sat Nov 25 18:19:07 2023 kern.debug kernel: [    1.931991]     TERM=linux
Sat Nov 25 18:19:07 2023 kern.debug kernel: [    1.931996]     rootfsname=rootfs
Sat Nov 25 18:19:07 2023 kern.info kernel: [    1.956502] mmc0: new HS200 MMC card at address 0001
Sat Nov 25 18:19:07 2023 kern.info kernel: [    1.957549] mmcblk0: mmc0:0001 H8G4a� 7.28 GiB
Sat Nov 25 18:19:07 2023 kern.info kernel: [    1.961013] mmcblk0boot0: mmc0:0001 H8G4a� partition 1 4.00 MiB
Sat Nov 25 18:19:07 2023 kern.info kernel: [    1.965362] mmcblk0boot1: mmc0:0001 H8G4a� partition 2 4.00 MiB
Sat Nov 25 18:19:07 2023 kern.info kernel: [    1.970855] mmcblk0rpmb: mmc0:0001 H8G4a� partition 3 4.00 MiB, chardev (246:0)
Sat Nov 25 18:19:07 2023 kern.info kernel: [    1.978694]  mmcblk0: p1 p2 p3 p4
{...}
Sat Nov 25 18:19:07 2023 kern.info kernel: [   10.593340] EXT4-fs (mmcblk0p3): 9 orphan inodes deleted
Sat Nov 25 18:19:07 2023 kern.info kernel: [   10.593381] EXT4-fs (mmcblk0p3): recovery complete
Sat Nov 25 18:19:07 2023 kern.info kernel: [   10.606116] EXT4-fs (mmcblk0p3): mounted filesystem with ordered data mode. Opts: (null)
Sat Nov 25 18:19:07 2023 user.info kernel: [   10.607076] mount_root: overlay filesystem has not been fully initialized yet
Sat Nov 25 18:19:07 2023 user.info kernel: [   10.615059] mount_root: switching to ext4 overlay
{...}

NB: both boots are after flashing via the u-boot flash upgrade function after having flashed the factory to openwrt transition image.

The only notable difference between 21.02 and 22.03 for the ipq40xx target seems to be that 22.03 added support for the GL-B2200 which uses EMMC partitions for OpenWrt; the GL-S1300 DTS seems unchanged and I can't see any apparently significant differences in the ipq40xx kernel config between 21.02 and 22.03 (though that's probably because I don't really know what to look for).

I'd appreciate any hints anyone might have as to:

  • where else to look for what's causing this
  • how I might get the overlayfs mounted from the NOR flash instead of the EMMC (to avoid disturbance to the GL.inet factory EMMC setup)
  • what might be needed to do a full EMMC installation like the GL-B2200

BTW: I have been able to save the configuration with 22.03, so I don't have any idea what additional problem the original poster in the linked thread had.

2 Likes

Which uboot is your S1300 running?
The AP1300, B1300, S1300 and B2200 all share the same uboot:

This was updated two years ago, there was an update on the ipq806x-sdk53 in 2020 that was missed until it was seen back in 2022.
https://github.com/gl-inet-builder/openwrt-sdk-ipq806x-qsdk53/commit/4cd17868b328a1786a530f5e7a2ade216aea0d08

Now if we look at the s1300 commits:
https://git.openwrt.org/?p=openwrt%2Fopenwrt.git&a=search&h=HEAD&st=commit&s=s1300

after 21.02 was released, there's a zImage commit due to a uboot issue:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=81d694e30b4926fea057bd3e46d996a8f098b95a

Now, that zImage commit is before the 2022 uboot commit in the gl-inet git, so you may be using a newer uboot than this commit is aware of.

2 Likes

From what I can understand, u-boot is updated when flashing the factory to openwrt transition image - the one I used is s1300-factory-to-openwrt.bin from the gl.inet 19.07.8 repo branch which seems to be from about March 2021.

I'm not convinced a zimage commit is involved, as the unit is booting the expected kernel and squashfs rootfs - it's just not doing the right thing with the overlayfs.

There are some other commits of potential interest though, so I'll think about installing the updated u-boot image from the gl.inet uboot-ipq40xx repo.

Thanks for the input!

3 Likes