OpenWrt port to LingYun IGKboards
guowenxue
2026-05-20 624a06e4e79fbd1f38e1a2343a94565b7e5c0727
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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