[Add kernel_in_ubi feature to separate image format]

[Description]
Add kernel_in_ubi feature to separate image format
1. kernel_in_ubi will decide partition layout and enable overlayfs
on/off

[Release-log]

diff --git a/recipes-kernel/linux/linux-mediatek-5.4/003-rdkb-mtd-kernel-ubi-relayout.patch b/recipes-kernel/linux/linux-mediatek-5.4/003-rdkb-mtd-kernel-ubi-relayout.patch
new file mode 100644
index 0000000..de552c2
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/003-rdkb-mtd-kernel-ubi-relayout.patch
@@ -0,0 +1,26 @@
+diff --git a/arch/arm/boot/dts/mt7986-spim-nand-partition.dtsi b/arch/arm/boot/dts/mt7986-spim-nand-partition.dtsi
+index 4cc7961..924f8cc 100644
+--- a/arch/arm/boot/dts/mt7986-spim-nand-partition.dtsi
++++ b/arch/arm/boot/dts/mt7986-spim-nand-partition.dtsi
+@@ -36,7 +36,7 @@
+ 
+ 			partition@580000 {
+ 				label = "ubi";
+-				reg = <0x580000 0x4000000>;
++				reg = <0x580000 0xFA80000>;
+ 			};
+ 		};
+ 	};
+diff --git a/arch/arm64/boot/dts/mediatek/mt7986-spim-nand-partition.dtsi b/arch/arm64/boot/dts/mediatek/mt7986-spim-nand-partition.dtsi
+index 4cc7961..924f8cc 100644
+--- a/arch/arm64/boot/dts/mediatek/mt7986-spim-nand-partition.dtsi
++++ b/arch/arm64/boot/dts/mediatek/mt7986-spim-nand-partition.dtsi
+@@ -36,7 +36,7 @@
+ 
+ 			partition@580000 {
+ 				label = "ubi";
+-				reg = <0x580000 0x4000000>;
++				reg = <0x580000 0xFA80000>;
+ 			};
+ 		};
+ 	};
diff --git a/recipes-kernel/linux/linux-mediatek_5.4.bb b/recipes-kernel/linux/linux-mediatek_5.4.bb
index ff50b19..f9f7ad6 100644
--- a/recipes-kernel/linux/linux-mediatek_5.4.bb
+++ b/recipes-kernel/linux/linux-mediatek_5.4.bb
@@ -21,6 +21,7 @@
     file://generic/defconfig \
     file://001-rdkb-eth-mtk-change-ifname-for.patch;apply=no \
     file://002-rdkb-mtd-ubi-relayout.patch;apply=no \
+    file://003-rdkb-mtd-kernel-ubi-relayout.patch;apply=no \
     "
 
 SRC_URI_append_mt7986 += " \
@@ -69,7 +70,11 @@
     cd ${S}
         if [ ! -e patch_applied ]; then
             patch -p1 < ${WORKDIR}/001-rdkb-eth-mtk-change-ifname-for.patch
-            
+            if ${@bb.utils.contains('DISTRO_FEATURES','kernel_in_ubi','true','false',d)}; then
+            patch -p1 < ${WORKDIR}/003-rdkb-mtd-kernel-ubi-relayout.patch
+            else
+            patch -p1 < ${WORKDIR}/002-rdkb-mtd-ubi-relayout.patch
+            fi
             patch -p1 < ${WORKDIR}/0600-net-phylink-propagate-resolved-link-config-via-mac_l.patch
             patch -p1 < ${WORKDIR}/9010-iwconfig-wireless-rate-fix.patch
             touch patch_applied