kanajakala/cacos
A simple OS written in zig
CaCOS (k-a-k-o-s) is a simple hobby operating system. It's goal is to be functional and have a clean and elegant codebase, as much as possible. In the current rewrite there is a text console, a basic file system, and userland applications. You can see how the operating system is designed in the docs
Here are all the steps of the development of the os.
implement the bootboot boot protocol
automate bootboot installation and image creation
frame-buffer
basic functions
text display
memory
page allocation and tracking
memory freeing
system
interrupt descriptor table (IDT) setup
global descriptor table (GDT) setup
interrupt service routine (ISR) setup
Keyboard driver
Filesystem
basic ramfs and file structures
basic filesystem functions (create, delete, read, ...)
path handling
filesystem on disk
Elf file loading
parse elf file
load and execute elf file
system calls
call kernel code from apps
pass arguments and return errors
error marshalling, through kernel and apps
console
execute commands
standard text streams
write simple apps leveraging elf loading and system calls
write a standard library providing basic functionality (memory, filesystem, ...)
build a complete set of utils, akin to busybox (filesystem utils, text manipulation, ...)
threads and multi tasking
write a scheduler
context switches and multitasking
multi threading
PCI driver
support for hardware accelerated graphics
mouse driver and support
complete graphical interface
networking
porting linux binaries and utils
NOTE: the OS is currently in heavy development and the process to run the OS is not streamlined yet
NOTE: running on macos or windows has never been tested, though it should work fine
To run the CacOS you have to download the most recent image from the releases
tab, and then run the following command: qemu-system-x86_64 -drive format=raw,file=kernel/img/cacos.img
Alternatively, you can clone the git directory (git clone https://github.com/kanajakala/cacos.git CaCOS
), cd into it (cd CaCOS
) and then run (zig build run --release=small
)
currently there is not much you can do, you can type motd
to show the motd, or ls <dir>
to show the files in the provided directory
you will need the following dependencies:
running the following command will download and compile bootboot, and it's image utility "mkbootimg", compile the OS code for you and run it in qemu:zig build run
you can customize the build process by running specific steps:
zig build compile
generate an elf executable of the kernelzig build compile-apps
generate executables for the kernel appszig build setup
dowloads and build mkbootimg, bootboots utility program to generate bootable imageszig build gen
create a bootable image using mkbootimgzig build run
run the all the previous steps, and run the image in qemu