From 62feb04fe12706ffc62933463ed917a19329687b Mon Sep 17 00:00:00 2001
From: Sven Eckelmann <sven.eckelmann@open-mesh.com>
Date: Thu, 19 May 2016 20:59:34 +0200
Subject: [PATCH] ar71xx-generic: Generate OpenMesh sysupgrades in OpenWrt

The workaround to generate sysupgrade images for OpenMesh devices in gluon
is replaced in LEDE/OpenWrt by a special patch. It is therefore better to
drop the workaround and use the upstream version.

Reported-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
---
 ...sysupgrade-images-for-OpenMesh-devic.patch | 30 +++++++++++++++++++
 targets/ar71xx-generic/profiles.mk            |  4 ---
 2 files changed, 30 insertions(+), 4 deletions(-)
 create mode 100644 patches/openwrt/0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devic.patch

diff --git a/patches/openwrt/0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devic.patch b/patches/openwrt/0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devic.patch
new file mode 100644
index 000000000..6470646d4
--- /dev/null
+++ b/patches/openwrt/0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devic.patch
@@ -0,0 +1,30 @@
+From: Sven Eckelmann <sven.eckelmann@open-mesh.com>
+Date: Tue, 17 May 2016 16:38:29 +0200
+Subject: ar71xx: Generate sysupgrade images for OpenMesh devices
+
+Some OpenWrt based firmwares like Gluon expect that a sysupgrade image
+exists when a device firmware can be updated via sysupgrade. This image
+wasn't created until now because OpenMesh devices use the same image for
+factory and sysupgrade flash. Copying the image from *factory.bin to
+*sysupgrade.bin is therefore enough to make the sysupgrade functionality
+visible.
+
+Reported-by: Matthias Schiffer <mschiffer@universe-factory.net>
+Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
+
+Forwarded: https://patchwork.ozlabs.org/patch/624172/
+
+diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
+index 916d4e2..f91e20e 100644
+--- a/target/linux/ar71xx/image/Makefile
++++ b/target/linux/ar71xx/image/Makefile
+@@ -1877,6 +1877,9 @@ define Image/Build/OpenMesh
+ 		"$(BUILD_DIR)/fwupgrade.cfg-$(4)" "fwupgrade.cfg" \
+ 		"$(KDIR_TMP)/vmlinux-$(2).uImage" "kernel" \
+ 		"$(KDIR)/root.$(1)" "rootfs"
++	if [ -e "$(call factoryname,$(1),$(2))" ]; then \
++		cp "$(call factoryname,$(1),$(2))" "$(call sysupname,$(1),$(2))"; \
++	fi
+ endef
+ 
+ 
diff --git a/targets/ar71xx-generic/profiles.mk b/targets/ar71xx-generic/profiles.mk
index 1b04068c1..f5a57da76 100644
--- a/targets/ar71xx-generic/profiles.mk
+++ b/targets/ar71xx-generic/profiles.mk
@@ -299,19 +299,16 @@ $(eval $(call GluonModel,OMEGA,onion-omega,onion-omega))
 
 # MR600
 $(eval $(call GluonProfile,MR600,om-watchdog uboot-envtools))
-$(eval $(call GluonProfileSysupgradeSuffix,MR600,-squashfs-factory,.bin))
 $(eval $(call GluonModel,MR600,mr600,openmesh-mr600))
 $(eval $(call GluonModelAlias,MR600,openmesh-mr600,openmesh-mr600-v2))
 
 # MR900
 $(eval $(call GluonProfile,MR900,om-watchdog uboot-envtools))
-$(eval $(call GluonProfileSysupgradeSuffix,MR900,-squashfs-factory,.bin))
 $(eval $(call GluonModel,MR900,mr900,openmesh-mr900))
 $(eval $(call GluonModelAlias,MR900,openmesh-mr900,openmesh-mr900-v2))
 
 # OM2P
 $(eval $(call GluonProfile,OM2P,om-watchdog uboot-envtools))
-$(eval $(call GluonProfileSysupgradeSuffix,OM2P,-squashfs-factory,.bin))
 $(eval $(call GluonModel,OM2P,om2p,openmesh-om2p))
 $(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-v2))
 $(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-hs))
@@ -320,7 +317,6 @@ $(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-lc))
 
 # OM5P
 $(eval $(call GluonProfile,OM5P,om-watchdog uboot-envtools))
-$(eval $(call GluonProfileSysupgradeSuffix,OM5P,-squashfs-factory,.bin))
 $(eval $(call GluonModel,OM5P,om5p,openmesh-om5p))
 $(eval $(call GluonModelAlias,OM5P,openmesh-om5p,openmesh-om5p-an))
 
-- 
GitLab