-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdkms.conf
More file actions
68 lines (56 loc) · 2.37 KB
/
dkms.conf
File metadata and controls
68 lines (56 loc) · 2.37 KB
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
PACKAGE_NAME="arise"
PACKAGE_VERSION=25.00.55
AUTOINSTALL="yes"
#REMAKE_INITRD="yes"
SKIP_IMMD_MODPROBE=1
BUILT_MODULE_NAME[0]="arise"
BUILT_MODULE_LOCATION[0]=""
DEST_MODULE_LOCATION[0]="/updates"
# Find out how many CPU cores can be use if we pass appropriate -j option to make.
# DKMS could use all cores on multicore systems to build the kernel module.
num_cpu_cores()
{
if [ -x /usr/bin/nproc ]; then
nproc
else
echo "1"
fi
}
check_gcc_version()
{
local KERNEL_UNAME=`uname -r`
local KERNEL_MODLIB=/lib/modules/${KERNEL_UNAME}
local KERNEL_SOURCES=`test -d ${KERNEL_MODLIB}/source && echo ${KERNEL_MODLIB}/source || echo ${KERNEL_MODLIB}/build`
local KERNEL_COMPILE_H=${KERNEL_SOURCES}/include/generated/compile.h
if [ -f ${KERNEL_COMPILE_H} ];then
# Try to get all installed gcc list
local SYSTEM_GCC_LIST=`ls /usr/bin/gcc-[0-9]* | xargs -n1 | sort -u`
# Try to get current GCC version, some GCC version string only hava major.minor
local SYSTEM_GCC_VERSION=`gcc -v 2>&1 | awk 'END{print}' | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' | head -n 1`
if [ -z "$SYSTEM_GCC_VERSION" ];then
SYSTEM_GCC_VERSION=`gcc -v 2>&1 | awk 'END{print}' | grep -o '[0-9]\+\.[0-9]\+' | head -n 1`
fi
# Get version string from 'compile.h', some GCC version string only hava major.minor
local KERNEL_BUILT_GCC_STRING=`cat ${KERNEL_COMPILE_H} | grep LINUX_COMPILER | cut -f 2 -d '"'`
local KERNEL_BUILT_GCC_VERSION=`echo "${KERNEL_BUILT_GCC_STRING}" | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' | head -n 1`
if [ -z "$KERNEL_BUILT_GCC_VERSION" ];then
KERNEL_BUILT_GCC_VERSION=`echo "${KERNEL_BUILT_GCC_STRING}" | grep -o '[0-9]\+\.[0-9]\+' | head -n 1`
fi
# Checking GCC version and assign gcc by 'CC=' here
if [ "$KERNEL_BUILT_GCC_VERSION" != "$SYSTEM_GCC_VERSION" ];then
for TARGET_GCC_PATH in $SYSTEM_GCC_LIST;
do
local TARGET_GCC_VERSION=`$TARGET_GCC_PATH -v 2>&1 | awk 'END{print}' | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' | head -n 1`
if [ -z "$TARGET_GCC_VERSION" ];then
TARGET_GCC_VERSION=`$TARGET_GCC_PATH -v 2>&1 | awk 'END{print}' | grep -o '[0-9]\+\.[0-9]\+' | head -n 1`
fi
if [ "$KERNEL_BUILT_GCC_VERSION" = "$TARGET_GCC_VERSION" ];then
echo "CC=$TARGET_GCC_PATH"
break;
fi
done
fi
fi
}
MAKE[0]="make $(check_gcc_version) -j$(num_cpu_cores) -C $kernel_source_dir M=$dkms_tree/$module/$module_version/build"
#POST_REMOVE="post-remove.sh $kernelver"