TP-Link EAP245 v3 "Bad file." when attempting to flash

I have a EAP245 v3 that is apparently a US model, though I purchased it in Canada. I first upgraded the stock firmware as specified in the wiki, but flashed the Canadian firmware (specifically EAP245(CA)_V3_5.0.0 Build 20201022). When I attempt to flash the openwrt factory image, I receive a "Bad file." message. I am first running cliclientd stopcs over ssh as the wiki specifies. Any advice?

Thanks also for the work porting this device, hopefully I can get mine to work!

Edit: I had a look at the datasheet and it seems to suggest there are only 2 HW variants (US and EU). So my difficulties presumably must be associated with the CA firmware.

You are probably right in assuming the issue lies with the CA firmware.

We've noticed that on other EAP-devices that the CA-firmware performs an extra check that isn't present in the EU/US firmware.

1 Like

Does the label say "US"?

Yes, it says EAP245(US) Ver:3.0

See if it can be flashed with US stock firmware.

I've just tried to flash the US firmware, and it also complains with "Bad file." I tried 2.20.0, 2.21.0 and 5.0.0.

Then it should most likely be possible that a similar approach would work on the EAP245 v3. I'll have to spend some time learning more about this stuff.

If you're building your own images (or feel comfortable trying), you can try patching the existing EAP245v3 code hack together a CA image. Basically, you need to add a 'product-info' partition to the firmware image that contains "region=CA".

EAP225-Outdoor CA patch
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index 888e252389d3..00f0bd80a406 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -85,6 +85,7 @@ struct device_info {
 	const char *id;
 	const char *vendor;
 	const char *support_list;
+	const char *product_info;
 	enum partition_trail_value part_trail;
 	const char *soft_ver;
 	uint32_t soft_ver_compat_level;
@@ -1341,6 +1342,47 @@ static struct device_info boards[] = {
 		.last_sysupgrade_partition = "file-system"
 	},
 
+	/** Firmware layout for the EAP225-Outdoor v1 CA */
+	{
+		.id     = "EAP225-OUTDOOR-V1-CA",
+		.support_list =
+			"SupportList:\r\n"
+			"EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n",
+		.product_info =
+			"EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n"
+			"key=BgIAAAAkAABSU0ExAAQAAAEAAQDZtUNzD6KsxO4Tfx/Sp8S7"
+			"w8TwPWwoppXy77wSPNs5WoV+Wr4kh09nu70vHVmSPji5KFUG+hmR"
+			"japsJsIJj+M0Zmd4EycKY8r0Ea3D4XO/uvloX4VHVPsDZkm8Kria"
+			"n5iNy6BgApVlebx0zQxto0GkgvPBq1nhoZxJNapLghGO7w==\r\n"
+			"rsaKey=BgIAAACkAABSU0ExAAQAAAEAAQDZaGCNzHjzrgNoCjyHK"
+			"a0TIkgmqE5kheNhZHs23TmAbHXN0dFwdNOqqDOTmTdoN1+zW6KY3"
+			"YkkwNypoZbDTR3sKdSdIDTNnftfHhRAlR9l4lNnnvfbUWRDqaGD2"
+			"nAkdasXXfD5c23COMvAEjLJXzwqZjNmj27ZgrrTlH9SoDPerg=="
+			"\r\nHWID=25D5A049380DDBA7AF3A96CC2DCB5986\r\n"
+			"region=CA\r\n",
+		.part_trail = PART_TRAIL_NONE,
+		.soft_ver = NULL,
+		.soft_ver_compat_level = 1,
+
+		.partitions = {
+			{"fs-uboot", 0x00000, 0x20000},
+			{"partition-table", 0x20000, 0x02000},
+			{"default-mac", 0x30000, 0x01000},
+			{"support-list", 0x31000, 0x00100},
+			{"product-info", 0x31100, 0x00400},
+			{"soft-version", 0x32000, 0x00100},
+			{"firmware", 0x40000, 0xd80000},
+			{"user-config", 0xdc0000, 0x30000},
+			{"mutil-log", 0xf30000, 0x80000},
+			{"oops", 0xfb0000, 0x40000},
+			{"radio", 0xff0000, 0x10000},
+			{NULL, 0, 0}
+		},
+
+		.first_sysupgrade_partition = "os-image",
+		.last_sysupgrade_partition = "file-system"
+	},
+
 	/** Firmware layout for the EAP225 v3 */
 	{
 		.id     = "EAP225-V3",
@@ -2431,6 +2473,16 @@ static struct image_partition_entry make_support_list(
 	);
 }
 
+/** Generates the product-info partition */
+static struct image_partition_entry make_product_info(
+	const struct device_info *info
+) {
+	uint32_t len = strlen(info->product_info);
+	return init_meta_partition_entry(
+		"product-info", info->product_info, len, info->part_trail
+	);
+}
+
 /** Partition with extra-para data */
 static struct image_partition_entry make_extra_para(
 	const struct device_info *info, const uint8_t *extra_para, size_t len
@@ -2734,8 +2786,11 @@ static void build_image(const char *output,
 		parts[5] = make_extra_para(
 			info, extra_para, sizeof(extra_para)
 		);
+	} else if (strcasecmp(info->id, "EAP225-OUTDOOR-V1-CA") == 0) {
+		parts[5] = make_product_info(info);
 	}
 
+
 	size_t len;
 	void *image;
 	if (sysupgrade)

I wrote a Python script that should allow you to build CA-compatible factory images, using the OpenWrt factory image and a TP-Link firmware image for the CA-version.

Usage is as follows to make an OpenWrt factory image compatible with a CA-region:

  1. Download the OpenWrt factory, e.g. from snapshot builds
  2. Download and extract the original firmware upgrade image for the CA region
  3. Run the patching script: patch-safeloader.py --factory openwrt-ath79-generic-tplink_eap245-v3-squashfs-factory.bin --input EAP245v3_5.0.0_\[20201022-rel59827\]_up_signed.bin --patch product-info --output factory-ca.bin

You should then be able to flash the resulting factory-ca.bin image.

2 Likes

Wow! Thank you so much! That worked perfectly.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.