dreamos82 / Dreamos64

My experiments with osdev... again
160 stars 8 forks source link
assembly c kernel operating-system operating-system-development operating-system-kernel operating-system-learning operating-systems-project osdev x86-64

DreamOS64

C/C++ CI Discord Chat

DreamOS64 is just my recent attempt to write a kernel again after many years far from osdev, But this time in 64bit.

It is not a real replacement of the original DreamOS, and i don't really have any long term plans for it at the moment.

I started this project because i was missing the excitement of low-level programming :)

What it does

Actually not much! :D

It just prints the OS name, a logo and few other string.

But at kernel level several things have been implemented:

Prerequisites:

These are the packages required to build and run it:

To build Dreamos64, a toolchain that supports the target architecture is required, it can be either gcc (in our case x86-64) or clang installed.

A complete guide on how to build the gcc cross-compiler, can be found here, for DreamOS64 the target architecture will be x86-64.

For clang we just need to install the llvmand the lld packages (the exact package name depends on the distribution used).

Compiling and Running the OS

For a complete guide on how to build DreamOS64 and the parameters that are availables is in the docs folder: docs/Building.md.

Build the OS

Before building the os we need to copy a PSF font (either v1 or v2) in the fonts folder, and change its name to default.psf (even if we are building with framebuffer off).

Once all the parameters in build/Config.mk are set, to build just type:

    make

It will use the default goal build and produce a bootable iso in the dist/ folder called.

Run and Debug

To launch the OS in qemu just use:

    make run

Instead if we type:

   make debug

It will compile the OS with the debug symbols enabled, all the output logging information will be sent to stdio.

Finally:

   make gdb

Will compile the OS with debug symbol, and launch qemu with remote debugging enabled and will wait connection from gdb to start.

Unit tests

There is a small set of tests implemented using asserts, if you want to run them just run:

make tests

Known issues

    Booting from DVD/CD...
    Boot failed: Could not read from CDROM (code 0009)

This means you are missing the grub-pc-bin package, and you need to install it.

src/kernel/framebuffer/framebuffer.c:122: undefined reference to `_binary_fonts_default_psf_start'

This means that the fonts folder is missing (you need either a psf v2 or v1 font file in the fonts folder, the file has to be called default.psf)

And now show time! :)

image

Acknowledgements

Well so far a big thank you goes to DeanoBurrito that implemented several stuff for Dreamos64 (x2apic, fixed some bugs, logging, and more to come...) not to mention his precious help explaining things and reviewing my crappy code :) And his operating system is worth a mention too: NorthPort

Finally if you are interested in how to develop your own kernel, you can head to https://github.com/dreamportdev/Osdev-Notes/ a project mantained by me, and DeanoBurrito on how to write a kernel from scratch.