Linux News

Kerla project develops Linux-compatible kernel in Rust language

Share on Facebook Share on Twitter Pinterest LinkedIn Tumblr

The Kerla project is developing an operating system kernel written in the Rust language. The new kernel is initially focused on ensuring compatibility with the Linux kernel at the ABI level, which will allow unmodified binaries built for Linux to run in a Kerla-based environment. The code is distributed under Apache 2.0 and MIT licenses. The project is being developed by the Japanese developer Seiya Nuta, known for creating the microkernel operating system Resea , written in the C language.

At the current stage of development Kerla can only work on systems with x86_64 architecture and implements basic system calls such as write, stat, mmap, pipe and poll, supports signals, unnamed pipes and context switches. Calls such as fork, wait4, and execve are provided to control the processes. There is support for tty and pseudo-terminals (pty). Of the file systems, initramfs (used to mount the root FS), tmpfs and devfs are still supported. A network stack with TCP and UDP socket support is provided based on the smoltcp library .

The developer has prepared a boot environment that runs in QEMU or in the Firecracker virtual machine with the virtio-net driver, to which you can already connect via SSH. Musl is used as a system library, and BusyBox is used as user utilities.

On the basis of Docker, a build system has been prepared that allows you to create your own boot initramfs with the Kerla kernel. Separately, developing fish-like program shell nsh and GUI-stack Kazari based Wayland protocol.

Using the Rust language in a project allows you to reduce the number of errors in your code due to the use of safe programming techniques and an increase in the efficiency of identifying problems when working with memory. Safe memory handling is ensured in Rust at compile time through reference checking, object ownership tracking and object lifetime (scope), as well as by evaluating the correctness of memory access at runtime. In addition, Rust provides protection against integer overflows, requires mandatory initialization of variable values ​​before use, adopts the concept of immutable references and variables by default, offers strong static typing to minimize logical errors, and simplifies input processing with pattern matching. …

For the development of low-level components such as the OS kernel, Rust provides support for raw pointers, struct packing, inline assembler insertions, and assembly language file embedding. To work without being tied to the standard library, there are separate crate packages for performing operations with strings, vectors, and bit flags. Among the advantages, the built-in tools for assessing the quality of the code (linter, rust-analyzer) and creating unit tests that can be run not only on real equipment, but also in QEMU are also noted.

Write A Comment

Exit mobile version