From a7818e0550a2594d50d2874c1321784be093d8d2 Mon Sep 17 00:00:00 2001
From: Tony Ambardar <itugrok@yahoo.com>
Date: Sat, 11 Nov 2023 04:53:26 -0800
Subject: [PATCH] ipq40xx: enable UBI size checks for some Linksys NAND devices

Add correct NAND_SIZE in device definitions for EA6350v3, EA8300, MR8300,
WHW01 and WHW03v2, to enable improved image size checks wrt UBI reserved
blocks on NAND devices.

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
---
 target/linux/ipq40xx/image/generic.mk | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index b4719033c0..f5132cb91f 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -680,6 +680,7 @@ define Device/linksys_ea6350v3
 	PAGESIZE := 2048
 	KERNEL_SIZE := 5120k
 	IMAGE_SIZE := 35840k
+	NAND_SIZE := 128m
 	UBINIZE_OPTS := -E 5
 	IMAGES += factory.bin
 	IMAGE/factory.bin := append-kernel | append-uImage-fakehdr filesystem | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=EA6350v3
@@ -694,6 +695,7 @@ define Device/linksys_ea8300
 	SOC := qcom-ipq4019
 	KERNEL_SIZE := 5120k
 	IMAGE_SIZE := 84992k
+	NAND_SIZE := 256m
 	BLOCKSIZE := 128k
 	PAGESIZE := 2048
 	UBINIZE_OPTS := -E 5    # EOD marks to "hide" factory sig at EOF
@@ -711,6 +713,7 @@ define Device/linksys_mr8300
 	SOC := qcom-ipq4019
 	KERNEL_SIZE := 5120k
 	IMAGE_SIZE := 84992k
+	NAND_SIZE := 256m
 	BLOCKSIZE := 128k
 	PAGESIZE := 2048
 	UBINIZE_OPTS := -E 5    # EOD marks to "hide" factory sig at EOF
@@ -728,6 +731,7 @@ define Device/linksys_whw03v2
 	SOC := qcom-ipq4019
 	KERNEL_SIZE := 6144k
 	IMAGE_SIZE := 158720k
+	NAND_SIZE := 512m
 	BLOCKSIZE := 128k
 	PAGESIZE := 2048
 	UBINIZE_OPTS := -E 5    # EOD marks to "hide" factory sig at EOF
@@ -743,6 +747,7 @@ define Device/linksys_whw01
 	DEVICE_MODEL := WHW01
 	KERNEL_SIZE := 6144k
 	IMAGE_SIZE := 75776k
+	NAND_SIZE := 256m
 	SOC := qcom-ipq4018
 	BLOCKSIZE := 128k
 	PAGESIZE := 2048
-- 
2.30.2