All Projects → AxFab → kora-kernel

AxFab / kora-kernel

Licence: AGPL-3.0 license
Kernel for my operating system KoraOS

Programming Languages

c
50402 projects - #5 most used programming language
shell
77523 projects
Makefile
30231 projects
assembly
5116 projects

Projects that are alternatives of or similar to kora-kernel

Macaron
A sweet hobby made operating system written in C++ for x86 CPUs with GUI
Stars: ✭ 34 (+126.67%)
Mutual labels:  os, osdev, operating-system, x86, hobby-os, hobby-kernel
KnutOS
An x86_64 hobbyist OS written in C and Assembly
Stars: ✭ 16 (+6.67%)
Mutual labels:  os, osdev, operating-system, hobby-os, hobby-kernel
Toaruos
A completely-from-scratch hobby operating system: bootloader, kernel, drivers, C library, and userspace including a composited graphical UI, dynamic linker, syntax-highlighting text editor, network stack, etc.
Stars: ✭ 4,687 (+31146.67%)
Mutual labels:  os, osdev, operating-system, x86
georgios
Hobby Operating System
Stars: ✭ 19 (+26.67%)
Mutual labels:  osdev, operating-system, x86, hobby-os
Dennix
Dennix is a unix-like hobbyist operating system written from scratch.
Stars: ✭ 53 (+253.33%)
Mutual labels:  os, osdev, operating-system, x86
RocketOS
RocketOS is a Unix based OS that uses legacy BIOS and GRUB and is written in C17. It is being developed for educational purposes primarily, but it still is a serious project. It is currently in its infancy.
Stars: ✭ 23 (+53.33%)
Mutual labels:  os, osdev, operating-system, x86
MeetixOS
An hobby OS written in modern C++20 which aims to be Unix-like. Currently based on EvangelionNG, a GhostOS derived kernel
Stars: ✭ 179 (+1093.33%)
Mutual labels:  osdev, operating-system, x86, hobby-os
Aqeous
(Inactive, Checkout AvanaOS, Rewrite of this) This is a New Operating System (Kernel right now). Made completely from scratch, We aim to make a complete OS for Learning purpose
Stars: ✭ 23 (+53.33%)
Mutual labels:  os, osdev, operating-system, x86
GENADEV OS
An AArch64 hobbyist OS for the Raspberry Pi 3 B+
Stars: ✭ 14 (-6.67%)
Mutual labels:  os, operating-system, hobby-os, hobby-kernel
Reactos
A free Windows-compatible Operating System
Stars: ✭ 10,216 (+68006.67%)
Mutual labels:  os, osdev, operating-system, x86
Toaru Nih
NOTICE: The ToaruOS-NIH Project has been MERGED UPSTREAM. This repository is now archived.
Stars: ✭ 66 (+340%)
Mutual labels:  os, osdev, operating-system, x86
opuntiaOS
opuntiaOS - an operating system targeting x86, ARMv7, Aarch64
Stars: ✭ 566 (+3673.33%)
Mutual labels:  os, operating-system, hobby-os, hobby-kernel
duckOS
Yet another hobby x86 UNIX-like operating system written in C and C++. Features a dynamically linked userspace, an in-house c standard library, and more! And yes, it runs DOOM.
Stars: ✭ 250 (+1566.67%)
Mutual labels:  os, osdev, operating-system, hobby-os
Mos
A hobby operating system developed from scratch
Stars: ✭ 169 (+1026.67%)
Mutual labels:  os, osdev, operating-system, x86
LudOS
A toy monolithic kernel written in C++
Stars: ✭ 38 (+153.33%)
Mutual labels:  os, osdev, operating-system
Unikraft
Unikraft is an automated system for building specialized POSIX-compliant OSes known as unikernels. (Core repository)
Stars: ✭ 183 (+1120%)
Mutual labels:  os, osdev, operating-system
Cyjon
A simple, clean code, multi-tasking operating system written in pure assembly language for 64-bit processors from the AMD64 family.
Stars: ✭ 184 (+1126.67%)
Mutual labels:  os, osdev, operating-system
MandelbrotOS
A community driven OS by the youth
Stars: ✭ 172 (+1046.67%)
Mutual labels:  os, osdev, operating-system
Wingos
a little 64bit operating system written in c++ with smp support
Stars: ✭ 361 (+2306.67%)
Mutual labels:  os, osdev, operating-system
Aquila
AquilaOS: UNIX-like Operating System
Stars: ✭ 413 (+2653.33%)
Mutual labels:  os, osdev, operating-system

KoraOS

KoraOs is an operating system written and designed from scratch. It's developed as a hobby by an enthusiasts developer.

This repository contains code for the kernel of the Kora system. If you wish to build the entire system look at KoraOs repository.

I've been trying to build my own kernel from some time. After many rework, breaks and rethinking I restart one entirely with meticulous care for the design. My objective has always been to build program that do just what they supposed to do and nothing more, light and fast with a strongly decoupled architecture.

This software is still a young pup but I have hope to build a reliable system soon. It'll provide all the basics features of a modern system and will be portable on several architectures (goal: x86, x86_64, ARM).

