ath79: add support for YunCore TFTP image generation
authorVincent Wiemann <vincent.wiemann@ironai.com>
Mon, 12 Aug 2019 23:26:45 +0000 (01:26 +0200)
committerPiotr Dymacz <pepe2k@gmail.com>
Mon, 25 Nov 2019 16:32:46 +0000 (17:32 +0100)
YunCore QCA9k based devices released in 2019 require a custom TFTP image
for U-Boot built-in recovery mode (triggered with reset button). Image
has to be prepended with 'YUNCORE' keyword followed by U-Boot CLI
commands which will be executed later. Images without the custom header
will be ignored by U-Boot.

To be able to support both the vendor firmware (QSDK) and OpenWrt flash
layouts, used here commands change the 'bootcmd' before flashing image.

This commit adds generic helper script for YunCore devices with 16 MB of
flash and enables TFTP image generation for A770 model.

Signed-off-by: Vincent Wiemann <vincent.wiemann@ironai.com>
[pepe2k@gmail.com: commit description reworded, recipe renamed]
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
target/linux/ath79/image/common-yuncore.mk [new file with mode: 0644]
target/linux/ath79/image/generic.mk

diff --git a/target/linux/ath79/image/common-yuncore.mk b/target/linux/ath79/image/common-yuncore.mk
new file mode 100644 (file)
index 0000000..a71d930
--- /dev/null
@@ -0,0 +1,12 @@
+define Build/yuncore-tftp-header-16m
+       ( \
+               echo -n -e \
+                       "YUNCOREsetenv bootcmd \"bootm 0x9f050000 || bootm 0x9fe80000\"" \
+                       "&& saveenv" \
+                       "&& erase 0x9f050000 +0xfa0000" \
+                       "&& cp.b 0x800600c0 0x9f050000 0xfa0000" |\
+               dd bs=192 count=1 conv=sync; \
+               dd if=$@; \
+       ) > $@.new
+       mv $@.new $@
+endef
index 2396219b00bc06a3cff914e66bacc093f3268ca3..0c674cfe9a2e9851e82114d0e824c9a25863c554 100644 (file)
@@ -1,6 +1,7 @@
 include ./common-buffalo.mk
 include ./common-netgear.mk
 include ./common-tp-link.mk
+include ./common-yuncore.mk
 
 DEVICE_VARS += ADDPATTERN_ID ADDPATTERN_VERSION
 DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK
@@ -1034,6 +1035,8 @@ define Device/yuncore_a770
   DEVICE_MODEL := A770
   DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9887-ct
   IMAGE_SIZE := 16000k
+  IMAGES += tftp.bin
+  IMAGE/tftp.bin := $$(IMAGE/sysupgrade.bin) | yuncore-tftp-header-16m
 endef
 TARGET_DEVICES += yuncore_a770