@@ -12,6 +12,7 @@ Options:
12
12
-v, --version VERSION The version of kernel
13
13
-b, --branch BRANCH NAME The branch of dst kernel
14
14
-t, --type KERNEL TYPE The kernel type: LTS from kernel.org, AOSP kernel
15
+ -d, --download KERNEL DOWNLOAD The kernel download type: GIT, TAR
15
16
-h, --help Show command help.
16
17
"
17
18
@@ -28,6 +29,7 @@ default_param() {
28
29
VERSION=linux-5.15.154
29
30
BRANCH=linux-5.15
30
31
TYPE=LTS
32
+ DOWNLOAD=TAR
31
33
}
32
34
33
35
# Function to parse command line arguments
@@ -59,6 +61,10 @@ parseargs()
59
61
TYPE=` echo $2 `
60
62
shift
61
63
shift
64
+ elif [ " x$1 " == " x-d" -o " x$1 " == " x--download" ]; then
65
+ DOWNLOAD=` echo $2 `
66
+ shift
67
+ shift
62
68
else
63
69
echo ` date` - ERROR, UNKNOWN params " $@ "
64
70
return 2
@@ -95,13 +101,18 @@ if [ "${URL: -1}" = "/" ]; then
95
101
URL=" ${URL: 0: len-1} "
96
102
fi
97
103
98
- wget ${URL} /${VERSION} .${TARBALL} -qO kernel/${VERSION} /${VERSION} .${TARBALL}
99
-
100
- # Unarchive Kernel
101
- echo Unarchive Kernel
102
- cd kernel/${VERSION}
103
- tar xf ${VERSION} .${TARBALL}
104
- cd ${VERSION}
104
+ # Download and Unarchive Kernel
105
+ if [ " x$DOWNLOAD " = " xTAR" ]; then
106
+ wget ${URL} /${VERSION} .${TARBALL} -qO kernel/${VERSION} /${VERSION} .${TARBALL}
107
+ echo Unarchive Kernel
108
+ cd kernel/${VERSION}
109
+ tar xf ${VERSION} .${TARBALL}
110
+ cd ${VERSION}
111
+ else
112
+ git clone ${URL} -b ${VERSION} --depth=1 ${VERSION}
113
+ cd ${VERSION}
114
+ rm -rf .git
115
+ fi
105
116
106
117
# Copy BSP files
107
118
echo Copying BSP files
@@ -128,11 +139,15 @@ echo Merging old kernel
128
139
mv .git ../
129
140
rm -rf *
130
141
131
- if [ " x$TYPE " = " xLTS" ]; then
132
- cp -raf ${ROOT_PATH} /kernel/${VERSION} /${VERSION} /. .
142
+ if [ " x$DOWNLOAD " = " xTAR" ]; then
143
+ if [ " x$TYPE " = " xLTS" ]; then
144
+ cp -raf ${ROOT_PATH} /kernel/${VERSION} /${VERSION} /. .
145
+ else
146
+ cp -raf ${ROOT_PATH} /kernel/${VERSION} /. .
147
+ rm -rf * .tar.gz
148
+ fi
133
149
else
134
- cp -raf ${ROOT_PATH} /kernel/${VERSION} /. .
135
- rm -rf * .tar.gz
150
+ cp -raf ${ROOT_PATH} /${VERSION} /. .
136
151
fi
137
152
138
153
mv ../.git .
0 commit comments