All Projects → aesophor → valkyrie

aesophor / valkyrie

Licence: GPL-3.0 license
🔮 A UNIX-like toy kernel built from scratch (for AArch64) with preemptive multi-threading, VM, CoW fork(), buddy, slob, VFS, FAT32.

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language
Makefile
30231 projects
assembly
5116 projects

Projects that are alternatives of or similar to valkyrie

MeetixOS
An hobby OS written in modern C++20 which aims to be Unix-like. Currently based on EvangelionNG, a GhostOS derived kernel
Stars: ✭ 179 (+214.04%)
Mutual labels:  osdev, cpp20
GPE-Helper
🚑 GPE 小幫手-拯救你我的程式檢定考試
Stars: ✭ 40 (-29.82%)
Mutual labels:  nctu, nycu
Rcore
Rust version of THU uCore OS. Linux compatible.
Stars: ✭ 2,175 (+3715.79%)
Mutual labels:  osdev, aarch64
Fukuro
Simple microkernel (early stage)
Stars: ✭ 18 (-68.42%)
Mutual labels:  osdev, aarch64
Luakernel
Lua + SQLite + musl libc running on x86.
Stars: ✭ 223 (+291.23%)
Mutual labels:  osdev
Sunriseos
Horizon/NX kernel reimplementation
Stars: ✭ 157 (+175.44%)
Mutual labels:  osdev
Zenithos
The Zenith Operating System is a modern, professional fork of the 64-bit Temple Operating System, designed to survive societal collapse.
Stars: ✭ 144 (+152.63%)
Mutual labels:  osdev
Raspberry Pi Os
Learning operating system development using Linux kernel and Raspberry Pi
Stars: ✭ 11,000 (+19198.25%)
Mutual labels:  osdev
rsync-static
Static RSync binaries compiled for x86, ARM, and ARM64. Useful for running on Android. Built daily
Stars: ✭ 40 (-29.82%)
Mutual labels:  aarch64
sonar
A Type-1 hypervisor aimed to implement kernel hotswapping
Stars: ✭ 23 (-59.65%)
Mutual labels:  osdev
Nebulet
A proof-of-concept microkernel that implements a WebAssembly "usermode" that runs in Ring 0.
Stars: ✭ 2,237 (+3824.56%)
Mutual labels:  osdev
Mos
A hobby operating system developed from scratch
Stars: ✭ 169 (+196.49%)
Mutual labels:  osdev
rust os
My hobby operating system microkernel written in Rust
Stars: ✭ 33 (-42.11%)
Mutual labels:  osdev
zab
C++20 liburing backed coroutine executor and event loop framework.
Stars: ✭ 54 (-5.26%)
Mutual labels:  cpp20
Snowflakeos
"It is very special"
Stars: ✭ 190 (+233.33%)
Mutual labels:  osdev
Emerald
An operating system written in C
Stars: ✭ 118 (+107.02%)
Mutual labels:  osdev
lsp-dsp-lib
DSP library for signal processing
Stars: ✭ 37 (-35.09%)
Mutual labels:  aarch64
Libhermit
HermitCore: A C-based, lightweight unikernel
Stars: ✭ 190 (+233.33%)
Mutual labels:  osdev
Unikraft
Unikraft is an automated system for building specialized POSIX-compliant OSes known as unikernels. (Core repository)
Stars: ✭ 183 (+221.05%)
Mutual labels:  osdev
Kernel
The Stupid Operating System
Stars: ✭ 217 (+280.7%)
Mutual labels:  osdev

VALKYRIE

A UNIX-like toy kernel built from scratch (for AArch64)

Kernel Features

  • Capable of running on a real Raspberry Pi 3B+
  • AArch64 kernel with (user & kernel) preemptive multi-threading
  • Copy-on-write fork()
  • Virtual memory
  • Virtual filesystem (VFS)
  • FAT32 filesystem (supports long filenames)
  • /dev, /proc, /tmp filesystem
  • Self-made C++ standard library

Syscalls

int sys_read(int fd, void __user *buf, size_t count);
int sys_write(int fd, const void __user *buf, size_t count);
int sys_open(const char __user *pathname, int options);
int sys_close(int fd);
int sys_fork();
int sys_exec(const char __user *name, const char __user *argv[]);
[[noreturn]] void sys_exit(int error_code);
int sys_getpid();
int sys_wait(int __user *wstatus);
int sys_sched_yield();
long sys_kill(pid_t pid, int signal);
int sys_signal(int signal, void(__user *handler)());
int sys_access(const char __user *pathname, int options);
int sys_chdir(const char __user *pathname);
int sys_mkdir(const char __user *pathname);
int sys_rmdir(const char __user *pathname);
int sys_unlink(const char __user *pathname);
int sys_mount(const char __user *device_name, const char __user *mountpoint,
              const char __user *fs_name);
int sys_umount(const char __user *mountpoint);
int sys_mknod(const char __user *pathname, mode_t mode, dev_t dev);
int sys_getcwd(char __user *buf);
void __user *sys_mmap(void __user *addr, size_t len, int prot, int flags, int fd,
                      int file_offset);
int sys_munmap(void __user *addr, size_t len);  // unfinished

User Programs

  • init
  • login
  • sh
  • ls
  • cat
  • mkdir
  • touch
  • fork_test
  • page_fault_test
  • procfs_test
  • vfs_test_dev
  • vfs_test_mnt
  • vfs_test_orw
  • mmap_illegal_read
  • mmap_illegal_write

Build valkyrie

Build requirements

  • GNU make
  • aarch64 (cross) compiler toolchain
  • qemu-system-aarch64

Installing ARMv8 (cross) compiler toolchain and QEMU

# Arch Linux (x86_64)
sudo pacman -S aarch64-linux-gnu-gcc aarch64-linux-gnu-gdb qemu-arch-extra

# macOS (x86_64)
brew tap messense/macos-cross-toolchains
brew install aarch64-unknown-linux-gnu qemu

# macOS (Apple Silicon)
brew install aarch64-elf-gcc aarch64-elf-binutils qemu

Building valkyrie

git clone https://github.com/aesophor/valkyrie
cd valkyrie
make

Run valkyrie

Download sd.img from here.

The sd.img file contains:

  • The boot partition (in which kernel8.img resides).
  • The root partition (consists of /bin, /usr, etc).
  • If you wish to run valkyrie in QEMU, then place sd.img under the project's root dir.
  • If you wish to run valkyrie on a real rpi3b+, then flash it to your SD card with dd.

Running valkyrie in QEMU

make run

Running valkyrie on a real rpi3b+

Set up the USB-TO-TTL (USB-TO-SERIAL) Converter

RPI3 Pin USB-TO-TTL Pin
GND GND
UART0 TX RXD
UART0 RX TXD

  1. Flash sd.img to the SD card (download)
  2. Mount the SD card and replace the kernel8.img on the SD card with the latest build.
  3. Eject the SD card and plug it into RPI3.
  4. Plug in the USB-TO-TTL converter to your computer
    • for macOS, run screen /dev/tty.usbserial-0001 115200
    • for linux, run screen /dev/ttyUSB0 115200

References

License

GNU General Public License v3

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].