-
Notifications
You must be signed in to change notification settings - Fork 4
/
apply-patch.sh
executable file
·57 lines (44 loc) · 1.22 KB
/
apply-patch.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
#!/bin/sh
arch=$(dpkg --print-architecture)
ncpu=$(cat /proc/cpuinfo | grep -F processor | wc -l)
# Resolve source location
base=$(cd "${0%/*}" ; pwd)
# Enter kernel location
if [ "$1" -a -d "$1" ]; then
cd "$1"
fi
echo "Working in directory: $PWD"
[ -f "Kconfig" ] || { echo "ERROR: this doesn't seem to be kernel source dir. missing Kconfig" >&2; exit 1; }
# copy patch to kernel source
for patchname in override_for_missing_acs_capabilities; do
cp "$base/$patchname.patch" "debian/patches/$patchname"
if ! grep -qs $patchname debian/patches/series; then
cat >> debian/patches/series <<EOF
# Added by acs override script
$patchname
EOF
fi
QUILT_PC=.pc quilt push -a
if ! grep -qs $patchname debian/changelog; then
dch -l$(hostname) "Add $patchname.patch"
fi
done
#nice -n2 dpkg-buildpackage -b -j3 -uc -us -tc
set -x
dpkg-buildpackage -T debian/rules.gen || true
dpkg-buildpackage -T clean && \
dpkg-buildpackage -T source && \
nice -n2 fakeroot make -j$ncpu -f debian/rules.gen binary-arch_${arch}_none && \
dpkg-buildpackage -T clean
ret=$?
set +x
(
cd ..
f=$(echo linux-image-*-${arch}*_${arch}.deb)
if [ "$f" ]; then
for file in $f; do
[ -e "$file" ] && echo "run: dpkg -i $PWD/$file"
done
fi
)
exit $ret