[OpenWrt-Devel] [RFC PATCH] ath79: clarify purpose of factory image

Adrian Schmutzler freifunk at adrianschmutzler.de
Thu Mar 26 11:56:54 EDT 2020


While the purpose of a factory image in general is to flash a
device with vendor OS "directly", some vagueness has evolved over
the years with respect to additional uses of these images.

One common case is when a device supports TFTP recovery.
Particularly with TP-Link devices in ar71xx/ath79, it is common
that the factory image can be flashed via TFTP without any additional
measures. In contrast, on some ramips devices the same procedure might
overwrite your u-boot partition and make the device unbootable.
However, in both cases you might only have a factory.bin which
won't reveal any further information just by itself.

To improve the situation at least a bit, this commit tries to
clarify the image names by introducing the following three schemes:

factory.bin - used from vendor OS, _not_ suitable for TFTP
factory-tftp.bin - used from vendor OS, _also_ suitable for TFTP
tftp.bin - can _not_ be used from vendor OS, but can be used via TFTP

Since factory.bin and tftp.bin are already used widely, this will
keep the impact relatively small by only adding the "combined"
factory-tftp.bin image name. No additional images are built, just
the name of the existing one is slightly adjusted for matching cases.
Despite, the name change as an indicator for the new TFTP capability
will have to be added manually, so in case of uncertainty the image
name will indicate the lesser functionality by default.

Thus, this patch introduces the factory-tftp.bin name for all devices
where TFTP flashing instructions are indicated by the commit message,
and for all TP-Link devices with v1 image/header or tplink-safeloader.

Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>

---

This is meant as a base for discussion. I plan to do the same for
ramips later if this sees positive resonance.

Feel free to add information about devices I overlooked.

This is not even build-tested.
---
 target/linux/ath79/image/common-tp-link.mk  |  6 ++---
 target/linux/ath79/image/generic-tp-link.mk |  2 +-
 target/linux/ath79/image/generic.mk         |  4 +--
 target/linux/ath79/image/tiny-tp-link.mk    | 28 ++++++++++-----------
 4 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/target/linux/ath79/image/common-tp-link.mk b/target/linux/ath79/image/common-tp-link.mk
index 328eaaed30..ed636ed7fd 100644
--- a/target/linux/ath79/image/common-tp-link.mk
+++ b/target/linux/ath79/image/common-tp-link.mk
@@ -17,9 +17,9 @@ define Device/tplink-v1
   LOADER_TYPE := gz
   KERNEL := kernel-bin | append-dtb | lzma
   KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | tplink-v1-header
-  IMAGES += factory.bin
+  IMAGES += factory-tftp.bin
   IMAGE/sysupgrade.bin := tplink-v1-image sysupgrade | append-metadata
-  IMAGE/factory.bin := tplink-v1-image factory
+  IMAGE/factory-tftp.bin := tplink-v1-image factory
 endef
 
 define Device/tplink-v2
@@ -80,7 +80,7 @@ define Device/tplink-safeloader
   KERNEL := kernel-bin | append-dtb | lzma | tplink-v1-header -O
   IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \
 	append-metadata | check-size
-  IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
+  IMAGE/factory-tftp.bin := append-rootfs | tplink-safeloader factory
 endef
 
 define Device/tplink-safeloader-uimage
diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk
index 4c925cf850..0e2a56a6d5 100644
--- a/target/linux/ath79/image/generic-tp-link.mk
+++ b/target/linux/ath79/image/generic-tp-link.mk
@@ -166,7 +166,7 @@ define Device/tplink_archer-c7-v2
 	ath10k-firmware-qca988x-ct
   TPLINK_HWID := 0xc7000002
   SUPPORTED_DEVICES += archer-c7
-  IMAGES += factory-us.bin factory-eu.bin
+  IMAGES += factory-tftp-us.bin factory-tftp-eu.bin
   IMAGE/factory-us.bin := tplink-v1-image factory -C US
   IMAGE/factory-eu.bin := tplink-v1-image factory -C EU
 endef
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index aac89e9269..53cdd04c1e 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -574,8 +574,8 @@ define Device/engenius_epg5000
   DEVICE_MODEL := EPG5000
   DEVICE_PACKAGES := ath10k-firmware-qca988x-ct kmod-ath10k-ct kmod-usb2
   IMAGE_SIZE := 14656k
