- C 91.8%
- Logos 2.6%
- Assembly 2.5%
- Python 1%
- Makefile 1%
- Other 1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
All checks were successful
Build disc (ISO) and disk (IMG) artifacts / build (push) Successful in 1m2s
|
||
| .forgejo/workflows | ||
| etc | ||
| extras | ||
| fonts | ||
| iso/boot/grub | ||
| patches | ||
| res | ||
| scripts | ||
| src | ||
| tests | ||
| .gitignore | ||
| .gitmodules | ||
| LICENSE | ||
| LICENSE.bizcat | ||
| LICENSE.impulse-tracker | ||
| LICENSE.libmodplug | ||
| LICENSE.libxmp | ||
| LICENSE.musl | ||
| LICENSE.openmpt | ||
| LICENSE.pciids | ||
| LICENSE.tetris | ||
| LICENSE.tinycc | ||
| LICENSE.zapfont | ||
| linker.ld | ||
| Makefile | ||
| README.md | ||
| TODO | ||
SystemK
Just a heads up:
Everything in this repository outside of the actual source code is a work in progress. The README, roadmap, and other documentation will be revised. Eventually.
SystemK is a hobby Unix-like operating system implemented in C. It is not intended for daily use, just an excuse to learn OS development and write something lightweight that runs on older, lower-end hardware.
Compatibility
SystemK currently targets 32-bit x86 (Pentium-class or newer). It is tested primarily in QEMU and Bochs, and also works on real hardware.
Requirements
- Pentium-class x86 CPU or newer
- 16MB of RAM minimum (32MB recommended)
- VESA framebuffer graphics card (640x480x8 minimum; defaults to 1024x768x32, with 1280x720 widescreen also available)
- Custom framebuffer modes can be built with
make FRAMEBUFFER_WIDTH=WIDTH FRAMEBUFFER_HEIGHT=HEIGHT FRAMEBUFFER_BPP=BPP - Support for changing the framebuffer mode at runtime is planned, but not yet implemented
- Custom framebuffer modes can be built with
- Bootable CD-ROM, USB drive, or MBR disk (for real hardware)
- Keyboard (PS/2 and USB mice also supported)
Tested hardware
- QEMU 10.0.11 (default CPU/video, 32MB RAM) (no errors to report)
- Bochs 3.0 (Pentium I, sample config in
extras/) (uptimecalculation is bugged) - Dell Latitude D520 (Core 2 Duo T7200, 4GB RAM, GMA 950) (no errors to report)
Roadmap
Stuff done:
- Paging, heap allocation, preemptive multitasking, ELF execution, and loadable
.kodriver modules - Multi-user accounts, groups, login (
login,su,passwd), and POSIX file permissions (chmod,chown) - On-system C toolchain with TinyCC (
tcc) and themuslC/POSIX standard library (/usr/include,/usr/lib) - FHS root filesystem layout with VFS, hard/symbolic links (
ln), and full FAT32 read/write + LFN support - Live-disc (ISO) root filesystem in a ramdisk that grows and shrinks on demand
- Storage drivers for IDE, AHCI SATA, and USB mass storage (MBR and GPT partitions)
- Bash-inspired shell (
/bin/shell) with history, Tab completion, autosuggestions, job control (Ctrl+C,Ctrl+Z,fg/bg), and$PATH - POSIX/BSD-style utilities (
ls,cp,mv,cat,dd,stat,uname,whoami,md5sum,shasum, etc.) and theedittext editor - Framebuffer console (1024x768 and 1280x720) with boot splash, PS/2 & USB mouse cursor, drag selection, and clipboard copy/paste
- Custom framebuffer modes (i.e. anything above 640x480) are also possible (see "Build instructions" below)
- Audio subsystem supporting AC'97, Sound Blaster 16, and PC speaker, with
soundconfiguration andjukeboxplayback (WAV, MIDI, MOD, XM, S3M, IT) - CPUID, ACPI, and PCI hardware detection with vendor/device lookup
Stuff planned:
- Support for changing the framebuffer mode at runtime
- Basic windowing system (K Windowing System)
- Networking (targeting
rtl8139ande1000initially), along withping,ssh,ftp,scp, and acurl/wget-like downloader - ...and more?
Suggestions are welcome via issues.
Known issues
- Uptime calculation is inaccurate in Bochs (works fine in QEMU and on real hardware).
Wontfix
- UEFI support: Shelved for now since I want to focus on the OS in general first. For now you can try using Legacy/CSM mode if your firmware supports it.
- i386 and i486 CPUs: SystemK uses GRUB, which requires a Pentium-class CPU or newer.
- VGA build bugs: Legacy VGA text-mode builds are deprecated and will eventually be removed; use framebuffer builds instead.
Build instructions
Assumes a Debian-based Linux distribution. Building on Windows requires WSL2 or a Linux VM.
Install dependencies and clone the repository:
sudo apt update
sudo apt install build-essential nasm make qemu-system-x86 xorriso grub-pc-bin dosfstools mtools
git clone https://git.thesillysociety.net/kooper/systemk.git
cd systemk
Common make targets:
*-widescreenbuilds default to 1280x720.For custom framebuffer modes, use
make FRAMEBUFFER_WIDTH=WIDTH FRAMEBUFFER_HEIGHT=HEIGHT
make all- builds standard and widescreen ISO and FAT32 disk imagesmake iso/make widescreen- builds an ISO imagemake disk/make disk-widescreen- builds a bootable MBR/FAT32 disk image (1024x768 or 1280x720)make iso-vga/make disk-vga- builds deprecated legacy VGA fallback images- This option will be removed at a later date.
make host-tests/make test-disk- runs host unit tests or QEMU disk boot testmake clean- cleans the build directory
Customizable make variables:
BUILD_TYPE-staging(default),release,staging+debug, orrelease+debug(+debugenables debug tools/logging and skips the splash screen)DISK_SIZE_MB/DISK_LABEL- FAT32 disk image size in MiB (default64) and label (defaultSYSTEMK)FRAMEBUFFER_WIDTH- width of the framebuffer in pixels (min640, default1024)FRAMEBUFFER_HEIGHT- height of the framebuffer in pixels (min480, default768)FRAMEBUFFER_BPP- bits per pixel (min16, default32)MEMORY- QEMU RAM size formake run*targets (default32M)RAMDISK_MAX_PERCENT- largest share of RAM (1-90, default50) the live-disc ramdisk may use (e.g. 8MB on a 16MB machine)CPU- QEMU CPU model formake run*targets (e.g.CPU=pentium,CPU=pentium3)AUDIO- QEMU audio device:ac97,sb16,pcspkr(default),hda,noneNET- QEMU network card:rtl8139,e1000,virtio,ne2k_pci,pcnet,none(default)
Built images are placed in build/ (e.g. build/systemk-staging.iso and build/systemk-staging.img).
Running in QEMU
make run # Boot ISO
make run-disk # Boot FAT32 image as hard drive
make run-usb # Boot FAT32 image as USB drive
make run-headless # Headless serial run (also run-headless-disk / run-headless-usb)
Running on real hardware
Write the disk image or ISO to your target medium and boot via BIOS (or UEFI Legacy/CSM mode):
# USB flash drive, HDD, or SSD (replace /dev/sdX):
sudo dd if=build/systemk-staging.img of=/dev/sdX bs=4M status=progress && sync
# CD/DVD:
sudo xorriso -as cdrecord -v dev=/dev/srX -eject build/systemk-staging.iso
Contributing
- Linux host environment required for the build toolchain.
- Include steps to reproduce, expected behavior, and actual behavior in issues and PRs.
- AI may be used to assist, not to blindly generate code or documentation. PRs suspected of being "vibecoded" will be closed without review.
Credits
- OSDev.org for OS development resources
- FreeDesktop.org for Unix filesystem hierarchy specifications
- musl libc for the C and POSIX standard library (
src/musl) - TinyCC (TCC) for the C compiler (
/bin/tcc,src/tinycc) - The PCI ID Repository (maintained by Martin Mareš) for the PCI vendor/device database (
src/acpi/pci.ids) - OpenMPT, libmodplug, libxmp, Impulse Tracker, and ProTracker for tracker replay algorithms, specifications, and period tables in
jukebox - NetBSD for
ln - Zap Console Fonts (
fonts/zap-ext-light16.psf) and Bizcat (fonts/bizcat.psf) for the 8x16 console bitmap fonts
AI Disclaimer
This project was partially assisted by AI, more specifically Google Gemini.
To be more explicit, AI was used in this repository to help with creating test code to verify that changes made to SystemK were not only functional, but did not cause any regressions.
To be clear:
- Any code assisted with AI in this repository has been reviewed manually by a human.
- This repository does not contain any AI "generated" code (that is to say, no code given by an LLM has been copied line-for-line).
- The rest of the SystemK repository, including the main codebase (kernel, userland, etc), do not and will not contain any AI generated or assisted code.
License
SystemK is licensed under the MIT License. Bundled software and assets in this repository are licensed as follows:
MIT License:
- SystemK: LICENSE
- musl libc (
src/musl): LICENSE.musl
Other licenses:
- TinyCC (
src/tinycc): GNU LGPL v2.1 (LICENSE.tinycc) - Sam Tay's Tetris (
src/demos/tetris): BSD-3-Clause (LICENSE.tetris) - PCI ID Repository (
src/acpi/pci.ids): BSD-3-Clause (LICENSE.pciids; also offered upstream under GNU GPL v2.0+) - Zap Console Fonts (
fonts/zap-ext-light16.psf): GNU GPL v3.0 (LICENSE.zapfont) - Bizcat (
fonts/bizcat.psf): Creative Commons Attribution 4.0 (LICENSE.bizcat)
Additionally, the following software are not bundled but were used in the development of SystemK and are licensed as follows:
- OpenMPT: BSD-3-Clause (LICENSE.openmpt)
- Impulse Tracker: BSD-3-Clause (LICENSE.impulse-tracker)
- libxmp: MIT License (LICENSE.libxmp)
- libmodplug: Public Domain (LICENSE.libmodplug)
Sounds
The following sounds (in src/sound/samples/) are bundled with SystemK:
- 4chnls.xm: "Acid Soul", unknown domain/license
- boh.it: "ItSoundsFine", unknown domain/license
- extensia.s3m: Samuli Laine, unknown domain/license
- addiction.mod: Jogeir Liljedahl, unknown domain/license
- Taken from https://modarchive.org/module.php?167100