Sysupgrade question for new device (TL-WPA8630P V2)

@andyboeh Is it possible that part of your issue from overwriting u-boot when reverting to stock comes from the fact that

		.first_sysupgrade_partition = "os-image",
		.last_sysupgrade_partition = "file-system"

in the relevant commit to tplink-safeloader.c are not in the list of existing partitions (see a few lines above in the .partitions member)?

Thanks for the response, but unfortunately that's not the case: If you look at the definitions for the other devices, it's the same thing.
Plus, even flashing an OEM image overwrites my boot loader, so I'm sure something else was/is broken. I don't really care since it works for me this way.

Full disclosure: I'm still learning when it comes to building openwrt, though I've got a working build system that's producing working images for my pi and netgear router. But I'm a total newbie when it comes to porting openwrt...

Does it matter that the partition tables in the US and EU firmware for the WPA8630Pv2 are different?

Specifically that the default-mac, pin, device-id, product-info partitions are at 7e0000 upwards in the US and AU firmware, and 630000 upwards in the EU (and UK) firmware? (I haven't looked at the others.)

I've got a pair of (UK) WPA8630Pv2 devices running the build from netadair.de, and am very interested in getting something better running - I'm finding wifi intermittently unstable on that build.

Jon

I just bought my second WPA8630Pv2 and was wondering how many people are successfully running OpenWRT on it? Also 2.4Ghz network seems to struggle for some reason even though I sit right next to it, 5Ghz runs really well. Could this improve with OpenWRT firmware?

Yes and no: The partition table stuff is only evaluated when flashing from stock. OpenWrt uses the MTD definitions in the .dts.
However, you don't want OpenWrt to overwrite important stuff from the stock firmware, so the definitions in the .dts file are usually created in a way that only the os-image and file-system partitions are used.

My EU v2 has the partition table at 0x620000, not at 0x630000. I can't even find a US version of the v2 firmware, where did you download it? The AU version also has the partition table at 0x620000, maybe you mixed up the P and non-P version as I did previously?

Yes, you're right, I was trying to find a US P v2, but there isn't one and I picked the not-P version by mistake. And yes, in all the versions of firmware I could find (for Pv2 models) the partition table starts at 0x620000.

I'm learning here - would appreciate feedback if I'm getting it, or not!

I can see the partitions in the .dts file - and these make sense. There's a single firmware partition at 0x40000 which spans both the os-image and file-system partitions defined in the stock firmware. All the others are marked read-only, and presumably the absence of a partition in, say, the 0x670000 to 0x7f0000 region doesn't matter, and openwrt won't overwrite it? (There are some more partitions defined here in the stock firmware).

I can also see the partitions in the safeloader, but these don't match the stock firmware - though again I guess this doesn't matter as you're only overwriting the firmware partition.

But what I didn't get for a while is that if the first and last sysupgrade partitions are os-image and file-system, how does the safeloader make sense of this when they're not defined in the list of partitions just above? But if I've understood the code correctly it splits the firmware partition into os-image and file-system partitions as it builds the image, thus allowing more flexibility as to where the boundary is between these. (and that seems to need to align to a flash block boundary in factory images, but not for sysupgrade, which also seems to make some sense).

I think I'm getting there...

I'm not an expert in this either, since I also mostly copied and interpreted other people's work.

Generally, I have about the same understanding as you. The partitions in safeloader should match with the sole exception being os-image and file-system replace by firmware.

Were you able to test my branch, especially flashing from stock? I'd love to create a PR, but I don't want to do this without a test by someone else...
EDIT: I created a PR in the meantime (https://github.com/openwrt/openwrt/pull/2991) and we found out that I was mixing DE and EU versions. That might be the reason why my device cannot flash from stock. I would still be interested if someone could test whether flash from stock works as expected - as mentioned, do a full backup first and be prepared to restoring your device via an SPI flasher.

Sorry, work got busy again. I tried flashing one of my 8630Pv2s from stock with a patched version of 19.07.2 a couple of weeks ago, and bricked it :-(. Haven't had time to do anything about that yet (it's still sitting on the workbench waiting for me to wire up the serial port).

I have this and installed the 18.06 version. Can someone please explain how to open the device to access the flash chip?

I did take dump from openwrt using dd but since has a massive role at my please for the kids internet I need to be able to flash it back quickly to a working device.

I hvae not been able to open the stupid thing. I did remove the 4 screws and tried with a bit hard to open it but it didn't do the trick.

If I remember correctly, I just unscrewed the four screws and could pry it open using a guitar pick (there are some snaps that still hold it together).

Usually, I take dd dumps from all mtd partitions before playing around, but this time, I forgot. Luckily, another user sent me his dumps which I could use to revive mine (bootloader overwritten). I used a Raspberry Pi to flash the IC directly (I soldered wires, but a Pomona clip helps as well).

If your bootloader is not destroyed, you can always flash via Serial and TFTP (not the dumps, but a working firmware image. The stock firmware needs to be prepared to be accepted!).

Thanks I will give it a go again. I felt at some stage that I was about to break it as I was using a flat head screwdriver.

That will probably leave marks...you can check the FCC Internal Photos on how the case is built: https://fccid.io/TE7WPA8630P/Internal-Photos/Internal-Photo-3188513

I have a stock device that I'm hoping to test in the next few days. I'm just waiting on delivery of a SOIC8 clip to dump the existing flash (does anyone know if its possible to dump this from stock u-boot?). I bought it in Greece from a Kotsovolos store. However I don't know 100% whether it's an EU version (as the model name implies and I'm leaning towards) or a DE version (as the separate supplier sticker shows!). If anyone can say for sure from the information below I would be grateful.

In the web UI:

Firmware Version: 2.0.3 Build 20171018 Rel.36564
Hardware Version: TL-WPA8630P v2.0

Box stickers:

Model: TL-WPA8630P KIT(EU) Ver:2.2

Edit: Device sticker:

Model: TL-WPA8630P(EU) Ver:2.0

On a seperate box sticker:

TP-Link Deutchland GmbH
Robert-Bosch-Straße 9, 65719
Hofheim am Taunus, Germany
http://www.tp-link.de

FYI, these are the partitions I see from the serial console output (stock firmware).

 [    0.450000] Creating 6 MTD partitions on "spi0.0":
 [    0.460000] 0x000000000000-0x000000020000 : "factory-uboot"
 [    0.470000] 0x000000020000-0x000000040000 : "u-boot"
 [    0.470000] 0x000000040000-0x000000140000 : "uImage"
 [    0.480000] 0x000000140000-0x0000007e0000 : "rootfs"
 [    0.480000] mtd: partition "rootfs" set to be root filesystem
 [    0.490000] 0x0000007e0000-0x0000007f0000 : "mib0"
 [    0.490000] 0x0000007f0000-0x000000800000 : "ART"

Hm, I'd say the sticker is what counts. Mine says "EU" at the bottom, too.

I wouldn't trust the partition table too much, because the config partitions and nvm/pib partitions are missing. Unfortunately, I don't have access to a stock boot log from mine so I can't compare it.

I'd be very interested in your dump once your SOIC8 clip arrives - drop me a PM in this case. It should be possible from U-Boot, but I haven't tried it and it depends very much on the U-Boot that you are using.

What you can do instead is load an OpenWrt initramfs image via TFTP and dump from there - this doesn't modify your flash, but you need serial console to load the image.

I am interested in this as well. I have the V2(P) UK I beleive.

this is what I have on dmesg (already installed openwrt on it).

m25p80 spi0.0: gd25q64 (8192 Kbytes)
[    0.610168] 9 cmdlinepart partitions found on MTD device spi0.0
[    0.616294] Creating 9 MTD partitions on "spi0.0":
[    0.621244] 0x000000000000-0x000000020000 : "factory-uboot"
[    0.629064] 0x000000020000-0x000000040000 : "u-boot"
[    0.635965] 0x000000040000-0x000000620000 : "firmware"
[    0.657737] 2 tplink-fw partitions found on MTD device firmware
[    0.663890] 0x000000040000-0x0000001a6711 : "kernel"
[    0.670354] 0x0000001b0000-0x000000620000 : "rootfs"
[    0.676954] mtd: device 4 (rootfs) set to be root filesystem
[    0.682834] 1 squashfs-split partitions found on MTD device rootfs
[    0.689273] 0x0000004f0000-0x000000620000 : "rootfs_data"
[    0.696695] 0x000000620000-0x000000630000 : "partition-table"
[    0.704441] 0x000000630000-0x000000670000 : "config"
[    0.711347] 0x000000670000-0x000000730000 : "nvm"
[    0.717995] 0x000000730000-0x000000770000 : "pib"
[    0.724644] 0x000000770000-0x0000007f0000 : "unused"
[    0.731529] 0x0000007f0000-0x000000800000 : "art"

EDIT: I can create a dump from openwrt and send it to you if you're insterested by the way.

K.

Which OpenWrt build did you install? And how did you flash it?

Thanks for the offer, but if you've already installed OpenWrt, it's too late.

I installed netadair's build found on his website.

I mailed you a copy of my devices stock un-upgraded firmware. I dumped the SPI flash directly, I wasn't able to reliably capture u-boot on the serial console, just the rest of the kernel messages.

I built a copy of your branch but it resulted in my device becoming unresponsive. I was able to re-flash the original firmware to get it working again. One thing I haven't tried yet is upgrading to the latest official firmware, and capturing/upgrading from that. I'll try that next.

Thank you very much for testing and for the E-Mail - I just had a look at your files. I'll flash your complete dump to my device and see if I'll be able to fix it - it will take a few days.

Good that you took a backup first!