[rdkb][common][bsp][Refactor hostapd and wpa-supplicant bb file]

[Description]
Refactor hostapd and wpa-supplicant bb file
1. due to align ucode ,hostapd and wpa-supplicant should depend on libnl-tiny not libnl.
otherwise hostapd with ucode will crash at bootup

[Release-log]

Change-Id: If8d1589b1c059633abd3a00bc4e8a021a14c84b8
diff --git a/recipes-wifi/hostapd/files/003-rdkb-uc-script-support.patch b/recipes-wifi/hostapd/files/003-rdkb-uc-script-support.patch
deleted file mode 100644
index 09183c1..0000000
--- a/recipes-wifi/hostapd/files/003-rdkb-uc-script-support.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From f02136395a9d534f3255a7ee1232aa9554c3e01c Mon Sep 17 00:00:00 2001
-From: mtk27745 <rex.lu@mediatek.com>
-Date: Tue, 14 Nov 2023 16:40:57 +0800
-Subject: [PATCH] rdkb uc script support
-
----
- common.uc | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/common.uc b/common.uc
-index 4c33779..ee30df9 100644
---- a/common.uc
-+++ b/common.uc
-@@ -49,6 +49,8 @@ function __phy_is_fullmac(phyidx)
- {
- 	let data = nl80211.request(nl80211.const.NL80211_CMD_GET_WIPHY, 0, { wiphy: phyidx });
- 
-+	if (data == null)
-+		return 1;
- 	return !data.software_iftypes.ap_vlan;
- }
- 
--- 
-2.18.0
-
diff --git a/recipes-wifi/hostapd/hostapd_2.10.3.bb b/recipes-wifi/hostapd/hostapd_2.10.3.bb
index 6351b22..60a40d9 100644
--- a/recipes-wifi/hostapd/hostapd_2.10.3.bb
+++ b/recipes-wifi/hostapd/hostapd_2.10.3.bb
@@ -4,7 +4,7 @@
 LICENSE = "BSD-3-Clause"
 LIC_FILES_CHKSUM = "file://hostapd/README;md5=c905478466c90f1cefc0df987c40e172"
 
-DEPENDS = "libnl openssl ubus ucode"
+DEPENDS = "libnl-tiny openssl ubus ucode"
 DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'telemetry2_0', 'telemetry', '', d)}"
 LDFLAGS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'telemetry2_0', ' -ltelemetry_msgsender ', '', d)}"
 RDEPENDS_${PN} += "gawk ucode"
@@ -31,7 +31,6 @@
     file://wpa_supplicant.uc \
     file://src-${PV} \
     file://002-rdkb-add-ucode-support.patch;apply=no \
-    file://003-rdkb-uc-script-support.patch;apply=no \
 "
 require files/patches-${PV}/patches.inc
 
@@ -75,15 +74,14 @@
     echo "CONFIG_IEEE80211BE=y" >> ${B}/.config
     echo "CONFIG_TESTING_OPTIONS=y" >> ${B}/.config
     echo "CONFIG_UCODE=y" >> ${B}/.config
+    echo "CONFIG_LIBNL20=y" >> ${B}/.config
+    echo "CONFIG_LIBNL_TINY=y" >> ${B}/.config
 }
 
 do_filogic_patches() {
     cd ${S}
         if [ ! -e patch_applied ]; then
             patch -p1 < ${WORKDIR}/002-rdkb-add-ucode-support.patch
-            cd ${WORKDIR}
-            patch -p1 < ${WORKDIR}/003-rdkb-uc-script-support.patch
-            cd ${S}
             touch patch_applied
         fi
 }
@@ -91,7 +89,7 @@
 addtask filogic_patches after do_patch before do_compile
 
 do_compile() {
-    export CFLAGS="-MMD -O2 -Wall -g -I${STAGING_INCDIR}/libnl3"
+    export CFLAGS="-MMD -O2 -Wall -g -I${STAGING_INCDIR}/libnl-tiny -D_GNU_SOURCE"
     export EXTRA_CFLAGS="${CFLAGS}"
     make V=1
 }
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/bp-0002-backports-update-kernel-version-check-for-eth_hw_add.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/bp-0002-backports-update-kernel-version-check-for-eth_hw_add.patch
new file mode 100644
index 0000000..5d91314
--- /dev/null
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/bp-0002-backports-update-kernel-version-check-for-eth_hw_add.patch
@@ -0,0 +1,39 @@
+From 085740016672333854d07d4ae266b6fa15103936 Mon Sep 17 00:00:00 2001
+From: Shayne Chen <shayne.chen@mediatek.com>
+Date: Mon, 27 Nov 2023 16:39:36 +0800
+Subject: [PATCH] backports: update kernel version check for eth_hw_addr_set()
+
+Kernel v5.4.260 has added this API, so update kernel version check in
+backports include.
+
+CR-Id: WCNCR00238098
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+Change-Id: I708aabbe51de9d480932ce03b30d004bf1d67ebd
+---
+ backport-include/linux/etherdevice.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/backport-include/linux/etherdevice.h b/backport-include/linux/etherdevice.h
+index 51a7d6d..ecc3bc2 100644
+--- a/backport-include/linux/etherdevice.h
++++ b/backport-include/linux/etherdevice.h
+@@ -39,7 +39,7 @@ static inline void u64_to_ether_addr(u64 u, u8 *addr)
+ }
+ #endif /* LINUX_VERSION_IS_LESS(4,11,0) */
+ 
+-#if LINUX_VERSION_IS_LESS(5,15,0)
++#if LINUX_VERSION_IS_LESS(5,4,260)
+ /**
+  * eth_hw_addr_set - Assign Ethernet address to a net_device
+  * @dev: pointer to net_device structure
+@@ -51,7 +51,7 @@ static inline void eth_hw_addr_set(struct net_device *dev, const u8 *addr)
+ {
+ 	ether_addr_copy(dev->dev_addr, addr);
+ }
+-#endif /* LINUX_VERSION_IS_LESS(5,15,0) */
++#endif /* LINUX_VERSION_IS_LESS(5,4,260) */
+ 
+ #if LINUX_VERSION_IS_LESS(5,16,0)
+ static inline int backport_device_get_mac_address(struct device *dev, char *addr)
+-- 
+2.18.0
\ No newline at end of file
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/subsys.inc b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/subsys.inc
index ccc29ce..14a1121 100644
--- a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/subsys.inc
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/subsys.inc
@@ -17,6 +17,7 @@
     file://400-allow-ibss-mixed.patch \
     file://782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch \
     file://bp-0001-Revert-mac80211-use-the-new-drop-reasons-infrastruct.patch \
