How to modify KVM (Kernel-based Virtual Machine)

2021-10-10 | Tags: #kvm #linux

First we need to get kernel source code. It can easily get with

$ apt-get install linux-source-$(uname -r)

after that, this command will download kernel source code to usr/src/linux-source.... . The source code should inside a .tar file and we need to untar.

$ ls usr/src/linux-source....
$ sudo tar -xf linux-source......tar.b2
$ cd linux-source...

Now we can modify KVM. After modification we need to compile the KVM module. To do this:

sudo make modules -j6  SUBDIRS=arch/x86/kvm/
sudo make -j6  M=arch/x86/kvm/

after that we need to change kernel module, first remove the kvm module

$ sudo rmmod kvm_intel; sudo rmmod kvm

after add kernel module to system

$ sudo insmod arch/x86/kvm/kvm.ko; sudo insmod arch/x86/kvm/kvm-intel.ko

This was the end of the blog post. You can reach me via email umusasadik at gmail com