This repository has been archived by the owner on Apr 21, 2021. It is now read-only.
/
build
executable file
·95 lines (76 loc) · 2.91 KB
/
build
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
#!/bin/bash
echo " _____ _ __ __ _ ";
echo "|_ _| | | | / / | |";
echo " | | | |__ __| |/ / ___ _ __ _ __ ___| |";
echo " | | | '_ \ / _\` \ / _ | '__| '_ \ / _ | |";
echo " | | | | | | (_| |\ | __| | | | | | __| |";
echo " \_/ |_| |_|\__,__| \_/\___|_| |_| |_|\___|_|";
echo " ";
echo " ";
echo " ";
KERNEL_CONFIG="thdkernel-latest_defconfig"
KV=$(make kernelversion)
if [ -z "$@" ]; then
MAKE_OPTS="-j$(nproc --all)"
else
MAKE_OPTS="$@"
fi
CCFLAGS="-march=skylake -mtune=skylake -O2 -pipe -msse -msse2 -msse3 -mmmx -m3dnow"
CCXXFLAGS="$CFLAGS"
CC="/usr/bin/gcc $CCFLAGS"
CXX="/usr/bin/g++ $CCFLAGS"
HOSTCC=$CC
# end of compilation options
echo "Preparing for compiling kernel ThdKernel-${KV}..."
rm -rf ../linux*.gz
make -s clean
make -s mrproper
touch .scmversion
# Time measurement
# UNIX timestamp concatenated with nanoseconds
T="$(date +%s%N)"
# Compilation process
make O=out ${MAKE_OPTS} CFLAGS="${CCFLAGS}" CXXFLAGS="${CCXXFLAGS}" distclean ${KERNEL_CONFIG} prepare all bindeb-pkg
RT=$?
if [ ! "$RT" -eq 0 ]; then
echo "There was an error during compilation... aborting"
exit $RT
fi
echo "Creating tools package..."
cd tools/
make ${MAKE_OPTS} CFLAGS="${CCFLAGS}" CXXFLAGS="${CXXFLAGS}" cpupower intel-speed-select pci bootconfig tmon usb x86_energy_perf_policy wmi freefall perf
sudo checkinstall -D --pkgname "linux-tools-thdkernel-${KV}" --pkgversion "${KV}" --pakdir .. --gzman -y --install=no --maintainer dev@javinator9889.com --exclude /root --exclude /media make cpupower_install intel-speed-select_install pci_install bootconfig_install tmon_install usb_install x86_energy_perf_policy_install wmi_install freefall_install perf_install
make -s clean
cd ..
sudo chown $USER:$USER *.deb
RT=$?
if [ ! "$RT" -eq 0 ]; then
echo "There was an error during compilation... exiting"
exit $RT
fi
# Time interval in nanoseconds
T="$(($(date +%s%N)-T))"
# Seconds
S="$((T/1000000000))"
# Milliseconds
M="$((T/1000000))"
printf "Compilation process took: "
if [ ! $((S/86400)) -eq 0 ]; then
printf "%02dd " "$((S/86400))"
fi
if [ ! $((S/3600%24)) -eq 0 ]; then
printf "%02dh " "$((S/3600%24))"
fi
if [ ! $((S/60%60)) -eq 0 ]; then
printf "%02dm " "$((S/60%60))"
fi
printf "%02ds\n" "$((S%60))"
echo " _____ _ __ __ _ ";
echo "|_ _| | | | / / | |";
echo " | | | |__ __| |/ / ___ _ __ _ __ ___| |";
echo " | | | '_ \ / _\` \ / _ | '__| '_ \ / _ | |";
echo " | | | | | | (_| |\ | __| | | | | | __| |";
echo " \_/ |_| |_|\__,__| \_/\___|_| |_| |_|\___|_|";
echo " ";
echo " ";
echo " ";