From 377e8942b247c8b3cc9d6dcf273ed86bc3d2c95a Mon Sep 17 00:00:00 2001 From: "Leon M. George" Date: Thu, 7 Nov 2019 13:24:40 +0100 Subject: [PATCH] ipq40xx: add cpximg to flash Compex WPJ428 via bootloader Generate a cpximg that is compatible with the cpximg loader in Compex' u-boot. The cpximg loader can be started either by holding the reset button during power up or by entering the u-boot prompt and entering 'cpximg'. Once it's running, a TFTP-server under 192.168.1.1 will accept an image appropriate for the board revision that is etched on the board (e.g. 6A04). The image can be pushed using tftp: tftp -v -m binary 192.168.1.1 -c put openwrt-ipq40xx-generic-compex_wpj428-squashfs-cpximg-6a04.bin cpximg files can also be used with the sysupgrade utility in stock images. (add SSH key in luci for root access) In mkmylofw_32m, the calculation of the "partition size" has been preferred to just padding the partition as this will result in less block transfers during flashing (while the additional complexity is bearable). Signed-off-by: Leon M. George Co-developed-by: Adrian Schmutzler Signed-off-by: Adrian Schmutzler --- target/linux/ipq40xx/image/Makefile | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/target/linux/ipq40xx/image/Makefile b/target/linux/ipq40xx/image/Makefile index 8097bf439a..50ea03d659 100644 --- a/target/linux/ipq40xx/image/Makefile +++ b/target/linux/ipq40xx/image/Makefile @@ -53,6 +53,22 @@ define Device/DniImage endef DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID +define Build/mkmylofw_32m + $(eval device_id=$(word 1,$(1))) + $(eval revision=$(word 2,$(1))) + + let \ + size="$$(stat -c%s $@)" \ + pad="$(subst k,* 1024,$(BLOCKSIZE))" \ + pad="(pad - (size % pad)) % pad" \ + newsize='size + pad'; \ + $(STAGING_DIR_HOST)/bin/mkmylofw \ + -B WPE72 -i 0x11f6:$(device_id):0x11f6:$(device_id) -r $(revision) \ + -s 0x2000000 -p0x180000:$$newsize:al:0x80208000:"OpenWrt":$@ \ + $@.new + @mv $@.new $@ +endef + define Build/SenaoFW -$(STAGING_DIR_HOST)/bin/mksenaofw \ -n $(BOARD_NAME) -r $(VENDOR_ID) -p $(1) \ @@ -243,8 +259,9 @@ define Device/compex_wpj428 BLOCKSIZE := 64k IMAGE_SIZE := 31232k KERNEL_SIZE := 4096k - IMAGES = sysupgrade.bin + IMAGES = sysupgrade.bin cpximg-6a04.bin IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata + IMAGE/cpximg-6a04.bin := append-kernel | append-rootfs | pad-rootfs | mkmylofw_32m 0x8A2 3 DEVICE_PACKAGES := kmod-gpio-beeper endef TARGET_DEVICES += compex_wpj428