-
Notifications
You must be signed in to change notification settings - Fork 5
/
entrypoint.sh
executable file
·63 lines (52 loc) · 983 Bytes
/
entrypoint.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
#!/bin/sh
help() {
echo "Usage: "
echo "run -a <architecture> -k <kernel_path> <stp_file>"
echo
echo "Supported architectures:"
echo " - x86_64"
echo " - i386"
echo " - arm"
echo " - aarch64"
echo " - mips"
}
while getopts "a:k:h" o; do
case "$o" in
a)
arch=$OPTARG
;;
k)
kernel=$OPTARG
;;
h)
help
exit 0
;;
*)
help
exit 1
;;
esac
done
shift $((OPTIND-1))
src=$*
if [ "${arch}" = "" -o "${kernel}" = "" -o "${src}" = "" ]; then
help
exit 1
fi
if [ ! -d "/csb/stapbuild-${arch}" ]; then
echo "Unsupported architecture: ${arch}"
echo
help
exit 1
fi
echo "Selected architecture: ${arch}"
echo "Kernel path: ${kernel}"
echo "Source .stp file: ${src}"
cp ${src} "/"
src_basename=$(basename ${src})
out_dir=$(dirname ${src})
out_file=${src_basename%.*}.ko
abs_kernel_path=$(readlink -f ${kernel})
/csb/stapbuild-${arch}/build.sh ${src_basename} ${abs_kernel_path} || exit 1
cp ${out_file} ${out_dir}