From b0565222f784329a3cb5fe4b8132115fbe338f38 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Fri, 22 Dec 2023 10:18:45 +0800
Subject: [PATCH] Update linux kernel build shell script

---
 kernel/build.sh |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/kernel/build.sh b/kernel/build.sh
index d7a5023..19748a7 100755
--- a/kernel/build.sh
+++ b/kernel/build.sh
@@ -52,7 +52,8 @@
 
 function build_kernel()
 {
-    PATCH_FILE=$PRJ_PATH/patches/$BOARD/linux-imx-$BSP_VER.patch
+    defconfig=${BOARD}_defconfig
+    patch_file=$PRJ_PATH/patches/$BOARD/linux-imx-$BSP_VER.patch
 
     cd $PRJ_PATH
 
@@ -61,19 +62,17 @@
     else
         pr_info "start fetch linux kernel source code"
         git clone $GIT_URL/linux-imx.git -b $BRANCH --depth=1
-
-        if [ -s $PATCH_FILE ] ; then
-            pr_warn "do patch for $KER_PATH now..."
-            cd $KER_PATH
-            patch -p1 < $PATCH_FILE
-        fi
     fi
 
     pr_info "Start build linux kernel source code"
 
     cd $KER_PATH
 
-    defconfig=${BOARD}_defconfig
+    if [ ! -s arch/arm64/configs/$defconfig ] ; then
+        pr_warn "do patch for $KER_PATH now..."
+        patch -p1 < $patch_file
+    fi
+
     if [ ! -s .config ] ; then
         make ${defconfig}
     fi

--
Gitblit v1.9.1