• Stars
    star
    325
  • Rank 129,350 (Top 3 %)
  • Language
    C
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ’Ύ A minimal, experimental and "toy" monolithic kernel to learn about OS development // Work In Progress

ArvernOS

Gitter CircleCI

ArvernOS (formerly known as "willOS") is a minimal and experimental monolithic kernel (not really an Operating System because it cannot do a lot of things currently).

Goals

The main goal of this project is to learn about operating systems, kernel development, different architectures and improve my C skills. ArvernOS is a monolithic (and hopefully modular) kernel with a unified homemade libc/libk, and userland programs.

The roadmap isn't clearly defined yet and it mainly depends on what I'd like to work on when I have time to spend on this project.

Architectures, boards and tiers

ArvernOS supports the architectures and boards listed below. Support for different architectures and boards are organized into two tiers, each with a different set of guarantees.

Tier 1

Tier 1 is the reference implementation and very likely the most advanced.

Current Tier 1 archs/boards:

  • x86_64
    • generic

Tier 2

Tier 2 is guaranteed to build but not all features have been implemented yet. Features are defined by the reference implementation and once feature parity is achieved, an architecture and/or board should move to Tier 1. Boards for which we cannot run enough tests in CI (e.g., because QEMU does not support the board) should stay in Tier 2, though.

Current Tier 2 archs/boards:

Hacking on ArvernOS

This section (and its sub-sections) are written for everyone interested in building and working on ArvernOS.

Setting up a development environment

The following dependencies are required to build this project:

  • llvm (version 13 currently)
  • make
  • qemu (version >= 5)

If you want to work on the x86_64 architecture, you'll need the following extra dependencies:

  • nasm
  • grub-mkrescue
  • xorriso

If you want to work on ARM architectures (aarch32 or aarch64), you'll need the following extra dependencies:

  • gcc-arm-none-eabi
  • u-boot-tools

Note: The recommended way to work on this project is to use Docker.

Getting the sources

This project contains git submodules. You have to clone the main project as well as the submodules, either by using this command:

$ git clone --recurse-submodules <url pointing to this repo>

or by using this command if you already have a copy of this git repository:

$ git submodule update --init

Docker (recommended way)

Use Docker with the provided Dockerfile. You can either use the willdurand/arvernos-toolchain image from DockerHub or build your own:

$ docker build -t willdurand/arvernos-toolchain .
[...]

You can then use it with docker run:

$ docker run -it --rm -v $(pwd):/app willdurand/arvernos-toolchain make help
ArvernOS - available commands for arch=x86_64

clean                          remove build artifacts
debug                          build the project in debug mode
docs                           build the docs
fmt                            automatically format the code with clang-format
gdb                            build, run the project in debug mode and enable GDB
help                           show this help message
libc                           build the libc
release                        build the project in release mode
run-debug                      run the project in debug mode
run-release                    run the project in release mode
run-test                       run the project in test mode
test                           run the unit tests
userland                       compile the userland programs (statically linked to libc)
version                        print tool versions

Note: The output of the make help command may contain different commands depending on the architecture and board configured.

MacOS

Install Homebrew, then run the following commands:

$ brew install nasm xorriso qemu llvm u-boot-tools

Linux

The tools/install-linux-deps script is used to install the dependencies. It is currently used by both the Dockerfile and Circle CI.

Building ArvernOS

You first need to install the development dependencies in order to build ArvernOS. The different final files are located in the build/<arch>/dist/ or build/<arch>/<board>/dist/ folder.

Debug mode

To build the image in debug mode, run:

$ make clean ; make debug

To compile the OS in debug mode, build the image, and start qemu with the OS loaded, run:

$ make clean ; make run-debug

Note: Some boards aren't supported in QEMU.

QEMU monitor

When running make run-debug, the QEMU monitor can be accessed over TCP on port 5555. You can use tools like telnet or nc:

$ telnet 127.0.0.1 5555
Logging

