Thanks a lot Jidong. I will give it a run. Thanks! Matt On Thu, May 22, 2014 at 10:12 PM, Jidong Xiao <jidong.xiao@xxxxxxxxx> wrote: > On Fri, May 23, 2014 at 12:57 AM, Mathew Li <mathew.li100@xxxxxxxxx> wrote: >> Hi All, >> >> I want to learn KVM code. Apologies for asking really simple >> questions. I have Ubuntu 12.04 32bit installed on my laptop. As I >> understand there are two modules of the KVM. One is called kvm.ko and >> other arch specific e.g. in my case it is kvm-intel.ko. These modules >> are already present in my system. I can do modinfo and it lists them. >> >> What I want to do is modify KVM code to add print statements to >> understand things better. But I don't know what code to modify and how >> to rebuild these two modules for my system, so that they have my print >> statements. Could you please guide me what code do I need to download >> and how to compile that to get the modules regenerated for my system? >> If I need to download the whole Linux kernel then where in Linux >> kernel KVM code lives? I don't want to compile the whole linux kernel, >> I just want to compile these modules for my system. >> >> Thanks a lot for any help you could provide. >> >> Thanks! >> Matt > If you are using the latest kernel, then arch/x86/kvm and virt/kvm are > the two directories you should look at, and also some header files are > under the include/linux directory. Since kvm is a part of the mainline > kernel, I don't think you need to download anything else other than > the mainline kernel. But, to use kvm, I think you should install Qemu, > which is a user-level tool. > > If you compile kvm as a kernel module, then each time you insert your > printk statements, you don't need to compile the whole kernel, just > compile the specific directory you have made changes in. For example, > if you have changed arch/x86/kvm directory, you can use the command: > `make modules SUBDIRS=arch/x86/kvm`. > > Once you are done, just copy the generated module: kvm.ko, > kvm-intel.ko to /lib/modules/your-kernel-version/kernel/arch/x86/kvm/. > Remove the existing kvm.ko/kvm-intel.ko, and install the new modules. > > -Jidong -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html