LmCast :: Stay tuned in

Moss: a Rust Linux-compatible kernel in 26,000 lines of code

Recorded: Nov. 29, 2025, 1:09 a.m.

Original Summarized

GitHub - hexagonal-sun/moss-kernel: Rust Linux-compatible kernel

Skip to content

Navigation Menu

Toggle navigation

Sign in

Appearance settings

PlatformAI CODE CREATIONGitHub CopilotWrite better code with AIGitHub SparkBuild and deploy intelligent appsGitHub ModelsManage and compare promptsMCP RegistryNewIntegrate external toolsDEVELOPER WORKFLOWSActionsAutomate any workflowCodespacesInstant dev environmentsIssuesPlan and track workCode ReviewManage code changesAPPLICATION SECURITYGitHub Advanced SecurityFind and fix vulnerabilitiesCode securitySecure your code as you buildSecret protectionStop leaks before they startEXPLOREWhy GitHubDocumentationBlogChangelogMarketplaceView all featuresSolutionsBY COMPANY SIZEEnterprisesSmall and medium teamsStartupsNonprofitsBY USE CASEApp ModernizationDevSecOpsDevOpsCI/CDView all use casesBY INDUSTRYHealthcareFinancial servicesManufacturingGovernmentView all industriesView all solutionsResourcesEXPLORE BY TOPICAISoftware DevelopmentDevOpsSecurityView all topicsEXPLORE BY TYPECustomer storiesEvents & webinarsEbooks & reportsBusiness insightsGitHub SkillsSUPPORT & SERVICESDocumentationCustomer supportCommunity forumTrust centerPartnersOpen SourceCOMMUNITYGitHub SponsorsFund open source developersPROGRAMSSecurity LabMaintainer CommunityAcceleratorArchive ProgramREPOSITORIESTopicsTrendingCollectionsEnterpriseENTERPRISE SOLUTIONSEnterprise platformAI-powered developer platformAVAILABLE ADD-ONSGitHub Advanced SecurityEnterprise-grade security featuresCopilot for BusinessEnterprise-grade AI featuresPremium SupportEnterprise-grade 24/7 supportPricing

Search or jump to...

Search code, repositories, users, issues, pull requests...

Search

Clear

Search syntax tips

Provide feedback


We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

hexagonal-sun

/

moss-kernel

Public

Notifications
You must be signed in to change notification settings

Fork
49

Star
1.4k

Rust Linux-compatible kernel

License

MIT license

1.4k
stars

49
forks

Branches

Tags

Activity

Star

Notifications
You must be signed in to change notification settings

Code

Issues
9

Pull requests
2

Discussions

Actions

Projects
0

Security

Uh oh!

There was an error while loading. Please reload this page.


Insights

Additional navigation options

Code

Issues

Pull requests

Discussions

Actions

Projects

Security

Insights

hexagonal-sun/moss-kernel

 masterBranchesTagsGo to fileCodeOpen more actions menuFolders and filesNameNameLast commit messageLast commit dateLatest commit History58 Commits.cargo.cargo  .github/workflows.github/workflows  etcetc  libkernellibkernel  scriptsscripts  srcsrc  .gitignore.gitignore  Cargo.lockCargo.lock  Cargo.tomlCargo.toml  LICENSELICENSE  README.mdREADME.md  build.rsbuild.rs  rust-toolchain.tomlrust-toolchain.toml  View all filesRepository files navigationREADMEMIT licensemoss

moss is a Unix-like, Linux-compatible kernel written in Rust and Aarch64
assembly.
It features a modern, asynchronous core, a modular architecture abstraction
layer, and binary compatibility with Linux userspace applications (currently
capable of running most BusyBox commands).
Features
Architecture & Memory

Full support for aarch64.
A well-defined HAL allowing for easy porting to other architectures (e.g.,
x86_64, RISC-V).
Memory Management:

Full MMU enablement and page table management.
Copy-on-Write (CoW) pages.
Safe copy to/from userspace async functions.
Kernel and userspace page fault management.
Buddy allocator for physical addresses and smalloc for boot allocations
and tracking memory reservations.

Async Core
One of the defining features of moss is its usage of Rust's async/await
model within the kernel context:

All non-trivial system calls are written as async functions, sleep-able
functions are prefixed with .await.
The compiler enforces that spinlocks cannot be held over sleep points,
eliminating a common class of kernel deadlocks.

Process Management

Full task management including scheduling and task migration via IPIs.
Currently implements 51 Linux syscalls; sufficient to execute most BusyBox
commands.
Advanced forking capabilities via clone().
Process and thread signal delivery and raising support.

VFS & Filesystems

Virtual File System with full async abstractions.
Drivers:

Ramdisk block device implementation.
FAT32 filesystem driver (ro).
devtmpfs driver for kernel character device access.

libkernel & Testing
moss is built on top of libkernel, a utility library designed to be
architecture-agnostic. This allows logic to be tested on a host machine (e.g.,
x86) before running on bare metal.

