[LEDE-DEV] [PATCH v2 2/3] ipq806x: Add support for new device: tew827dru

Mathias Kresin dev at kresin.me
Sun Sep 11 01:39:52 PDT 2016


11.09.2016 03:36, J Mo:
>
>
> On 09/10/2016 10:27 AM, Mathias Kresin wrote:
>> 10.09.2016 03:35, J Mo:
>>> --- a/include/image-commands.mk
>>> +++ b/include/image-commands.mk
>>> @@ -168,3 +168,19 @@ define Build/sysupgrade-tar
>>>          --rootfs $(call
>>> param_get_default,rootfs,$(1),$(IMAGE_ROOTFS)) \
>>>          $@
>>>  endef
>>> +
>>> +define Build/cameo-sig
>>> +    { \
>>> +        cameo_sig=$(word 1, $(1)) ;\
>>> +        align=$(if $(2),$(2),64) ;\
>>> +        oldsize=$$(stat -c %s $@) ;\
>>> +        sigsize=$$(echo -n $$cameo_sig | wc -c) ;\
>>> +        padsize=$$(( ( ( ( $$oldsize + $$sigsize ) / $$align ) + 1 )
>>> - ( ( $$oldsize + $$sigsize ) / $$align ) )) ;\
>>> +        newsize=$$(( $$oldsize + $$padsize )) ;\
>>> +        echo "Appending Cameo signature: \"$$cameo_sig\",
>>> oldsize=$$oldsize align=$$align sigsize=$$sigsize padsize=$$padsize
>>> newsize=$$newsize" ;\
>>> +        dd if=$@ of=$@.new bs=$$newsize count=1 conv=sync ;\
>>> +        echo -n "$$cameo_sig" >> $@.new ; \
>>> +    }
>>> +    @mv $@.new $@
>>> +endef
>>
>
> I'm not doing anything obscure here. This should be self-evident. Add a
> byte-aligned signature. pad-to can't do that.

Well if it would be obvious what you are trying to do I wouldn't ask.

I still don't get what and to which boundary you are trying to align. 
After fixing the build errors I do get the following:

Appending Cameo signature: "AP148AR9880-RT-150127-00", oldsize=5901955 
align=64 sigsize=24 padsize=1 newsize=5901956

PreFooter size: 5901956
PostFooter size: 5901979

Neither the pre footer image nor the post footer image is padded to a 
multiple of 64 byte.

Do you want to add the signature to a 64 byte padded image or should the 
image + signature padded to a multiple of 64byte? Where does the 64 byte 
does come from? It doesn't seam to be related to the 128k blocksize of 
the flash.

>>> diff --git
>>> a/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
>>> b/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
>>>
>>> index 1ae4352..a3326ab 100644
>>> ---
>>> a/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
>>>
>>> +++
>>> b/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
>>>
>>> @@ -18,6 +18,9 @@ case "$board" in
>>>      ea8500)
>>>          echo $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr)
>>> $(($PHYNBR + 1)) ) > /sys${DEVPATH}/macaddress
>>>          ;;
>>> +    tew827dru)
>>> +        echo $(macaddr_add $(mtd_get_mac_ascii APPSBLENV wan_mac)
>>> $(($PHYNBR + 1)) ) > /sys${DEVPATH}/macaddress
>>> +        ;;
>>>      *)
>>>          ;;
>>>  esac
>>
>> This whole file (already before your changes) looks completely wrong
>> to me. Would you please send me a dump of your ART partition!
>>
>> I'll have a look at the checksum. I've a checksum patcher for ath9k in
>> place (https://git.io/vi0eK) which might work for QCA99x0 caldata as
>> well. This way the ath10kcal_patch_mac function in
>> hotplug.d/firmware/11-ath10k-caldata can be used to fix the wifi mac
>> address.
>
> I have uploaded a dump of two ART partitions from two different
> tew827dru here if you or anyone else wants to look at them:
>
> http://jmomo.net/files/lede/tew827dru-ARTs/
>
> There is some discussion about this over on the TP-Link Archer C2600
> thread. I suggest you go check it out for additional background:
>
>     https://forum.openwrt.org/viewtopic.php?id=54973&p=13
>     https://forum.openwrt.org/viewtopic.php?id=54973&p=14
>     https://forum.openwrt.org/viewtopic.php?pid=317711#p317711
> https://github.com/ianchi/openwrt/commit/83084c84414b44801a1ba8f323b363f0bc748e64

This one is quite neat. It allows me to verify my changes. Would you 
please try the attached patch.

Before:

$ ./caldata -i './caldata1.bin' -v
Size: 12064
MAC: 12:34:56:78:90:12
Checksum: 0xdf10 (OK)

Patched:

$ ./caldata -v -i ./patched.bin
Size: 12064
MAC: aa:bb:cc:dd:ee:ff
Checksum: 0x184c (OK)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: ath10kcal_patch_mac.patch
Type: text/x-patch
Size: 4265 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/lede-dev/attachments/20160911/285a3206/attachment.bin>


More information about the Lede-dev mailing list