So it's a little more complicated it seems, which is made worse because I don't have the actual source to my particular device (U-Boot for 1010-12) and Zyxel has not yet responded. I'll do a new request for the code though ...
When looking at the code for the XGS1210-12 and XGS1010-12, we see that the logs are stored as I said above, at the end of the partition (https://gitlab.com/olliver/openwrt/realtek_sdk/-/blob/xgs1250/sdk/system/uboot/cmd/uboot_func.c#L3545) however, it looks like, zyxel in all its wise-ness, is storing this data at the start of 'runtime2' partition for the XGS1010-12. Due to the above check failing due to these bytes being read incorrectly, we get the same behavior as @Borromini mentioned earlier ...
Which means, that the XGS1010-12 is for the time being, artificially limited to 8MiB firmware slots, due to a check being done on this bytes
I was hoping to avoid having to re-do U-Boot; because I'm not even sure we have all sources needed to compile U-Boot; and replacing U-boot is always 'scary'.
I might consider taking the XGS1210-12 U-Boot; but I'd need someone to donate it @RaylynnKnight can probably help here. Which sadly means, more effort to support the device; but I suppose that's a risk we'd have to be willing to take ... Stupid vendor crap
Small update; the hw selftest runs the flash write test on address 0xb48f0000
which is actually near the end of the actual firmware partition O.O 0xb4300000-0xb497ffff
[round:31] Flash: fill pattern(0x80000000) from 0xb48f0000 to 0xb4900000 passed!
So, I looked more into the previously mentioned abortboot()
function, which is actually a normal U-Boot function. What realtek did however, is hacked in their self-test check, which due to their sloppy ness is evident by alignment alone already
What does that mean? U-boot checks if bit 28 is set (because they don't do 0 != htpModeIf
or 0 > htpModeIf
, anyway, bit 28 in flash-address 0x810000
which is in the middle of the flash. So one could argue, any of the self-test commands etc are at risk of corrupting flash/wiping flash, but by ensuring bit28 is always cleared, this would never happen, so the rest of the flash could be used, except for the fact that again, this is in the middle of the flash :S So for the xgs1010-12 this makes things annoying. Once I get the XGS1210-12 bootloader, I'll experiment some more, as I think the restrictions are 'better' due to these restrictions comming from the bootloader ... I'll put my findings in the wiki
P.S. can we tell openwrt to use the second partition as storage? that would alleviate the pain; what name/ih-magic would it have to have?