In debug mode, logging very likely uses the serial port COM1 to write various debugging information. QEMU is configured to write the output of this serial port to a logfile in ./log/. DEBUG level logs are not necessarily written by default, though, and it is possible to enable DEBUG logs for specific modules like this:

# Enable the debug logs for the "net" and "fs" modules
$ make clean ; make run-debug ENABLE_NET_DEBUG=1 ENABLE_FS_DEBUG=1

The available debug variables are:

  • ENABLE_CONFIG_DEBUG
  • ENABLE_CORE_DEBUG
  • ENABLE_FS_DEBUG
  • ENABLE_MMU_DEBUG
  • ENABLE_NET_DEBUG
  • ENABLE_PROC_DEBUG
  • ENABLE_SYS_DEBUG
  • ENABLE_USERLAND_DEBUG
Stack traces

Log files may contain stack traces without debug symbols if the symbols haven't been loaded:

[...]
DEBUG    | src/kernel/arch/x86_64/kshell/kshell.c:108:run_command(): command='selftest' argc=1
DEBUG    | src/kernel/arch/x86_64/kernel/panic.c:30:kernel_dump_stacktrace(): kernel stacktrace:
DEBUG    | src/kernel/arch/x86_64/kernel/panic.c:39:kernel_dump_stacktrace(): 00000000001163B3 - ???+0x0
DEBUG    | src/kernel/arch/x86_64/kernel/panic.c:39:kernel_dump_stacktrace(): 0000000000115941 - ???+0x0
DEBUG    | src/kernel/arch/x86_64/kernel/panic.c:39:kernel_dump_stacktrace(): 0000000000115BE1 - ???+0x0
DEBUG    | src/kernel/arch/x86_64/kernel/panic.c:39:kernel_dump_stacktrace(): 00000000001152BF - ???+0x0
DEBUG    | src/kernel/arch/x86_64/kernel/panic.c:39:kernel_dump_stacktrace(): 000000000010935B - ???+0x0

Use the tools/fix-stacktrace.py script to add missing symbol names to the output:

$ ./tools/fix-stacktrace.py build/x86_64/dist/symbols.txt log/x86_64-debug.log
[...]
DEBUG    | src/kernel/arch/x86_64/kshell/kshell.c:108:run_command(): command='selftest' argc=1
DEBUG    | src/kernel/arch/x86_64/kernel/panic.c:30:kernel_dump_stacktrace(): kernel stacktrace:
DEBUG    | src/kernel/arch/x86_64/kernel/panic.c:39:kernel_dump_stacktrace():   00000000001163B3 - selftest+0x63
DEBUG    | src/kernel/arch/x86_64/kernel/panic.c:39:kernel_dump_stacktrace():   0000000000115941 - run_command+0x271
DEBUG    | src/kernel/arch/x86_64/kernel/panic.c:39:kernel_dump_stacktrace():   0000000000115BE1 - kshell_run+0x181
DEBUG    | src/kernel/arch/x86_64/kernel/panic.c:39:kernel_dump_stacktrace():   00000000001152BF - kmain+0x107f
DEBUG    | src/kernel/arch/x86_64/kernel/panic.c:39:kernel_dump_stacktrace():   000000000010935B - long_mode_start+0x13

In addition, you might want to find the corresponding line of code in the source files by using llvm-addr2line or llvm-symbolizer:

$ llvm-symbolizer-13 --obj=build/x86_64/dist/kernel-x86_64.bin 0x01163B3
print_selftest_header
/path/to/ArvernOS/src/kernel/kshell/selftest.c:12:3
selftest
/path/to/ArvernOS/src/kernel/kshell/selftest.c:30:3
$ llvm-addr2line-13 -e build/x86_64/dist/kernel-x86_64.bin 01163B3
/path/to/ArvernOS/src/kernel/kshell/selftest.c:12
Debugging

Use make gdb to run the project in debug mode with QEMU configured to wait for gdb to connect. This has been tested with vim (:Termdebug) and VS Code.

