From b8d02950d8c50611c2784c7a40e0b3003acf8d49 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Thu, 18 Jul 2024 09:38:11 +0800
Subject: [PATCH] Patch:IGKBoard-IMX8MP: Add HDMI support

---
 drivers/igkboard-imx6ull/build.sh |   61 +++++++++++++++++++++++++++---
 1 files changed, 54 insertions(+), 7 deletions(-)

diff --git a/drivers/igkboard-imx6ull/build.sh b/drivers/igkboard-imx6ull/build.sh
index e1caac0..964f5fe 100755
--- a/drivers/igkboard-imx6ull/build.sh
+++ b/drivers/igkboard-imx6ull/build.sh
@@ -94,6 +94,10 @@
     export KER_PATH=$TOP_PATH/kernel/linux-imx
     export DRV_PATH=$TOP_PATH/kernel/install
 
+    export KER_VER=`echo $BSP_VER|awk -F"-" '{print $2}'`
+    export KER_MODPATH=`ls -d $DRV_PATH/lib/modules/${KER_VER}* | head -n 1`
+    export KER_MODNAME=`basename ${KER_MODPATH}`
+
     export JOBS=`cat /proc/cpuinfo | grep processor | wc -l`
 
     if [[ $BOARD =~ mx6ull ]] ; then
@@ -120,7 +124,7 @@
     cd ${PRJ_PATH}
 }
 
-function build_wifi()
+function build_rtl8188fu()
 {
     SRC=rtl8188fu
 
@@ -150,8 +154,6 @@
 
     pr_warn "start update $SRC USB WiFi driver source code"
 
-    KER_VER=`echo $BSP_VER|awk -F"-" '{print $2}'`
-
     sed -i "s|^CROSS_COMPILE ?=.*|CROSS_COMPILE ?= ${CROSS_COMPILE}|g" Makefile
     sed -i "s|^ARCH ?=.*|ARCH ?= arm|g" Makefile
     sed -i "s|^KVER.*|KVER := $KER_VER|g" Makefile
@@ -166,11 +168,54 @@
     pr_warn "start build $SRC USB WiFi driver"
     make -j ${JOBS} modules
 
-    cp rtl8188fu.ko ${DRV_PATH}/lib/modules/${KER_VER}-dirty/extra/
-    depmod -a -b ${DRV_PATH}/ ${KER_VER}-dirty
+    cp rtl8188fu.ko ${KER_MODPATH}/extra/
+    depmod -a -b ${DRV_PATH}/ ${KER_MODNAME}
 
     mkdir -p ${DRV_PATH}/lib/firmware/rtlwifi/
     cp firmware/rtl8188fufw.bin ${DRV_PATH}/lib/firmware/rtlwifi/
+}
+
+
+function build_rtl8723du()
+{
+    SRC=rtl8723du
+
+    cd $PRJ_PATH
+
+    if [ -d $SRC ] ; then
+        pr_info "$SRC USB WiFi driver source code fetched already"
+    else
+        pr_info "start fetch $SRC USB WiFi drver source code"
+
+        if [[ $BSP_URL =~ github.com ]] ; then
+            git clone https://github.com/lwfinger/rtw88.git --depth=1 $SRC
+        else
+            mkdir -p $TARBALL_PATH
+
+            # Download source code packet
+            if [ ! -s $TARBALL_PATH/$SRC.tar.xz ] ; then
+                wget $BSP_URL/imx/bsp/misc/$SRC.tar.xz -P $TARBALL_PATH
+            fi
+
+            # decompress source code packet
+            do_unpack $TARBALL_PATH/$SRC.tar.xz
+        fi
+    fi
+
+    cd $SRC
+
+    pr_warn "start update $SRC USB WiFi driver source code"
+
+    sed -i "s|^KVER.*|KVER ?= $KER_VER|g" Makefile
+    sed -i "s|^KSRC.*|KSRC := ${KER_PATH}|g" Makefile
+    sed -i "s|^MODDESTDIR.*|MODDESTDIR := ${KER_MODPATH}/extra/|g" Makefile
+    sed -i "s|^FIRMWAREDIR.*|FIRMWAREDIR := ${DRV_PATH}/lib/firmware/|g" Makefile
+    sed -i '/depmod -a .*/d' Makefile
+
+    pr_warn "start build $SRC USB WiFi driver"
+    make -j ${JOBS}
+    make install
+    depmod -a -b ${DRV_PATH}/ ${KER_MODNAME}
 }
 
 
@@ -180,14 +225,16 @@
 
     build_user
 
-    build_wifi
+    build_rtl8188fu
+
+    build_rtl8723du
 }
 
 function do_clean()
 {
     cd $PRJ_PATH
 
-    rm -rf rtl8188fu tarballs
+    rm -rf rtl8188fu rtl8723du tarballs
 
     if [ -d user ] ; then
         cd user

--
Gitblit v1.9.1