OpenWrt support for Linksys MX4200

Managed to get it building with:

diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk
index b30491911a..c45bf3ac0e 100644
--- a/target/linux/qualcommax/image/ipq807x.mk
+++ b/target/linux/qualcommax/image/ipq807x.mk
@@ -109,7 +109,7 @@ endef
 TARGET_DEVICES += linksys_mx4200v1

 define Device/linksys_mx4200v2
-       $(call Device/linksys_mx4200)
+       $(call Device/linksys_mx4200v1)
         DEVICE_VARIANT := v2
 endef
 TARGET_DEVICES += linksys_mx4200v2

But unfortunately, still no WiFi.

No WiFi because you're still on old Partition

You need to power it off after 5s of turning it om

So sysupgrade -> restart -> wait 5s -> power it off -> power it on?

Yeah you got it

If I do that, it seems to not boot properly? There's a solid blue LED and it doesn't seem to assign any IP.

Link speed (Receive/Transmit):	1000/1000 (Mbps)
Link-local IPv6 address:	fe80::26d8:9d02:159:fa4e%15
IPv6 DNS servers:	fec0:0:0:ffff::1%1 (Unencrypted)
fec0:0:0:ffff::2%1 (Unencrypted)
fec0:0:0:ffff::3%1 (Unencrypted)
Manufacturer:	Intel Corporation
Description:	Intel(R) I211 Gigabit Network Connection
Driver version:	12.19.1.32
Physical address (MAC):	18-C0-4D-07-B1-6A

If I turn it off, wait a good 30s and turn it on, then it "boots", but the LED doesn't work at all and neither does WiFi.

Is there no way to boot into the correct partition via terminal?

Yeah that's what I'm talking about sysupgrade doesn't work

Right, I think I'm understanding? So, when the first flash happens from stock with openwrt-qualcommax-ipq807x-linksys_mx4200v1-squashfs-factory.bin, it flashes to alt_rootfs? Then on consequent sysupgrade it doesn't actually flash the updated firmware?

Can we not use mtd instead, like here?

You can try but I can't guarantee anything since I haven't tried it

It does flash it but it just waits for ubiblock0_1

Understood - so are we stuck at this point essentially?

Well uhm I'm busy with studies so basically yeah

If another dev wants to chip in feel free Todo so

Understood, thanks for the work so far! If you have the time, a brief overview of the partition issues would be helpful.

@Ansuel, I don't suppose you could point into the right direction for sorting out the issue with the boot partitions?

I would but I've tried everything I know got no clue myself,

I asked IRC chat and here's what another guy said

2 Likes

Hello,
I am unclear about the status of MX4200 support.
Is V2 OK, but V1 Not?

Both are good, just sysupgrade doesn't work on either of them

Somewhere above iirc supersebbo has OEM fw log

I'm not optimistic (as I say I don't really know what I'm poking at but trying to understand) but I wonder if the behaviour might be any different with this patch?

diff --git a/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh b/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh
index 21d22c6f1b..e01e207676 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh
@@ -44,6 +44,10 @@ linksys_get_target_firmware() {
 	esac
 }

+linksys_get_root_magic() {
+	(get_image "$@" | dd skip=786432 bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2>/dev/null
+}
+
 platform_do_upgrade_linksys() {
 	local magic_long="$(get_magic_long "$1")"

@@ -102,6 +106,19 @@ platform_do_upgrade_linksys() {

 	}
 	[ "$magic_long" = "27051956" ] && {
+		# check firmwares' rootfs types
+		local oldroot="$(linksys_get_root_magic $target_mtd)"
+		local newroot="$(linksys_get_root_magic "$1")"
+
+		if [ "$newroot" = "55424923" -a "$oldroot" = "55424923" ]
+		# we're upgrading from a firmware with UBI to one with UBI
+		then
+			# erase everything to be safe
+			mtd erase $part_label
+			get_image "$1" | mtd -n write - $part_label
+		else
+			get_image "$1" | mtd write - $part_label
+		fi
 		get_image "$1" | mtd write - $part_label
 	}
 }

This was some code that was removed a number of years ago as it was deemed to be doing nothing but I wonder if it is relevant. Bit a stab in the dark but maybe worth a shot?

Sorry, I'm new around here.
I found my way there: https://downloads.openwrt.org/snapshots/targets/qualcommax/ipq807x/
but I can't find the relevant files.
Do I have to compile it? From which code? Is there a doc I can follow (I mean specific to the MX4200)?