Skip to content

bassosimone/vsos

Repository files navigation

VSOS: Very Small Operating System

Let's return to userspace!

VSOS is a really-basic, portable, hobby operating system written in C.

Roadmap

  • bootstrap with qemu-system-aarch -M virt(arm64)
  • return from interrupt at EL1 context (arm64)
  • console driver (PL011 UART)
  • printk (arm64)
  • cooperative multitasking (arm64)
  • system-timer driver (arm64)
  • virtual memory at EL1 context (arm64)
  • interruptible process sleep (arm64)
  • bitmap based allocator
  • SYS_read (arm64)
  • SYS_write (arm64)
  • initial shell (arm64)
  • ELF loader (arm64)
  • virtual memory at EL0 context (arm64)
  • zygote user process (arm64)
  • O_NONBLOCK and SYS_select (arm64)
  • block device driver (arm64)
  • file system (arm64)

Documentation

Dependencies

On Ubuntu 25.04, we need these dependencies:

sudo apt install build-essential clang clangd lld llvm ninja-build qemu-system-arm

Building

We use ninja for building. To build the kernel and the shell, type:

ninja

This process produces kernel.elf, the kernel. The build process (see ninja.build) embeds the shell ELF binary inside the kernel itself.

To remove all built artifacts, use:

ninja -t clean

Testing

We use qemu-system-aarch64 -M virt for testing.

This is the only system supported by VSOS.

qemu-system-aarch64 \
  -M virt \
  -cpu cortex-a53 \
  -nographic \
  -kernel kernel.elf

To investigate errors, obtain more detailed logs using:

qemu-system-aarch64 \
  -M virt \
  -cpu cortex-a53 \
  -d in_asm,cpu,int,guest_errors -D qemu.log \
  -nographic \
  -kernel kernel.elf

This invocation will produce extensive logs inside the qemu.log file.

You will frequently need to correlate the logs with the kernel disassembly.

To obtain the kernel disassembly, use:

llvm-objdump -d --no-show-raw-insn -M no-aliases kernel.elf

or:

readelf -a kernel.elf

License

SPDX-License-Identifier: MIT

Portions of this code derive from nuta/operating-system-in-1000-lines.