From a2c80c586b81efc1662fec23202b88e2790e305e Mon Sep 17 00:00:00 2001
From: David Bauer <mail@david-bauer.net>
Date: Tue, 14 Mar 2023 04:04:18 +0100
Subject: [PATCH] tplink-safeloader: add Archer AX23

Original partition alignment
----------------------------

partition fs-uboot base 0x00000 size 0x40000
partition os-image base 0x40000 size 0x400000
partition file-system base 0x440000 size 0xb60000
partition default-mac base 0xfa0000 size 0x00200
partition pin base 0xfa0200 size 0x00100
partition device-id base 0xfa0300 size 0x00100
partition product-info base 0xfa0400 size 0x0fc00
partition default-config base 0xfb0000 size 0x08000
partition ap-def-config base 0xfb8000 size 0x08000
partition user-config base 0xfc0000 size 0x0a000
partition ag-config base 0xfca000 size 0x04000
partition certificate base 0xfce000 size 0x02000
partition ap-config base 0xfd0000 size 0x06000
partition router-config base 0xfd6000 size 0x06000
partition favicon base 0xfdc000 size 0x02000
partition logo base 0xfde000 size 0x02000
partition partition-table base 0xfe0000 size 0x00800
partition soft-version base 0xfe0800 size 0x00100
partition support-list base 0xfe0900 size 0x00200
partition profile base 0xfe0b00 size 0x03000
partition extra-para base 0xfe3b00 size 0x00100
partition radio base 0xff0000 size 0x10000

Vendor image partition-table
----------------------------

partition fs-uboot base 0x00000 size 0x40000
partition os-image base 0x40000 size 0x400000
partition file-system base 0x440000 size 0xb60000
partition default-mac base 0xfa0000 size 0x00200
partition pin base 0xfa0200 size 0x00100
partition device-id base 0xfa0300 size 0x00100
partition product-info base 0xfa0400 size 0x0fc00
partition default-config base 0xfb0000 size 0x08000
partition ap-def-config base 0xfb8000 size 0x08000
partition user-config base 0xfc0000 size 0x0a000
partition ag-config base 0xfca000 size 0x04000
partition certificate base 0xfce000 size 0x02000
partition ap-config base 0xfd0000 size 0x06000
partition router-config base 0xfd6000 size 0x06000
partition favicon base 0xfdc000 size 0x02000
partition logo base 0xfde000 size 0x02000
partition partition-table base 0xfe0000 size 0x00800
partition soft-version base 0xfe0800 size 0x00100
partition support-list base 0xfe0900 size 0x00200
partition profile base 0xfe0b00 size 0x03000
partition extra-para base 0xfe3b00 size 0x00100
partition radio base 0xff0000 size 0x10000

Signed-off-by: David Bauer <mail@david-bauer.net>
---
 src/tplink-safeloader.c | 44 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

--- a/src/tplink-safeloader.c
+++ b/src/tplink-safeloader.c
@@ -874,6 +874,49 @@ static struct device_info boards[] = {
 		.last_sysupgrade_partition = "file-system",
 	},
 
+	/** Firmware layout for the Archer AX23 v1 */
+	{
+		.id     = "ARCHER-AX23-V1",
+		.vendor = "",
+		.support_list =
+			"SupportList:\n"
+			"{product_name:Archer AX23,product_ver:1.0,special_id:45550000}\n"
+			"{product_name:Archer AX23,product_ver:1.20,special_id:45550000}\n"
+			"{product_name:Archer AX23,product_ver:1.0,special_id:4A500000}\n"
+			"{product_name:Archer AX23,product_ver:1.20,special_id:4A500000}\n"
+			"{product_name:Archer AX23,product_ver:1.0,special_id:4B520000}\n"
+			"{product_name:Archer AX23,product_ver:1.0,special_id:52550000}\n"
+			"{product_name:Archer AX1800,product_ver:1.20,special_id:52550000}\n",
+		.part_trail = 0x00,
+		.soft_ver = SOFT_VER_TEXT("soft_ver:3.0.3\n"),
+
+		.partitions = {
+			{"fs-uboot", 0x00000, 0x40000},
+			{"firmware", 0x40000, 0xf60000},
+			{"default-mac", 0xfa0000, 0x00200},
+			{"pin", 0xfa0200, 0x00100},
+			{"device-id", 0xfa0300, 0x00100},
+			{"product-info", 0xfa0400, 0x0fc00},
+			{"default-config", 0xfb0000, 0x08000},
+			{"ap-def-config", 0xfb8000, 0x08000},
+			{"user-config", 0xfc0000, 0x0a000},
+			{"ag-config", 0xfca000, 0x04000},
+			{"certificate", 0xfce000, 0x02000},
+			{"ap-config", 0xfd0000, 0x06000},
+			{"router-config", 0xfd6000, 0x06000},
+			{"favicon", 0xfdc000, 0x02000},
+			{"logo", 0xfde000, 0x02000},
+			{"partition-table", 0xfe0000, 0x00800},
+			{"soft-version", 0xfe0800, 0x00100},
+			{"support-list", 0xfe0900, 0x00200},
+			{"profile", 0xfe0b00, 0x03000},
+			{"extra-para", 0xfe3b00, 0x00100},
+			{"radio", 0xff0000, 0x10000},
+			{NULL, 0, 0}
+		},
+		.first_sysupgrade_partition = "os-image",
+		.last_sysupgrade_partition = "file-system",
+	},
 	/** Firmware layout for the C2v3 */
 	{
 		.id     = "ARCHER-C2-V3",
@@ -3353,6 +3396,7 @@ static void build_image(const char *outp
 	if (strcasecmp(info->id, "ARCHER-A6-V3") == 0 ||
 	    strcasecmp(info->id, "ARCHER-A7-V5") == 0 ||
 	    strcasecmp(info->id, "ARCHER-A9-V6") == 0 ||
+	    strcasecmp(info->id, "ARCHER-AX23-V1") == 0 ||
 	    strcasecmp(info->id, "ARCHER-C2-V3") == 0 ||
 	    strcasecmp(info->id, "ARCHER-C7-V4") == 0 ||
 	    strcasecmp(info->id, "ARCHER-C7-V5") == 0 ||