A sensible configuration is automatically generated when this command is executed (see also: make gdbinit). If a file named .gdbinit.local exists in the project's root directory, its content will be appended to the generated .gdbinit file.

Note: make gdb calls make run-debug under the hood so all configuration options are also supported. For example, it is possible to run make gdb KERNEL_CMDLINE="kshell selftest".

Release mode

To compile the OS in release mode, build the image, and start qemu with the OS loaded, run:

$ make clean ; make run-release

config files

config files are used to configure how a build works. The content must be compatible with make. Here is an example:

# LLVM config on MacOS with Homebrew
LLVM_PREFIX = /usr/local/opt/llvm@13/bin/
LLVM_SUFFIX =

# Always enable the Undefined Behavior sanitizer
UBSAN = 1

# Logging
ENABLE_CORE_DEBUG     = 1
ENABLE_PROC_DEBUG     = 1
ENABLE_SYS_DEBUG      = 1
ENABLE_USERLAND_DEBUG = 1

License

ArvernOS is released under the MIT License. See the bundled LICENSE file for details. In addition, some parts of this project have their own licenses attached (either in the source files or in a LICENSE file next to them).

More Repositories

1

Negotiation

Content Negotiation tools for PHP.
PHP
1,371
star
2

Hateoas

A PHP library to support implementing representations for HATEOAS REST web services.
PHP
1,016
star
3

JsonpCallbackValidator

JSONP callback validator.
PHP
653
star
4

EmailReplyParser

PHP library for parsing plain text email content.
PHP
621
star
5

BazingaJsTranslationBundle

A pretty nice way to expose your Symfony translation messages to your client applications.
JavaScript
574
star
6

BazingaHateoasBundle

Integration of the Hateoas library into Symfony.
PHP
290
star
7

BazingaFakerBundle

Put the awesome Faker library into the Symfony2 DIC and populate your database with fake data.
PHP
279
star
8

docker-elk

🐳 Creating an ELK stack could not be easier.
270
star
9

nmap

nmap is a PHP wrapper for Nmap.
PHP
154
star
10

willdurand.github.io

William Durand's website ✨
HTML
147
star
11

Propilex

Silex, Propel, Backbone, Stack, Hateoas, Negotiation, and so on!
PHP
134
star
12

anchorify.js

A dead simple JavaScript library for automatically creating anchored headings in your HTML documents.
JavaScript
117
star
13

BazingaRestExtraBundle

Provides extra features for your REST APIs built using Symfony.
PHP
95
star
14

puppet-nodejs

Puppet module to manage Node.js and NPM that just works.
Ruby
69
star
15

TravisLight

A build monitoring tool (buildwall) that allows you to quickly detect failing projects for Travis-CI.
JavaScript
64
star
16

rustwasm-addon

πŸ¦€ + πŸ•Έ + 🦊 // A web-extension to reverse a string. Yep.
JavaScript
63
star
17

StateMachineBehavior

This behavior adds a finite state machine to your model.
PHP
38
star
18

EMD

Fast and Adaptive Bidimensional Empirical Mode Decomposition Using Order-Statistics Filter Based Envelope Estimation
C++
37
star
19

dotfiles

πŸ’» My dotfiles.
Shell
36
star
20

hubot-cachet

A hubot script to manage incidents/statuses with Cachet.
CoffeeScript
34
star
21

BazingaOAuthServerBundle

[Symfony2] A server side implementation of the OAuth 1.0 protocol based on RFC 5849.
PHP
31
star
22

puppet-composer

Puppet module to install Composer.
Ruby
30
star
23

StackNegotiation

Stack middleware for content negotiation.
PHP
27
star
24

docker-logstash-forwarder

Docker image for Logstash Forwarder, formerly known as lumberjack.
25
star
25

TypehintableBehavior

Insane Propel behavior that helps you to be compliant with third-party interfaces by adding type hint to generated methods.
PHP
22
star
26

