Increasing EA8500 / EA7500 kernel size to enable builds?

The Ubiquiti Edgerouter X has a 3MB MTD device and due to the size check with KERNEL_SIZE, the "factory" image is not built as the kernel has gotten to be ~4.8MB.

A solution with that device is to build a slimmed down kernel, build the factory file, flash the factory file, then sysupgrade to the full kernel. Details about the build options I used can be found here: https://github.com/openwrt/openwrt/issues/5090 I got it down to ~2.7MB.

TBH I don't quite understand why the full kernel is able to be used when the MTD size is still 3MB, but it seems to work.

Looking at the images with a hex editor, the factory image does not start with the OEM header (like e.g. Netgear firmware formats typically do), but starts directly with the kernel partition. That makes is easier to use the OpenWrt sysupgrade for flashing. (The same is true with Linksys WRT1900AC, WRT3200ACM etc., so you can use sysupgrade -F for factory)

You could try sysupgrade force without settings for the factory image.
Use sysupgrade -F -n or in LuCI uncheck "keep settings" and say yes to "force" once the image check fails.

Alternatively, using the OEM TFTP or (old) OEM firmware to flash should work.

Note that @t3hn00b was able to flash somehow...

I just loaded the factory image from the ui forcing the upgrade

The output of the commands on 21.02
root@Burloga:~# cat /etc/banner
  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 21.02.1, r16325-88151b8303
 -----------------------------------------------------
root@Burloga:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 3.8M      3.8M         0 100% /rom
tmpfs                   106.6M    304.0K    106.3M   0% /tmp
/dev/ubi0_1              25.3M    404.0K     23.6M   2% /overlay
overlayfs:/overlay       25.3M    404.0K     23.6M   2% /
tmpfs                   512.0K         0    512.0K   0% /dev
root@Burloga:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00020000 "SBL1"
mtd1: 00140000 00020000 "MIBIB"
mtd2: 00140000 00020000 "SBL2"
mtd3: 00280000 00020000 "SBL3"
mtd4: 00120000 00020000 "DDRCONFIG"
mtd5: 00120000 00020000 "SSD"
mtd6: 00280000 00020000 "TZ"
mtd7: 00280000 00020000 "RPM"
mtd8: 00140000 00020000 "art"
mtd9: 00100000 00020000 "APPSBL"
mtd10: 00040000 00020000 "u_env"
mtd11: 00040000 00020000 "s_env"
mtd12: 00040000 00020000 "devinfo"
mtd13: 02800000 00020000 "kernel1"
mtd14: 02500000 00020000 "rootfs1"
mtd15: 02800000 00020000 "kernel2"
mtd16: 02500000 00020000 "rootfs2"
mtd17: 00100000 00020000 "sysdiag"
mtd18: 01f80000 00020000 "syscfg"
root@Burloga:~# ubinfo -a
UBI version:                    1
Count of UBI devices:           1
UBI control device major/minor: 10:62
Present UBI devices:            ubi0

