Hey there; answer is inline too.
Thanks for picking this up!

On 8/14/21 3:54 PM, Tomasz Maciej Nowak wrote:
> Hi,
> one comment inline.
>
> W dniu 14.08.2021 o 14:33, Jan-Niklas Burfeind pisze:
>> [...]
>> +            partitions {
>> +                    compatible = "fixed-partitions";
>> +                    #address-cells = <1>;
>> +                    #size-cells = <1>;
>> +
>> +                    uboot: partition@0 {
>> +                            label = "u-boot";
>> +                            reg = <0x000000 0x020000>;
>
> Is this really the size of the U-Boot? According to the sources of
> U-Boot [1] the max size of bootloader is 64KiB. If the sources don't
> lie, what's between 0x10000-0x20000? Is that some hardcoded data or
> U-Boot environment? If it's the environment, You can't use static
> address of the MAC in nvmem-cells, because it can move around if
someone modified the environment. For that You'll need to extract it in
> userspace.
>
> 1.
https://github.com/OnionIoT/uboot/blob/684829a3a89eabca4b573530e89d60faed277dee/Makefile#L31
>
uboot knows it is 64KiB, printenv yields uboot_size=0x10000
It further knows, firmware starts not before 128Kib:
firmware_addr=0x9F020000

these are the last lines of mtd0:

000f8d0 ffff ffff ffff ffff ffff ffff ffff ffff
*
001fc00 40a3 6bc1 10b2 ffff ffff ffff ffff ffff
001fc10 ffff ffff ffff ffff ffff ffff ffff ffff
*
001fd00 4f4d 4547 41ff ffff ffff ffff ffff ffff
001fd10 ffff ffff ffff ffff ffff ffff ffff ffff
*
0020000

The six bytes at 001fc00 are the macaddress.

The six bytes at 001fd00 spell OMEGA.

>> +                            read-only;
>> +                            compatible = "nvmem-cells";
>> +                            #address-cells = <1>;
>> +                            #size-cells = <1>;
>> +
>> +                            macaddr_uboot_1fc00: macaddr@1fc00 {
>> +                                    reg = <0x1fc00 0x6>;
>> +                            };
>> +                    };
>> +
>> +                    partition@20000 {
>> +                            compatible = "tplink,firmware";
>> +                            label = "firmware";
>> +                            reg = <0x020000 0xfd0000>;
>> +                    };
>> +
>> +                    art: partition@ff0000 {
>> +                            label = "art";
>> +                            reg = <0xff0000 0x010000>;
>> +                            read-only;
>> +                    };
>> +            };
>> +    };
>> +};
>> +
>> +&wmac {
>> +    status = "okay";
>> +
>> +    mtd-cal-data = <&art 0x1000>;
>> +    nvmem-cells = <&macaddr_uboot_1fc00>;
>> +    nvmem-cell-names = "mac-address";
>> +};
>
> [ snip ]
>
> Regards
>

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to