- C 93.2%
- Python 3.4%
- Makefile 3.1%
- Assembly 0.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
All checks were successful
Build disc (ISO) and disk (IMG) artifacts / build (push) Successful in 38s
- update AI disclaimer to clarify on a few things |
||
| .forgejo/workflows | ||
| etc | ||
| extras | ||
| fonts | ||
| iso/boot/grub | ||
| res | ||
| scripts | ||
| src | ||
| tests | ||
| .gitignore | ||
| LICENSE | ||
| LICENSE.gpl3 | ||
| 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 actual daily use.
This repository is just an excuse for me to learn about OS development, as well as to write something that can run on older, lower-end hardware. Don't expect anything groundbreaking here.
Compatibility
SystemK is built for the i386 architecture and should run on any x86-compatible CPU. It is tested primarily in QEMU and Bochs, but it should also work on real hardware.
Requirements
- At least Pentium-class CPU (i386 or later).
- i386 and i486 are not possible at the moment due to SystemK's reliance on GRUB as a bootloader.
- A graphics card that supports either VGA or a framebuffer (VESA BIOS Extensions).
- Framebuffer support requires at least a 640x480x8 display mode, but higher resolutions are supported as well.
- 1024x768x32 is the default resolution for the framebuffer build, and a generic 1280x720 widescreen build is also available (continue below for the "Build instructions" section).
- At least 8MB of RAM
- Expect this to rise in the future as more features are added, general recommendation is at least 32MB of RAM
- A bootable CD-ROM drive or USB drive (for real hardware).
- For more information on how to properly burn the ISO image, see the "Build instructions" section below.
- Any keyboard should do. PS/2 and USB mice are also supported.
Tested hardware
- QEMU version 10.0.11 (default CPU, default video, 16MB RAM) (works perfectly)
- Bochs 3.0 (tested with default settings, CPU: Pentium I) (works perfectly)
- Located in
extrasis a sample Bochs configuration file that can be used to test SystemK in Bochs. - For currently unknown reasons, uptime is not accurate in Bochs, but everything else works perfectly.
- Located in
- Dell Latitude D520 (Core 2 Duo T7200, 4GB RAM, GMA 950) (works perfectly)
Roadmap
Stuff currently done:
- Kernel boots on virtual and real hardware
- Basic memory management with paging and heap allocation
- Ramdisk and temporary storage support
- FHS root filesystem layout (
/bin,/boot,/dev,/etc,/home,/lib,/media,/mnt,/proc,/tmp,/usr,/var) - A bash-inspired shell with command history, tab completion, environment variables (
export,env), and dynamic$PATHbinary search - Standalone
/binuserland executables (clear,uptime,date,stat,rand,hex,beep) - Dynamic device driver framework with runtime relocatable ELF module loading (
.ko) - GNU-ish command-line utilities (ls, cat, echo, etc.) and a text editor
- VGA and framebuffer graphics support
- Includes standard (1024x768) and widescreen (1280x720) modes
- Boot splash screen for framebuffer displays
- Keyboard support and PS/2 & USB HID mouse support
- Visual framebuffer arrow cursor with background save/restore
- Click-and-drag text selection with visual inversion highlighting
- Terminal clipboard buffer with copy (
Ctrl+Shift+C) and paste (Ctrl+Shift+V/ middle mouse click)
- Sound support
- Currently limited to PC speaker beeps, AC'97 and SB16 is planned later
- Serial console support (just for debugging, not for user input)
- Basic timer support and preemptive multitasking scheduling
- CPUID support (for CPU feature detection)
- Storage device support (IDE, AHCI SATA, and USB drives) with MBR and GPT partitioning
- Virtual File System (VFS) with FAT32 read and write support
- Process control and background jobs (Ctrl+C, Ctrl+Z, background execution)
- Executable binary loading (ELF)
- ACPI and PCI hardware detection with device name lookup
Stuff planned:
- Sound card support for AC'97 and Sound Blaster 16 (planned for 0.0.11)
soundcommand for configuring sound settings- Audio file playback (
mplayfor MIDI and WAV) - Tracker music playback (
trakkerfor MOD, XM, S3M, IT)
- Implement a basic windowing system (K Windowing System)
- Networking (will likely be limited to QEMU's rtl8139 or e1000 for simplicity)
- A
curl-like orwget-like command for downloading files over the internet pingcommand for testing network connectivitysshcommand for connecting to remote serversftpcommand for transferring files over the internetscpcommand for securely copying files over the internet
- A
- ...and more?
More stuff will probably be added to the roadmap when it comes to mind. If you have any suggestions, feel free to open an issue.
Known issues
- Uptime calculation is botched in Bochs despite it working fine in QEMU and on real hardware, will look into later.
Wontfix
- UEFI support
- I am currently prioritising the functionality and usability of SystemK, so UEFI support is essentially being shelved for now.
- Support for i386 and i486 CPUs
- SystemK relies on GRUB as a bootloader, which requires a Pentium-class CPU or later. This means that i386 and i486 CPUs are not supported at the moment.
- I may look into adding support for these CPUs in the future, but it is not a priority at the moment.
- Any bugs from VGA builds
- These builds are deprecated and will eventually be removed entirely. No support can be expected, please use the framebuffer builds instead.
Build instructions
These instructions currently assume a Debian-based Linux distribution. Adjust package names and commands for other distributions as needed.
Additionally, no Windows support is provided at this time for building SystemK. If you wish to build it on Windows, you must use a virtual machine or WSL2.
Firstly, install the required dependencies:
sudo apt update
sudo apt install build-essential nasm make qemu-system-x86 xorriso grub-pc-bin dosfstools mtools
After that, you can then clone the repository:
git clone https://git.thesillysociety.net/kooper/systemk.git
cd systemk
The following generic make targets are available (there are more make targets in general however most people do not need to care about them):
Please note that VGA builds have been deprecated as of prerelease 0.0.9, and will eventually be removed entirely.
Additionally, to build SystemK with a different resolution (outside of the defaults) please see the "Make variables" section below.
make all- builds both the standard and widescreen bootable ISO and FAT32 disk imagesmake iso- builds the standard framebuffer ISO image (1024x768)make widescreen(ormake iso-widescreen) - builds the widescreen framebuffer ISO image (1280x720)make iso-vga(ormake vga) - builds the legacy VGA fallback ISO imagemake disk- builds a bootable partitioned MBR disk image with FAT32 containing SystemK (1024x768 framebuffer)make disk-widescreen- builds a bootable FAT32 disk image (1280x720 widescreen framebuffer)make disk-vga- builds a bootable FAT32 disk image (VGA fallback)make host-tests- runs a comprehensive host unit and subsystem test suitemake test-disk- tests booting the FAT32 disk image in QEMU via serialmake clean- cleans the build directory
The following make variables are available for customizing the build:
BUILD_TYPE- build profile to use. Options includestaging(default),release,staging+debug, andrelease+debug. Output files will include the build type in their filenames (e.g.build/systemk-staging-fb.iso,build/systemk-staging-fb.img). Builds with+debugenable debug logging and skip the boot splash screen.DISK_SIZE_MB- total size of the bootable FAT32 disk image in MiB (defaults to64)DISK_LABEL- FAT32 volume label for the boot partition (defaults toSYSTEMK)FRAMEBUFFER_WIDTH- the width of the framebuffer in pixels (at least 640, ideally a multiple of 8, defaults to 1024)FRAMEBUFFER_HEIGHT- the height of the framebuffer in pixels (at least 480, ideally a multiple of 16, defaults to 768)FRAMEBUFFER_BPP- the bits per pixel of the framebuffer (8, 16, 24, or 32, defaults to 32)MEMORY- guest memory size formake runtargets (defaults to32M; numbers without a unit suffix default to KB, e.g.MEMORY=8192allocates 8192 KB)CPU- QEMU CPU model formake runtargets (e.g.CPU=pentium,CPU=486)
Now, you should have bootable ISO images (e.g. build/systemk-staging-fb.iso) or bootable FAT32 disk images (e.g. build/systemk-staging-fb.img) in the build/ directory. You can run them in QEMU or Bochs, or burn them to a CD, USB drive, or hard drive/SSD to run on real hardware.
Running SystemK in QEMU
Instructions are for QEMU only.
TODO:
- Add Bochs instructions
- Add instructions for other emulators (e.g. VirtualBox, VMware, etc.)
# Framebuffered build from ISO (standard 1024x768)
make run
# Framebuffered build from FAT32 hard disk image
make run-disk
# Framebuffered build booting from emulated USB flash drive (EHCI)
make run-usb
# Headless runs (serial output directed to terminal)
make run-headless
make run-headless-disk
make run-headless-usb
Running SystemK on real hardware
- Write the bootable image to a USB flash drive, hard drive, SSD, or CD/DVD:
- For USB flash drives and hard drives/SSDs, write the
.img(or.isoin "DD mode") directly to the target device.
- For USB flash drives and hard drives/SSDs, write the
- Boot from the USB drive or hard disk and enjoy SystemK!
- SystemK supports booting from BIOS MBR partitioned disks and USB drives formatted with FAT32.
- SystemK currently targets legacy BIOS booting. Enable "Legacy Boot" or "CSM" in your UEFI motherboard settings.
# For USB flash drives, hard drives, or SSDs, replace /dev/sdX with your destination block device:
sudo dd if=build/systemk-staging.img of=/dev/sdX bs=4M status=progress && sync
# For CD/DVD:
sudo xorriso -as cdrecord -v dev=/dev/srX -eject build/systemk-staging.iso
Contributing
If you want to contribute, please follow these guidelines:
- Linux only, since we depend on some toolchains that Windows doesn't provide as easily.
- When creating issues or PRs, include steps to reproduce, expected behavior, and actual behavior.
- AI usage is not inherently forbidden, but do not use it to blindly generate code or documentation. Pull requests which are suspected of being "vibecoded" (i.e. majority generated by AI with a lack of understanding) will be closed without review. Use AI to assist, but not to replace your own knowledge and effort.
Credits
Credits go to:
- OSDev.org for their invaluable resources on OS development
- FreeDesktop.org Specifications for their detail on the Unix(-like) filesystem hierarchy
The following outside files are included in this repository
fonts/bizcat.psf: The original 8x16 bitmap font used by SystemK: https://robey.lag.net/2020/02/09/bizcat-bitmap-font.html- This font is licensed under the Creative Commons By 4.0 International License.
fonts/zap-ext-light16.psf: The current 8x16 bitmap font used by SystemK: https://www.zap.org.au/projects/console-fonts-zap/- This font is licensed under the GNU General Public License v3.0.
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
This project is licensed under the MIT License. For questions or contributions, please open an issue or submit a pull request.
The source code of SystemK contains a snapshot of the PCI ID Repository database, which is licensed here under GNU GPL v3.0 (said repository accepts both GPL >= v2.0 and BSD-3-Clause). The PCI ID Repository database is maintained by Martin Mares and is available at https://pci-ids.ucw.cz/.