ubi0
Volumes count:                           2
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     296 (37584896 bytes, 35.8 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  20
Current maximum erase counter value:     2
Minimum input/output unit size:          2048 bytes
Character device major/minor:            246:0
Present volumes:                         0, 1

Volume ID:   0 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        30 LEBs (3809280 bytes, 3.6 MiB)
State:       OK
Name:        rootfs
Character device major/minor: 246:1
-----------------------------------
Volume ID:   1 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        242 LEBs (30728192 bytes, 29.3 MiB)
State:       OK
Name:        rootfs_data
Character device major/minor: 246:2
root@Burloga:~#
Just the factory image
BusyBox v1.35.0 (2022-02-22 17:50:22 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r18949-c0849c1d9c
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 6.3M      6.3M         0 100% /rom
tmpfs                   105.9M    252.0K    105.6M   0% /tmp
/dev/ubi0_1              22.2M     52.0K     21.0M   0% /overlay
overlayfs:/overlay       22.2M     52.0K     21.0M   0% /
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00020000 "SBL1"
mtd1: 00140000 00020000 "MIBIB"
mtd2: 00140000 00020000 "SBL2"
mtd3: 00280000 00020000 "SBL3"
mtd4: 00120000 00020000 "DDRCONFIG"
mtd5: 00120000 00020000 "SSD"
mtd6: 00280000 00020000 "TZ"
mtd7: 00280000 00020000 "RPM"
mtd8: 00140000 00020000 "art"
mtd9: 00100000 00020000 "APPSBL"
mtd10: 00040000 00020000 "u_env"
mtd11: 00040000 00020000 "s_env"
mtd12: 00040000 00020000 "devinfo"
mtd13: 02800000 00020000 "kernel1"
mtd14: 02400000 00020000 "rootfs1"
mtd15: 02800000 00020000 "kernel2"
mtd16: 02400000 00020000 "rootfs2"
mtd17: 00100000 00020000 "sysdiag"
mtd18: 01f80000 00020000 "syscfg"
root@OpenWrt:~# ubinfo -a
UBI version:                    1
Count of UBI devices:           1
UBI control device major/minor: 10:62
Present UBI devices:            ubi0

ubi0
Volumes count:                           2
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     288 (36569088 bytes, 34.8 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  20
Current maximum erase counter value:     2
Minimum input/output unit size:          2048 bytes
Character device major/minor:            247:0
Present volumes:                         0, 1

Volume ID:   0 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        50 LEBs (6348800 bytes, 6.0 MiB)
State:       OK
Name:        rootfs
Character device major/minor: 247:1
-----------------------------------
Volume ID:   1 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        214 LEBs (27172864 bytes, 25.9 MiB)
State:       OK
Name:        rootfs_data
Character device major/minor: 247:2
root@OpenWrt:~#
After the sysupgrade
BusyBox v1.35.0 (2022-02-22 17:50:22 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r18949-c0849c1d9c
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 6.3M      6.3M         0 100% /rom
tmpfs                   105.9M    248.0K    105.6M   0% /tmp
/dev/ubi0_1              22.2M     60.0K     20.9M   0% /overlay
overlayfs:/overlay       22.2M     60.0K     20.9M   0% /
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00020000 "SBL1"
mtd1: 00140000 00020000 "MIBIB"
mtd2: 00140000 00020000 "SBL2"
mtd3: 00280000 00020000 "SBL3"
mtd4: 00120000 00020000 "DDRCONFIG"
mtd5: 00120000 00020000 "SSD"
mtd6: 00280000 00020000 "TZ"
mtd7: 00280000 00020000 "RPM"
mtd8: 00140000 00020000 "art"
mtd9: 00100000 00020000 "APPSBL"
mtd10: 00040000 00020000 "u_env"
mtd11: 00040000 00020000 "s_env"
mtd12: 00040000 00020000 "devinfo"
mtd13: 02800000 00020000 "kernel1"
mtd14: 02400000 00020000 "rootfs1"
mtd15: 02800000 00020000 "kernel2"
mtd16: 02400000 00020000 "rootfs2"
mtd17: 00100000 00020000 "sysdiag"
mtd18: 01f80000 00020000 "syscfg"
root@OpenWrt:~# ubinfo -a
UBI version:                    1
Count of UBI devices:           1
UBI control device major/minor: 10:62
Present UBI devices:            ubi0

ubi0
Volumes count:                           2
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     288 (36569088 bytes, 34.8 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  20
Current maximum erase counter value:     2
Minimum input/output unit size:          2048 bytes
Character device major/minor:            247:0
Present volumes:                         0, 1

Volume ID:   0 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        50 LEBs (6348800 bytes, 6.0 MiB)
State:       OK
Name:        rootfs
Character device major/minor: 247:1
-----------------------------------
Volume ID:   1 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        214 LEBs (27172864 bytes, 25.9 MiB)
State:       OK
Name:        rootfs_data
Character device major/minor: 247:2
root@OpenWrt:~#

(Edited to have code blocks)
Edit: It's a Linksys EA7500v1 as I have forgotten to write that

Good to know.

The partitions looks ok to me, both after the factory flash and the sysupgrade flash.

And good that your device is 7500v1, so if @eginnc tests 8500, we should be good to go.

Looks like we are good to go then.

I flashed the new factory image on my spare EA8500 command line with "sysupgrade -F -n". The EA8500 was connected by Ethernet cable to another router on my home lan subnet (not 192.168.x.x) at time of flashing.

After a good long wait profitably used getting a cup of coffee, I could not ssh into the device at 192.168.1.1 after connecting it by ethernet cable to a PC (tried plugging it in again) that was also on my home wireless lan, so I powered the EA8500 off, then back on. After which, I could ssh into the device at 192.168.1.1 just fine from the PC without having to set a static 192.168.1.x IP on the PC. For clarity, it did boot up the new test r18949-c0849c1d9c factory image, not a different older image left on a second backup recovery partition.

Next I scp'd the new sysupgrade to the device, flashed it with "sysupgrade -v" and ssh'd back into the EA8500 without incident (no power down or Ethernet cable re-plugging needed), which again reported version r18949-c0849c1d9c. Success!

Results of requested commands on my other EA8500 running the last compiled snapshot image (not yours):

BusyBox v1.35.0 (2022-02-11 22:17:40 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r18795-c391dcdf86
 -----------------------------------------------------
root@EA8500:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 3.8M      3.8M         0 100% /rom
tmpfs                   232.6M      1.3M    231.3M   1% /tmp
/dev/ubi0_1              25.3M     10.8M     13.2M  45% /overlay
overlayfs:/overlay       25.3M     10.8M     13.2M  45% /
tmpfs                   512.0K         0    512.0K   0% /dev
root@EA8500:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00020000 "SBL1"
mtd1: 00140000 00020000 "MIBIB"
mtd2: 00140000 00020000 "SBL2"
mtd3: 00280000 00020000 "SBL3"
mtd4: 00120000 00020000 "DDRCONFIG"
mtd5: 00120000 00020000 "SSD"
mtd6: 00280000 00020000 "TZ"
mtd7: 00280000 00020000 "RPM"
mtd8: 00140000 00020000 "art"
mtd9: 00100000 00020000 "APPSBL"
mtd10: 00040000 00020000 "u_env"
mtd11: 00040000 00020000 "s_env"
mtd12: 00040000 00020000 "devinfo"
mtd13: 02800000 00020000 "kernel1"
mtd14: 02500000 00020000 "rootfs1"
mtd15: 02800000 00020000 "kernel2"
mtd16: 02500000 00020000 "rootfs2"
mtd17: 02080000 00020000 "syscfg"
root@EA8500:~# ubinfo -a
UBI version:                    1
Count of UBI devices:           1
UBI control device major/minor: 10:62
Present UBI devices:            ubi0

ubi0
Volumes count:                           2
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     296 (37584896 bytes, 35.8 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  20
Current maximum erase counter value:     35
Minimum input/output unit size:          2048 bytes
Character device major/minor:            246:0
Present volumes:                         0, 1

Volume ID:   0 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        30 LEBs (3809280 bytes, 3.6 MiB)
State:       OK
Name:        rootfs
Character device major/minor: 246:1
-----------------------------------
Volume ID:   1 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        242 LEBs (30728192 bytes, 29.3 MiB)
State:       OK
Name:        rootfs_data
Character device major/minor: 246:2
root@EA8500:~#  

After flashing the new sysupgrade image:

BusyBox v1.35.0 (2022-02-22 17:50:22 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r18949-c0849c1d9c
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:~# df-h
-ash: df-h: not found
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 6.3M      6.3M         0 100% /rom
tmpfs                   232.7M     72.0K    232.6M   0% /tmp
/dev/ubi0_1              22.2M     60.0K     20.9M   0% /overlay
overlayfs:/overlay       22.2M     60.0K     20.9M   0% /
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00020000 "SBL1"
mtd1: 00140000 00020000 "MIBIB"
mtd2: 00140000 00020000 "SBL2"
mtd3: 00280000 00020000 "SBL3"
mtd4: 00120000 00020000 "DDRCONFIG"
mtd5: 00120000 00020000 "SSD"
mtd6: 00280000 00020000 "TZ"
mtd7: 00280000 00020000 "RPM"
mtd8: 00140000 00020000 "art"
mtd9: 00100000 00020000 "APPSBL"
mtd10: 00040000 00020000 "u_env"
mtd11: 00040000 00020000 "s_env"
mtd12: 00040000 00020000 "devinfo"
mtd13: 02800000 00020000 "kernel1"
mtd14: 02400000 00020000 "rootfs1"
mtd15: 02800000 00020000 "kernel2"
mtd16: 02400000 00020000 "rootfs2"
mtd17: 02080000 00020000 "syscfg"
root@OpenWrt:~# ubinfo -a
UBI version:                    1
Count of UBI devices:           1
UBI control device major/minor: 10:62
Present UBI devices:            ubi0

ubi0
Volumes count:                           2
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     288 (36569088 bytes, 34.8 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  20
Current maximum erase counter value:     10
Minimum input/output unit size:          2048 bytes
Character device major/minor:            247:0
Present volumes:                         0, 1

Volume ID:   0 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        50 LEBs (6348800 bytes, 6.0 MiB)
State:       OK
Name:        rootfs
Character device major/minor: 247:1
-----------------------------------
Volume ID:   1 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        214 LEBs (27172864 bytes, 25.9 MiB)
State:       OK
Name:        rootfs_data
Character device major/minor: 247:2
root@OpenWrt:~#

And just to be complete, after just flashing the new factory image:

BusyBox v1.35.0 (2022-02-22 17:50:22 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r18949-c0849c1d9c
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 6.3M      6.3M         0 100% /rom
tmpfs                   232.7M     80.0K    232.6M   0% /tmp
/dev/ubi0_1              22.2M     52.0K     21.0M   0% /overlay
overlayfs:/overlay       22.2M     52.0K     21.0M   0% /
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00020000 "SBL1"
mtd1: 00140000 00020000 "MIBIB"
mtd2: 00140000 00020000 "SBL2"
mtd3: 00280000 00020000 "SBL3"
mtd4: 00120000 00020000 "DDRCONFIG"
mtd5: 00120000 00020000 "SSD"
mtd6: 00280000 00020000 "TZ"
mtd7: 00280000 00020000 "RPM"
mtd8: 00140000 00020000 "art"
mtd9: 00100000 00020000 "APPSBL"
mtd10: 00040000 00020000 "u_env"
mtd11: 00040000 00020000 "s_env"
mtd12: 00040000 00020000 "devinfo"
mtd13: 02800000 00020000 "kernel1"
mtd14: 02400000 00020000 "rootfs1"
mtd15: 02800000 00020000 "kernel2"
mtd16: 02400000 00020000 "rootfs2"
mtd17: 02080000 00020000 "syscfg"
root@OpenWrt:~# ubinfo -a
UBI version:                    1
Count of UBI devices:           1
UBI control device major/minor: 10:62
Present UBI devices:            ubi0

ubi0
Volumes count:                           2
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     288 (36569088 bytes, 34.8 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  20
Current maximum erase counter value:     2
Minimum input/output unit size:          2048 bytes
Character device major/minor:            247:0
Present volumes:                         0, 1

Volume ID:   0 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        50 LEBs (6348800 bytes, 6.0 MiB)
State:       OK
Name:        rootfs
Character device major/minor: 247:1
-----------------------------------
Volume ID:   1 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        214 LEBs (27172864 bytes, 25.9 MiB)
State:       OK
Name:        rootfs_data
Character device major/minor: 247:2
root@OpenWrt:~# 

Hi Guys
not sure how the duel boot side of this all works
but if there is going to be partitions changes for v22
i'll throw this out there as idea atm

is it conceivable as UBI has it's own error correction
that both areas of rootfs1 & rootfs2 can be concatenated
so we would end up with 2x36M (72M)
even if flash file size is limited to 4+36M
can leave the 2 copy of the kernels & boot from ether
but would both access the same fixed location UBI concatenation

not sure how this will effect sysupgrade & making sure both kernels are the same
but the good thing would be with the same UBI's no matter witch kernel booted
the config would be the same with double the space for programs like Samba4 etc

That would not work.
It is not only about kernel, but also the installed add-on packages and settings are release-specific. All those are in the rootfs. If there is dual-boot with two different kernels, you also need two separate rootfs instances for them.

I did comment about the 2 kernels being synced
to elaborate on this thy would have to be the same version
an updated together so the kernels would the same and could not be different

@eginnc @t3hn00b
Sounds great so far.

Could you please test again sysupgrading from 21.02 (or normal 3 MB master):
I added the compatibility version check and a message that gets shown if you try to sysupgrade with the sysupgrade image.

  • trying to sysupgrade from 21.02 with a new sysupgrade image should fail and give you a warning message telling you to use the factory image.
  • sysupgrading further from a new 4 MB build to the next, should work normally

I uploaded the new images to Dropbox.

(commit can be seen in https://github.com/hnyman/openwrt/commit/cca222ca27013745886756b563fe86ac7d4c31b0 )

EDIT:
I created a pull request about these changes:

I can confirm your new sysupgrade image gives the warning on my "production" EA8500 AP running a 3MB snapshot.

From the command line:

BusyBox v1.35.0 (2022-02-11 22:17:40 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r18795-c391dcdf86
 -----------------------------------------------------
root@EA8500:~# cd /tmp
root@EA8500:/tmp# ls *.bin
openwrt-ipq806x-generic-linksys_ea8500-squashfs-sysupgrade.bin
root@EA8500:/tmp# sysupgrade -v /tmp/*.bin
Wed Feb 23 19:11:23 EST 2022 upgrade: The device is supported, but this image is incompatible for sysupgrade based on the image version (1.0->2.0).
Wed Feb 23 19:11:24 EST 2022 upgrade: *** Kernel partition size has changed from earlier versions. You need to sysupgrade with the OpenWrt factory image and use the force flag when image check fails. Settings will be lost. ***
Image check failed.
root@EA8500:/tmp#

and from LuCI:

And for the other half of it on the EA8500....

I confirmed I received the warning message attempting to flash your new 4MB sysupgrade from your old 4MB image.

After flashing your new 4MB factory image, I confirmed I did NOT receive the warning message when flashing your new 4MB sysupgrade image:

BusyBox v1.35.0 (2022-02-23 17:14:59 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r18953-b9251e3b40
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:~# cd /tmp
root@OpenWrt:/tmp# ls *upgr*.bin
openwrt-ipq806x-generic-linksys_ea8500-squashfs-sysupgrade.bin
root@OpenWrt:/tmp# sysupgrade -v /tmp/openwrt-ipq806x-generic-linksys_ea8500-squashfs-sysupgrade.bin
Wed Feb 23 19:20:43 EET 2022 upgrade: Saving config files...
etc/collectd.conf
etc/config/collectd
etc/config/dhcp
etc/config/dropbear
etc/config/firewall
etc/config/fstab
etc/config/luci
etc/config/luci_statistics
etc/config/network
etc/config/openssl
etc/config/rpcd
etc/config/system
etc/config/ubootenv
etc/config/ucitrack
etc/config/uhttpd
etc/config/wireless
etc/dropbear/dropbear_ed25519_host_key
etc/dropbear/dropbear_rsa_host_key
etc/fw_env.config
etc/group
etc/hosts
etc/inittab
etc/luci-uploads/.placeholder
etc/nftables.d/10-custom-filter-chains.nft
etc/nftables.d/README
etc/opkg/keys/17ec14f0d1558824
etc/opkg/keys/b5043e70f9a75cde
etc/passwd
etc/profile
etc/rc.local
etc/shadow
etc/shells
etc/shinit
etc/sysctl.conf
etc/uhttpd.crt
etc/uhttpd.key
etc/uhttpd.key
etc/uhttpd.crt
Wed Feb 23 19:20:43 EET 2022 upgrade: Commencing upgrade. Closing all shell sessions.
Command failed: Connection failed
root@OpenWrt:/tmp# Connection to 192.168.1.1 closed by remote host.
Connection to 192.168.1.1 closed.

Time to put a fork in it and call it done?

EDIT: I also noticed (a little late) that you included LuCI in your new 4MB builds. I was able to do an "opkg update" successfully, but things got a little dicey trying to install my favorite packages - not unexpected. Lots of "* pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.100-1-d7e200f5b925ad7d1616d927c28f37fb) for..." etc. messages on configuration. I'll put this device aside until I see your PR accepted.

Many thanks for working on this and keeping these devices supported!

unfortunately not quite. :slightly_frowning_face: Linksys didn't include uboot sources (or at least I'm unable to find it?) so behind the "bootipq" could still be a lurking "size check".

The EA7500-v1 and EA8500 kernel sizes are 3054276 Bytes ( = 2983 KiB), which is below the 3072KiB barrier. This is because the OpenWrt Buildbot will include all the in-tree and out-of-tree kmods (CONFIG_ALL_KMODS). Some of these kmods enable extra kernel subsystems (sound, input, RTC, block, iio) and not all of the subsystems are/can be packaged as modules but get integrated into the kernel.

I'll see if I can provide some extra "bloated" images tomorrow evening (CET).

@t3hn00b @eginnc

Well, apparently not quite yet :frowning:

@chunkeey noted that the kernel in previous test builds was slightly smaller than the 3 MB limit. So, although the rootfs start was pushed back to 4 MB in the image, it is still possible that the u-boot bootloader has an internal max. size of 3 MB defined for the kernel, and the boot would fail if the kernel size exceeds it.

See discussion in https://github.com/openwrt/openwrt/pull/9319

So, I added a few unneeded file systems and crypto algorithms to the built kernel, and rebuilt, so that the kernel+DTS now takes 3.5 MB (upto 0x0038cb10 in the factory image)

So, could you test once more... Just flashing the factory image should be enough. Does it reboot ok?

1 Like

The latest factory image also flashed (I needed to sysupgrade -F -n) and rebooted just fine on my EA8500. Here are the results of the commands you previously requested:

BusyBox v1.35.0 (2022-02-24 21:51:46 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r18967-cf346dfadf
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 7.0M      7.0M         0 100% /rom
tmpfs                   231.6M     76.0K    231.6M   0% /tmp
/dev/ubi0_1              21.4M     56.0K     20.2M   0% /overlay
overlayfs:/overlay       21.4M     56.0K     20.2M   0% /
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00020000 "SBL1"
mtd1: 00140000 00020000 "MIBIB"
mtd2: 00140000 00020000 "SBL2"
mtd3: 00280000 00020000 "SBL3"
mtd4: 00120000 00020000 "DDRCONFIG"
mtd5: 00120000 00020000 "SSD"
mtd6: 00280000 00020000 "TZ"
mtd7: 00280000 00020000 "RPM"
mtd8: 00140000 00020000 "art"
mtd9: 00100000 00020000 "APPSBL"
mtd10: 00040000 00020000 "u_env"
mtd11: 00040000 00020000 "s_env"
mtd12: 00040000 00020000 "devinfo"
mtd13: 02800000 00020000 "kernel1"
mtd14: 02400000 00020000 "rootfs1"
mtd15: 02800000 00020000 "kernel2"
mtd16: 02400000 00020000 "rootfs2"
mtd17: 02080000 00020000 "syscfg"
root@OpenWrt:~# ubinfo -a
UBI version:                    1
Count of UBI devices:           1
UBI control device major/minor: 10:62
Present UBI devices:            ubi0

ubi0
Volumes count:                           2
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     288 (36569088 bytes, 34.8 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  20
Current maximum erase counter value:     2
Minimum input/output unit size:          2048 bytes
Character device major/minor:            247:0
Present volumes:                         0, 1

Volume ID:   0 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        57 LEBs (7237632 bytes, 6.9 MiB)
State:       OK
Name:        rootfs
Character device major/minor: 247:1
-----------------------------------
Volume ID:   1 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        207 LEBs (26284032 bytes, 25.0 MiB)
State:       OK
Name:        rootfs_data
Character device major/minor: 247:2
root@OpenWrt:~#                                                                                                         
1 Like

@hnyman @chunkeey

I also flashed the new sysupgrade image on my spare EA8500 for completeness. Again - worked fine, booted right up with no issues.

BusyBox v1.35.0 (2022-02-24 21:51:46 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r18967-cf346dfadf
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 7.0M      7.0M         0 100% /rom
tmpfs                   231.6M     76.0K    231.6M   0% /tmp
/dev/ubi0_1              21.4M     64.0K     20.2M   0% /overlay
overlayfs:/overlay       21.4M     64.0K     20.2M   0% /
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00020000 "SBL1"
mtd1: 00140000 00020000 "MIBIB"
mtd2: 00140000 00020000 "SBL2"
mtd3: 00280000 00020000 "SBL3"
mtd4: 00120000 00020000 "DDRCONFIG"
mtd5: 00120000 00020000 "SSD"
mtd6: 00280000 00020000 "TZ"
mtd7: 00280000 00020000 "RPM"
mtd8: 00140000 00020000 "art"
mtd9: 00100000 00020000 "APPSBL"
mtd10: 00040000 00020000 "u_env"
mtd11: 00040000 00020000 "s_env"
mtd12: 00040000 00020000 "devinfo"
mtd13: 02800000 00020000 "kernel1"
mtd14: 02400000 00020000 "rootfs1"
mtd15: 02800000 00020000 "kernel2"
mtd16: 02400000 00020000 "rootfs2"
mtd17: 02080000 00020000 "syscfg"
root@OpenWrt:~# ubinfo -a
UBI version:                    1
Count of UBI devices:           1
UBI control device major/minor: 10:62
Present UBI devices:            ubi0

ubi0
Volumes count:                           2
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     288 (36569088 bytes, 34.8 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  20
Current maximum erase counter value:     11
Minimum input/output unit size:          2048 bytes
Character device major/minor:            247:0
Present volumes:                         0, 1

Volume ID:   0 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        57 LEBs (7237632 bytes, 6.9 MiB)
State:       OK
Name:        rootfs
Character device major/minor: 247:1
-----------------------------------
Volume ID:   1 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        207 LEBs (26284032 bytes, 25.0 MiB)
State:       OK
Name:        rootfs_data
Character device major/minor: 247:2
root@OpenWrt:~#                                                                                                         
1 Like

Hi, got busy at work and what not. So here's my EA7500v1: sysupgrade from ssh

root@Burloga:~# sysupgrade  -v /tmp/openwrt-ipq806x-generic-linksys_ea7500-v1-squashfs-factory.bin
Sat Feb 26 16:39:45 EET 2022 upgrade: Image metadata not present
Sat Feb 26 16:39:45 EET 2022 upgrade: Use sysupgrade -F to override this check when downgrading or flashing to vendor firmware
Image check failed.

And here's the output after flashing it

BusyBox v1.35.0 (2022-02-24 21:51:46 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r18967-cf346dfadf
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 7.0M      7.0M         0 100% /rom
tmpfs                   104.9M    248.0K    104.6M   0% /tmp
/dev/ubi0_1              21.4M     60.0K     20.2M   0% /overlay
overlayfs:/overlay       21.4M     60.0K     20.2M   0% /
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00020000 "SBL1"
mtd1: 00140000 00020000 "MIBIB"
mtd2: 00140000 00020000 "SBL2"
mtd3: 00280000 00020000 "SBL3"
mtd4: 00120000 00020000 "DDRCONFIG"
mtd5: 00120000 00020000 "SSD"
mtd6: 00280000 00020000 "TZ"
mtd7: 00280000 00020000 "RPM"
mtd8: 00140000 00020000 "art"
mtd9: 00100000 00020000 "APPSBL"
mtd10: 00040000 00020000 "u_env"
mtd11: 00040000 00020000 "s_env"
mtd12: 00040000 00020000 "devinfo"
mtd13: 02800000 00020000 "kernel1"
mtd14: 02400000 00020000 "rootfs1"
mtd15: 02800000 00020000 "kernel2"
mtd16: 02400000 00020000 "rootfs2"
mtd17: 00100000 00020000 "sysdiag"
mtd18: 01f80000 00020000 "syscfg"
root@OpenWrt:~# ubinfo -a
UBI version:                    1
Count of UBI devices:           1
UBI control device major/minor: 10:62
Present UBI devices:            ubi0

ubi0
Volumes count:                           2
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     288 (36569088 bytes, 34.8 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  20
Current maximum erase counter value:     2
Minimum input/output unit size:          2048 bytes
Character device major/minor:            247:0
Present volumes:                         0, 1

Volume ID:   0 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        57 LEBs (7237632 bytes, 6.9 MiB)
State:       OK
Name:        rootfs
Character device major/minor: 247:1
-----------------------------------
Volume ID:   1 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        207 LEBs (26284032 bytes, 25.0 MiB)
State:       OK
Name:        rootfs_data
Character device major/minor: 247:2
root@OpenWrt:~#

Thanks for the confirmation.

@chunkeey has my commit already in his staging repo, but hasn't yet pushed it to the main OpenWrt repo.

yes, I'm holding out hope for a compromise since pepe2k wants more:

Out of curiosity, why not extend it lets say twice, to 6 MB? Wouldn't that survive longer and more kernel updates/size increases? Is there a limit of data size U-Boot reads from kernel partition?

and man0sn's

I don't object the 4MB change but I agree that 6MB would be more future-proof as pepe2k said.

I would support that 4 MiB (as this is for 4 MiB xz-compressed and other IPQ806x). I've run compile-tests and there were no hiccups.

On remaining detail is: Should there be a little extra spare area (so 4.5-5 MiB kernel partition) to have some space for perfectly working EA8500/EA7500v1 that have unfortunately experienced bad nand pages in the kernel region once the kernel grows close to the 4M size? Or just merge it as is?

I would merge as it is.
Trying to define some extra space between kernel and rootfs might work with sysupgrade after the OpenWrt is already installed, but it is futile with the factory image. As factory is monolithic, the possible bad blocks push rootfs start location further, making it unfoundable and causing bootloop. See R7800 -> Flashing openwrt causes bootloop (bad block in kernel area) - #49 by Steltek

If you want to go that road, you could leave the 4 MB kernel size limit in the image recipe, but define the rootfs to start 256 kB later.

We have lots of ipq806x devices with 4 MB kernel, so will need action at that point in future in any case. But sure, you could go with 5 MB here. (Assuming that the bootloader did not have a 4 MB limit that has been tested...)

2 Likes

Can I quote you there (commit message)?