From 624a06e4e79fbd1f38e1a2343a94565b7e5c0727 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Wed, 20 May 2026 22:11:10 +0800
Subject: [PATCH] Update openwrt build script

---
 patch/gen_patch.sh |   75 +++++++++++++++++++++++++++++++++++++
 1 files changed, 75 insertions(+), 0 deletions(-)

diff --git a/patch/gen_patch.sh b/patch/gen_patch.sh
new file mode 100755
index 0000000..d7cb4d4
--- /dev/null
+++ b/patch/gen_patch.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# Description: This shell script used to generate patch file
+#      Author: guowenxue <guowenxue@gmail.com>
+#     Version: 1.0.0
+
+# this project absolute path
+#PRJ_PATH=$(cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd)
+PRJ_PATH=$(pwd)
+
+# shell script will exit once get command error
+#set -e
+
+#+-------------------------+
+#| Shell script functions  |
+#+-------------------------+
+
+function pr_error() {
+    echo -e "\033[40;31m $1 \033[0m"
+}
+
+function pr_warn() {
+    echo -e "\033[40;33m $1 \033[0m"
+}
+
+function pr_info() {
+    echo -e "\033[40;32m $1 \033[0m"
+}
+
+# parser configure file and export environment variable
+function do_export()
+{
+    export SDKVER=$(basename $1)
+    export BOARD=$(basename $2)
+}
+
+function gen_patch()
+{
+    SRC_PATH=$1
+    PATCH_NAME=${SDKVER}-${BOARD}.patch
+
+    if [ ! -d $SRC_FPATH ] ;  then
+        pr_error "\nERROR: source code $SRC_FPATH not exist, exit now\n\n"
+        exit;
+    fi
+
+    pr_info "generate patch file for $SRC_PATH"
+    cd $SRC_PATH
+
+    pwd
+
+    if [ ! -f patched.tag ] ; then
+        touch patched.tag
+    fi
+
+    git add * 2> /dev/null
+    git add .igkboard-*.defconfig 2> /dev/null
+    git add -f files 2> /dev/null
+
+    git diff --cached > $PRJ_PATH/$PATCH_NAME
+}
+
+function do_patch()
+{
+    gen_patch buildroot
+}
+
+if [ $# != 2 ] ; then
+    pr_info "$0 usage example:"
+    pr_info "$0 openwrt-25.12 igkboard-rk3576"
+    exit
+fi
+
+do_export $1 $2
+
+gen_patch $1

--
Gitblit v1.10.0