Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
K

kvm-kernel-example

> 编程语言
Open source

Examples for: Learning KVM - implement your own kernel

384 stars0 likes0 views
WebsiteGitHub

About

Examples for: Learning KVM - implement your own kernel

KVM-Kernel Example

The source code are examples on my blog: Learning KVM - implement your own kernel.

I've described how to implement a KVM-based hypervisor and the key points to implement a kernel on my blog. You can leave comments in the blog or file issues here if you have questions or find any bug.

Dir

Hypervisor

The KVM-based hypervisor, its role is like qemu-system.

Kernel

A extremely simple kernel, supports few syscalls.

User

Simple ELF(s) for testing our kernel. Pre-built user program was provided, and you can re-generate by the following commands:

$ pip3 install pwntools
$ user/gen.py

NOTE: You have to install Python 3.x in advance.

Setup

Check KVM support

Check if your CPU supports virtualization:

$ egrep '(vmx|svm)' /proc/cpuinfo

NOTE: CPUs in a VM might not support virtualization (i.e. no nested virtualization). For example, EC2 on AWS doesn't support using KVM.

Install KVM device

Check if the KVM device exists:

$ ls -la /dev/kvm

If /dev/kvm is not found, you can enable it (on Ubuntu) with:

$ sudo apt install qemu-kvm

If you are not root, you need to add yourself into the kvm group to have permission for accessing /dev/kvm.

$ sudo usermod -a -G kvm `whoami`

Remember to logout and login to have the group changing effective.

How to run

…

Environment

I only tested the code on Ubuntu 18.04, but I expect it to work on all KVM-supported x86 Linux distributions. Please file an issue if you find it's not true.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ckernelkvmkvm-hypervisorlinux-kernel

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言