{"id":21436955,"url":"https://github.com/axfab/kora-kernel","last_synced_at":"2025-07-14T14:33:39.708Z","repository":{"id":74655635,"uuid":"131108860","full_name":"AxFab/kora-kernel","owner":"AxFab","description":"Kernel for my operating system KoraOS","archived":false,"fork":false,"pushed_at":"2024-08-24T15:54:28.000Z","size":2416,"stargazers_count":17,"open_issues_count":7,"forks_count":2,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2024-08-24T17:08:09.613Z","etag":null,"topics":["c","hobby-kernel","hobby-os","kernel","operating-system","os","os-kernel","osdev","x86"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AxFab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-26T06:16:59.000Z","updated_at":"2024-08-24T15:54:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"8bfaef34-6797-4933-886c-4662eb53cf26","html_url":"https://github.com/AxFab/kora-kernel","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxFab%2Fkora-kernel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxFab%2Fkora-kernel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxFab%2Fkora-kernel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxFab%2Fkora-kernel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AxFab","download_url":"https://codeload.github.com/AxFab/kora-kernel/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225981801,"owners_count":17554924,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","hobby-kernel","hobby-os","kernel","operating-system","os","os-kernel","osdev","x86"],"created_at":"2024-11-23T00:16:59.859Z","updated_at":"2024-11-23T00:17:00.433Z","avatar_url":"https://github.com/AxFab.png","language":"C","readme":"# KoraOS\n\nKoraOs is an operating system written and designed from scratch.\nIt's developed as a hobby by an enthusiasts developer.\n\nThis repository contains code for the kernel of the Kora system. If you wish to build the entire system look at [KoraOs](https://github.com/axfab/koraos) repository.\n\nI'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.\n\nThis 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).\n\n\u003e **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.\n\n## Build Instructions\n\nBuild a kernel isn't like building a regular application an some extra work might be needed.\n\nThe repository (like other from Kora) contains a close to standard `Makefile`.\nA `configure` script is available but only to build from another directory and is not mandatory.\nThis script is only used to search and persist build options.\n\n\n\nHere a list of main commands:\n\n```bash\nmake \t        # Build the kernel for the host architecture\nmake check      # Build and run unit-tests\nmake coverage   # Run tests and coppute coverage\nmake install    # Build and update the kernel (not yet)\nmake install-headers # Copy and erase kernelheaders to $(prefix)/include\n\n# For cross-compile using 'i386-kora-gcc' compiler\nmake target=i386-pc-kora CROSS=i386-kora- CC=gcc\n\n# Simpler using configure\n/path/to/sources/configure --target=i386\nmake # No need to set target or cross.\n```\n\n### Cross-compile\n\nRemember that for a kernel __it's almost always a cross-compilation__.\nThe most __common pitfall__ is trying to build a `i386` kernel on `x86_64` host.\n\nBy default it use a __freestanding__ environment but the host headers might cause some issues.\n\nOn case or errors, it's prefered to use a 'cross-compilor'.\n\n\u003e **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`.\n\u003e For checks, add also _valgrind and lcov_.\n\n### Debug\n\nHere also some variablez accepted by the `Makefile` for extend configuration:\n\n - `VERBOSE=y`: Print compilation commands\n - `QUIET=y`: Don't print verbose compilation step\n - `CFLAGS`: Add extra flags to c compiler\n - `NODEPS=y`: Don't include \\*.d dependancies files (default for clean or if 'obj' directory doesn't exist yet)\n - `NOCOV=y`: Remove coverage options for unit-tests\n - `kname=?`: Change the name of the kernel delivery file\n\nAfter the build, if you're here to get dirty, think about `qemu` and `gdb` for debugging and investigation.\n\n\n### Toolchain\n\n - Download, look at `scripts/toolchain.sh` (it takes time, no logs)\n - Rebuild, look at `koraos/make/build_toolchain.sh` (it takes even more time).\n\n\n## Features\n\nIt'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.\n\n### Platform\n\nKoraOs'kernel is using virtual memory, with basic page allocation. It use proper recycling of pages, but no swap is available.\nOn Intel architecture, proper CPUs features identification is made but yet poorly used.\nThe kernel is multi-core ready (thread-safe) but still require some work to be used.\n\nThe 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).\n\n### Devices capabilities\n\nThe 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).\n\nAll those files and devices can be access through an evolved VFS (virtual file system) with good caching facilities.\n\nThe network stack support the protocols: Ethernet, ARP, IPv4, ICMP, DHCP, UDP, ~~TCP, DNS and NTP~~.\nThe kernel provided a basic DHCP client which allow for automatic IP configuration.\n\n\n### Syscalls\n\n\u003e _Incomplete section_\n\nAs the system is not fully functional, most of my tests are done using kernel thread, but here some working system calls -- nothing finalized yet:\n\n```c\n/* --------\n  Tasks, Process \u0026 Sessions\n--------- */\nlong sys_stop(unsigned tid, int status);\nlong sys_sleep(long timeout);\n\n/* --------\n  Input \u0026 Output\n--------- */\nlong sys_read(int fd, char *buf, int len);\nlong sys_write(int fd, const char *buf, int len);\nlong sys_open(int fd, const char * path, int flags);\nlong sys_close(int fd);\n\n/* --------\n  File system\n--------- */\nint sys_pipe(int *fds);\nint sys_window(int width, int height, unsigned features, unsigned evmask);\n\n/* --------\n  Network\n--------- */\nint sys_socket(int protocol, const char *address, int port);\n\n/* --------\n  Memory\n--------- */\nvoid *sys_mmap(void *address, size_t length, int fd, off_t off, unsigned flags);\nlong sys_munmap(void *address, size_t length);\nlong sys_mprotect(void *address, size_t length, unsigned flags);\n\n/* --------\n  Signals\n--------- */\n\n/* --------\n  System\n--------- */\nlong sys_ginfo(unsigned info, void *buf, int len);\nlong sys_sinfo(unsigned info, const void *buf, int len);\nlong sys_log(const char * msg);\n```\n\n## Kernel headers\n\n\u003e _Target bit not current files_\n\n - `kernel/types.h`: Reference basic types and declare opaque structures.\n - `kernel/utils.h`: Provide basic runtime like allocation, string and time.\n - `kernel/core.h`: Provide an access to core structures `kSYS` \u0026 `kCPU`.\n - `kernel/syscalls.h`: List of syscall routines as `sys_*`.\n - `kernel/io.h`: Interface for ioport, mmio and dma.\n - `kernel/{...}.h`: Provide API of a kernel core module (tasks, memory, vfs...).\n - `kernel/net/{...}.h`: API for network protocol (lo, eth, ip4).\n - `kernel/bus/{...}.h`: API for bus provider (pci or usb).\n\n## On the roadmap\n\n 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).\n\n\n## To know more\n\n - [Github wiki](https://github.com/axfab/koraos/wiki) _Still far from ready yet!_\n - Join the [Discord](https://discord.gg/hdvV4zcgxk) channel\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxfab%2Fkora-kernel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxfab%2Fkora-kernel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxfab%2Fkora-kernel/lists"}