Skip to content

suguuss/cOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

150 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

cOS, an OS made in C


Table of contents generated with markdown-toc

The Operating System

πŸ’½ Bootloader

Legacy booting

The bios loads the first sector of the bottable device and look for the magic number (0xAA55, chosen number to represent a bootable signature). If the number is found, the bios jumps to the first instructions in the sector.

πŸ’Ύ FAT32

πŸ“€ Reading sectors from the 'disk'

πŸ“ƒ GDT - Global Desriptor Table

πŸ”’ Protected Mode

πŸ–₯️ Kernel

πŸ”Œ Ports

⏱️ Interrupts

πŸ“œ IDT - Interrupt Descriptor Table

⌨️ Keyboard

βŒ› Timer / PIC - Programmable Interrupt Controller

πŸ–₯️ Screen

Cursor
Color
Printing
Scrolling

πŸ’Ώ Disk I/O

Read / Write

πŸš€ Dependencies

make

Make is used to automate the build process. It is used to compile the kernel, and to build the bootloader.

nasm

Compiles assembly code into machine code.

mtools

A collection of utilities for manipulating MS-DOS filesystems.

Install on Manjaro / Arch

sudo pacman -S make nasm qemu mtools

⚠️ On manjaro, there is a bug in mcopy (part of mtools). It is recommended to build an older version yourself (mtools-4.0.31.tar.gz). from https://ftp.gnu.org/gnu/mtools/

Install on Ubuntu

sudo apt-get install make nasm qemu mtools 

Install on Fedora / CentOS

sudo dnf install make nasm qemu mtools

Building the cross compiler

To build the cross compiler, you can use a script inside the scripts folder. The credit for the script goes to mell-o-tron. If no script are available for your distro, you can refer to this table from the osdev wiki and install the dependencies yourself.


Repository structure

.
β”œβ”€β”€ Docs
β”‚   β”œβ”€β”€ assets
β”‚   β”‚   └── drive.png
β”‚   β”œβ”€β”€ build.md
β”‚   β”œβ”€β”€ Links.md
β”‚   β”œβ”€β”€ schematics.drawio
β”‚   └── TODO.md
β”œβ”€β”€ LICENSE
β”œβ”€β”€ Makefile
β”œβ”€β”€ README.md
β”œβ”€β”€ scripts
β”‚   β”œβ”€β”€ setup-gcc-arch.sh
β”‚   └── setup-gcc-ubuntu.sh
└── src
    β”œβ”€β”€ bootloader
    β”‚   β”œβ”€β”€ bootsector.asm
    β”‚   └── Makefile
    └── kernel
        β”œβ”€β”€ drivers
        β”‚   β”œβ”€β”€ disk
        β”‚   β”‚   β”œβ”€β”€ ata
        β”‚   β”‚   β”‚   β”œβ”€β”€ ata.c
        β”‚   β”‚   β”‚   └── ata.h
        β”‚   β”‚   └── fat32
        β”‚   β”‚       β”œβ”€β”€ fat32.c
        β”‚   β”‚       └── fat32.h
        β”‚   β”œβ”€β”€ keyboard
        β”‚   β”‚   β”œβ”€β”€ ch-fr_keymap.h
        β”‚   β”‚   β”œβ”€β”€ keyboard.c
        β”‚   β”‚   └── keyboard.h
        β”‚   β”œβ”€β”€ ports
        β”‚   β”‚   β”œβ”€β”€ ports.c
        β”‚   β”‚   └── ports.h
        β”‚   └── screen
        β”‚       β”œβ”€β”€ color
        β”‚       β”‚   β”œβ”€β”€ color.c
        β”‚       β”‚   └── color.h
        β”‚       β”œβ”€β”€ cursor
        β”‚       β”‚   β”œβ”€β”€ cursor.c
        β”‚       β”‚   └── cursor.h
        β”‚       └── print
        β”‚           β”œβ”€β”€ print.c
        β”‚           └── print.h
        β”œβ”€β”€ interrupts
        β”‚   β”œβ”€β”€ interrupts.c
        β”‚   └── interrupts.h
        β”œβ”€β”€ kernel.c
        β”œβ”€β”€ kernel_entry.asm
        β”œβ”€β”€ Makefile
        └── stdlibs
            β”œβ”€β”€ stdlib.c
            β”œβ”€β”€ stdlib.h
            β”œβ”€β”€ string.c
            └── string.h

Links

https://ecotrust-canada.github.io/markdown-toc/

About

First attempt at making an os from scratch in C

Resources

License

Stars

Watchers

Forks

Contributors