-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_action-mips64el.sh
223 lines (218 loc) · 7.17 KB
/
build_action-mips64el.sh
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
#!/usr/bin/env bash
sudo rm -rfv "${GITHUB_WORKSPACE}"/linux*/
sudo rm -rfv /tmp/*
sed -i "/deb-src/s/# //g" /etc/apt/sources.list
sudo apt update
sudo apt install gpg python3-pyquery -y
aria2c $KEY
gpg --import --pinentry-mode loopback --batch --passphrase "$KEYPASSWORD" private-file.key
python3 get-newest-version.py $1
#VERSION=$(grep 'Kernel Configuration' < config | awk '{print $3}')
# add deb-src to sources.list
VERSION=`cat /tmp/kernelversion.txt`
URL=`cat /tmp/kernelurl.txt`
MAINVERSION=`expr substr $VERSION 1 1`
SHOWVERSION=$VERSION
# 使用 deepin hwe config编译
if [[ $2 == 1 ]]; then
SHOWVERSION=$VERSION-hwe
fi
if [[ $2 == 1 ]]; then
curl https://github.com/gfdgd-xi/gxde-linux-kernel/raw/main/l/linux-kernel-gxde-gfdgdxi-$1-hwe/linux-kernel-gxde-gfdgdxi-$1-hwe_${VERSION}_mips64el.deb | grep 404
result=$?
else
curl https://github.com/gfdgd-xi/gxde-linux-kernel/raw/main/l/linux-kernel-gxde-gfdgdxi-$1/linux-kernel-gxde-gfdgdxi-${1}_${VERSION}_mips64el.deb | grep 404
result=$?
fi
if [[ $result != 0 ]]; then
exit
fi
# install dep
sudo apt install -y wget xz-utils make gcc flex bison dpkg-dev bc rsync kmod cpio libssl-dev git lsb vim libelf-dev
sudo apt install -y gcc-mips64el-linux-gnuabi64
sudo apt build-dep -y linux
# change dir to workplace
cd "${GITHUB_WORKSPACE}" || exit
# download kernel source
wget $URL
if [[ -f linux-"$VERSION".tar.xz ]]; then
tar -xf linux-"$VERSION".tar.xz
fi
if [[ -f linux-"$VERSION".tar.gz ]]; then
tar -xf linux-"$VERSION".tar.gz
fi
if [[ -f linux-"$VERSION".tar ]]; then
tar -xf linux-"$VERSION".tar
fi
if [[ -f linux-"$VERSION".bz2 ]]; then
tar -xf linux-"$VERSION".tar.bz2
fi
cd linux-"$VERSION" || exit
# copy config file
# 使用 deepin hwe config编译
if [[ $2 == 1 ]]; then
cp ../config-6.1.11-mips64el-desktop-hwe .config
else
cp ../config-mips64el .config
fi
echo $VERSION | grep 4.14
if [[ $? == 0 ]]; then
cp ../config-4.19.0-10-mips64el .config
fi
#
# disable DEBUG_INFO to speedup build
# scripts/config --disable DEBUG_INFO
scripts/config --set-str SYSTEM_TRUSTED_KEYS ""
scripts/config --set-str SYSTEM_REVOCATION_KEYS ""
scripts/config --undefine DEBUG_INFO
scripts/config --undefine DEBUG_INFO_COMPRESSED
scripts/config --undefine DEBUG_INFO_REDUCED
scripts/config --undefine DEBUG_INFO_SPLIT
scripts/config --undefine GDB_SCRIPTS
scripts/config --disable DEBUG_INFO
scripts/config --set-val DEBUG_INFO_DWARF5 n
scripts/config --set-val DEBUG_INFO_NONE y
# build deb packages
CPU_CORES=$(($(grep -c processor < /proc/cpuinfo)*2))
sudo env DEBEMAIL="gfdgd xi <[email protected]>" make ARCH=mips CROSS_COMPILE=mips64el-linux-gnuabi64- bindeb-pkg -j"$CPU_CORES"
# 移动 deb
mkdir /tmp/deb-result
cp ../*.deb /tmp/deb-result
rm /tmp/deb-result/linux-libc-dev*.deb
rm /tmp/deb-result/*dbg*.deb
if [[ $2 == 1 ]]; then
# move deb packages to artifact dir
cd ..
mkdir "artifact"
#cp ./*.deb artifact/
rm -rfv "${GITHUB_WORKSPACE}/linux-$VERSION*"
git clone https://gfdgd-xi:[email protected]/gfdgd-xi/gxde-linux-kernel --depth=1
mkdir dclc-kernel
mkdir dclc-kernel/$SHOWVERSION
mkdir dclc-kernel/head
rm -rfv *dbg*.deb
mv ./*.deb dclc-kernel/$SHOWVERSION
cd dclc-kernel/$SHOWVERSION
cd ..
cd head
mkdir deb/DEBIAN -vp
cat > deb/DEBIAN/control <<EOF
Package: linux-kernel-gxde-gfdgdxi-hwe
Version: $VERSION
Maintainer: gfdgd xi <[email protected]>
Homepage: https://github.com/gfdgd-xi/dclc-kernel
Architecture: mips64el
Severity: serious
Certainty: possible
Check: binaries
Type: binary, udeb
Priority: optional
Depends: linux-headers-$VERSION-mips64el-loongson3-gfdgdxi-desktop-hwe, linux-image-$VERSION-mips64el-loongson3-gfdgdxi-desktop-hwe
Section: utils
Installed-Size: 0
Description: 内核 $VERSION
EOF
if [[ ! -d deb-$MAINVERSION ]]; then
mkdir -pv deb-$MAINVERSION/DEBIAN
fi
cat > deb-$MAINVERSION/DEBIAN/control <<EOF
Package: linux-kernel-gxde-gfdgdxi-$1-hwe
Version: $VERSION
Maintainer: gfdgd xi <[email protected]>
Homepage: https://github.com/gfdgd-xi/dclc-kernel
Architecture: mips64el
Severity: serious
Certainty: possible
Check: binaries
Type: binary, udeb
Priority: optional
Depends: linux-headers-$VERSION-mips64el-loongson3-gfdgdxi-desktop-hwe, linux-image-$VERSION-mips64el-loongson3-gfdgdxi-desktop-hwe
Section: utils
Installed-Size: 0
Description: 内核 HWE $VERSION
EOF
dpkg-deb -Z xz -b deb linux-kernel-gxde-gfdgdxi-hwe_${VERSION}_mips64el.deb
dpkg-deb -Z xz -b deb-$MAINVERSION linux-kernel-gxde-gfdgdxi-$1-hwe_${VERSION}_mips64el.deb
cd ../../gxde-linux-kernel
#bash ./repack-zstd --scan .
#./build.py
./move-letter-path.py ../dclc-kernel/$SHOWVERSION/*.deb
./move-letter-path.py ../dclc-kernel/head/*.deb
./move-letter-path.py /tmp/deb-result/*.deb
touch l/linux-headers-$VERSION-mips64el-gfdgdxi-desktop-hwe/lock
rm -rfv l/linux-libc-dev/
git add .
#git pull
git config --global user.email [email protected]
git config --global user.name gfdgd-xi
git commit -m 提交$VERSION
git push
else
# move deb packages to artifact dir
cd ..
mkdir "artifact"
#cp ./*.deb artifact/
rm -rfv "${GITHUB_WORKSPACE}/linux-$VERSION*"
git clone https://gfdgd-xi:[email protected]/gfdgd-xi/gxde-linux-kernel --depth=1
#cd dclc-kernel
mkdir dclc-kernel
mkdir dclc-kernel/$VERSION
mkdir dclc-kernel/head
rm -rfv *dbg*.deb
mv ./*.deb dclc-kernel/$VERSION
cd dclc-kernel/$VERSION
cd ..
cd head
mkdir deb/DEBIAN -vp
cat > deb/DEBIAN/control <<EOF
Package: linux-kernel-gxde-gfdgdxi
Version: $VERSION
Maintainer: gfdgd xi <[email protected]>
Homepage: https://github.com/gfdgd-xi/dclc-kernel
Architecture: mips64el
Severity: serious
Certainty: possible
Check: binaries
Type: binary, udeb
Priority: optional
Depends: linux-headers-$VERSION-mips64el-loongson3-gfdgdxi-desktop, linux-image-$VERSION-mips64el-loongson3-gfdgdxi-desktop
Section: utils
Installed-Size: 0
Description: 内核(虚包)
EOF
if [[ ! -d deb-$MAINVERSION ]]; then
mkdir -pv deb-$MAINVERSION/DEBIAN
fi
cat > deb-$MAINVERSION/DEBIAN/control <<EOF
Package: linux-kernel-gxde-gfdgdxi-$1
Version: $VERSION
Maintainer: gfdgd xi <[email protected]>
Homepage: https://github.com/gfdgd-xi/dclc-kernel
Architecture: mips64el
Severity: serious
Certainty: possible
Check: binaries
Type: binary, udeb
Priority: optional
Depends: linux-headers-$VERSION-mips64el-loongson3-gfdgdxi-desktop, linux-image-$VERSION-mips64el-loongson3-gfdgdxi-desktop
Section: utils
Installed-Size: 0
Description: 内核(虚包)
EOF
dpkg-deb -Z xz -b deb linux-kernel-gxde-gfdgdxi_${VERSION}_mips64el.deb
dpkg-deb -Z xz -b deb-$MAINVERSION linux-kernel-gxde-gfdgdxi-${1}_${VERSION}_mips64el.deb
cd ../../gxde-linux-kernel
#bash ./repack-zstd --scan .
#./build.py
./move-letter-path.py ../dclc-kernel/$VERSION/*.deb
./move-letter-path.py ../dclc-kernel/head/*.deb
./move-letter-path.py /tmp/deb-result/*.deb
rm -rfv l/linux-libc-dev/
touch l/linux-headers-$VERSION-mips64el-gfdgdxi-desktop/lock
git add .
#git pull
git config --global user.email [email protected]
git config --global user.name gfdgd-xi
git commit -m 提交$VERSION
git push
fi