Address Types: Strong typing for VA (Virtual), PA (Physical), and UA
(User) addresses.
Containers: VMA management, generic page-based ring buffer (kbuf), and
waker sets.
Sync Primitives: spinlock, mutex, condvar, per_cpu.
Test Suite: A comprehensive suite of 230+ tests ensuring functionality across
architectures (e.g., validating Aarch64 page table parsing logic on an x86
host).

Building and Running
Prerequisites
You will need QEMU for aarch64 emulation and dosfstools to create the virtual file system.
sudo apt install qemu-system-aarch64 dosfstools
Additionally you will need a version of the aarch64-none-elf toolchain installed.
Any OS
To install aarch64-none-elf on any os, download the correct release of aarch64-none-elf onto your computer, unpack it, then export the bin folder to path.
macOS
There is experimental support for macOS in the scripts/mac-experimental folder. The scripts in there are not guaranteed to work for all macOS users and has only been tested on an M4 Apple Silicon MacBook Air.
NixOS
Run the following command
nix shell nixpkgs#pkgsCross.aarch64-embedded.stdenv.cc nixpkgs#pkgsCross.aarch64-embedded.stdenv.cc.bintools
Preparing the image
First, run the following script to prepare the binaries for the image:
./scripts/build-deps.sh
This will download and build the necessary dependencies for the kernel and put them
into the build directory.
Once that is done, you can create the image using the following command:
sudo ./scripts/create-image.sh
This will create an image file named moss.img in the root directory of the project,
format it as VFAT 32 and create the necessary files and directories for the kernel.
This script needs to run with sudo to mount the image through a loop device,
which is required to properly create the image for the kernel to work.
Running via QEMU
To build the kernel and launch it in QEMU:
cargo run --release
Running the Test Suite
Because libkernel is architecturally decoupled, you can run the logic tests on
your host machine:
cargo test -p libkernel --target x86_64-unknown-linux-gnu
Roadmap & Status
moss is under active development. Current focus areas include:

Basic Linux Syscall Compatibility (Testing through BusyBox).
Networking Stack: TCP/IP implementation.
Scheduler Improvements: Task load balancing.
A fully read/write capable filesystem driver (e.g., ext2/4).
Expanding coverage beyond the current 49 calls.

Contributing
Contributions are welcome! Whether you are interested in writing a driver,
porting to x86, or adding syscalls.
License
Distributed under the MIT License. See LICENSE for more information.

About

Rust Linux-compatible kernel

Resources

Readme

License

MIT license

Uh oh!

There was an error while loading. Please reload this page.


Activity
Stars

1.4k
stars
Watchers

7
watching
Forks

49
forks

Report repository

Releases
No releases published

Packages
0

No packages published

Contributors
6

Languages

Rust
98.3%

Other
1.7%

Footer

© 2025 GitHub, Inc.

Footer navigation

Terms

Privacy

Security

Status

Community

Docs

Contact

Manage cookies

Do not share my personal information

You can’t perform that action at this time.

The moss-kernel project represents a significant undertaking: a Linux-compatible kernel written entirely in Rust, designed for AArch64 architecture. Developed by hexagonal-sun, the kernel’s core philosophy centers around asynchronous operation, aiming to mitigate common kernel deadlocks through Rust’s strong guarantees. This project meticulously constructs a functional kernel leveraging Rust’s features, including strong typing, ownership, and concurrency primitives. The kernel achieves full MMU enablement, copy-on-write pages, and robust process management, mirroring elements of the Linux kernel while employing a novel asynchronous core.

The design explicitly incorporates a modular architecture abstraction layer facilitated by `libkernel`, a utility library that allows for testing kernel logic on a host machine (e.g., x86) before deployment on bare metal. This decoupled architecture, coupled with strong typing for virtual, physical, and user addresses, constitutes a key element of the project's development strategy. Furthermore, the project offers robust container management utilizing VMA (Virtual Memory Area) management, page-based ring buffers, and waker sets. Synchronization primitives like spinlocks, mutexes, condition variables, and per-CPU data structures provide the foundation for its concurrent operations. A comprehensive test suite, numbering over 230 tests, is integrated to validate functionality across diverse architectures, facilitating architecture independent testing via the `libkernel` library.

The development process is notably practical, with a strong emphasis on a streamlined build and deployment workflow. Prerequisites include QEMU emulation for AArch64 and dosfstools for VFS creation and the aarch64-none-elf toolchain. The project provides a detailed running guide, incorporating steps to prepare the image, build dependencies, and deploy the kernel via QEMU. The guide encompasses specific instructions for macOS (experimental support) and NixOS. The build process involves downloading, building, and packaging necessary dependencies, culminating in the creation of a VFAT 32 formatted image file named `moss.img`.

The project’s roadmap outlines several key areas of development, including improving Linux syscall compatibility (through BusyBox testing), implementing a networking stack (TCP/IP), enhancing scheduler efficiency with task load balancing, and developing a fully read/write filesystem driver (e.g., ext2/4), expanding syscall coverage beyond the initial 49 calls. While currently under active development, the project aims to bolster existing capabilities and extend functionality, furthering the feasibility of a Rust-based Linux kernel. Contributions for developing drivers, porting to x86, or adding new syscalls are welcome. The project is licensed under the MIT License and is presented under the guidance of hexagonal-sun.