From c934641f454650062bb79dd2783d039ed1b9ed0f Mon Sep 17 00:00:00 2001
From: "Igor Zalatov (from Citadel PC)" <flyrouter@gmail.com>
Date: Thu, 11 Nov 2021 22:15:52 +0300
Subject: [PATCH] Create optimization for RTL8188FU Makefile

---
 br-ext-chip-ambarella/board/s2l/kernel/patches/.dot    |  0
 .../board/s2l/kernel/s2l22m.generic.config             |  1 +
 .../board/s2l/kernel/s2l33m.generic.config             |  1 +
 br-ext-chip-ambarella/board/s2l/s2l22m.config          |  1 +
 br-ext-chip-ambarella/board/s2l/s2l33m.config          |  1 +
 .../board/unknown_unknown_s2l22m_unknown/config        | 10 ++++++++++
 .../unknown_unknown_s2l22m_unknown/kernel/.gitkeep     |  0
 .../board/unknown_unknown_s2l33m_unknown/config        | 10 ++++++++++
 .../unknown_unknown_s2l33m_unknown/kernel/.gitkeep     |  0
 .../configs/unknown_unknown_s2l22m_openipc_defconfig   |  1 +
 .../configs/unknown_unknown_s2l33m_openipc_defconfig   |  1 +
 .../package/rtl8188fu-openipc/00_optimization.patch    | 10 ++++++++++
 general/package/xiongmai-osdrv-xm530/files/script/wifi |  4 ++--
 13 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100644 br-ext-chip-ambarella/board/s2l/kernel/patches/.dot
 create mode 100644 br-ext-chip-ambarella/board/s2l/kernel/s2l22m.generic.config
 create mode 100644 br-ext-chip-ambarella/board/s2l/kernel/s2l33m.generic.config
 create mode 100644 br-ext-chip-ambarella/board/s2l/s2l22m.config
 create mode 100644 br-ext-chip-ambarella/board/s2l/s2l33m.config
 create mode 100644 br-ext-chip-ambarella/board/unknown_unknown_s2l22m_unknown/config
 create mode 100644 br-ext-chip-ambarella/board/unknown_unknown_s2l22m_unknown/kernel/.gitkeep
 create mode 100644 br-ext-chip-ambarella/board/unknown_unknown_s2l33m_unknown/config
 create mode 100644 br-ext-chip-ambarella/board/unknown_unknown_s2l33m_unknown/kernel/.gitkeep
 create mode 100644 br-ext-chip-ambarella/configs/unknown_unknown_s2l22m_openipc_defconfig
 create mode 100644 br-ext-chip-ambarella/configs/unknown_unknown_s2l33m_openipc_defconfig
 create mode 100644 general/package/rtl8188fu-openipc/00_optimization.patch

diff --git a/br-ext-chip-ambarella/board/s2l/kernel/patches/.dot b/br-ext-chip-ambarella/board/s2l/kernel/patches/.dot
new file mode 100644
index 00000000..e69de29b
diff --git a/br-ext-chip-ambarella/board/s2l/kernel/s2l22m.generic.config b/br-ext-chip-ambarella/board/s2l/kernel/s2l22m.generic.config
new file mode 100644
index 00000000..792d6005
--- /dev/null
+++ b/br-ext-chip-ambarella/board/s2l/kernel/s2l22m.generic.config
@@ -0,0 +1 @@
+#
diff --git a/br-ext-chip-ambarella/board/s2l/kernel/s2l33m.generic.config b/br-ext-chip-ambarella/board/s2l/kernel/s2l33m.generic.config
new file mode 100644
index 00000000..792d6005
--- /dev/null
+++ b/br-ext-chip-ambarella/board/s2l/kernel/s2l33m.generic.config
@@ -0,0 +1 @@
+#
diff --git a/br-ext-chip-ambarella/board/s2l/s2l22m.config b/br-ext-chip-ambarella/board/s2l/s2l22m.config
new file mode 100644
index 00000000..792d6005
--- /dev/null
+++ b/br-ext-chip-ambarella/board/s2l/s2l22m.config
@@ -0,0 +1 @@
+#
diff --git a/br-ext-chip-ambarella/board/s2l/s2l33m.config b/br-ext-chip-ambarella/board/s2l/s2l33m.config
new file mode 100644
index 00000000..792d6005
--- /dev/null
+++ b/br-ext-chip-ambarella/board/s2l/s2l33m.config
@@ -0,0 +1 @@
+#
diff --git a/br-ext-chip-ambarella/board/unknown_unknown_s2l22m_unknown/config b/br-ext-chip-ambarella/board/unknown_unknown_s2l22m_unknown/config
new file mode 100644
index 00000000..fdce2d0c
--- /dev/null
+++ b/br-ext-chip-ambarella/board/unknown_unknown_s2l22m_unknown/config
@@ -0,0 +1,10 @@
+VENDOR=unknown
+MODEL=unknown
+FAMILY=s2l
+CHIP=s2l22m
+RAM_SIZE=?
+RAM_LINUX_SIZE=?
+RAM_MPP_SIZE=?
+ROM_SIZE=?
+CMOS=unknown
+UBOOT_SIZE=?
diff --git a/br-ext-chip-ambarella/board/unknown_unknown_s2l22m_unknown/kernel/.gitkeep b/br-ext-chip-ambarella/board/unknown_unknown_s2l22m_unknown/kernel/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/br-ext-chip-ambarella/board/unknown_unknown_s2l33m_unknown/config b/br-ext-chip-ambarella/board/unknown_unknown_s2l33m_unknown/config
new file mode 100644
index 00000000..127718eb
--- /dev/null
+++ b/br-ext-chip-ambarella/board/unknown_unknown_s2l33m_unknown/config
@@ -0,0 +1,10 @@
+VENDOR=unknown
+MODEL=unknown
+FAMILY=s2l
+CHIP=s2l33m
+RAM_SIZE=?
+RAM_LINUX_SIZE=?
+RAM_MPP_SIZE=?
+ROM_SIZE=?
+CMOS=unknown
+UBOOT_SIZE=?
diff --git a/br-ext-chip-ambarella/board/unknown_unknown_s2l33m_unknown/kernel/.gitkeep b/br-ext-chip-ambarella/board/unknown_unknown_s2l33m_unknown/kernel/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/br-ext-chip-ambarella/configs/unknown_unknown_s2l22m_openipc_defconfig b/br-ext-chip-ambarella/configs/unknown_unknown_s2l22m_openipc_defconfig
new file mode 100644
index 00000000..792d6005
--- /dev/null
+++ b/br-ext-chip-ambarella/configs/unknown_unknown_s2l22m_openipc_defconfig
@@ -0,0 +1 @@
+#
diff --git a/br-ext-chip-ambarella/configs/unknown_unknown_s2l33m_openipc_defconfig b/br-ext-chip-ambarella/configs/unknown_unknown_s2l33m_openipc_defconfig
new file mode 100644
index 00000000..792d6005
--- /dev/null
+++ b/br-ext-chip-ambarella/configs/unknown_unknown_s2l33m_openipc_defconfig
@@ -0,0 +1 @@
+#
diff --git a/general/package/rtl8188fu-openipc/00_optimization.patch b/general/package/rtl8188fu-openipc/00_optimization.patch
new file mode 100644
index 00000000..74c072b6
--- /dev/null
+++ b/general/package/rtl8188fu-openipc/00_optimization.patch
@@ -0,0 +1,10 @@
+--- a/Makefile	2020-09-14 06:45:19.000000000 +0300
++++ b/Makefile	2021-11-11 21:58:55.719826716 +0300
+@@ -1,6 +1,6 @@
+ # SPDX-License-Identifier: GPL-2.0
+ EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS)
+-EXTRA_CFLAGS += -O1
++EXTRA_CFLAGS += -Os
+ #EXTRA_CFLAGS += -O3
+ #EXTRA_CFLAGS += -Wall
+ #EXTRA_CFLAGS += -Wextra
diff --git a/general/package/xiongmai-osdrv-xm530/files/script/wifi b/general/package/xiongmai-osdrv-xm530/files/script/wifi
index d6856850..ca7554ca 100755
--- a/general/package/xiongmai-osdrv-xm530/files/script/wifi
+++ b/general/package/xiongmai-osdrv-xm530/files/script/wifi
@@ -7,7 +7,7 @@ if [ "$WIFI" = "xm711" ]; then
     insmod /lib/modules/3.10.103+/xiongmai/dwc_otg.ko
     insmod /lib/modules/3.10.103+/xiongmai/wifi_pdn.ko value=96
     insmod /lib/modules/3.10.103+/xiongmai/compat.ko
-    insmod /lib/modules/3.10.103+/kernel/net/wireless/cfg80211.ko  # grab from original firmware
-    insmod /lib/modules/3.10.103+/kernel/net/mac80211/mac80211.ko
+    insmod /lib/modules/3.10.103+/kernel/net/wireless/cfg80211.ko     # grab from original firmware
+    # insmod /lib/modules/3.10.103+/kernel/net/mac80211/mac80211.ko   # not used with grabbed cfg80211
     insmod /lib/modules/3.10.103+/xiongmai/xm711.ko
 fi