blob: d086eccc2bf897caae92e42df26f4c54fd4d43e8 (
plain)
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
|
The eBPF module requires the following kernel features:
KProbes (CONFIG_KPROBES = y)
syscalls tracing support (CONFIG_FTRACE_SYSCALLS = y)
Instructions for compiling the kernel are taken from the following website:
https://www.slackbook.org/html/system-configuration-kernel.html
Run all of the following commands below as root.
- Enter into the kernel source directory:
cd /usr/src/linux
- Back up the current .config file:
cp .config .config_backup
- Bring the kernel back to its base state:
make mrproper
- Restore the previous .config file:
cp .config_backup .config
- Configure the kernel (it will load up .config):
make menuconfig
- Enable KProbes support:
General architecture-dependent-options --->
[*] KProbes
- Enable syscalls tracing:
Kernel Hacking --->
[*] Tracers --->
[*] Trace Syscalls
- Save the changes before exiting.
- After exiting, prepare the source tree for compiling:
make dep
make clean
- Compile the kernel:
make bzImage
- Then compile kernel modules:
make modules
- Back up previous vmlinuz and System.map files
- Then copy the new vmlinuz and System.map files to /boot
- For example (change depending on ARCH, generic vs huge kernel, etc.):
KERNEL_VER=$(uname -r)
mv /boot/vmlinuz-generic-$KERNEL_VER /boot/vmlinuz-generic-$KERNEL_VER-old
cp arch/x86_64/boot/bzImage /boot/vmlinuz-generic-$KERNEL_VER
mv /boot/System.map-generic-$KERNEL_VER /boot/System.map-generic-$KERNEL_VER-old
cp System.map /boot/System.map-generic-$KERNEL_VER
- After finishing all of the steps above, install the kernel:
make modules_install
- To load all the tracepoints for the eBPF module (otherwise, OpenSnitch will display a warning):
- Mount debugfs at boot time
- That is, edit /etc/fstab and add the following line:
debugfs /sys/kernel/debug debugfs defaults 0 0
- Please complete any extra necessary steps on your system
(ex. recompile initrd, run /sbin/lilo, etc.)
|