-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
11,454 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,33 @@ | ||
# KVM内核模块源码分析 | ||
|
||
* KVM基于内核的虚拟机 在2007年2月被导入Linux 2.6.20核心中。散步内核不同顶层目录下 | ||
- 主要包括两个目录:virt和arch/x86/kvm | ||
- virt包含内核中非硬件体系架构相关的部分如IOMMU、中断控制等 | ||
- arch/x86很明显arch就是跟体系相关。KVM不单单支持x86,还支持PowerPC、MIPS等 | ||
* 在此之前都是单模块,以色列开发人员搞得,就是个内核模块单目录 | ||
|
||
## 源码获取 | ||
|
||
下载目录:<https://sourceforge.net/projects/kvm/files/?source=navbar> | ||
|
||
![1532478632446.png](image/1532478632446.png) | ||
|
||
这里要分清不同目录 | ||
|
||
* kvm-kmod里面存放不同内核版本的kvm功能模块,仅包含kvm功能模块,不包含其它内核内容 | ||
* qemu-kvm其实就是支持kvm的改版qemu | ||
* kvm是更早之前,没有加入内核模块的kvm,单独的内核模块和qemu-kvm补丁 | ||
* 剩下的两个是客户端驱动,半虚拟化用到 | ||
|
||
获取kvm目录中最早期的源码 | ||
|
||
![1532479038159.png](image/1532479038159.png) | ||
|
||
这时候还是单模块+补丁的形式打进内核。最原始的源码,这,只能说我能找到的最原始的源码了。 | ||
|
||
|
||
|
||
|
||
|
||
|
||
## END |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
EXTRA_CFLAGS := -I$(PWD)/include | ||
obj-m := kvm.o | ||
kvm-objs := kvm_main.o mmu.o x86_emulate.o debug.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
KERNELDIR := /lib/modules/`uname -r`/build | ||
|
||
rpmrelease = devel | ||
|
||
all:: | ||
$(MAKE) -C $(KERNELDIR) M=`pwd` "$$@" | ||
|
||
tmpspec = .tmp.kvm-kmod.spec | ||
|
||
rpm: all | ||
mkdir -p ../BUILD ../RPMS/$$(uname -m) | ||
sed 's/^Release:.*/Release: $(rpmrelease)/' kvm-kmod.spec > $(tmpspec) | ||
rpmbuild --define="kverrel $$(uname -r)" \ | ||
--define="objdir $$(pwd)" \ | ||
--define="_topdir $$(pwd)/.." \ | ||
-bb $(tmpspec) |
Oops, something went wrong.