14.12.2016 18:41, FUKAUMI Naoki:
only DHP-EU and DHP2-JP (fw ver. 2.x) images are built for now.

it seems DHP-JP/AP/TW (fw ver. 1.x) use different buffalo_csum() formula,
so this may not work for them. (not confirmed)

Signed-off-by: FUKAUMI Naoki <nao...@gmail.com>
---
 target/linux/bcm53xx/image/Makefile | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/target/linux/bcm53xx/image/Makefile 
b/target/linux/bcm53xx/image/Makefile
index 853c9b2..d612b26 100644
--- a/target/linux/bcm53xx/image/Makefile
+++ b/target/linux/bcm53xx/image/Makefile
@@ -84,6 +84,35 @@ define Build/seama-nand
                -i $@.entity
 endef

+define Build/dhp-factory-image
+       $(eval product=$(word 1,$(1)))
+       $(eval region=$(word 2,$(1)))
+       $(eval language=$(word 3,$(1)))
+       ( \
+               echo $(product)_9.99_9.99_$(region)_bcm; \
+               echo filelen=$$(stat -c%s $@); \
+               cat $@ \
+       ) > $@.trx
+       $(STAGING_DIR_HOST)/bin/buffalo-enc \
+               -m 'start' \
+               -p $(product) -v '9.99' \
+               -i $@.trx -o $@.trx.enc
+       $(STAGING_DIR_HOST)/bin/buffalo-tag \
+               -a bcm \
+               -b $(product) -p $(product) \
+               -l $(language) -r $(region) -r $(region) \
+               -s \
+               -v '9.99' -m '9.99' \
+               -w 1 \
+               -I $@.trx.enc -o $@.tag
+       $(STAGING_DIR_HOST)/bin/buffalo-enc \
+               -m 'start' \
+               -p '' -v '' \
+               -i $@.tag -o $@.tag.enc
+       $(STAGING_DIR_HOST)/bin/mkdhpimg \
+               $@.tag.enc $@.trx.enc $@
+endef

Please split the whole block into single Build defines. This way we you can reuse the build steps for the WSR-1166DHP/WSR-1166DHP2 for example instead of adding the same chain of commands again.

Personally I prefer to prepend the unencrypted tag to the image and encrypt only the tag within the image in a next step instead of creating an external tag file, encrypt it and prepend it to the image.

Doing it this way, your factory image build code could be something like this:

IMAGE/factory-DHP-EU.bin := append-ubi | trx-nand | buffalo-wzr-900dhp-header | buffalo-enc -param a -param b | buffalo-tag -param a -param b | buffalo-enc-tag -size $tagsize | mkdhpimg

If the buffalo-tag has a fixed size, it might be more elegant to move the size param of buffalo-enc-tag to the Build define.

It's obviously to me that you have way more knowledge about Buffalo factory images than I. Therefore I have not set the patches to "changes requested" in patchwork yet. Might be possible that I've missed something and the outlined way would not work or there isn't any benefit of doing it this way.

Would be great if you could give me a feedback on this.

Mathias

_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to