diff --git a/recipes-devtools/wifi-test-tool/files/COPYING b/recipes-devtools/wifi-test-tool/files/COPYING
new file mode 100644
index 0000000..0332e75
--- /dev/null
+++ b/recipes-devtools/wifi-test-tool/files/COPYING
@@ -0,0 +1 @@
+Copyright (c) Mediatek 2022
diff --git a/recipes-devtools/wifi-test-tool/files/src/Makefile.am b/recipes-devtools/wifi-test-tool/files/src/Makefile.am
new file mode 100644
index 0000000..59dee99
--- /dev/null
+++ b/recipes-devtools/wifi-test-tool/files/src/Makefile.am
@@ -0,0 +1,13 @@
+AM_CFLAGS = -D_ANSC_LINUX
+AM_CFLAGS += -D_ANSC_USER
+AM_CFLAGS += -D_ANSC_LITTLE_ENDIAN_
+
+AM_CPPFLAGS = -Wall -Werror
+ACLOCAL_AMFLAGS = -I m4
+hardware_platform = armv7ahf-neon-rdk-linux-musleabi
+
+bin_PROGRAMS = wifi_test_tool
+wifi_test_tool_CPPFLAGS = -I$(top_srcdir)/include $(CPPFLAGS) -D_WIFI_HAL_TEST_
+wifi_test_tool_SOURCES = wifi-test-tool.c
+wifi_test_tool_LDFLAGS = -lhal_wifi
+
diff --git a/recipes-devtools/wifi-test-tool/files/src/configure.ac b/recipes-devtools/wifi-test-tool/files/src/configure.ac
new file mode 100644
index 0000000..8783d84
--- /dev/null
+++ b/recipes-devtools/wifi-test-tool/files/src/configure.ac
@@ -0,0 +1,33 @@
+AC_PREREQ([2.65])
+AC_INIT([hal], [1.0], [BUG-REPORT-ADDRESS])
+AM_INIT_AUTOMAKE([foreign])
+LT_INIT
+
+AC_PREFIX_DEFAULT(`pwd`)
+AC_ENABLE_SHARED
+AC_DISABLE_STATIC
+
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4])
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_INSTALL
+AM_PROG_CC_C_O
+AM_PROG_LIBTOOL(libtool)
+
+# Checks for header files.
+AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_HEADER_STDBOOL
+AC_C_INLINE
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+
+AC_CONFIG_FILES(Makefile)
+
+
+AC_OUTPUT
+
diff --git a/recipes-devtools/wifi-test-tool/files/src/wifi-test-tool.c b/recipes-devtools/wifi-test-tool/files/src/wifi-test-tool.c
new file mode 100644
index 0000000..94fde80
--- /dev/null
+++ b/recipes-devtools/wifi-test-tool/files/src/wifi-test-tool.c
@@ -0,0 +1,336 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <uci.h>
+#include "wifi-test-tool.h"
+
+void set_channel(wifi_radio_param *radio_param, char *channel)
+{
+    if (strcmp(channel, "auto") != 0) {
+        radio_param->auto_channel = FALSE;
+        radio_param->channel = atoi(channel);
+    }
+}
+
+void set_band(wifi_radio_param *radio_param, char *country)
+{
+    strcpy(radio_param->country, country);
+}
+
+void set_country(wifi_radio_param *radio_param, char *band)
+{
+    strcpy(radio_param->band, band);
+}
+
+void set_hwmode(wifi_radio_param *radio_param, char *hwmode)
+{
+    if (strncmp(hwmode, "11a", 3) == 0)
+        strcpy(radio_param->hwmode, "a");
+    if (strncmp(hwmode, "11b", 3) == 0)
+        strcpy(radio_param->hwmode, "b");
+    if (strncmp(hwmode, "11g", 3) == 0)
+        strcpy(radio_param->hwmode, "g");
+}
+
+void set_htmode(wifi_radio_param *radio_param, char *htmode)
+{
+    char tmp[16] = {0};
+    char *ptr = htmode;
+    ULONG bandwidth = 0;
+    radio_param->bandwidth = 20;
+    while (*ptr) {
+        if (isdigit(*ptr)) {
+            bandwidth = strtoul(ptr, NULL, 10);
+            radio_param->bandwidth = bandwidth;
+            break;
+        }
+        ptr++;
+    }
+
+    // HT40     -> 11NGHT40PLUS
+    // VHT40+   -> 11ACVHT40PLUS
+    // HE80     -> 11AXHE80
+    if (strstr(htmode, "+") != NULL) {
+        strncpy(tmp, htmode, strlen(htmode) - 1);
+        strcat(tmp, "PLUS");
+    } else if (strstr(htmode, "-") != NULL) {
+        strncpy(tmp, htmode, strlen(htmode) - 1);
+        strcat(tmp, "MINUS");
+    } else 
+        strcpy(tmp, htmode);
+
+
+    if (strstr(htmode, "VHT") != NULL) {
+        snprintf(radio_param->htmode, sizeof(radio_param->htmode), "11AC%s", tmp);
+    } else if (strstr(htmode, "HT") != NULL && strstr(htmode, "NO") == NULL) {
+        snprintf(radio_param->htmode, sizeof(radio_param->htmode), "11NG%s", tmp);
+    } else if (strstr(htmode, "HE") != NULL) {
+        snprintf(radio_param->htmode, sizeof(radio_param->htmode), "11AX%s", tmp);
+    } else {        // NOHT or NONE should be parsed with the band, so just fill the original string.
+        strcpy(radio_param->htmode, tmp);
+    }
+
+}
+
+void set_disable(wifi_radio_param *radio_param, char *disable)
+{
+    if (strcmp(disable, "1") == 0)
+        radio_param->disabled = TRUE;
+    else
+        radio_param->disabled = FALSE;
+}
+
+void set_radionum(wifi_ap_param *ap_param, char *radio_name)
+{
+    int radio_num;
+    char *ptr = radio_name;
+
+    while (*ptr) {
+        if (isdigit(*ptr)) {
+            radio_num = strtoul(ptr, NULL, 10);
+            ap_param->radio_index = radio_num;
+            break;
+        }
+        ptr++;
+    }
+}
+
+void set_ssid(wifi_ap_param *ap_param, char *ssid)
+{
+    strncpy(ap_param->ssid, ssid, 32);
+}
+
+void set_encryption(wifi_ap_param *ap_param, char *encryption_mode)
+{
+    if (strstr(encryption_mode, "3") != NULL) {
+        strcpy(ap_param->enctyption_mode, "WPA3-");
+    } else if (strstr(encryption_mode, "2") != NULL) {
+        strcpy(ap_param->enctyption_mode, "WPA2-");
+    } else if (strstr(encryption_mode, "1") != NULL) {
+        strcpy(ap_param->enctyption_mode, "WPA-");
+    } else if (strstr(encryption_mode, "mix") != NULL) {
+        strcpy(ap_param->enctyption_mode, "WPA-WPA2-");
+    }
+
+    if (strstr(encryption_mode, "psk") != NULL) {
+        strcat(ap_param->enctyption_mode, "Personal");
+    } else if (strstr(encryption_mode, "wpa") != NULL) {
+        strcat(ap_param->enctyption_mode, "Enterprise");
+    }
+    
+    if (strcmp(encryption_mode, "none") == 0) {
+        strcpy(ap_param->enctyption_mode, "None");
+    }
+}
+
+void set_key(wifi_ap_param *ap_param, char *key)
+{
+    strncpy(ap_param->password, key, 64);
+}
+
+void set_radio_param(wifi_radio_param radio_parameter)
+{
+    BOOL enable;
+    BOOL current;
+    char config_file[64] = {0};
+    int ret = 0;
+    struct params param;
+
+    fprintf(stderr, "Start setting radio\n");
+    sprintf(config_file, "/nvram/hostapd%d.conf", radio_parameter.radio_index);
+
+    // Call hal to set in this function
+    // Channel
+    fprintf(stderr, "Set channel: %d, bandwidth: %d\n", radio_parameter.channel, radio_parameter.bandwidth);
+    if (radio_parameter.auto_channel == TRUE) {
+        ret = wifi_setRadioAutoChannelEnable(radio_parameter.radio_index, TRUE);
+    } else {
+        // wifi_setRadioChannel(radio_parameter.radio_index, radio_parameter.channel);
+        ret = wifi_pushRadioChannel2(radio_parameter.radio_index, radio_parameter.channel, radio_parameter.bandwidth, 30);
+    }
+    if (ret != RETURN_OK)
+        fprintf(stderr, "[Set channel failed!!!]\n");
+    ret = 0;
+
+    // Country
+    fprintf(stderr, "Set Country: %s\n", radio_parameter.country);
+    ret = wifi_setRadioCountryCode(radio_parameter.radio_index, radio_parameter.country);
+    if (ret != RETURN_OK)
+        fprintf(stderr, "[Set Country failed!!!]\n");
+    ret = 0;
+
+    // hwmode
+    fprintf(stderr, "Set hwmode: %s\n", radio_parameter.hwmode);
+    ret = wifi_setRadioHwMode(radio_parameter.radio_index, radio_parameter.hwmode);
+    if (ret != RETURN_OK)
+        fprintf(stderr, "[Set hwmode failed!!!]\n");
+    ret = 0;
+
+    // htmode
+    wifi_ieee80211_Mode pure_mode;
+    if (strcmp(radio_parameter.band, "2g") == 0) {
+
+        pure_mode |= WIFI_MODE_B | WIFI_MODE_G;
+        if (strcmp(radio_parameter.htmode, "NOHT") == 0 || strcmp(radio_parameter.htmode, "NONE") == 0)
+            strcpy(radio_parameter.htmode, "11G");
+
+    } else if (strcmp(radio_parameter.band, "5g") == 0) {
+
+        pure_mode |= WIFI_MODE_A;
+        if (strcmp(radio_parameter.htmode, "NOHT") == 0 || strcmp(radio_parameter.htmode, "NONE") == 0) 
+            strcpy(radio_parameter.htmode, "11A");
+    }
+
+    if (strstr(radio_parameter.htmode, "VHT") != NULL)
+        pure_mode |= WIFI_MODE_N | WIFI_MODE_AC;
+    else if (strstr(radio_parameter.htmode, "HT") != NULL && strstr(radio_parameter.htmode, "NO") == NULL)
+        pure_mode |= WIFI_MODE_N;
+    else if (strstr(radio_parameter.htmode, "HE") != NULL)
+        pure_mode |= WIFI_MODE_N | WIFI_MODE_AC | WIFI_MODE_AX;
+
+    radio_parameter.pure_mode = (int)pure_mode;
+    fprintf(stderr, "Set htmode: %s, puremode: %d\n", radio_parameter.htmode, radio_parameter.pure_mode);
+    ret = wifi_setRadioMode(radio_parameter.radio_index, radio_parameter.htmode, radio_parameter.pure_mode);
+    if (ret != RETURN_OK)
+        fprintf(stderr, "[Set htmode failed!!!]\n");
+    ret = 0;
+
+    // disabled
+    if (radio_parameter.disabled == FALSE)
+        enable = TRUE;
+    ret = wifi_getRadioEnable(radio_parameter.radio_index, &current);
+    fprintf(stderr, "radio %d, current: %s, set: %s, getstatus return: %s\n", radio_parameter.radio_index, current ? "enable":"disable", radio_parameter.disabled ? "disable":"enable",  (ret==RETURN_OK)? "success": "failed");
+    // fprintf(stderr, "In if closure. enable: %d, current: %d.\n", enable, current);
+    if (enable != current) {
+        ret = wifi_setRadioEnable(radio_parameter.radio_index, enable);
+    }
+    if (ret != RETURN_OK)
+        fprintf(stderr, "[Set radio %s failed!!!]\n", enable?"enble":"disable");
+    ret = 0;
+
+}
+
+void set_ap_param(wifi_ap_param ap_param)
+{
+    int ret = 0;
+
+    fprintf(stderr, "Start setting ap\n");
+    // Call hal to set in this function
+    // SSID
+    fprintf(stderr, "Set SSID: %s\n", ap_param.ssid);
+    ret = wifi_setSSIDName(ap_param.ap_index, ap_param.ssid);
+    if (ret != RETURN_OK)
+        fprintf(stderr, "[Set SSID failed!!!]\n");
+
+    // wpa and security mode
+    fprintf(stderr, "Set encryption mode: %s\n", ap_param.enctyption_mode);
+    ret = wifi_setApSecurityModeEnabled(ap_param.ap_index, ap_param.enctyption_mode);
+    if (ret != RETURN_OK)
+        fprintf(stderr, "[Set encryption mode failed!!!]\n");
+
+    // key
+    if (strlen(ap_param.password) > 0) {
+        fprintf(stderr, "Set password: %s\n", ap_param.password);
+        ret = wifi_setApSecurityKeyPassphrase(ap_param.ap_index, ap_param.password);
+        if (ret != RETURN_OK)
+            fprintf(stderr, "[Set password failed!!!]\n");
+    }
+
+    // restart ap
+    wifi_setApEnable(ap_param.ap_index, FALSE);
+    wifi_setApEnable(ap_param.ap_index, TRUE);
+}
+
+int apply_uci_config ()
+{
+    struct uci_context *uci_ctx = uci_alloc_context();
+    struct uci_package *uci_pkg = NULL;
+    struct uci_element *e;
+    // struct uci_section *s;
+    const char cfg_name[] = "wireless";
+    int max_radio_num = 0;
+    BOOL parsing_radio = FALSE;
+
+    wifi_getMaxRadioNumber(&max_radio_num);
+    fprintf(stderr, "max radio number: %d\n", max_radio_num);
+    if (uci_load(uci_ctx, cfg_name, &uci_pkg) != UCI_OK) {
+        uci_free_context(uci_ctx);
+        fprintf(stderr, "%s: load uci failed.\n", __func__);
+        return RETURN_ERR;
+    }
+
+    uci_foreach_element(&uci_pkg->sections, e) {
+
+        struct uci_section *s = uci_to_section(e);
+        struct uci_element *option = NULL;
+        wifi_radio_param radio_param = {0};
+        wifi_ap_param ap_param = {0};
+        radio_param.radio_index = -1;
+        ap_param.ap_index = -1;
+
+        if (strcmp(s->type, "wifi-device") == 0) {
+            sscanf(s->e.name, "radio%d", &radio_param.radio_index);
+            parsing_radio = TRUE;
+            fprintf(stderr, "\n----- Start parsing radio %d config. -----\n", radio_param.radio_index);
+        } else if (strcmp(s->type, "wifi-iface") == 0) {
+            sscanf(s->e.name, "default_radio%d", &ap_param.ap_index);
+            parsing_radio = FALSE;
+            fprintf(stderr, "\n----- Start parsing ap %d config. -----\n", ap_param.ap_index);
+        }
+
+        uci_foreach_element(&s->options, option) {
+
+            struct uci_option *op = uci_to_option(option);
+            if (parsing_radio == TRUE) {
+                // transform the type from input string and store the value in radio_param.
+                if (strcmp(op->e.name, "channel") == 0)
+                    set_channel(&radio_param, op->v.string);
+                else if (strcmp(op->e.name, "hwmode") == 0)
+                    set_hwmode(&radio_param, op->v.string);
+                else if (strcmp(op->e.name, "htmode") == 0)
+                    set_htmode(&radio_param, op->v.string);
+                else if (strcmp(op->e.name, "disabled") == 0)
+                    set_disable(&radio_param, op->v.string);
+                else if (strcmp(op->e.name, "band") == 0)
+                    set_band(&radio_param, op->v.string);
+                else if (strcmp(op->e.name, "country") == 0)
+                    set_country(&radio_param, op->v.string);
+                else if (strcmp(op->e.name, "noscan") == 0)
+                    set_band(&radio_param, op->v.string);
+                else
+                    fprintf(stderr, "[%s %s not set!]\n", op->e.name, op->v.string);
+            } else {        
+                // parsing iface
+                if (strcmp(op->e.name, "device") == 0)
+                    set_radionum(&ap_param, op->v.string);
+                else if (strcmp(op->e.name, "ssid") == 0)
+                    set_ssid(&ap_param, op->v.string);
+                else if (strcmp(op->e.name, "encryption") == 0)
+                    set_encryption(&ap_param, op->v.string);
+                else if (strcmp(op->e.name, "key") == 0)
+                    set_key(&ap_param, op->v.string);
+                else
+                    fprintf(stderr, "[%s %s not set!]\n", op->e.name, op->v.string);
+            }
+        }
+        if (parsing_radio == TRUE)
+            set_radio_param(radio_param);
+        else
+            set_ap_param(ap_param);
+    }
+
+    uci_unload(uci_ctx, uci_pkg);
+    uci_free_context(uci_ctx);
+    return RETURN_OK;
+}
+
+int main(int argc, char **argv)
+{
+    if (argc != 2 || strcmp(argv[1], "reload") != 0) {
+        fprintf(stderr, "Usage: wifi reload.\nThis tool is only for RDKB MSP/SQC test.\n");
+        return -1;
+    }
+    apply_uci_config();
+    return 0;
+}
diff --git a/recipes-devtools/wifi-test-tool/files/src/wifi-test-tool.h b/recipes-devtools/wifi-test-tool/files/src/wifi-test-tool.h
new file mode 100644
index 0000000..a8cc11c
--- /dev/null
+++ b/recipes-devtools/wifi-test-tool/files/src/wifi-test-tool.h
@@ -0,0 +1,62 @@
+#include "uci_config.h"
+#include "wifi_hal.h"
+
+typedef enum {
+    WIFI_MODE_A = 0x01,
+    WIFI_MODE_B = 0x02,
+    WIFI_MODE_G = 0x04,
+    WIFI_MODE_N = 0x08,
+    WIFI_MODE_AC = 0x10,
+    WIFI_MODE_AX = 0x20,
+} wifi_ieee80211_Mode;
+
+typedef struct {
+    int radio_index;
+    char type[16];
+    char phy[16];
+    char macaddr[18];
+    BOOL disabled;
+    int channel;
+    BOOL auto_channel;
+    char channels[64];      // list type
+    char hwmode[2];
+    char band[8];
+    char htmode[16];
+    int bandwidth;
+    int pure_mode;
+    int chanbw;
+    char ht_capab[8];
+    int txpower;
+    BOOL diversity;
+    int rxantenna;
+    int txantenna;
+    char country[3];
+    BOOL country_ie;
+    int distance;
+    int beacon_int;
+    BOOL legacy_rates;
+    char require_mode[2];
+    int cell_density;
+    char basic_rate[64];
+    char supported_rates[64];
+    int log_level;
+    char hostapd_options[64];
+} wifi_radio_param;
+
+typedef struct {
+    wifi_radio_param *radio_info;   // for multiple vap
+    int radio_index;
+    int ap_index;
+    char ssid[33];
+    int wpa;
+    char password[64];
+    char enctyption_mode[64];
+} wifi_ap_param;
+
+struct params
+{
+    char * name;
+    char * value;
+};
+
+INT wifi_getMaxRadioNumber(INT *max_radio_num);