+    file://bp-0002-backports-update-kernel-version-check-for-eth_hw_add.patch \
     file://mtk-0001-mac80211-mtk-do-not-setup-twt-when-twt-responder-is-.patch \
     file://mtk-0002-cfg80211-mtk-extend-CAC-time-for-weather-radar-chann.patch \
     file://mtk-0003-mac80211-mtk-it-s-invalid-case-when-frag_threshold-i.patch \
diff --git a/recipes-wifi/ucode/files/0001-change-cmakelist.patch b/recipes-wifi/ucode/files/0001-change-cmakelist.patch
new file mode 100644
index 0000000..26386f0
--- /dev/null
+++ b/recipes-wifi/ucode/files/0001-change-cmakelist.patch
@@ -0,0 +1,21 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ade8aac..c8ae7b7 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -28,13 +28,10 @@ find_library(libuci NAMES uci)
+ find_library(libubox NAMES ubox)
+ find_library(libubus NAMES ubus)
+ find_library(libblobmsg_json NAMES blobmsg_json)
++find_library(libnl_tiny NAMES nl-tiny)
+ 
+-if(LINUX)
+-  find_library(libnl_tiny NAMES nl-tiny)
+-
+-  if(libnl_tiny AND libubox)
+-    set(DEFAULT_NL_SUPPORT ON)
+-  endif()
++if(libnl_tiny AND libubox)
++  set(DEFAULT_NL_SUPPORT ON)
+ endif()
+ 
+ if(libuci AND libubox)
\ No newline at end of file
diff --git a/recipes-wifi/ucode/ucode_git.bb b/recipes-wifi/ucode/ucode_git.bb
index 64c9c09..219806e 100644
--- a/recipes-wifi/ucode/ucode_git.bb
+++ b/recipes-wifi/ucode/ucode_git.bb
@@ -6,6 +6,7 @@
 
 SRC_URI = " \
     git://git@github.com/jow-/ucode.git;protocol=https \
+    file://0001-change-cmakelist.patch \
 "
 
 SRCREV = "a6e75e02528e36f3610a7f0073453018336def2e"
diff --git a/recipes-wifi/wpa-supplicant/wpa-supplicant_2.10.3.bb b/recipes-wifi/wpa-supplicant/wpa-supplicant_2.10.3.bb
index 76c69a7..e23b9c3 100644
--- a/recipes-wifi/wpa-supplicant/wpa-supplicant_2.10.3.bb
+++ b/recipes-wifi/wpa-supplicant/wpa-supplicant_2.10.3.bb
@@ -6,7 +6,7 @@
 LICENSE = "BSD-3-Clause"
 LIC_FILES_CHKSUM = "file://hostapd/README;md5=c905478466c90f1cefc0df987c40e172"
 
-DEPENDS = "dbus libnl ubus ucode"
+DEPENDS = "dbus libnl-tiny ubus ucode"
 FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
 FILESEXTRAPATHS_prepend := "${THISDIR}/files/patches-${PV}:"
 
@@ -64,7 +64,8 @@
 
 	# RDKB
 	echo "CONFIG_BUILD_WPA_CLIENT_SO=y" >> wpa_supplicant/.config
-
+	echo "CFLAGS +=-I${STAGING_INCDIR}/libnl-tiny -D_GNU_SOURCE" >> wpa_supplicant/.config
+	echo "DRV_CFLAGS +=-I${STAGING_INCDIR}/libnl-tiny" >> wpa_supplicant/.config
 	# mtk add
 	echo "CONFIG_MBO=y" >> wpa_supplicant/.config
 	echo "CONFIG_WPS_UPNP=y" >> wpa_supplicant/.config
@@ -87,6 +88,8 @@
 	echo "CONFIG_HE_OVERRIDES=y" >> wpa_supplicant/.config
 	echo "CONFIG_EHT_OVERRIDES=y" >> wpa_supplicant/.config
 	echo "CONFIG_UCODE=y" >> wpa_supplicant/.config
+	echo "CONFIG_LIBNL20=y" >> wpa_supplicant/.config
+	echo "CONFIG_LIBNL_TINY=y" >> wpa_supplicant/.config
 }
 
 do_compile () {