X-Kernel is a multi-architecture monolithic kernel written in Rust. It provides a modular subsystem design covering memory management, process scheduling, file systems, networking, device drivers, and TEE (Trusted Execution Environment) support. The kernel targets multiple hardware architectures (AArch64, x86_64, RISC-V 64, LoongArch64) and runs on both virtual and physical platforms.
This project is inspired by StarryOS, an experimental monolithic OS based on ArceOS, developed by Tsinghua University.
- RISC-V 64
- LoongArch64
- AArch64
- x86_64
- QEMU
- Hygon CSV Environment
- Linux kylin-x Pkvm Virtual Machine
- Tee support
# Rust toolchain
rustup target add aarch64-unknown-none-softfloat
# QEMU (Debian/Ubuntu)
sudo apt install qemu-system| Architecture | GCC Version | Musl Version | Origin Link |
|---|---|---|---|
| x86_64 | 11.2.1 | git-b76f37f (2021-09-23) | musl.cc |
| aarch64 | 11.2.1 | git-b76f37f (2021-09-23) | musl.cc |
| riscv64 | 11.2.1 | git-b76f37f (2021-09-23) | musl.cc |
| loongarch64 | 13.2.0 | 1.2.5 | LoongsonLab |
cp platforms/aarch64-qemu-virt/defconfig .config
make defconfigmake defconfig expands the copied minimal defconfig into a full .config.
If you want to change the kernel configuration, use the following command to open the menuconfig interface:
make menuconfigThis updates the .config file in the project root, which is then used for builds.
make oldconfigThis is the Linux-style interactive refresh flow: it reloads the current .config and asks you to confirm values for newly introduced symbols.
make olddefconfigThis is the non-interactive Linux-style refresh flow: it reloads the current .config and automatically fills newly introduced symbols with their Kconfig defaults.
make savedefconfigThis writes a minimized ./defconfig containing only values that differ from Kconfig defaults. It is useful when updating a platform defconfig after menuconfig changes.
Download a pre-built root filesystem image:
make rootfs
make rootfs ROOTFS_VARIANT=alpine-busybox
make rootfs ROOTFS_VARIANT=debian-busyboxInstall repository uapps into the image with make uapps, or perform both
steps with make rootfs-uapps. A custom image can be selected through
DISK_IMG or xkmake run --disk-image.
You can build the kernel
make buildThis expands .config when needed and creates a versioned bundle under
target/xkmake/<platform>/<profile>/.
we support directly running the kernel on QEMU
cp platforms/aarch64-qemu-virt/defconfig .config
make defconfig
make run
cp platforms/x86_64-qemu-virt/defconfig .config
make defconfig
make run
make run UEFI=y
# x86-csv UEFI + SEV launch helper
bash scripts/start.shFor x86_64, make build creates both kernel.bzimg and kernel.uefi.img in
the bundle. make run uses LinuxBoot by default; make run UEFI=y selects
OVMF/UEFI. Custom firmware paths can be supplied with OVMF_CODE and
OVMF_VARS_TEMPLATE.
Pass run options through XKMAKE_ARGS:
make run XKMAKE_ARGS='--memory 2g --smp 2 --no-net'
make run XKMAKE_ARGS='--no-vsock'
make run XKMAKE_ARGS='-- --d guest_errors'Kernel unit tests use the same build-and-QEMU path:
make unittest
make unittest UNITTEST_CRATE=kvfs,kprocessSuccessful unit-test runs generate coverage.txt, coverage.info, and
coverage.xml under target/<rust-target>/<profile>/.
Generate workspace API documentation with the configured feature set:
make doc
make doc_check_missingThis project is now released under the Apache License 2.0. See the LICENSE and NOTICE files for details.