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 # alpine-busybox (musl, default)
make rootfs ROOTFS_VARIANT=debian-busybox # debian-busybox (glibc)
make rootfs ROOTFS_VARIANT=debian-systemd # debian-systemd (glibc)Or you can build your own root filesystem image(only supported ext4 and musl for now)
You can build the kernel
make buildthis will create a kernel image from .config
For x86_64, make build also creates boot media artifacts in the project root:
xkernel_<platform>.bzimg: LinuxBoot/direct boot imagexkernel_<platform>.uefi.img: UEFI FAT boot disk containingBOOTX64.EFI,axboot.toml, and the kernel ELF
we support directly running the kernel on QEMU
cp platforms/aarch64-qemu-virt/defconfig .config
make run
cp platforms/x86_64-qemu-virt/defconfig .config
# Default x86_64 QEMU flow: LinuxBoot/direct boot
make run
# Optional x86_64 UEFI flow: OVMF + generated UEFI boot disk
make run UEFI=y
# x86-csv UEFI + SEV launch helper
bash scripts/start.shFor the x86_64 UEFI flow, the host needs OVMF firmware files (for example /usr/share/OVMF/OVMF_CODE_4M.fd and OVMF_VARS_4M.fd).
This project is now released under the Apache License 2.0. See the LICENSE and NOTICE files for details.