-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathbuild.sh
executable file
·46 lines (35 loc) · 1.23 KB
/
build.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
#!/bin/bash
###################################################
# The author of this script is free5lot
# Licence is GPL 2 (or later).
# https://github.com/free5lot/
###################################################
LINUX_HEADER_DIR="${LINUX_HEADER_DIR:-/usr/src/linux-headers-$(uname -r)}"
# Check if $LINUX_HEADER_DIR exists
if [ ! -d "$LINUX_HEADER_DIR" ]; then
echo "============================================="
echo "Error: Linux headers directory was not found."
echo "Searched for: $LINUX_HEADER_DIR"
echo ""
echo "Try to install it to solve this problem, e.g:"
echo "sudo apt-get install linux-headers-`uname -r`"
echo "============================================="
exit;
fi
# Make hid-apple.ko module
echo "============================================="
echo "Starting kernel module make"
make -C "$LINUX_HEADER_DIR" M="$(pwd)" modules
# Remove generated files
echo "============================================="
echo "Removing useless generated files"
rm -v -R ".tmp_versions"
rm -v ".hid-apple.ko.cmd"
rm -v ".hid-apple.o.cmd"
rm -v ".hid-apple.mod.o.cmd"
rm -v "hid-apple.mod.c"
rm -v "hid-apple.mod.o"
rm -v "hid-apple.o"
rm -v "Module.symvers"
rm -v "modules.order"
echo "============================================="