-  IMAGES += factory.dlf
-  IMAGE/factory.dlf := append-kernel | pad-to $$$$(BLOCKSIZE) | \
+  IMAGES += factory-tftp.dlf
+  IMAGE/factory-tftp.dlf := append-kernel | pad-to $$$$(BLOCKSIZE) | \
 	append-rootfs | pad-rootfs | check-size | \
 	senao-header -r 0x101 -p 0x71 -t 2
   SUPPORTED_DEVICES += epg5000
diff --git a/target/linux/ath79/image/tiny-tp-link.mk b/target/linux/ath79/image/tiny-tp-link.mk
index dc91a74ae1..d0bb119923 100644
--- a/target/linux/ath79/image/tiny-tp-link.mk
+++ b/target/linux/ath79/image/tiny-tp-link.mk
@@ -279,9 +279,9 @@ define Device/tplink_tl-wr841-v11
   DEVICE_VARIANT := v11
   TPLINK_HWID := 0x08410011
   SUPPORTED_DEVICES += tl-wr841n-v11
-  IMAGES += factory-us.bin factory-eu.bin
-  IMAGE/factory-us.bin := tplink-v1-image factory -C US
-  IMAGE/factory-eu.bin := tplink-v1-image factory -C EU
+  IMAGES += factory-tftp-us.bin factory-tftp-eu.bin
+  IMAGE/factory-tftp-us.bin := tplink-v1-image factory -C US
+  IMAGE/factory-tftp-eu.bin := tplink-v1-image factory -C EU
 endef
 TARGET_DEVICES += tplink_tl-wr841-v11
 
@@ -292,9 +292,9 @@ define Device/tplink_tl-wr841-v12
   DEVICE_VARIANT := v12
   TPLINK_HWID := 0x08410012
   SUPPORTED_DEVICES += tl-wr841n-v11
-  IMAGES += factory-us.bin factory-eu.bin
-  IMAGE/factory-us.bin := tplink-v1-image factory -C US
-  IMAGE/factory-eu.bin := tplink-v1-image factory -C EU
+  IMAGES += factory-tftp-us.bin factory-tftp-eu.bin
+  IMAGE/factory-tftp-us.bin := tplink-v1-image factory -C US
+  IMAGE/factory-tftp-eu.bin := tplink-v1-image factory -C EU
 endef
 TARGET_DEVICES += tplink_tl-wr841-v12
 
@@ -315,10 +315,10 @@ define Device/tplink_tl-wr940n-v4
   DEVICE_VARIANT := v4
   TPLINK_HWID := 0x09400004
   SUPPORTED_DEVICES += tl-wr940n-v4
-  IMAGES += factory-us.bin factory-eu.bin factory-br.bin
-  IMAGE/factory-us.bin := tplink-v1-image factory -C US
-  IMAGE/factory-eu.bin := tplink-v1-image factory -C EU
-  IMAGE/factory-br.bin := tplink-v1-image factory -C BR
+  IMAGES += factory-tftp-us.bin factory-tftp-eu.bin factory-tftp-br.bin
+  IMAGE/factory-tftp-us.bin := tplink-v1-image factory -C US
+  IMAGE/factory-tftp-eu.bin := tplink-v1-image factory -C EU
+  IMAGE/factory-tftp-br.bin := tplink-v1-image factory -C BR
 endef
 TARGET_DEVICES += tplink_tl-wr940n-v4
 
@@ -329,10 +329,10 @@ define Device/tplink_tl-wr940n-v6
   DEVICE_VARIANT := v6
   TPLINK_HWID := 0x09400006
   SUPPORTED_DEVICES += tl-wr940n-v6
-  IMAGES += factory-us.bin factory-eu.bin factory-br.bin
-  IMAGE/factory-us.bin := tplink-v1-image factory -C US
-  IMAGE/factory-eu.bin := tplink-v1-image factory -C EU
-  IMAGE/factory-br.bin := tplink-v1-image factory -C BR
+  IMAGES += factory-tftp-us.bin factory-tftp-eu.bin factory-tftp-br.bin
+  IMAGE/factory-tftp-us.bin := tplink-v1-image factory -C US
+  IMAGE/factory-tftp-eu.bin := tplink-v1-image factory -C EU
+  IMAGE/factory-tftp-br.bin := tplink-v1-image factory -C BR
 endef
 TARGET_DEVICES += tplink_tl-wr940n-v6
 
-- 
2.20.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list