Giter Club home page Giter Club logo

willos's Introduction

willOS

Gitter CircleCI

willOS is a minimal 64 bits kernel (not really an Operating System because it cannot do a lot of things currently). Some screencasts are available in this Twitter thread.

Setting up a development environment

The following dependencies are required to build this project:

  • gcc (build-essential)
  • nasm
  • ld
  • grub-mkrescue (part of grub2-common)
  • xorriso
  • (optional) qemu

This project targets x86_64 architectures, so you likely need a cross-compilation toolchain.

Docker (recommended way)

Use Docker with the provided Dockerfile:

$ docker build -t willos/toolchain .
[...]

$ docker run -it --rm -v $(pwd):/app willos/toolchain make help
clean                          remove build artifacts
debug                          build the OS in debug mode
docs                           build the docs
fmt                            automatically format the code with clang-format
gdb                            build, run the OS in debug mode and enable GDB
initrd                         build the init ram disk
iso                            build the image of the OS (.iso)
kernel                         compile the kernel
libc                           build the libc (for userland)
run-debug                      run the OS in debug mode
run-test                       run the OS in test mode
run                            run the OS
test                           run unit tests
userland                       compile the userland programs (statically linked to libc)
version                        print tool versions

MacOS

Install Homebrew, then run the following commands:

$ brew install nasm
$ brew install xorriso
$ brew install qemu
$ brew install x86_64-elf-gcc

You need to tap hawkw/x86_64-pc-elf and hawkw/grub to be able to install the GRUB utility:

$ brew tap hawkw/x86_64-pc-elf
$ brew tap hawkw/grub
$ brew install x86_64-pc-elf-gcc
$ brew install grub --with-x86_64-pc-elf --HEAD

Hat tip to Eliza Weisman for the taps!

Linux

See the circle-ci config.

Building willOS

To compile the kernel (ELF 64-bit), run:

$ make clean kernel

To build the ISO (this is the default target), run:

$ make clean iso

To build the ISO in DEBUG mode, run:

$ make clean debug

To compile the OS in DEBUG mode, build the ISO, and start qemu with the OS loaded, run:

$ make clean run-debug

Note: in DEBUG mode, logging uses the serial port COM1 to write various debugging information. qemu is configured to write the output of this serial port to ./logs/debug.log.

To compile the OS in normal mode, build the ISO, and start qemu with the OS loaded, run:

$ make clean un

Early boot sequence

  1. The BIOS loads the bootloader (GRUB) from the ISO
  2. The bootloader reads the kernel executable and finds the multiboot header
  3. The bootloader copies the .boot and .text sections to memory (to addresses 0x100000 and 0x100020)
  4. The bootloader jumps to the entry point (at 0x100020)
  5. Various checks are performed to make sure we can continue the boot process
  6. Page table and paging are configured and enabled
  7. Load a 64-bit Global Descriptor Table
  8. Reload all the data segment registers
  9. Call the C kmain() function

License

willOS 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).

willos's People

Contributors

willdurand avatar littlecodingfox avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.