pihole-oled

πŸ’» Pi-hole and system stats displayed on an OLED 0.96" screen.
Python
22
star
27

jenairienacacher.fr

Site informatif autour de l'argument "je n'ai rien Γ  cacher".
HTML
22
star
28

pman

"pear-doc.php.net/pman" on Composer/Packagist!
Shell
20
star
29

EventDispatcherBehavior

Integrates the Symfony2 EventDispatcher component in your Model classes.
PHP
19
star
30

Speaker

Speaker aims to convert my blog posts in audio files.
Shell
16
star
31

EspWiFi

Arduino driver for the ESP8266 WiFi module.
C++
15
star
32

hubot-ansible

Let Hubot run `ansible-playbook` for you!
CoffeeScript
14
star
33

sonoff-webthing

πŸ’‘ An alternative firmware to create "Things" with iTead Sonoff devices.
Makefile
13
star
34

pino-devtools

🌲 A transport for viewing logs in your favorite browser devtools!
JavaScript
13
star
35

jenkins-phing-symfony

Jenkins/Phing for symfony 1.x (Works with Hudson)
12
star
36

gitlab-elk-demo

A demo project showing how to integrate Gitlab with the ELK stack.
11
star
37

dynhost

πŸ“‘ Automatically update a dynamic DNS record for an OVH domain.
Rust
11
star
38

workshop-rest-from-zero-to-hero

Workshop.
PHP
10
star
39

PublishableBehavior

The PublishableBehavior is designed to quickly add publish/unpublish features to your model.
PHP
10
star
40

container-registry-proxy

πŸ“– A proxy that makes the GitHub Container Registry compatible with the Docker Registry HTTP API V2 specification.
Go
10
star
41

BazingaPropelEventDispatcherBundle

Integrates the Propel EventDispatcherBehavior into Symfony2.
PHP
10
star
42

docker-buildtools

9
star
43

chipolata

🌭 A CHIP-8 interpreter written in Rust.
Rust
9
star
44

clermontech-workshop-git-deploy

Material for my Git Workshop.
Shell
8
star
45

cwrm

πŸ“Έ WiFi Remote Module ✨ // Work In Progress
Makefile
8
star
46

containers

πŸ“¦ This is a repository with some code I wrote to learn more about containers.
Go
7
star
47

gitpod-firefox-dev

Firefox development with Gitpod = ❀️
Shell
6
star
48

gameboy-breakout-board

A GameBoy card slot breakout board.
OpenSCAD
6
star
49

Karotz-Plugin

A Jenkins Plugin for my beloved Karotz.
Java
6
star
50

puppet-bazinga

A set of Puppet roles and some useful functions.
Puppet
6
star
51

thesis

πŸ“ Automated Test Generation for production systems with a Model-based Testing approach.
TeX
6
star
52

kicad-libs

William Durand's KiCad Libraries
OpenSCAD
6
star
53

DuckHunt

A little game in haXe.
Haxe
4
star
54

isomorphic-formdata

formdata-node + browser support = <3
JavaScript
4
star
55

StateMachineExporter

Generate a Graphviz compatible file (.dot file) from a Propel XML schema, and the StateMachineBehavior.
PHP
3
star
56

demo-pretty-printer

A demo project to complement my blog post about Pretty Printers.
JavaScript
3
star
57

amo-info

🦊 An extension to show information about AMO related services.
JavaScript
3
star
58

hardware-hacking-cast-device

Tools and design files related to my research on a cheap "cast device" clone.
C
3
star
59

uberdex

The official Uberdex!
2
star
60

puppet-stoplight

This module manages Stoplight, a powerful build monitoring tool.
Ruby
1
star
61

fx-attribution-data-reader

Attribution data reader for Firefox installers
JavaScript
1
star
62

drnd.me

CSS
1
star
63

universal-express-http-context

DEPRECATED: the work highlighted here has been merged into upstream.
JavaScript
1
star