Interoperability: As I try to understand how things are made, and why, I sometimes get outside of strict POSIX or UNIX specifications. I try to be as compliant as possible -- with both NT and UNIX world -- but I authorize myself to take different choices.

Build Instructions

Build a kernel isn't like building a regular application an some extra work might be needed.

The repository (like other from Kora) contains a close to standard Makefile. A configure script is available but only to build from another directory and is not mandatory. This script is only used to search and persist build options.

Here a list of main commands:

make 	        # Build the kernel for the host architecture
make check      # Build and run unit-tests
make coverage   # Run tests and coppute coverage
make install    # Build and update the kernel (not yet)
make install-headers # Copy and erase kernelheaders to $(prefix)/include

# For cross-compile using 'i386-kora-gcc' compiler
make target=i386-pc-kora CROSS=i386-kora- CC=gcc

# Simpler using configure
/path/to/sources/configure --target=i386
make # No need to set target or cross.

Cross-compile

Remember that for a kernel it's almost always a cross-compilation. The most common pitfall is trying to build a i386 kernel on x86_64 host.

By default it use a freestanding environment but the host headers might cause some issues.

On case or errors, it's prefered to use a 'cross-compilor'.

Note: Be sure to have all package installed like binutils, gcc, make and git but also the assembler for some architecture (like nasm for i386 and amd64. For checks, add also valgrind and lcov.

Debug

Here also some variablez accepted by the Makefile for extend configuration:

  • VERBOSE=y: Print compilation commands
  • QUIET=y: Don't print verbose compilation step
  • CFLAGS: Add extra flags to c compiler
  • NODEPS=y: Don't include *.d dependancies files (default for clean or if 'obj' directory doesn't exist yet)
  • NOCOV=y: Remove coverage options for unit-tests
  • kname=?: Change the name of the kernel delivery file

After the build, if you're here to get dirty, think about qemu and gdb for debugging and investigation.

Toolchain

  • Download, look at scripts/toolchain.sh (it takes time, no logs)
  • Rebuild, look at koraos/make/build_toolchain.sh (it takes even more time).

Features

It's not easy to describe kernel features, as most components are required and all kernels provide roughly the same, but differs in quality and behavior for all those features.

Platform

KoraOs'kernel is using virtual memory, with basic page allocation. It use proper recycling of pages, but no swap is available. On Intel architecture, proper CPUs features identification is made but yet poorly used. The kernel is multi-core ready (thread-safe) but still require some work to be used.

The kernel is multi-process, multi-thread but not multi-user yet. Tasks can be created to be either on kernel or in userspace. New task can be created either from clean slate (Window way) or forked (Unix way).

Devices capabilities

The kernel provide numerous types of files and devices: block devices, char devices, pipes, directory (or volume), regular files, video streams (surface, camera or screens), network devices and sockets. (Note that file types are different from UNIX).

All those files and devices can be access through an evolved VFS (virtual file system) with good caching facilities.

The network stack support the protocols: Ethernet, ARP, IPv4, ICMP, DHCP, UDP, TCP, DNS and NTP. The kernel provided a basic DHCP client which allow for automatic IP configuration.

Syscalls

Incomplete section

As the system is not fully functional, most of my tests are done using kernel thread, but here some working system calls -- nothing finalized yet:

/* --------
  Tasks, Process & Sessions
--------- */
long sys_stop(unsigned tid, int status);
long sys_sleep(long timeout);

/* --------
  Input & Output
--------- */
long sys_read(int fd, char *buf, int len);
long sys_write(int fd, const char *buf, int len);
long sys_open(int fd, const char * path, int flags);
long sys_close(int fd);

/* --------
  File system
--------- */
int sys_pipe(int *fds);
int sys_window(int width, int height, unsigned features, unsigned evmask);

/* --------
  Network
--------- */
int sys_socket(int protocol, const char *address, int port);

/* --------
  Memory
--------- */
void *sys_mmap(void *address, size_t length, int fd, off_t off, unsigned flags);
long sys_munmap(void *address, size_t length);
long sys_mprotect(void *address, size_t length, unsigned flags);

/* --------
  Signals
--------- */

/* --------
  System
--------- */
long sys_ginfo(unsigned info, void *buf, int len);
long sys_sinfo(unsigned info, const void *buf, int len);
long sys_log(const char * msg);

Kernel headers

Target bit not current files

  • kernel/types.h: Reference basic types and declare opaque structures.
  • kernel/utils.h: Provide basic runtime like allocation, string and time.
  • kernel/core.h: Provide an access to core structures kSYS & kCPU.
  • kernel/syscalls.h: List of syscall routines as sys_*.
  • kernel/io.h: Interface for ioport, mmio and dma.
  • kernel/{...}.h: Provide API of a kernel core module (tasks, memory, vfs...).
  • kernel/net/{...}.h: API for network protocol (lo, eth, ip4).
  • kernel/bus/{...}.h: API for bus provider (pci or usb).

On the roadmap

I planned on deliver version 0.1 once I can run basics programs logon, desktop, krish, folder and lua and have at least one full-featured writable file-system (like vfat or ext2).

To know more

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].