routerbootpart: hard_config partition can be larger than a single block on MikroTik devices

Thibaut hacks at slashdirt.org
Sat May 1 12:09:58 BST 2021


Following up on IRC conversation, for the record:

> Le 1 mai 2021 à 11:27, Thibaut <hacks at slashdirt.org> a écrit :

[…]

> Yes, but only the first 4K is used. What’s needed is to check whether or not the rb_hardconfig driver will successfully process a 4K-only block from an 8K partition. I *think* it should, but haven’t looked back at the code or tested that yet.

After checking, the rb_hardconfig driver will handle this case with no problem.

> If that’s the case then adapting routerbootpart is relatively trivial.

There are two ways to deal with the hap-ac2 situation:

Either fix it globally, by making the hard_config partition auto-extend up to the next defined partition via the following patch:

--- a/target/linux/generic/files/drivers/mtd/parsers/routerbootpart.c
+++ b/target/linux/generic/files/drivers/mtd/parsers/routerbootpart.c
@@ -99,7 +99,7 @@ static struct routerboot_dynpart rb_dynparts[] = {
                .magic = RB_MAGIC_HARD, // stored in CPU-endianness on flash
                .size_fixup = NULL,
                .offset = 0x0,
-               .size = RB_BLOCK_SIZE,
+               .size = 0x0,
                .found = false,
        }, {
                .name = "soft_config »,

This would of course need to be confirmed working on all currently supported devices (I can’t think of a situation where this would break, but one never knows).

Alternatively, overriding the size= parameter in the hap-ac2 DTS should also work. It’s likely this change will be needed for other ipq-based mikrotik devices.

HTH,
Thibaut


More information about the openwrt-devel mailing list