Skip to content

kylin-x-kernel/x-kernel

Repository files navigation

X-Kernel

中文版

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.

Supported Architectures

  • RISC-V 64
  • LoongArch64
  • AArch64
  • x86_64

Supported Platforms

Features

  • Tee support

Quick Start

1. Install dependencies

# Rust toolchain
rustup target add aarch64-unknown-none-softfloat

# QEMU (Debian/Ubuntu)
sudo apt install qemu-system

Musl toolchain

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

2. Config kernel

start from a platform defconfig

cp platforms/aarch64-qemu-virt/defconfig .config
make defconfig

make defconfig expands the copied minimal defconfig into a full .config.

change configuration

If you want to change the kernel configuration, use the following command to open the menuconfig interface:

make menuconfig

This updates the .config file in the project root, which is then used for builds.

refresh an existing configuration after Kconfig changes

make oldconfig

This is the Linux-style interactive refresh flow: it reloads the current .config and asks you to confirm values for newly introduced symbols.

make olddefconfig

This is the non-interactive Linux-style refresh flow: it reloads the current .config and automatically fills newly introduced symbols with their Kconfig defaults.

save the current configuration back to a minimal defconfig

make savedefconfig

This writes a minimized ./defconfig containing only values that differ from Kconfig defaults. It is useful when updating a platform defconfig after menuconfig changes.

3. Prepare rootfs

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)

4. Build

You can build the kernel

make build

this 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 image
  • xkernel_<platform>.uefi.img: UEFI FAT boot disk containing BOOTX64.EFI, axboot.toml, and the kernel ELF

5. Build and run on QEMU

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.sh

For 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).

License

This project is now released under the Apache License 2.0. See the LICENSE and NOTICE files for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages