351 Commits

Author SHA1 Message Date
Jannis Heydemann
59016e3cb8 started dev on TicTacToe 2026-05-13 14:05:48 +02:00
Lluciocc
57bc840bcb Clean up README.md by removing sections 2026-05-13 09:54:46 +02:00
Lluciocc
5d0e828b41 asking testing platform and env in the PR template 2026-05-13 08:36:30 +02:00
Lluciocc
c66bfa62cf Merge pull request #36 from zeyadhost/main
Add du command for disk usage reporting
2026-05-12 23:07:45 +02:00
Lluciocc
4b169b92de Update headers 2026-05-12 23:01:43 +02:00
zeyad
e75952e510 fix(cli): correct du usage format and replace -h with -H 2026-05-12 20:58:53 +00:00
boreddevnl
f6141dfcaf Merge branch 'main' of https://github.com/BoredDevNL/BoredOS 2026-05-12 22:48:59 +02:00
boreddevnl
e813a6cdfd docs: add section for issue tags in bug report and feature request templates 2026-05-12 22:48:49 +02:00
zeyad
a6118e8d21 feat(cli): add du command for disk usage reporting 2026-05-12 20:33:09 +00:00
Chris
1ccc86ea41 doc: Add requirement for comments in PR template 2026-05-12 20:06:50 +02:00
Lluciocc
642dc7f8c9 Update toolchain.md with qemu-img PATH instruction 2026-05-12 19:28:28 +02:00
boreddevnl
43a62b025d Merge branch 'main' of https://github.com/BoredDevNL/BoredOS 2026-05-12 19:18:06 +02:00
boreddevnl
52b6532700 brand: add orbital.png
Co-Authored-By: Target <71287126+toiletalphamale@users.noreply.github.com>
2026-05-12 19:18:04 +02:00
Lluciocc
1655f1cf22 Add 'git' to required development tools installation 2026-05-12 19:17:00 +02:00
Lluciocc
5e3ba70730 Revise Windows toolchain installation instructions 2026-05-12 19:13:29 +02:00
boreddevnl
8d4ffd8a09 kernel: prevent infinite loop in process termination 2026-05-12 19:11:17 +02:00
Lluciocc
d007600e30 PR #34 from BoredDevNL: Implement df command and statfs support
Implement df command and statfs support
2026-05-12 18:08:54 +02:00
boreddevnl
a7cfb5d22d fix: stop format real human 2026-05-12 18:06:35 +02:00
boreddevnl
93811816fd Implement df command and statfs support 2026-05-12 17:06:47 +02:00
boreddevnl
13eaa7589d brand: remove 2 old wallpapers 2026-05-12 15:47:02 +02:00
boreddevnl
24b2754acb brand: Add The-Cat-Of-Destiny.png
Co-Authored-By: artemix1508 <273844106+artemix1508@users.noreply.github.com>
2026-05-12 15:21:08 +02:00
boreddevnl
a0e8521cf0 brand: add adrian.jpg
Co-Authored-By: QWR <196812618+qwroffc@users.noreply.github.com>
2026-05-12 15:19:28 +02:00
boreddevnl
16eedb752f doc: update contributors list 2026-05-12 14:30:28 +02:00
boreddevnl
6cf10fdbd3 brand: added squiggly.png
Co-Authored-By: pixelyblah <221841823+pixelyblah@users.noreply.github.com>
2026-05-12 14:26:43 +02:00
boreddevnl
7eaa9d278a brand: added Web-Of-Connectivity.png
Co-Authored-By: artemix1508 <273844106+artemix1508@users.noreply.github.com>
2026-05-12 14:26:08 +02:00
boreddevnl
45f26db141 brand: aded flowerdark/light.jpg
Co-Authored-By: QWR <196812618+qwroffc@users.noreply.github.com>
2026-05-12 14:25:07 +02:00
boreddevnl
801278cf73 feat: scrollable wallpaper page 2026-05-12 14:24:09 +02:00
boreddevnl
329fcf3bc0 doc: fix broken contributor list README.md 2026-05-12 11:37:52 +02:00
Lluciocc
04794bb986 doc: Update toochain steps on windows (#33)
* Create pull_request_template.md

Add a pull request template for better PR submissions.

* Document toolchain installation steps for Windows

* Add Table of Contents to toolchain.md
2026-05-12 10:01:47 +02:00
Myles "Mellurboo" Wilson
f171ff7278 pr: Standardize string functions for freestanding env #29 2026-05-11 22:10:58 +02:00
Lluciocc
51900ca0a7 Update syscalls id 2026-05-11 21:23:28 +02:00
boreddevnl
4141766c4f doc: Update contributors block README.md 2026-05-11 20:57:00 +02:00
boreddevnl
640c548a4b brand: Add boredshadow.png - Created by naplon74
Co-Authored-By: Naplon <94738563+naplon74@users.noreply.github.com>
2026-05-11 20:55:46 +02:00
Chris
0b31c5bb64 brand: Remove old (kind of ugly) wallpaper 2026-05-11 20:47:46 +02:00
Lluciocc
912bd4a20e pr: Add ps && hexdump (#26)
* Adding hexdump and ps.c

* Add hexdump and ps command descriptions to help

* Update with missing ;
2026-05-11 20:28:16 +02:00
Lluciocc
2bb15d517f pr: Create pull_request_template.md (#27)
Add a pull request template for better PR submissions.
2026-05-11 19:56:45 +02:00
boreddevnl
d45a19aac1 docs(appdev): update best practices for loop throttling 2026-05-11 19:52:48 +02:00
boreddevnl
a3a4494265 perf(userland): replace sys_yield with sleep for WAY better idle efficiency 2026-05-11 19:52:43 +02:00
boreddevnl
78a9afebf4 perf(terminal): optimize string rendering via color buffering 2026-05-11 19:52:18 +02:00
boreddevnl
309f68df48 feat(taskman): implement scrollbar and UI optimizations 2026-05-11 19:52:07 +02:00
boreddevnl
d3a353c9f8 legal: Add license header for zeyadhost 2026-05-11 19:38:50 +02:00
zeyad
ed5f10eb7d pr: Add lslbk disk listing command (#24)
* add lsblk disk listing command

* fix lsblk placeholder labels

* fix fat32 volume labels

* doc lsblk command

* add lsblk to help

* doc lsblk usage
2026-05-11 18:59:31 +02:00
boreddevnl
a01a34b7f2 dep: Depricate man.c 2026-05-11 18:54:34 +02:00
Lluciocc
e48f3674c7 pr: Update part of the docs (#17)
* Add cursor rendering section to window manager documentation

* Add cursor scale system commands to syscalls.md

* Add settings documentation for BoredOS

* Document cross-compiler build instructions for Linux

* Create README.md for BoredOS architecture documentation

* Update Architecture Overview link in README

* Reorganize Color Settings section in settings.md
2026-05-11 00:12:54 +02:00
boreddevnl
8a4ddb9b1e doc: add zeyadhost to README.md contributors list 2026-05-10 23:21:36 +02:00
boreddevnl
4e91a5619e Merge branch 'main' of https://github.com/BoredDevNL/BoredOS 2026-05-10 23:15:41 +02:00
boreddevnl
3691a2e1d6 doc: updated README feature set 2026-05-10 23:15:37 +02:00
zeyad
6993041a96 pr: Fix process slot exhaustion in process lifecycle (#16)
* fix process slot reuse after exit

* fix terminal tty reuse after close
2026-05-10 23:01:12 +02:00
boreddevnl
10018b62a3 Merge branch 'main' of https://github.com/BoredDevNL/BoredOS 2026-05-10 21:56:30 +02:00
boreddevnl
6784b2139f fix(net): improve network stability and resource management 2026-05-10 21:56:23 +02:00
boreddevnl
2d40ca30af fix(wm): implement window ownership and thread-safe glyph caching 2026-05-10 21:56:11 +02:00
boreddevnl
f5a79e451a feat(mem): harden slab allocator and fix paging race conditions 2026-05-10 21:55:50 +02:00
Myles "Mellurboo" Wilson
b85bb900e6 pr: ACPI Power Shutdown Implemented (#14)
* Flush PS/2 Devices on boot to avoid Locking dependent on the out buffer on real hardware / emulated PS2 over USB

Removed Slow and Unnessisarty flipping causing kconsole write slowdowns consequently speeding up the boot process

* sod wc

* ignoring dynamically created objects, added make run rule which will automatically detect the platform and then use the correct platform rule

* ACPI Power Shutdown
2026-05-10 21:16:54 +02:00
boreddevnl
77744464e3 legal: Remove redundant usage policy and boot prompt 2026-05-10 20:15:53 +02:00
boreddevnl
a452e5bee7 Merge branch 'main' of https://github.com/BoredDevNL/BoredOS 2026-05-10 19:33:05 +02:00
boreddevnl
9683971b0b doc: Update contributors block in README.md 2026-05-10 19:32:56 +02:00
Chris
8bbcea7d3e doc: Add feature request template for Issues 2026-05-10 17:44:04 +02:00
Chris
19bbd1e9bb doc: Add bug report template for Issues 2026-05-10 17:41:31 +02:00
boreddevnl
2bae90f797 doc: adjust usage.md for updated Makefile 2026-05-10 17:29:34 +02:00
boreddevnl
2be30b3056 doc: Add Discord invite to README.md 2026-05-10 17:29:19 +02:00
boreddevnl
a508da4ac8 test: add extra line to test webhook 2026-05-10 16:50:50 +02:00
boreddevnl
2d6c8a2947 Merge branch 'main' of https://github.com/BoredDevNL/BoredOS 2026-05-10 16:47:04 +02:00
boreddevnl
0a8a5877db doc: remove emoji from features section in README.md (webhook test lol) 2026-05-10 16:46:57 +02:00
Myles "Mellurboo" Wilson
6fa2aa453b pr: .gitignore changes & make run generic rule with platform detection (#13)
* Flush PS/2 Devices on boot to avoid Locking dependent on the out buffer on real hardware / emulated PS2 over USB

Removed Slow and Unnessisarty flipping causing kconsole write slowdowns consequently speeding up the boot process

* sod wc

* ignoring dynamically created objects, added make run rule which will automatically detect the platform and then use the correct platform rule
2026-05-10 16:36:34 +02:00
boreddevnl
066f6740e5 art: Add Bored Bird
Co-authored-by: Artemix <artemix1508@users.noreply.github.com>
2026-05-10 11:30:12 +02:00
Myles "Mellurboo" Wilson
fdcfd48a24 pr: Removed Unnessisary Flipping on kconsole leading to Vastly Faster Boot Times & PS/2 Hardware Correctness (#12)
* Flush PS/2 Devices on boot to avoid Locking dependent on the out buffer on real hardware / emulated PS2 over USB

Removed Slow and Unnessisarty flipping causing kconsole write slowdowns consequently speeding up the boot process

* sod wc
2026-05-10 11:22:18 +02:00
boreddevnl
e9888f26b1 feat: add datetime and cpu list to sysfetch 2026-05-09 23:54:18 +02:00
boreddevnl
97c5c3ffdf feat: add datetime to procfs 2026-05-09 23:53:50 +02:00
boreddevnl
e80f4ba172 doc: prettier README 2026-05-09 23:43:32 +02:00
boreddevnl
3d53e45e20 fix: doom inputs 2026-05-09 23:14:19 +02:00
boreddevnl
3bb90a8b7f fix(input): refine legacy key mapping and ensure codepoints on release 2026-05-09 22:30:53 +02:00
boreddevnl
963e68162b mv: rename night_mountain.jpg --> volcano.jpg 2026-05-09 22:20:13 +02:00
boreddevnl
5a7ef42b4a brand: replace old icon 2026-05-09 22:19:51 +02:00
boreddevnl
85d06482fc feat: keymap_legacy_key support in doomgeneric 2026-05-09 22:19:28 +02:00
boreddevnl
0ff2f2b07e feat: support multiple image formats in wallpaper chooser 2026-05-09 22:18:51 +02:00
boreddevnl
4ed39f6a0c fix: slow code from llucioc >:( 2026-05-09 22:08:05 +02:00
boreddevnl
f1cee25e62 Merge branch 'main' of https://github.com/BoredDevNL/BoredOS 2026-05-09 21:55:51 +02:00
boreddevnl
0557174a67 feat: Add seperate runtime parameters for run-hd for windows and linux 2026-05-09 21:55:36 +02:00
Lluciocc
cfae88f9f5 PR: Fixing settings && Adding a option for cursor scale (#11)
* Adding slider widget

* feat: Add mouse cursor scale commands and settings improvement speed

* Correct wallpaper scanning and thumbnail loading
2026-05-09 21:53:07 +02:00
boreddevnl
36ed0d4a9e fix: ensure partitions are recognized after fdisk and fix AHCI slot bug 2026-05-09 21:51:28 +02:00
boreddevnl
82226ddbe5 actions: auto run on pushed commit 2026-05-09 21:37:46 +02:00
boreddevnl
4f3ac28401 brand: change boot splash logo 2026-05-09 21:36:31 +02:00
boreddevnl
fbd66a804e lib: Copy stb_image into TCC lib 2026-05-09 19:29:18 +02:00
boreddevnl
a47c4aa841 Add co-author credit for art
Co-authored-by: Artemix <artemix1508@users.noreply.github.com>
2026-05-09 19:03:51 +02:00
boreddevnl
1e91395eaa build: modernize initrd structure and asset management 2026-05-09 18:54:51 +02:00
boreddevnl
5c2347d5d1 ui: replace legacy ASCII logos with graphical assets 2026-05-09 18:54:42 +02:00
boreddevnl
2784c36e84 wm: add support for graphical logo 2026-05-09 18:54:20 +02:00
boreddevnl
8fcf0f67a4 brand: New boredOS ascii art 2026-05-09 18:52:20 +02:00
boreddevnl
8ecc3e7b0c brand: New branding and wallpaper 2026-05-09 18:51:55 +02:00
boreddevnl
e639c6884c doc: new icons, contributor and README refresh 2026-05-09 18:51:27 +02:00
boreddevnl
30e8ed22a0 doc: Remove outdated header. 2026-05-09 17:27:55 +02:00
boreddevnl
ff9be87c5d perf: optimize graphics rendering and implement caching 2026-05-09 17:27:39 +02:00
boreddevnl
eb05d62891 feat(viewer): improve GIF loading and system stability 2026-05-09 17:27:27 +02:00
boreddevnl
aedf72eeef ignore: Static .a libraries 2026-05-09 17:25:40 +02:00
boreddevnl
679b2ae878 actions: fix indentation 2026-05-09 03:16:06 +02:00
boreddevnl
d25e23f999 actions: script fix 2026-05-09 03:14:27 +02:00
boreddevnl
08e6482f08 actions: fix build script 2026-05-09 03:09:32 +02:00
boreddevnl
14e38a5221 build: merge remaining submodules and clean up .gitignore 2026-05-09 01:56:30 +02:00
boreddevnl
93722faa91 userland: replace legacy cc with native TCC and vendor submodule 2026-05-09 01:54:09 +02:00
boreddevnl
e2ecef39e6 doc: TCC 2026-05-09 01:17:55 +02:00
boreddevnl
3e52d8c8fc .gitignore: undo src/userland/cli/third_party/tcc/ removal 2026-05-09 01:12:32 +02:00
boreddevnl
5fa713c514 .gitignore: src/userland/cli/third_party/tcc/ 2026-05-09 01:11:58 +02:00
boreddevnl
230e404a98 feature: added third_party TCC into userland 2026-05-09 01:11:29 +02:00
boreddevnl
a62b22faa9 app: Resizable txtedit.c 2026-05-09 01:10:21 +02:00
boreddevnl
8fd0605f85 doc: Remove unnecesary note
Co-authored-by: Copilot <copilot@github.com>
2026-05-08 21:08:56 +02:00
boreddevnl
480149a94e ignore edk2-vars.fd 2026-05-08 21:07:21 +02:00
boreddevnl
274ee54814 docs: update syscall reference and add installation guides 2026-05-08 21:06:07 +02:00
boreddevnl
6e1eb7768d core: update system boot logic for disk-based root and cmdline flags 2026-05-08 21:05:33 +02:00
boreddevnl
0fbc3a5fc8 wm: implement root filesystem pivoting and persistence provisioning 2026-05-08 21:04:58 +02:00
boreddevnl
5ae8c56d40 libc: add disk management syscalls and expanded stdio support 2026-05-08 21:04:35 +02:00
boreddevnl
91edd3bc78 feature(install): add system installer and FAT32 formatting utility 2026-05-08 21:03:51 +02:00
boreddevnl
fd18369bd7 disk: add GPT/MBR writing and disk rescan support 2026-05-08 21:02:47 +02:00
boreddevnl
3e26332b1a fs: implement FAT32 LFN support and root volume abstraction 2026-05-08 21:02:14 +02:00
boreddevnl
b04bde3d9e legal: Usage policy V2.0 2026-05-04 23:20:50 +02:00
boreddevnl
d854d0e50f ver: bump OS and kernel to x.x.1
Note: versions >= x.x.1 require users to comply with POLICY.md.
2026-05-04 22:54:14 +02:00
boreddevnl
5b7940dd04 legal: Add usage policy for current and future commits.
Co-authored-by: Copilot <copilot@github.com>
2026-05-04 19:45:36 +02:00
boreddevnl
b486bb2ca5 ver: 4.2.0-dev --> 4.2.0-stable 2026-05-01 20:57:12 +02:00
boreddevnl
7ae1d40e41 ver: 26.5-dev --> 26.5-stable 2026-05-01 20:56:19 +02:00
boreddevnl
9ec4695df1 tweak: User agent rename 2026-04-28 22:10:38 +02:00
boreddevnl
a43465e3d3 feat: implement left/right arrow navigation and inline editing in shell 2026-04-27 16:07:25 +02:00
boreddevnl
39088c7e8e img: New wallpapers 2026-04-26 23:41:01 +02:00
boreddevnl
5ff52b430d optimization: Improve speed on launch of settings 2026-04-26 22:30:32 +02:00
Lluciocc
8d0e744991 doc: Add UTF-8 byte structure section and resources (#10)
Added a section on UTF-8 byte structure with a diagram and a recommended video for further understanding.
2026-04-25 00:51:54 +02:00
boreddevnl
7a480b44b9 Merge branch 'main' of https://github.com/boreddevnl/BoredOS 2026-04-25 00:38:54 +02:00
boreddevnl
836c20de8a image: Added power.jpg wallpaper 2026-04-25 00:38:52 +02:00
Lluciocc
d1a6eb8985 Enhance makefile (#9) 2026-04-24 10:55:58 +02:00
Lluciocc
c11d4a8a00 doc: Add UTF-8 Library Application Development Guide
This document provides an overview and API reference for a UTF-8 utility module in the userland libc, including functions for decoding, encoding, and traversing UTF-8 strings.
2026-04-23 22:13:32 +02:00
boreddevnl
81ea21e746 fix(input): update boredword, browser, grapher and libwidget to support UTF8 2026-04-23 21:59:42 +02:00
boreddevnl
8006a83449 fix(input): update terminal and txtedit to use UTF-8 input subsystem. 2026-04-23 21:33:59 +02:00
Lluciocc
915e33434e feature(input): implement keyboard layouts and utf-8 input subsystem
* Adding keyboard layout (backend)

* Update settings.c with new keyboard tab

* Fixing keyboard icon && Fixing long loading time in settings.c

* Refactor of key handling for a larger compatibility with the keyboard layout

* Adding keyboard handler

* Udating ps2.c with the new logic

* Updating WM/kernel/userland with the new input system

* Fixing keycode range && Updating dead keys handling

* Add comments for explanation

* Update notepad & vm.c to parse utf-8

* Adding utf-8 parsing utils in libc && Update notepad.c

* Adding icon for icon settings

* Fixing a warning with double definition

* Adding new kb kayout: QWERTZ and DVORAK && Update new layout instrauction

* Add documentation for keyboard input subsystem

This document outlines the architecture and design of the input subsystem, focusing on keyboard input processing, driver responsibilities, keycode representation, and keymap functionality.

---------

Co-authored-by: boreddevnl <chris@boreddev.nl>
2026-04-23 21:31:52 +02:00
boreddevnl
228b5753d9 txtedit: support proportional fonts and dynamic cursor alignment 2026-04-23 00:03:06 +02:00
boreddevnl
eb19e37d91 libui: hook userland mouse events 2026-04-23 00:01:20 +02:00
boreddevnl
35ee3fec21 wm: add mouse event callbacks to Window 2026-04-23 00:01:12 +02:00
boreddevnl
85d1dc0991 settings: add scrollable font selection 2026-04-23 00:00:47 +02:00
boreddevnl
4d1e619d7a term: switch to TrueType fonts 2026-04-23 00:00:36 +02:00
boreddevnl
5f1a564d29 fonts: add system TTF assets 2026-04-23 00:00:18 +02:00
boreddevnl
5af02da5a1 docs: restructure architecture documentation and add new guides 2026-04-22 18:15:39 +02:00
boreddevnl
bbc5a44982 docs: document memory manager architecture 2026-04-22 00:20:40 +02:00
boreddevnl
206cca7e28 refactor(mem): rewrite allocator to use two-tier slab and dynamic block list 2026-04-22 00:20:22 +02:00
boreddevnl
034aab48d3 fix(net): guard network_cleanup() with TCP connection ownership token 2026-04-21 16:42:24 +02:00
boreddevnl
987a96e2e8 feature(wm): dynamic dock with persistence, drag-to-reorder, and file pinning 2026-04-21 16:41:33 +02:00
boreddevnl
3893276974 fix(idt): print RIP, err_code, and CR2 to serial before kernel panic 2026-04-21 16:41:03 +02:00
boreddevnl
67f27a908f fix(net): guard network_cleanup() with TCP connection ownership token 2026-04-21 16:40:53 +02:00
boreddevnl
9988a6e420 fix(fs): remove 256-file limit in RAMFS using a dynamic linked list 2026-04-21 16:40:21 +02:00
boreddevnl
c1411e378a doc: add documentation for OS and kernel versioning schemes 2026-04-21 01:17:40 +02:00
boreddevnl
db4862c2d0 chore: update OS codename to Genesis, referencing laying roots for future versions. 2026-04-21 01:07:07 +02:00
boreddevnl
c3d1f44dfd chore: bump OS and kernel versions to 26.5-dev and 4.2.0-dev 2026-04-21 00:46:21 +02:00
boreddevnl
9c600caf45 feature: Add ELF metadata support 2026-04-21 00:29:39 +02:00
boreddevnl
2498045362 feature: Add syscalls for ELF metadata parsing 2026-04-21 00:29:11 +02:00
boreddevnl
8d51238a3d doc: adjust examples with ELF metadata 2026-04-21 00:28:29 +02:00
boreddevnl
d14000b7eb doc: Add documentation for ELF app metadata syscalls 76 and 77 2026-04-21 00:27:38 +02:00
boreddevnl
054c802ad0 doc: Create documentation for elf metadata 2026-04-21 00:27:04 +02:00
boreddevnl
1634b621cf doc: remove unprofessional emojis 2026-04-21 00:26:30 +02:00
boreddevnl
a1c06fdd08 doc: add reference to ELF metadata for appdev 2026-04-21 00:25:35 +02:00
boreddevnl
ee4ce4039c doc: Add total downloads in README.md 2026-04-21 00:24:28 +02:00
boreddevnl
0a7d1f1ee7 remove: duplicate svg icons 2026-04-20 22:58:40 +02:00
boreddevnl
5ee006f736 doc: update screenshot in README.md 2026-04-20 20:04:52 +02:00
boreddevnl
840c0a0be4 tweak: increase thumbnail cache wm.c 2026-04-20 19:43:48 +02:00
boreddevnl
b865023dc2 feature: use Colloid icons instead of hardcoded shape icons 2026-04-20 19:08:12 +02:00
boreddevnl
ef32527733 fix: Fallback color for terminal color if disable in bshrc 2026-04-20 13:03:11 +02:00
boreddevnl
f2753c0d57 Merge branch 'main' of https://github.com/boreddevnl/BoredOS 2026-04-20 12:43:22 +02:00
boreddevnl
51e26758ee feat: added a BoredOS boot banner for kterm 2026-04-20 12:43:13 +02:00
Chris
75b262c767 merge: pull request #6 from Lluciocc/terminal-fix
Terminal update (shortcuts for switching terminal tabs and colors to check if your command is correct.
2026-04-20 12:28:29 +02:00
Lluciocc
016f6dad15 Update bshrc 2026-04-20 12:23:21 +02:00
Lluciocc
65d5fc974f Fix for color when the config is at false 2026-04-20 10:18:01 +02:00
Lluciocc
750880dcb5 Adding support for multiple PATH 2026-04-20 10:09:39 +02:00
Lluciocc
0e32f35d91 Merge branch 'BoredDevNL:main' into terminal-fix 2026-04-20 09:46:03 +02:00
boreddevnl
f8ca9d9d91 tweak: increased cursor size and improved design 2026-04-20 00:40:22 +02:00
boreddevnl
af5eda1647 feat: Add signals, exec/wait, and FD/pipe support
Introduce process lifecycle and POSIX-like features: add parent_pid, pgid, exited/exit_status, signal state and handlers, waitpid/reap, and an exec-replace function. Refactor file descriptor handling to use fd_kind/fd_flags with reference-counted file refs and in-process pipes; implement open/read/write/close/seek/tell/size/dup/dup2/pipe/fcntl semantics and O_* flags. Add syscall handlers for exec, waitpid, kill/signal, sigaction, sigprocmask, sigpending, meminfo/ticks and map many SYSTEM_CMD_* constants; deliver signals from the syscall path. Cleanup/terminate logic updated to free resources correctly and initialize kernel/user processes with new state. Misc: minor syscall/table renames (wallpaper), helper utilities (process_close_fd_inner, process_init_signal_state) and paging/stack handling for exec.
2026-04-20 00:03:52 +02:00
boreddevnl
ae8c7e21ac doc: Add syscalls and libc refs to appdev docs
Update docs/README.md to expand the Application Development index: reword the SDK Reference as an overview hub and add links for Syscalls (numbers, FS/SYSTEM command IDs, wrapper guidance) and libc Reference (headers, implemented APIs, behavior notes). Improves discoverability of syscall and libc documentation for SDK users.
2026-04-20 00:03:05 +02:00
boreddevnl
7d66d9b439 workflow: added a daily nightly build
This is a workflow that runs every day at 00:00 UTC and creates an ISO of the last commit at said time and pushes it to the Releases.
2026-04-20 00:02:12 +02:00
boreddevnl
b1f45b90cd doc: improve sdk_reference
Added all the syscalls by number and what they do, i also added all the headers inside of libc
2026-04-19 23:58:01 +02:00
boreddevnl
4280c3a802 doc: Fix wording in comment 2026-04-19 22:03:42 +02:00
boreddevnl
78ae0f154d refactor(libc): move Lua an DOOM stubs into shared libc modules 2026-04-19 21:58:25 +02:00
boreddevnl
f788ba416d FIX: use dsound instead of coreaudio for run-windows in the Makefile 2026-04-19 20:41:21 +02:00
Lluciocc
8ab28661a1 Merge branch 'BoredDevNL:main' into terminal-fix 2026-04-19 20:26:44 +02:00
boreddevnl
6e85adb000 remove unused memory manager debug/utility APIs 2026-04-19 01:16:19 +02:00
boreddevnl
5be803e4d4 MV: src/net/lwip --> src/net/third_party/lwip 2026-04-19 01:06:42 +02:00
Lluciocc
992aad52e5 Fixing yellow color not showing 2026-04-19 00:45:41 +02:00
Lluciocc
75c3e4c27a Adding a argument in bshrc to enable/disable terminal color 2026-04-19 00:35:30 +02:00
boreddevnl
4fc48eab73 fix: include local time header to satisfy IntelliSense 2026-04-18 22:04:36 +02:00
boreddevnl
ecaa5f60f7 FIX: Flickering when serial output occurs. 2026-04-18 21:57:56 +02:00
boreddevnl
75278b9a27 FEAT: Lua runtime 5.5.0 2026-04-18 21:53:39 +02:00
boreddevnl
baa52da4c0 RM: g_need_prompt_newline 2026-04-18 19:56:35 +02:00
boreddevnl
f6b6fd97ce Merge branch 'main' of https://github.com/boreddevnl/BoredOS 2026-04-18 18:37:25 +02:00
boreddevnl
b419de43f0 refactor: replace syscall if/else chains with dispatch tables 2026-04-18 18:37:13 +02:00
Chris
6d999fdaa3 Remove installation instructions for toolchain
Removed installation instructions for macOS, Linux, and related notes.
2026-04-18 16:45:48 +02:00
Lluciocc
01aa75a4f1 Removing ref to the history 2026-04-18 10:11:52 +02:00
Lluciocc
e1864b2a66 Merge branch 'BoredDevNL:main' into terminal-fix 2026-04-18 09:59:33 +02:00
boreddevnl
d4b066c29f FEAT: add donut.c demo by Andy Sloane 2026-04-17 23:11:06 +02:00
Chris
3eafa5b360 DOC: Update project disclaimer with BrewKernel hyperlink 2026-04-17 16:00:57 +02:00
boreddevnl
8ea457694d RM: Old test userspace application 2026-04-17 14:16:10 +02:00
boreddevnl
fb00bbac2b RM: Old userspace/syscall test assembly files 2026-04-17 14:13:44 +02:00
boreddevnl
89140d7546 FIX: Cursor misalignment when PROMPT_RIGHT was enabled 2026-04-17 13:35:40 +02:00
boreddevnl
9357f82d17 FEAT: added colored prompts, a right aligned prompt and minimal history to Bsh 2026-04-17 13:09:51 +02:00
Lluciocc
d00eed4e13 Refactor command input handling in terminal.c 2026-04-17 12:06:31 +02:00
boreddevnl
0a8f913045 DOC: Updated typo in copyright date 2026-04-17 11:50:42 +02:00
boreddevnl
15a7465019 DOC: Capitalize BoredDevNL in README 2026-04-17 11:40:17 +02:00
Lluciocc
c4562e8778 Implement command history and input color updates 2026-04-17 11:40:11 +02:00
boreddevnl
e738041020 Merge branch 'main' of https://github.com/boreddevnl/BoredOS 2026-04-17 11:25:51 +02:00
boreddevnl
9830b6ad96 VER: 26.4.2 --> 26.4.2.1 2026-04-17 11:25:45 +02:00
Chris
a09103e40d PR: Snake game - Lluciocc
Add a Snake game
2026-04-17 11:12:39 +02:00
Lluciocc
aff3e99ab2 Implement adjustable game speed for Snake game 2026-04-17 11:10:09 +02:00
boreddevnl
93bf2e1734 RM: commented-out button draw calls
Clean up src/userland/games/2048.c by removing a block of commented-out draw_button calls in game_paint(). This eliminates unrecommended UI code and tidies the rendering function; no functional behavior changes.
2026-04-17 09:52:37 +02:00
boreddevnl
eaa02c9a5d Fix Task Manager CPU usage math 2026-04-17 09:42:43 +02:00
boreddevnl
0ad151d7fc OPTIMIZATION: Throttle terminal/Bsh idle polling 2026-04-17 09:42:27 +02:00
Lluciocc
b54e371f3f Add snake.c 2026-04-17 09:32:42 +02:00
boreddevnl
79eeaa73d9 DOC: new screenshot in README.md 2026-04-17 09:31:08 +02:00
boreddevnl
481eb42268 FIX: Make /root/* folders 2026-04-17 09:28:44 +02:00
boreddevnl
feb0d6ffbf DOC: Add a contributors section to the README.md file 2026-04-17 09:25:11 +02:00
boreddevnl
67ebcb98d1 Merge branch 'main' of https://github.com/boreddevnl/BoredOS 2026-04-17 09:20:41 +02:00
boreddevnl
957c74365c DOC: Reference .bashrc in terminal docs 2026-04-17 09:20:39 +02:00
boreddevnl
31b6f48a2c DOC: Added supported media types in README.md and added a smaller BMAC link at the top of the README 2026-04-17 09:19:53 +02:00
Chris
67b7bb1a97 Merge pull request #4 from Lluciocc/fix-input 2026-04-17 07:58:21 +02:00
Lluciocc
e05ff65f92 Update 2048.c with new input ref 2026-04-17 01:16:57 +02:00
Lluciocc
40f63097e1 Fix missing newline at end of input.h 2026-04-17 01:12:20 +02:00
Lluciocc
d677d37b1c Add keylog.c 2026-04-17 01:05:18 +02:00
Lluciocc
9b6297c917 Add input.h 2026-04-17 01:02:07 +02:00
boreddevnl
dd6cbf1fe0 DOC: Update usage.md with new make flags 2026-04-17 00:06:09 +02:00
boreddevnl
7e123b6429 VER: 4.0.1-stable --> v1.0-stable 2026-04-16 23:54:29 +02:00
boreddevnl
4177484366 VER: 26.4 --> 26.4.2 2026-04-16 23:53:50 +02:00
boreddevnl
8dc5ee5867 CREDIT: re-added original credit in 2048. Fixes #2
Co-authored-by: Lluciocc <Lluciocc@users.noreply.github.com>
2026-04-16 22:41:00 +02:00
boreddevnl
884c2f8980 FIX: update explorer spawns for new process_create_elf signature 2026-04-16 22:34:36 +02:00
boreddevnl
36d61e3b7b FEAT: Seperate run parameters for windows, mac and linux 2026-04-16 22:28:31 +02:00
boreddevnl
013f0b513f Merge branch 'main' of https://github.com/boreddevnl/BoredOS 2026-04-16 22:14:22 +02:00
boreddevnl
28108adde3 FIX: Retry to stop false application launch failures 2026-04-16 22:14:18 +02:00
boreddevnl
62ac2ab849 FIX: Redraw menubar upon application start 2026-04-16 22:13:21 +02:00
boreddevnl
7f510c6aa5 FIX: Race condition causing applications to print to serial out instead of the CLI 2026-04-16 22:12:20 +02:00
boreddevnl
7116de4152 TWEAK: rename TOPBAR --> MENUBAR 2026-04-16 22:11:44 +02:00
boreddevnl
049d67e821 FIX: Redraw menubar upon application launch 2026-04-16 22:10:58 +02:00
Chris
0f3971bb1c MERGE: Add 2048 game - LLuciocc
Add 2048 game
2026-04-16 22:03:06 +02:00
Lluciocc
66f55242a7 Update man_entries.h 2026-04-16 18:39:21 +02:00
Lluciocc
8a8fb7de27 Remove credit 2026-04-16 18:06:47 +02:00
Lluciocc
914c60e1f1 Adding 2048.c 2026-04-16 17:58:08 +02:00
boreddevnl
5141eaea60 FEAT: uname 2026-04-15 23:36:42 +02:00
boreddevnl
6e90c3e197 TWEAK: sysfetch added in startup.bsh 2026-04-15 23:36:11 +02:00
boreddevnl
bdd43f43cd FEATURE: add Bsh + userspace terminal, remove legacy cmd/cli utils 2026-04-15 22:47:24 +02:00
boreddevnl
a8866da3cb FEAT: mute terminal output from applications not launched via cli 2026-04-15 20:10:53 +02:00
boreddevnl
14decdd705 DOC: Update README.md 2026-04-15 11:00:06 +02:00
boreddevnl
ed73b88ec1 enable verbose by default 2026-04-15 10:59:44 +02:00
boreddevnl
f9bc6c7c38 FIX: FAT32 cluster management, allocation performance, and AHCI safety 2026-04-14 14:29:19 +02:00
boreddevnl
bb187faf79 DOC: small user manual 2026-04-14 10:59:52 +02:00
boreddevnl
fd7fa4f16e FIX: man entries 2026-04-14 10:59:28 +02:00
boreddevnl
5bd9e537c5 FEAT: bootfs 2026-04-13 16:04:47 +02:00
boreddevnl
e4603792b6 FEAT: Verbose boot 2026-04-13 12:17:39 +02:00
boreddevnl
a27b2c6423 RN: Renamed spotlight to lumos for legal reasons :kek: 2026-04-12 21:51:24 +02:00
boreddevnl
bb176f2193 FEAT: Lumos file searcher 2026-04-12 21:46:28 +02:00
boreddevnl
8dd756f25b FIX: cpuinfo stack overflow and add GUI tab character support 2026-04-12 19:07:08 +02:00
boreddevnl
d13fca2d4a CHECKP: vfs 2026-04-12 18:23:38 +02:00
boreddevnl
a1b6d58b77 Tweak: os_codename = Voyager 2026-04-12 17:59:10 +02:00
boreddevnl
cbc196a4b1 tweak: add -stable after kernel_version 2026-04-12 17:57:54 +02:00
boreddevnl
b4c14af48d TWEAK: kernel_version = 3.2.3 --> 4.0.0 2026-04-12 17:56:35 +02:00
boreddevnl
700839e6be FEAT: VFS overhaul 2026-04-12 17:53:31 +02:00
boreddevnl
921e8a5658 RM: Legacy drive selector in explorer 2026-04-12 00:34:22 +02:00
boreddevnl
437d57312f FIX: remove accidentally copied code 2026-04-12 00:28:03 +02:00
boreddevnl
afc4e16fcf STABILITY: SMP improvements 2026-04-12 00:26:04 +02:00
boreddevnl
38ed0b5ffa CHECKP: semi-stable vfs 2026-04-11 23:08:33 +02:00
boreddevnl
5933483009 CHECKP: shitty VFS 2026-04-11 21:41:11 +02:00
boreddevnl
6b6a22d518 OPT: use ui_draw_image in paint.c 2026-04-11 16:14:39 +02:00
boreddevnl
85427041de FEAT: Caps lock support in ps2 driver 2026-04-11 16:12:37 +02:00
boreddevnl
8b77e8c48e doc: update grapher with tri-axis marching 2026-04-04 19:39:49 +02:00
boreddevnl
1ce08c70b0 FEAT: add tri-axis marching pipeline and atomic depth-color updates to Grapher 2026-04-04 18:05:04 +02:00
boreddevnl
fca67f68a9 NEW: math.h/libmath.c 2026-04-03 23:28:29 +02:00
boreddevnl
c330382436 DOCS: math.h 2026-04-03 23:27:45 +02:00
boreddevnl
f0c2963793 CHECKPOINT: polygon rendering 2026-04-03 23:16:03 +02:00
boreddevnl
3b24bc882c FEAT: Add grapher to dock 2026-04-03 13:32:38 +02:00
boreddevnl
2b44e59e9f TWEAK: Adjust window size 2026-04-03 13:32:23 +02:00
boreddevnl
7a2769e8e3 UI: New main wallpaper (bored.jpg) 2026-04-03 13:23:52 +02:00
boreddevnl
1a6e30b52e Docs: Clean up README.md 2026-04-03 11:53:57 +02:00
boreddevnl
69847adee6 DOCS: Refine and add documentation for libwidget.c 2026-04-03 11:52:06 +02:00
boreddevnl
f402e5e4f0 Merge branch 'main' of https://github.com/boreddevnl/BoredOS 2026-04-03 11:47:05 +02:00
boreddevnl
684ed774ee TWEAK: Balanced resolution and cpu usage with GRID_3D resolution 2026-04-03 11:46:33 +02:00
Chris
9ed8eac3e5 Update Buy Me A Coffee link in README 2026-04-03 00:08:05 +02:00
boreddevnl
c6d512b0f2 FIX: Flickering of colors with 3D graphs 2026-04-02 22:00:04 +02:00
boreddevnl
0b7a134282 TWEAK: Update version.c to 26.4 "Geometry" 2026-04-02 21:59:25 +02:00
boreddevnl
91b67bd8d5 OPT: Multithreaded WM rendering 2026-04-02 21:36:00 +02:00
boreddevnl
e60f232812 OPTIMIZATION: Bytecode engine 2026-04-02 20:21:58 +02:00
boreddevnl
3169ec51cb FEAT: SYSTEM_CMD_PARALLEL_RUN 2026-04-02 20:21:06 +02:00
boreddevnl
beb2c724ff FEAT: ROTATE variable to toggle auto rotate in 3d graphs. 2026-04-02 17:58:33 +02:00
boreddevnl
bf3c2cb578 FEAT: always rotate 3d graph 2026-04-02 17:51:43 +02:00
boreddevnl
823e9c0ce7 FIX: autofit when adjusting graph not shooting into outer space (LOL) 2026-04-02 15:58:56 +02:00
boreddevnl
0ddb1e7610 FEAT: Measurements on graph, fixed overflow and ctrl + r to reset zoom 2026-04-02 15:55:27 +02:00
boreddevnl
32a6bb4d72 FEAT: Pass ctrl pressed through syscall 2026-04-02 15:51:16 +02:00
boreddevnl
d8e680604c FIX: gpf when closing boredword.c 2026-04-01 23:33:25 +02:00
boreddevnl
2e28f860cb FEAT: resizing of window in viewer.c 2026-04-01 23:27:49 +02:00
boreddevnl
9634ebb086 FIX: Fixed framebuffer freeze upon screenshot 2026-04-01 23:05:52 +02:00
boreddevnl
d7d97b5a97 MV: graphing.c --> grapher.c 2026-04-01 22:19:57 +02:00
boreddevnl
4a3752583c FEAT: graphing.c a graphing calculator app. 2026-04-01 22:19:10 +02:00
boreddevnl
9de8ee143c OPT: Reduce render calls when zooming 2026-04-01 22:18:57 +02:00
boreddevnl
8d5fa53d3e FEAT: Cursor nav in text box 2026-04-01 22:18:26 +02:00
boreddevnl
ad8db32305 RM: broken .gif 2026-03-24 19:35:56 +01:00
boreddevnl
92928e55fb fix wm freeze explorer 2026-03-24 19:34:47 +01:00
boreddevnl
31eb7afdc6 fix: better parsing in browser.c 2026-03-23 21:25:46 +01:00
boreddevnl
ad9fac3e28 fix: scrollbar functionality 2026-03-23 20:40:38 +01:00
boreddevnl
70cd296d19 BFIX: Fix gpf's in .elf applications 2026-03-23 17:26:41 +01:00
boreddevnl
b7020152c1 feat: .tar application loading 2026-03-23 09:10:17 +01:00
boreddevnl
63749b8734 FEAT: libwidget.c 2026-03-22 22:07:30 +01:00
boreddevnl
4e8ea5acd2 perf: fix core starvation 2026-03-22 21:04:50 +01:00
boreddevnl
5c199e028a OPTIMIZATION: Network and browser optimizations 2026-03-22 19:26:05 +01:00
boreddevnl
ec2a9d1883 OPTIMIZATION: Browser loading optimization 2026-03-22 18:55:55 +01:00
boreddevnl
4c46650c64 OPTIMIZATION: use mem_mcpy in display buffer 2026-03-22 18:50:29 +01:00
boreddevnl
1ee2fcad9e DOC: Remove unneccessary word readme.md 2026-03-21 17:55:56 +01:00
boreddevnl
5c29ac1473 RM: Deletion unnecessary .vcxproj files 2026-03-20 00:02:01 +01:00
boreddevnl
81743261bf tweak: file cleanup 2026-03-19 12:19:41 +01:00
boreddevnl
4eeb907342 TWEAK: rename DOOM window 2026-03-19 10:43:48 +01:00
boreddevnl
e527f63af7 TWEAK: version.c update for BoredOS Syncwave 2026-03-18 18:18:24 +01:00
boreddevnl
1e19963a8d DOC: Adjust filesystem documentation 2026-03-18 18:14:56 +01:00
boreddevnl
60ab70a49d DOC: Missing space in README.md 2026-03-18 18:10:58 +01:00
boreddevnl
d9bcc4aff7 DOC: Update documentation with multi-threading support 2026-03-18 18:09:46 +01:00
boreddevnl
5604866882 FIX: Mouse trailing with single core CPU's 2026-03-18 18:09:24 +01:00
boreddevnl
e95c82b162 CHECKP: multi-thread applications 2026-03-18 17:04:10 +01:00
boreddevnl
9fb307e603 CHECKP: multi core scheduling 2026-03-17 22:11:32 +01:00
boreddevnl
a7c3cccce7 CheckP: smp support 2026-03-17 21:44:21 +01:00
boreddevnl
7eb55f3a59 FEAT: Unicode support using NotoEmoji 2026-03-17 19:46:48 +01:00
boreddevnl
72baf6506d FEAT: sorting from A->Z in explorer.c 2026-03-17 19:20:53 +01:00
boreddevnl
2817ad51da DOC: Example applications in documentation 2026-03-17 18:52:03 +01:00
boreddevnl
5b10127e02 Tweak: Improved Documentation and README.MD 2026-03-17 17:40:00 +01:00
boreddevnl
1404a6ae4f TWEAK: Rename word.c to boredword.c 2026-03-17 16:24:40 +01:00
boreddevnl
7b7f134e27 feat: centralize OS version info in kernel syscall 2026-03-17 16:06:00 +01:00
boreddevnl
0491c4ad0f TWEAK: change version number for V1.72 and 3.1.2 2026-03-17 15:50:25 +01:00
boreddevnl
c6fe9971d8 BFIX: export bugs in word.c and fixed explorer always ZTop in wm 2026-03-17 15:48:42 +01:00
boreddevnl
88f178e368 checkpoint: BoredWord application 2026-03-17 14:41:13 +01:00
boreddevnl
d824b4610a FIX: Replace blocking k_beep with an asynchronous k_beep 2026-03-16 17:22:42 +01:00
boreddevnl
a4f16b0604 RM: remove broken file artifact 2026-03-16 17:19:06 +01:00
boreddevnl
83413fdd2b fix: Broken script in documentation 2026-03-16 17:16:20 +01:00
boreddevnl
2a918bc7ba Tweak: Updatedscreenshot.jpg and fixed boredos.svg alignment 2026-03-16 15:59:37 +01:00
boreddevnl
2624b4f8df update LICENSE 2026-03-16 15:21:17 +01:00
boreddevnl
be67c27f58 fix makefile to include doom1.wad 2026-03-16 15:06:14 +01:00
boreddevnl
65f362feab seperate net folder 2026-03-16 15:00:24 +01:00
boreddevnl
6b18d44fab markdown viewer massive update 2026-03-16 14:50:47 +01:00
boreddevnl
8b172a69a1 Docs included in iso + explorer corruption fix 2026-03-16 14:28:45 +01:00
boreddevnl
0846ed27b2 exclude .o binaries .gitignore 2026-03-16 14:11:22 +01:00
boreddevnl
1cb8425653 .DS_Store added to .gitignore 2026-03-16 14:09:04 +01:00
boreddevnl
f403816acf stop stracking build artifacts 2026-03-16 14:04:56 +01:00
boreddevnl
5af6b8ec5c deletion old log 2026-03-16 10:47:14 +01:00
boreddevnl
cea0b59c93 deletion old log 2026-03-16 10:46:44 +01:00
boreddevnl
c5111cdcb5 virtio net nic driver fix 2026-03-16 10:45:49 +01:00
boreddevnl
803ebdaefa add link to net/nic drivers in usage documentation 2026-03-16 10:29:02 +01:00
boreddevnl
884af3857f docs: Update admonition syntax for caution block in usage documentation. 2026-03-16 10:26:54 +01:00
boreddevnl
b427b1d4ac DOCS 2026-03-16 10:23:40 +01:00
boreddevnl
d01c309166 updated readme 2026-03-16 00:34:24 +01:00
boreddevnl
fc83d7941b src/kernel --> src/ 2026-03-16 00:30:47 +01:00
boreddevnl
3da1496e4f missed files in organization 2026-03-16 00:27:27 +01:00
boreddevnl
90e5125913 Folder organization 2026-03-16 00:24:47 +01:00
boreddevnl
30f1b66b05 stupid code fix 2026-03-15 17:04:55 +01:00
boreddevnl
6c273e0f2f k_shutdown() fix 2026-03-15 16:53:38 +01:00
boreddevnl
4bab8949e7 revamped network settings 2026-03-15 16:49:56 +01:00
boreddevnl
df73f00efd rtl8111 NIC driver 2026-03-15 16:32:52 +01:00
boreddevnl
b05b221c41 Network Virtio and RTL8139 NIC support 2026-03-14 16:52:52 +01:00
boreddevnl
95c465ca39 task manager fix 2026-03-13 14:48:58 +01:00
boreddevnl
569adabf10 limine 2026-03-13 09:24:33 +01:00
3180 changed files with 234853 additions and 19673 deletions

BIN
.DS_Store vendored

Binary file not shown.

2
.gitattributes vendored
View File

@@ -1,2 +0,0 @@
# Auto detect text files and perform LF normalization
* text=auto

31
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,31 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**1. System/Environment:**
* Are you running on QEMU, VirtualBox, VMware, or Bare Metal?
* What OS are you compiling from? (e.g., Ubuntu 22.04, Windows/WSL2)
* Which branch/commit of BoredOS are you on?
**2. Describe the Bug:**
A clear and concise description of what the bug is. What did you expect to happen, and what actually happened?
**3. Steps to Reproduce:**
1. Boot the OS using 'make run'
2. Open application 'X'
3. Click on 'Y'
4. See error...
**4. Logs and Screenshots:**
* Please attach screenshots of the kernel panic, GUI glitch, or terminal output.
* If you have serial logs, attach them as a `.txt` file or use a code block. Do NOT paste 500 lines of logs directly into the chat!
**5. Additional Context:**
Add any other context about the problem here (e.g., "This only happens when my mouse is moving").
**6. Please add tags to your issue to help with organization.**

View File

@@ -0,0 +1,25 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**1. Is your feature request related to a problem?**
A clear and concise description of what the problem is. (e.g., "I'm always frustrated when I can't save files persistently across reboots...")
**2. Describe the Solution you'd like:**
A clear and concise description of what you want to happen. Are you proposing a new syscall, a new userspace app, or a kernel change?
**3. Describe alternatives you've considered:**
A clear and concise description of any alternative solutions or features you've considered. (e.g., "Instead of ext2, we could just implement FAT32 first.")
**4. Can you help build it?**
Let us know if this is just an idea you'd like to see, or if you plan on submitting a Pull Request for it yourself!
**5. Additional Context:**
Add any other context, mockup screenshots, or links to technical documentation (e.g., OSDev Wiki links) here.
**6. Please add tags to your issue to help with organization.**

36
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,36 @@
## Description
Describe the changes made in this PR.
---
## Testing
- [ ] Code has been tested
- [ ] Existing tests pass
### Platform / Environment
What platform and environment were used for development and testing?
Examples:
- Windows 11 / macOS / Linux
- MSYS2 / WSL2 / Debian
Notes:
<!-- Add anything relevant about testing -->
---
## Documentation
- [ ] Code contains appropriate comments (REQUIRED for medium to large PR's.)
- [ ] Documentation updated if needed
Notes:
<!-- Add anything relevant about documentation -->
---
## Additional Notes
<!-- Anything reviewers should know -->

62
.github/workflows/nightly.yml vendored Normal file
View File

@@ -0,0 +1,62 @@
name: Nightly Build
on:
push:
branches:
- 'main'
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
permissions:
contents: write
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
make \
gcc-x86-64-linux-gnu \
binutils-x86-64-linux-gnu \
nasm \
xorriso
sudo ln -sf /usr/bin/x86_64-linux-gnu-gcc /usr/local/bin/x86_64-elf-gcc
sudo ln -sf /usr/bin/x86_64-linux-gnu-ld /usr/local/bin/x86_64-elf-ld
sudo ln -sf /usr/bin/x86_64-linux-gnu-ar /usr/local/bin/x86_64-elf-ar
- name: Build ISO
run: make -j4
- name: Update nightly tag
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -fa nightly -m "Nightly build ${GITHUB_SHA}" "${GITHUB_SHA}"
git push origin refs/tags/nightly --force
- name: Prepare release metadata
id: metadata
run: |
echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
- name: Publish nightly release asset
uses: softprops/action-gh-release@v2
with:
tag_name: nightly
name: Nightly Build (${{ steps.metadata.outputs.short_sha }})
body: |
This is an automated nightly build of BoredOS, this is not a final release and may be unstable.
Built from commit:
- Full hash: `${{ github.sha }}`
- Short hash: `${{ steps.metadata.outputs.short_sha }}`
prerelease: true
make_latest: false
files: |
boredos.iso
overwrite_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

46
.gitignore vendored
View File

@@ -1,32 +1,24 @@
.git 2/FETCH_HEAD
limine 2/BOOTAA64.EFI
limine 2/BOOTIA32.EFI
limine 2/BOOTRISCV64.EFI
limine 2/BOOTX64.EFI
limine 2/install-sh
limine 2/LICENSE
limine 2/limine-bios-cd.bin
limine 2/limine-bios-hdd.h
limine 2/limine-bios-pxe.bin
limine 2/limine-bios.sys
limine 2/limine-uefi-cd.bin
limine 2/limine.c
limine 2/limine.dSYM/Contents/Info.plist
limine 2/limine.dSYM/Contents/Resources/Relocations/aarch64/limine.yml
limine 2/limine.h
limine 2/Makefile
limine 2/limine
limine 2/limine.dSYM/Contents/Resources/DWARF/limine
limine 2/limine.exe
boredos.dump
qemu-debug.log
build/
# Build artifacts
/build/
iso_root/
limine/
src/kernel/userland/bin/
boredos.iso
disk.img
limine
disk.qcow2
edk2-vars.fd
qemu-debug.log
boredos.dump
# Userland
src/userland/bin/
# Temporary files
**/.DS_Store
.DS_Store
src/.DS_Store
*.o
*.a
# Others
.gitignore
src/userland/cli/third_party/tcc/tcc.elf
src/userland/sdk/include/*
limine

View File

View File

@@ -647,7 +647,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/\>.
Also add information on how to contact you by electronic and paper mail.
@@ -666,11 +666,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
<https://www.gnu.org/licenses/\>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html\>.

480
Makefile
View File

@@ -1,6 +1,3 @@
# BoredOS Makefile
# Target Architecture: x86_64
# Host: macOS
# Copyright (c) 2023-2026 Chris (boreddevnl)
# This software is released under the GNU General Public License v3.0. See LICENSE file for details.
# This header needs to maintain in any file it is present in, as per the GPL license terms.
@@ -10,27 +7,72 @@ LD = x86_64-elf-ld
NASM = nasm
XORRISO = xorriso
SRC_DIR = src/kernel
SRC_DIR = src
BUILD_DIR = build
ISO_DIR = iso_root
KERNEL_ELF = $(BUILD_DIR)/boredos.elf
ISO_IMAGE = boredos.iso
C_SOURCES = $(wildcard $(SRC_DIR)/*.c) \
$(wildcard $(SRC_DIR)/lwip/core/*.c) \
$(wildcard $(SRC_DIR)/lwip/core/ipv4/*.c) \
$(SRC_DIR)/lwip/netif/ethernet.c \
$(SRC_DIR)/lwip/netif/bridgeif.c
BLUE = \033[1;34m
GREEN = \033[1;32m
YELLOW= \033[1;33m
RESET = \033[0m
ASM_SOURCES = $(wildcard $(SRC_DIR)/*.asm)
OBJ_FILES = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o, $(C_SOURCES)) \
$(patsubst $(SRC_DIR)/%.asm, $(BUILD_DIR)/%.o, $(ASM_SOURCES))
define PRINT_STEP
@printf ""
@printf "\n$(BLUE)============================================================$(RESET)\n"
@printf "$(BLUE)== %s$(RESET)\n" "$(1)"
@printf "$(BLUE)============================================================$(RESET)\n"
endef
DOCK_COLLOID_ICONS = $(shell sed -n 's/^[[:space:]]*{"\([^"]*\.png\)",[[:space:]]*DOCK_ICON_UNTRIED.*/\1/p' $(SRC_DIR)/wm/wm.c)
USERLAND_COLLOID_ICONS = $(shell { \
find $(SRC_DIR)/userland -type f -name '*.c' ! -path '*/third_party/*' -exec grep -hoE '"[^"]+\.png"' {} + 2>/dev/null; \
find $(SRC_DIR)/userland -type f -name '*.h' ! -path '*/third_party/*' ! -name 'stb_image.h' -exec grep -hoE '"[^"]+\.png"' {} + 2>/dev/null; \
} | sed 's/"//g' | sed 's@.*/@@' | sort -u)
USERLAND_METADATA_ICONS = $(shell { \
find $(SRC_DIR)/userland -type f -name '*.c' -exec sed -n 's@^[[:space:]]*//[[:space:]]*BOREDOS_APP_ICONS:[[:space:]]*@@p' {} + 2>/dev/null; \
} | tr ';' '\n' | sed 's@.*/@@' | sed '/^[[:space:]]*$$/d' | sort -u)
COLLOID_ICONS = $(sort $(DOCK_COLLOID_ICONS) $(USERLAND_COLLOID_ICONS) $(USERLAND_METADATA_ICONS) xterm.png)
C_SOURCES = $(wildcard $(SRC_DIR)/core/*.c) \
$(wildcard $(SRC_DIR)/sys/*.c) \
$(wildcard $(SRC_DIR)/mem/*.c) \
$(wildcard $(SRC_DIR)/dev/*.c) \
$(wildcard $(SRC_DIR)/drivers/*.c) \
$(wildcard $(SRC_DIR)/input/*.c) \
$(wildcard $(SRC_DIR)/net/*.c) \
$(wildcard $(SRC_DIR)/net/nic/*.c) \
$(wildcard $(SRC_DIR)/fs/*.c) \
$(wildcard $(SRC_DIR)/wm/*.c) \
$(wildcard $(SRC_DIR)/net/third_party/lwip/core/*.c) \
$(wildcard $(SRC_DIR)/net/third_party/lwip/core/ipv4/*.c) \
$(SRC_DIR)/net/third_party/lwip/netif/ethernet.c \
$(SRC_DIR)/net/third_party/lwip/netif/bridgeif.c
ASM_SOURCES = $(wildcard $(SRC_DIR)/arch/*.asm)
OBJ_FILES = $(patsubst $(SRC_DIR)/core/%.c, $(BUILD_DIR)/%.o, $(wildcard $(SRC_DIR)/core/*.c)) \
$(patsubst $(SRC_DIR)/sys/%.c, $(BUILD_DIR)/%.o, $(wildcard $(SRC_DIR)/sys/*.c)) \
$(patsubst $(SRC_DIR)/mem/%.c, $(BUILD_DIR)/%.o, $(wildcard $(SRC_DIR)/mem/*.c)) \
$(patsubst $(SRC_DIR)/dev/%.c, $(BUILD_DIR)/%.o, $(wildcard $(SRC_DIR)/dev/*.c)) \
$(patsubst $(SRC_DIR)/drivers/%.c, $(BUILD_DIR)/%.o, $(wildcard $(SRC_DIR)/drivers/*.c)) \
$(patsubst $(SRC_DIR)/input/%.c, $(BUILD_DIR)/%.o, $(wildcard $(SRC_DIR)/input/*.c)) \
$(patsubst $(SRC_DIR)/net/%.c, $(BUILD_DIR)/%.o, $(wildcard $(SRC_DIR)/net/*.c)) \
$(patsubst $(SRC_DIR)/net/nic/%.c, $(BUILD_DIR)/%.o, $(wildcard $(SRC_DIR)/net/nic/*.c)) \
$(patsubst $(SRC_DIR)/fs/%.c, $(BUILD_DIR)/%.o, $(wildcard $(SRC_DIR)/fs/*.c)) \
$(patsubst $(SRC_DIR)/wm/%.c, $(BUILD_DIR)/%.o, $(wildcard $(SRC_DIR)/wm/*.c)) \
$(patsubst $(SRC_DIR)/net/third_party/lwip/%.c, $(BUILD_DIR)/lwip/%.o, $(filter $(SRC_DIR)/net/third_party/lwip/%.c, $(C_SOURCES))) \
$(patsubst $(SRC_DIR)/arch/%.asm, $(BUILD_DIR)/%.o, $(ASM_SOURCES))
CFLAGS = -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding \
-fno-stack-protector -fno-stack-check -fno-lto -fPIE \
-m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone \
-I$(SRC_DIR) -I$(SRC_DIR)/lwip
-I$(SRC_DIR) -I$(SRC_DIR)/net/third_party/lwip -I$(SRC_DIR)/core \
-I$(SRC_DIR)/sys -I$(SRC_DIR)/mem -I$(SRC_DIR)/dev \
-I$(SRC_DIR)/drivers \
-I$(SRC_DIR)/net -I$(SRC_DIR)/net/nic -I$(SRC_DIR)/fs \
-I$(SRC_DIR)/wm -I$(SRC_DIR)/input
LDFLAGS = -m elf_x86_64 -nostdlib -static -pie --no-dynamic-linker \
-z text -z max-page-size=0x1000 -T linker.ld
@@ -40,125 +82,427 @@ NASMFLAGS = -f elf64
LIMINE_VERSION = 10.8.2
LIMINE_URL_BASE = https://github.com/limine-bootloader/limine/raw/v$(LIMINE_VERSION)
.PHONY: all clean run limine-setup
HOST_OS := $(shell uname -s 2>/dev/null || echo Windows)
all: $(ISO_IMAGE)
.PHONY: all clean run run-hd limine-setup run-windows run-mac run-linux run-hd-mac run-hd-windows run-hd-linux
all:
$(call PRINT_STEP,STARTING BOREDOS BUILD)
$(MAKE) $(ISO_IMAGE)
$(call PRINT_STEP,BUILD COMPLETE)
$(BUILD_DIR):
$(call PRINT_STEP,CREATING BUILD DIRECTORY)
mkdir -p $(BUILD_DIR)
mkdir -p $(BUILD_DIR)
limine-setup:
$(call PRINT_STEP,SETTING UP LIMINE)
@if [ ! -f limine/limine-bios.sys ]; then \
echo "Limine binaries missing or invalid. Cloning v$(LIMINE_VERSION)-binary..."; \
printf "$(YELLOW)[LIMINE] Limine binaries missing or invalid. Cloning v$(LIMINE_VERSION)-binary...$(RESET)"; \
rm -rf limine; \
git clone https://github.com/limine-bootloader/limine.git --branch=v$(LIMINE_VERSION)-binary --depth=1 limine; \
else \
printf "$(YELLOW)[LIMINE] Existing Limine binaries found.$(RESET)"; \
fi
@if [ ! -f $(SRC_DIR)/limine.h ]; then \
echo "Copying limine.h..."; \
cp limine/limine.h $(SRC_DIR)/limine.h; \
@if [ ! -f $(SRC_DIR)/core/limine.h ]; then \
printf "$(YELLOW)[LIMINE] Copying limine.h...$(RESET)"; \
cp limine/limine.h $(SRC_DIR)/core/limine.h; \
else \
printf "$(YELLOW)[LIMINE] limine.h already present.$(RESET)"; \
fi
@echo "Building Limine host utility..."; \
@printf "$(YELLOW)[LIMINE] Building Limine host utility...$(RESET)"
$(MAKE) -C limine
@printf "$(GREEN)[OK] Limine setup complete.$(RESET)"
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c | $(BUILD_DIR) limine-setup
@printf "$(YELLOW)[CC]$(RESET) $< -> $@"
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/core/%.c | $(BUILD_DIR) limine-setup
@printf "$(YELLOW)[CC]$(RESET)[core] $< -> $@"
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/sys/%.c | $(BUILD_DIR) limine-setup
@printf "$(YELLOW)[CC]$(RESET)[sys] $< -> $@"
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.asm | $(BUILD_DIR)
$(BUILD_DIR)/%.o: $(SRC_DIR)/mem/%.c | $(BUILD_DIR) limine-setup
@printf "$(YELLOW)[CC]$(RESET)[mem] $< -> $@"
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/dev/%.c | $(BUILD_DIR) limine-setup
@printf "$(YELLOW)[CC]$(RESET)[dev] $< -> $@"
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/drivers/%.c | $(BUILD_DIR) limine-setup
@printf "$(YELLOW)[CC]$(RESET)[drivers] $< -> $@"
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/input/%.c | $(BUILD_DIR) limine-setup
@printf "$(YELLOW)[CC]$(RESET)[input] $< -> $@"
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/net/%.c | $(BUILD_DIR) limine-setup
@printf "$(YELLOW)[CC]$(RESET)[net] $< -> $@"
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/net/nic/%.c | $(BUILD_DIR) limine-setup
@printf "$(YELLOW)[CC]$(RESET)[net/nic] $< -> $@"
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/fs/%.c | $(BUILD_DIR) limine-setup
@printf "$(YELLOW)[CC]$(RESET)[fs] $< -> $@"
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/wm/%.c | $(BUILD_DIR) limine-setup
@printf "$(YELLOW)[CC]$(RESET)[wm] $< -> $@"
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/lwip/%.o: $(SRC_DIR)/net/third_party/lwip/%.c | $(BUILD_DIR) limine-setup
@printf "$(YELLOW)[CC]$(RESET)[lwIP] $< -> $@"
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/arch/%.asm | $(BUILD_DIR)
@printf "$(YELLOW)[ASM]$(RESET) $< -> $@"
$(NASM) $(NASMFLAGS) $< -o $@
$(BUILD_DIR)/test_syscall.o: $(SRC_DIR)/test_syscall.asm | $(BUILD_DIR)
$(BUILD_DIR)/test_syscall.o: $(SRC_DIR)/arch/test_syscall.asm | $(BUILD_DIR)
@printf "$(YELLOW)[ASM][test_syscall]$(RESET) $< -> $@"
$(NASM) $(NASMFLAGS) $< -o $@
$(BUILD_DIR)/user_test.o: $(SRC_DIR)/user_test.asm | $(BUILD_DIR)
$(BUILD_DIR)/user_test.o: $(SRC_DIR)/arch/user_test.asm | $(BUILD_DIR)
@printf "$(YELLOW)[ASM][user_test]$(RESET) $< -> $@"
$(NASM) $(NASMFLAGS) $< -o $@
$(BUILD_DIR)/process_asm.o: $(SRC_DIR)/process_asm.asm | $(BUILD_DIR)
$(BUILD_DIR)/process_asm.o: $(SRC_DIR)/arch/process_asm.asm | $(BUILD_DIR)
@printf "$(YELLOW)[ASM][process]$(RESET) $< -> $@"
$(NASM) $(NASMFLAGS) $< -o $@
$(KERNEL_ELF): $(OBJ_FILES)
$(call PRINT_STEP,LINKING KERNEL)
@printf "$(YELLOW)[LD]$(RESET) Linking kernel ELF: $@"
$(LD) $(LDFLAGS) -o $@ $(OBJ_FILES)
@printf "$(GREEN)[OK]$(RESET) Kernel ELF built: $@"
$(call PRINT_STEP,BUILDING USERLAND)
$(MAKE) -C $(SRC_DIR)/userland
@printf "$(GREEN)[OK]$(RESET) Userland build complete."
$(ISO_IMAGE): $(KERNEL_ELF) limine.conf limine-setup
$(BUILD_DIR)/initrd.tar: $(KERNEL_ELF)
$(call PRINT_STEP,BUILDING INITRD)
@printf "$(YELLOW)[INITRD]$(RESET) Cleaning previous initrd directory..."
rm -rf $(BUILD_DIR)/initrd
@printf "$(YELLOW)[INITRD]$(RESET) Creating directory structure..."
mkdir -p $(BUILD_DIR)/initrd/bin
mkdir -p $(BUILD_DIR)/initrd/Library/images/Wallpapers
mkdir -p $(BUILD_DIR)/initrd/Library/images/gif
mkdir -p $(BUILD_DIR)/initrd/Library/images/icons/colloid
mkdir -p $(BUILD_DIR)/initrd/Library/Fonts/Emoji
mkdir -p $(BUILD_DIR)/initrd/Library/DOOM
mkdir -p $(BUILD_DIR)/initrd/Library/conf
mkdir -p $(BUILD_DIR)/initrd/Library/bsh
mkdir -p $(BUILD_DIR)/initrd/Library/BWM/Wallpaper
mkdir -p $(BUILD_DIR)/initrd/Library/art
mkdir -p $(BUILD_DIR)/initrd/Library/images/branding
mkdir -p $(BUILD_DIR)/initrd/docs
mkdir -p $(BUILD_DIR)/initrd/boot
mkdir -p $(BUILD_DIR)/initrd/mnt
mkdir -p $(BUILD_DIR)/initrd/dev
mkdir -p $(BUILD_DIR)/initrd/root/Desktop
mkdir -p $(BUILD_DIR)/initrd/root/Pictures
mkdir -p $(BUILD_DIR)/initrd/root/Documents
mkdir -p $(BUILD_DIR)/initrd/root/Downloads
mkdir -p $(BUILD_DIR)/initrd/etc
mkdir -p $(BUILD_DIR)/initrd/usr/lib/tcc/include
mkdir -p $(BUILD_DIR)/initrd/usr/local/include
mkdir -p $(BUILD_DIR)/initrd/usr/include/sys
mkdir -p $(BUILD_DIR)/initrd/usr/include/libc
mkdir -p $(BUILD_DIR)/initrd/usr/lib
@printf "$(YELLOW)[COPY]$(RESET) Limine binaries + kernel for installer..."
@if [ -f limine/BOOTX64.EFI ]; then cp limine/BOOTX64.EFI $(BUILD_DIR)/initrd/boot/; fi
@if [ -f limine/BOOTIA32.EFI ]; then cp limine/BOOTIA32.EFI $(BUILD_DIR)/initrd/boot/; fi
@if [ -f limine/limine-bios.sys ]; then cp limine/limine-bios.sys $(BUILD_DIR)/initrd/boot/; fi
@cp $(KERNEL_ELF) $(BUILD_DIR)/initrd/boot/boredos.elf
@printf "$(YELLOW)[COPY]$(RESET) Userland binaries..."
@for f in $(SRC_DIR)/userland/bin/*.elf; do \
if [ -f "$$f" ]; then \
printf " -> $$f"; \
cp "$$f" $(BUILD_DIR)/initrd/bin/; \
fi \
done
@printf "$(YELLOW)[COPY]$(RESET) TCC support files..."
@cp $(SRC_DIR)/userland/cli/third_party/tcc/libtcc1.a $(BUILD_DIR)/initrd/usr/lib/tcc/
@cp $(SRC_DIR)/userland/cli/third_party/tcc/libtcc1.a $(BUILD_DIR)/initrd/usr/lib/
@cp $(SRC_DIR)/userland/cli/third_party/tcc/include/*.h $(BUILD_DIR)/initrd/usr/lib/tcc/include/
@cp $(SRC_DIR)/userland/sdk/lib/libboredos.a $(BUILD_DIR)/initrd/usr/lib/
@cp $(SRC_DIR)/userland/sdk/lib/libc.a $(BUILD_DIR)/initrd/usr/lib/
@cp $(SRC_DIR)/userland/sdk/lib/libm.a $(BUILD_DIR)/initrd/usr/lib/
@cp $(SRC_DIR)/userland/bin/crt0.o $(BUILD_DIR)/initrd/usr/lib/crt0.o
@cp $(SRC_DIR)/userland/bin/crt0.o $(BUILD_DIR)/initrd/usr/lib/crt1.o
@cp $(SRC_DIR)/userland/bin/empty.o $(BUILD_DIR)/initrd/usr/lib/crti.o
@cp $(SRC_DIR)/userland/bin/empty.o $(BUILD_DIR)/initrd/usr/lib/crtn.o
@cp $(SRC_DIR)/userland/libc/*.h $(BUILD_DIR)/initrd/usr/include/
@cp $(SRC_DIR)/userland/libc/sys/*.h $(BUILD_DIR)/initrd/usr/include/sys/
@cp $(SRC_DIR)/userland/libc/*.h $(BUILD_DIR)/initrd/usr/include/libc/
@cp $(SRC_DIR)/userland/libc/*.h $(BUILD_DIR)/initrd/usr/local/include/
@cp $(SRC_DIR)/userland/stb_image.h $(BUILD_DIR)/initrd/usr/include/
@printf "$(YELLOW)[COPY]$(RESET) Wallpapers..."
@for f in $(SRC_DIR)/images/wallpapers/*; do \
if [ -f "$$f" ]; then \
printf " -> $$f"; \
cp "$$f" $(BUILD_DIR)/initrd/Library/images/Wallpapers/; \
fi \
done
@printf "$(YELLOW)[COPY]$(RESET) GIF assets..."
@for f in $(SRC_DIR)/images/gif/*.gif; do \
if [ -f "$$f" ]; then \
printf " -> $$f"; \
cp "$$f" $(BUILD_DIR)/initrd/Library/images/gif/; \
fi \
done
@printf "$(YELLOW)[COPY]$(RESET) Colloid icons..."
@for f in $(COLLOID_ICONS); do \
src="$(SRC_DIR)/images/icons/colloid/$$f"; \
if [ -f "$$src" ]; then \
printf " -> $$src"; \
cp "$$src" $(BUILD_DIR)/initrd/Library/images/icons/colloid/; \
fi \
done
@printf "$(YELLOW)[COPY]$(RESET) BoredOS icons..."
@mkdir -p $(BUILD_DIR)/initrd/Library/images/icons/boredos
@for f in $(SRC_DIR)/images/icons/boredos/*.png; do \
if [ -f "$$f" ]; then \
printf " -> $$f"; \
cp "$$f" $(BUILD_DIR)/initrd/Library/images/icons/boredos/; \
fi \
done
@printf "$(YELLOW)[COPY]$(RESET) Branding assets..."
@cp -r branding/* $(BUILD_DIR)/initrd/Library/images/branding/
@printf "$(YELLOW)[COPY]$(RESET) Fonts..."
@for f in $(SRC_DIR)/fonts/*.ttf; do \
if [ -f "$$f" ]; then \
printf " -> $$f"; \
cp "$$f" $(BUILD_DIR)/initrd/Library/Fonts/; \
fi \
done
@printf "$(YELLOW)[COPY]$(RESET) Emoji fonts..."
@for f in $(SRC_DIR)/fonts/Emoji/*.ttf; do \
if [ -f "$$f" ]; then \
printf " -> $$f"; \
cp "$$f" $(BUILD_DIR)/initrd/Library/Fonts/Emoji/; \
fi \
done
@printf "$(YELLOW)[COPY]$(RESET) bsh configuration..."
@if [ -f $(SRC_DIR)/library/bsh/bshrc ]; then printf " -> bshrc"; cp $(SRC_DIR)/library/bsh/bshrc $(BUILD_DIR)/initrd/Library/bsh/; fi
@if [ -f $(SRC_DIR)/library/bsh/startup.bsh ]; then printf " -> startup.bsh"; cp $(SRC_DIR)/library/bsh/startup.bsh $(BUILD_DIR)/initrd/Library/bsh/; fi
@if [ -f $(SRC_DIR)/library/bsh/boot.bsh ]; then printf " -> boot.bsh"; cp $(SRC_DIR)/library/bsh/boot.bsh $(BUILD_DIR)/initrd/Library/bsh/; fi
@if [ -f $(SRC_DIR)/library/conf/sysfetch.cfg ]; then printf " -> sysfetch.cfg"; cp $(SRC_DIR)/library/conf/sysfetch.cfg $(BUILD_DIR)/initrd/Library/conf/; fi
@printf "$(YELLOW)[COPY]$(RESET) DOOM assets..."
@if [ -f $(SRC_DIR)/userland/games/doom/doom1.wad ]; then printf " -> doom1.wad"; cp $(SRC_DIR)/userland/games/doom/doom1.wad $(BUILD_DIR)/initrd/Library/DOOM/; fi
@printf "$(YELLOW)[COPY]$(RESET) ASCII art..."
@if [ -f $(SRC_DIR)/library/art/boredos.txt ]; then printf " -> boredos.txt"; cp $(SRC_DIR)/library/art/boredos.txt $(BUILD_DIR)/initrd/Library/art/; fi
@printf "$(YELLOW)[COPY]$(RESET) Documentation..."
@for f in $$(find docs -name '*.md' 2>/dev/null); do \
if [ -f "$$f" ]; then \
printf " -> $$f"; \
dir=$$(dirname "$$f"); \
mkdir -p $(BUILD_DIR)/initrd/"$$dir"; \
cp "$$f" $(BUILD_DIR)/initrd/"$$dir"/; \
fi \
done
@printf "$(YELLOW)[COPY]$(RESET) Root files..."
@if [ -f README.md ]; then printf " -> README.md"; cp README.md $(BUILD_DIR)/initrd/; fi
@if [ -f LICENSE ]; then printf " -> LICENSE"; cp LICENSE $(BUILD_DIR)/initrd/; fi
@if [ -f limine.conf ]; then printf " -> limine.conf"; cp limine.conf $(BUILD_DIR)/initrd/; fi
@printf "$(YELLOW)[TAR]$(RESET) Creating initrd.tar..."
cd $(BUILD_DIR)/initrd && COPYFILE_DISABLE=1 tar --exclude="._*" -cf ../initrd.tar *
@printf "$(GREEN)[OK]$(RESET) Initrd created: $(BUILD_DIR)/initrd.tar"
$(ISO_IMAGE): $(KERNEL_ELF) $(BUILD_DIR)/initrd.tar limine.conf limine-setup
$(call PRINT_STEP,CREATING ISO IMAGE)
@printf "$(YELLOW)[ISO]$(RESET) Cleaning previous ISO root..."
rm -rf $(ISO_DIR)
@printf "$(YELLOW)[ISO]$(RESET) Creating ISO directory structure..."
mkdir -p $(ISO_DIR)
mkdir -p $(ISO_DIR)/EFI/BOOT
@printf "$(YELLOW)[COPY]$(RESET) Kernel ELF..."
cp $(KERNEL_ELF) $(ISO_DIR)/
@printf "$(YELLOW)[COPY]$(RESET) Limine config..."
cp limine.conf $(ISO_DIR)/
mkdir -p $(ISO_DIR)/bin
@for f in $(SRC_DIR)/userland/bin/*.elf; do \
if [ -f "$$f" ]; then \
basename=$$(basename "$$f"); \
cp "$$f" $(ISO_DIR)/bin/; \
echo " module_path: boot():/bin/$$basename" >> $(ISO_DIR)/limine.conf; \
fi \
done
@if [ -f README.md ]; then cp README.md $(ISO_DIR)/; fi
@if [ -f $(SRC_DIR)/userland/doom/doom1.wad ]; then \
mkdir -p $(ISO_DIR)/Library/DOOM; \
cp $(SRC_DIR)/userland/doom/doom1.wad $(ISO_DIR)/Library/DOOM/; \
echo " module_path: boot():/Library/DOOM/doom1.wad" >> $(ISO_DIR)/limine.conf; \
fi
@printf "$(YELLOW)[COPY]$(RESET) Initrd..."
cp $(BUILD_DIR)/initrd.tar $(ISO_DIR)/
mkdir -p $(ISO_DIR)/Library/images/Wallpapers
@for f in $(SRC_DIR)/images/wallpapers/*; do \
if [ -f "$$f" ]; then \
basename=$$(basename "$$f"); \
cp "$$f" $(ISO_DIR)/Library/images/Wallpapers/; \
echo " module_path: boot():/Library/images/Wallpapers/$$basename" >> $(ISO_DIR)/limine.conf; \
fi \
done
@if [ -f splash.jpg ]; then cp splash.jpg $(ISO_DIR)/; fi
@printf "$(YELLOW)[CONFIG]$(RESET) Adding initrd module path..."
printf " module_path: boot():/initrd.tar" >> $(ISO_DIR)/limine.conf
mkdir -p $(ISO_DIR)/Library/images/gif
@for f in $(SRC_DIR)/images/gif/*.gif; do \
if [ -f "$$f" ]; then \
basename=$$(basename "$$f"); \
cp "$$f" $(ISO_DIR)/Library/images/gif/; \
echo " module_path: boot():/Library/images/gif/$$basename" >> $(ISO_DIR)/limine.conf; \
fi \
done
@printf "$(YELLOW)[COPY]$(RESET) Optional splash image..."
@if [ -f branding/splash.jpg ]; then printf " -> splash.jpg"; cp branding/splash.jpg $(ISO_DIR)/splash.jpg; else printf " -> no splash.jpg found"; fi
@printf "$(YELLOW)[COPY]$(RESET) Limine boot files..."
cp limine/limine-bios.sys $(ISO_DIR)/
cp limine/limine-bios-cd.bin $(ISO_DIR)/
cp limine/limine-uefi-cd.bin $(ISO_DIR)/
@printf "$(YELLOW)[COPY]$(RESET) EFI bootloaders..."
cp limine/BOOTX64.EFI $(ISO_DIR)/EFI/BOOT/
cp limine/BOOTIA32.EFI $(ISO_DIR)/EFI/BOOT/
mkdir -p $(ISO_DIR)/Library/Fonts
@for f in $(SRC_DIR)/fonts/*.ttf; do \
if [ -f "$$f" ]; then \
basename=$$(basename "$$f"); \
cp "$$f" $(ISO_DIR)/Library/Fonts/; \
echo " module_path: boot():/Library/Fonts/$$basename" >> $(ISO_DIR)/limine.conf; \
fi \
done
$(call PRINT_STEP,GENERATING BOOTABLE ISO)
$(XORRISO) -as mkisofs -R -J -b limine-bios-cd.bin \
-no-emul-boot -boot-load-size 4 -boot-info-table \
--efi-boot limine-uefi-cd.bin \
-efi-boot-part --efi-boot-image --protective-msdos-label \
$(ISO_DIR) -o $(ISO_IMAGE)
@printf "$(YELLOW)[LIMINE]$(RESET) Installing BIOS bootloader..."
./limine/limine bios-install $(ISO_IMAGE)
@printf "$(GREEN)[OK]$(RESET) ISO image ready: $(ISO_IMAGE)"
clean:
$(call PRINT_STEP,CLEANING BUILD OUTPUT)
rm -rf $(BUILD_DIR) $(ISO_DIR) $(ISO_IMAGE)
$(MAKE) -C $(SRC_DIR)/userland clean
@printf "$(GREEN)[OK]$(RESET) Clean complete."
run: $(ISO_IMAGE)
disk.qcow2:
$(call PRINT_STEP,CREATING 10GB EXPANDABLE DISK IMAGE)
qemu-img create -f qcow2 disk.qcow2 10G
run: $(ISO_IMAGE) disk.qcow2
$(call PRINT_STEP,DETECTING PLATFORM AND RUNNING BOREDOS)
@if [ "$(HOST_OS)" = "Darwin" ]; then \
printf "$(GREEN)[RUN]$(RESET) Detected macOS\n"; \
$(MAKE) run-mac; \
elif [ "$(HOST_OS)" = "Linux" ]; then \
printf "$(GREEN)[RUN]$(RESET) Detected Linux\n"; \
$(MAKE) run-linux; \
else \
printf "$(GREEN)[RUN]$(RESET) Detected Windows\n"; \
$(MAKE) run-windows; \
fi
run-hd: disk.qcow2 $(OVMF_VARS)
$(call PRINT_STEP,DETECTING PLATFORM AND BOOTING FROM HARD DRIVE)
@if [ "$(HOST_OS)" = "Darwin" ]; then \
printf "$(GREEN)[RUN-HD]$(RESET) Detected macOS\n"; \
$(MAKE) run-hd-mac; \
elif [ "$(HOST_OS)" = "Linux" ]; then \
printf "$(GREEN)[RUN-HD]$(RESET) Detected Linux\n"; \
$(MAKE) run-hd-linux; \
else \
printf "$(GREEN)[RUN-HD]$(RESET) Detected Windows\n"; \
$(MAKE) run-hd-windows; \
fi
run-windows: $(ISO_IMAGE) disk.qcow2
$(call PRINT_STEP,RUNNING BOREDOS IN QEMU ON WINDOWS)
qemu-system-x86_64 -m 4G -serial stdio -cdrom $< -boot d \
-smp 4 \
-audiodev dsound,id=audio0 -machine pcspk-audiodev=audio0 \
-vga std -global VGA.xres=1920 -global VGA.yres=1080 \
-drive file=disk.qcow2,format=qcow2,file.locking=off
run-mac: $(ISO_IMAGE) disk.qcow2
$(call PRINT_STEP,RUNNING BOREDOS IN QEMU ON MACOS)
qemu-system-x86_64 -m 4G -serial stdio -cdrom $< -boot d \
-smp 4 \
-audiodev coreaudio,id=audio0 -machine pcspk-audiodev=audio0 \
-netdev user,id=net0,hostfwd=udp::12346-:12345 -device e1000,netdev=net0 \
-vga std -global VGA.xres=1920 -global VGA.yres=1080 \
-display cocoa,show-cursor=off \
-drive file=disk.img,format=raw,file.locking=off \
-device ahci,id=ahci -drive file=disk.qcow2,format=qcow2,if=none,id=disk0 -device ide-hd,bus=ahci.0,drive=disk0 \
-cpu max
OVMF_CODE := /opt/homebrew/share/qemu/edk2-x86_64-code.fd
OVMF_VARS_TMPL := /opt/homebrew/share/qemu/edk2-i386-vars.fd
OVMF_VARS := edk2-vars.fd
ifeq ($(shell test -f $(OVMF_CODE) && echo 1),)
OVMF_CODE := /usr/local/share/qemu/edk2-x86_64-code.fd
OVMF_VARS_TMPL := /usr/local/share/qemu/edk2-i386-vars.fd
endif
$(OVMF_VARS):
@if [ -f $(OVMF_VARS_TMPL) ]; then \
printf "$(YELLOW)[UEFI]$(RESET) Creating local NVRAM vars..."; \
cp $(OVMF_VARS_TMPL) $(OVMF_VARS); \
fi
run-hd-mac: disk.qcow2 $(OVMF_VARS)
$(call PRINT_STEP,BOOTING BOREDOS FROM HARD DRIVE ON MACOS)
qemu-system-x86_64 -m 4G -serial stdio -boot c \
-smp 4 \
-audiodev coreaudio,id=audio0 -machine pcspk-audiodev=audio0 \
-vga std -global VGA.xres=1920 -global VGA.yres=1080 \
-display cocoa,show-cursor=off \
-drive if=pflash,format=raw,readonly=on,file=$(OVMF_CODE) \
-drive if=pflash,format=raw,file=$(OVMF_VARS) \
-device ahci,id=ahci \
-drive file=disk.qcow2,format=qcow2,if=none,id=disk0 -device ide-hd,bus=ahci.0,drive=disk0 \
-drive file=disk.img,format=raw,if=none,id=disk1 -device ide-hd,bus=ahci.1,drive=disk1 \
-cpu max
run-linux: $(ISO_IMAGE) disk.qcow2
$(call PRINT_STEP,RUNNING BOREDOS IN QEMU ON LINUX)
qemu-system-x86_64 -m 4G -serial stdio -cdrom $< -boot d \
-smp 4 \
-audiodev pa,id=audio0 -machine pcspk-audiodev=audio0 \
-vga std -global VGA.xres=1920 -global VGA.yres=1080 \
-display gtk,show-cursor=off \
-device ahci,id=ahci -drive file=disk.qcow2,format=qcow2,if=none,id=disk0 -device ide-hd,bus=ahci.0,drive=disk0 \
-cpu max
run-hd-windows: disk.qcow2
$(call PRINT_STEP,BOOTING BOREDOS FROM HARD DRIVE ON WINDOWS)
qemu-system-x86_64 -m 4G -serial stdio -boot c \
-smp 4 \
-audiodev dsound,id=audio0 -machine pcspk-audiodev=audio0 \
-vga std -global VGA.xres=1920 -global VGA.yres=1080 \
-device ahci,id=ahci \
-drive file=disk.qcow2,format=qcow2,if=none,id=disk0 -device ide-hd,bus=ahci.0,drive=disk0 \
-cpu max
run-hd-linux: disk.qcow2 $(OVMF_VARS)
$(call PRINT_STEP,BOOTING BOREDOS FROM HARD DRIVE ON LINUX)
qemu-system-x86_64 -m 4G -serial stdio -boot c \
-smp 4 \
-audiodev pa,id=audio0 -machine pcspk-audiodev=audio0 \
-vga std -global VGA.xres=1920 -global VGA.yres=1080 \
-display gtk,show-cursor=off \
-drive if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF_CODE.fd \
-drive if=pflash,format=raw,file=$(OVMF_VARS) \
-device ahci,id=ahci \
-drive file=disk.qcow2,format=qcow2,if=none,id=disk0 -device ide-hd,bus=ahci.0,drive=disk0 \
-cpu max

280
README.md
View File

@@ -1,168 +1,166 @@
# BoredOS
<div align="center">
<img src="boredos.svg" alt="BoredOS Logo" width="450" />
</div>
BoredOS is a simple x86_64 hobbyist operating system.
It features a DE (and WM), a FAT32 filesystem, customizable UI and much much more!
<img src="branding/bOS_full_gradient_cropped.png" alt="BoredOS Logo" width="450" />
![Screenshot](screenshot.jpg)
*this screenshot might be outdated*
<h3>A modern x86_64 hobbyist operating system built from the ground up.</h3>
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
![Platform: x86_64](https://img.shields.io/badge/Platform-x86_64-lightgrey)
![Status: Active](https://img.shields.io/badge/Status-Active-brightgreen)
![GitHub all releases](https://img.shields.io/github/downloads/boreddevnl/BoredOS/total?color=brightgreen)
<br />
[Docs](docs/README.md) · [Build & Run](docs/build/usage.md) · [AppDev SDK](docs/appdev/sdk_reference.md) · [Discord](https://discord.gg/J2BxWaFAgY) · [Support](https://buymeacoffee.com/boreddevhq)
</div>
---
![Screenshot](branding/screenshot.jpg)
> [!NOTE]
> The screenshot above may represent a previous build and is subject to change as the UI evolves.
---
## Features
- userspace
- JPG image support
- Disk manager
- Drag and drop mouse centered UI
- Customizable UI
- Basic Networking Stack
- Bored WM
- FAT32 filesystem
- 64-bit long mode support
- Multiboot2 compliant
- Text editor
- Markdown Viewer
- Minesweeper
- Markdown Viewer
- GUI Text editor
- Paint application
- IDT
- Ability to run on actual x86_64 hardware
- CLI
- (Limited) C Compiler
## Prerequisites
### Kernel and Architecture
- **Long Mode Architecture** — Native x86_64 implementation utilizing 64-bit address space and registers
- **Symmetric Multi-Processing** — Scalable multi-core support with IPI-based scheduling and synchronization
- **Advanced Memory Management** — Custom slab allocator with object pooling and efficient physical/virtual page mapping
- **Hybrid VFS Layer** — Unified filesystem interface supporting FAT32, TAR, ProcFS, and SysFS
- **Preemptive Multitasking** — Prioritized process scheduling with full context isolation
- **Hardware Abstraction** — Comprehensive driver support for PCI, AHCI, PS/2, and ACPI
To build BoredOS, you'll need the following tools installed:
### Graphical Desktop Environment
- **BoredWM** — High-performance window manager featuring window stacking, focus management, and drag-and-drop interactions
- **Typography Engine** — Integrated font manager with TrueType (TTF) support and efficient glyph caching
- **Rich Media Subsystem** — Native hardware-independent decoding for PNG, JPEG, GIF, BMP, and TGA formats
- **LibWidget Toolkit** — Native UI component library for rapid application development
- **x86_64 ELF Toolchain**: `x86_64-elf-gcc`, `x86_64-elf-ld`
- **NASM**: Netwide Assembler for compiling assembly code
- **xorriso**: For creating bootable ISO images
- **QEMU** (optional): For testing the kernel in an emulator
### Networking Stack
- **TCP/IP Integration** — Full lwIP-based network stack featuring DHCP, DNS, and Berkeley-style sockets
- **Network Services** — Integrated support for basic web browsing and real-time network telemetry
On macOS, you can install these using Homebrew:
```sh
brew install x86_64-elf-binutils x86_64-elf-gcc nasm xorriso qemu
```
## Building
Simply run `make` from the project root:
```sh
make
```
This will:
1. Compile all kernel C sources and assembly files
2. Link the kernel ELF binary
3. Generate a bootable ISO image (`boredos.iso`)
The build output is organized as follows:
- Compiled object files: `build/`
- ISO root filesystem: `iso_root/`
- Final ISO image: `boredos.iso`
## Running
### QEMU Emulation
Run the kernel in QEMU:
```sh
make run
```
Or manually:
```sh
qemu-system-x86_64 -m 2G -serial stdio -cdrom boredos.iso -boot d
```
### Running on Real Hardware
*Warning: This is at YOUR OWN RISK. This software comes with ZERO warranty and may break your system.*
1. **Create bootable USB**: Use [Balena Etcher](https://www.balena.io/etcher/) to flash `boredos.iso` to a USB drive
2. **Prepare the system**:
- Enable legacy (BIOS) boot in your system BIOS/UEFI settings
- Disable Secure Boot if needed
3. **Boot**: Insert the USB drive and select it in the boot menu during startup
**Networking requires an Intel E1000 network card or similar while using Ethernet.**
4. **Tested Hardware**:
- HP EliteDesk 705 G4 DM (AMD Ryzen 5 PRO 2400G, Radeon Vega) **Tested, no networking.**
- Lenovo ThinkPad A475 20KL002VMH (AMD Pro A12-8830B, Radeon R7) **Tested, no networking.**
- Acer Aspire E5-573-311M (Intel Core i3-5005U, Intel HD Graphics) **Tested, no networking.**
### Application Ecosystem
| Category | Applications |
|----------|--------------|
| Productivity | Text Editor, Markdown Viewer, BoredWord Processor, Web Browser, Calculator |
| Development | TCC (Tiny C Compiler), Lua|
| System | Explorer (File Manager), Task Manager, System Monitor, Graphing Utility |
| Games | doomgeneric, Minesweeper, 2048, Snake |
## Project Structure
- `src/kernel/` - Main kernel implementation
- `boot.asm` - Boot assembly code
- `main.c` - Kernel entry point
- `*.c / *.h` - Core kernel modules (graphics, interrupts, filesystem, etc.)
- `cli_apps/` - Command-line applications
- `build/` - Compiled object files (generated during build)
- `iso_root/` - ISO filesystem layout (generated during build)
- `limine/` - Limine bootloader files (downloaded automatically)
- `linker.ld` - Linker script for x86_64 ELF
- `limine.conf` - Limine bootloader configuration
- `Makefile` - Build configuration and targets
---
## 📚 Documentation
###
###
| Guide | Description |
|-------|-------------|
| [Documentation Index](docs/README.md) | Start here! |
| [Architecture Overview](docs/architecture/README.md) | Deep dive into the kernel |
| [Building and Running](docs/build/usage.md) | Set up your build environment |
| [AppDev SDK](docs/appdev/custom_apps.md) | Build your own apps for BoredOS |
<h2 align="left">Help me brew some coffee! ☕️</h2>
---
###
<p align="left">
If you enjoy this project, and like what i'm doing here, consider buying me a coffee!
<br><br>
<a href="https://buymeacoffee.com/boreddevnl" target="_blank">
## Contributors
<table>
<tr>
<td align="center">
<a href="https://github.com/boreddevnl">
<img src="https://github.com/boreddevnl.png?size=80" width="60" /><br />
<sub><b>BoredDevNL</b></sub>
</a><br />
Creator & Lead Maintainer
</td>
<td align="center">
<a href="https://github.com/Lluciocc">
<img src="https://github.com/Lluciocc.png?size=80" width="60" /><br />
<sub><b>Lluciocc</b></sub>
</a><br />
Maintainer
</td>
<td align="center">
<a href="https://github.com/Mellurboo">
<img src="https://github.com/Mellurboo.png?size=80" width="60" /><br />
<sub><b>Mellurboo</b></sub>
</a><br />
Contributor
</td>
<td align="center">
<a href="https://github.com/Artemix1508">
<img src="https://github.com/Artemix1508.png?size=80" width="60" /><br />
<sub><b>Artemix1508</b></sub>
</a><br />
Artwork
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/zeyadhost">
<img src="https://github.com/zeyadhost.png?size=80" width="60" /><br />
<sub><b>Zeyadhost</b></sub>
</a><br />
Contributor
</td>
<td align="center">
<a href="https://github.com/naplon74">
<img src="https://github.com/naplon74.png?size=80" width="60" /><br />
<sub><b>Naplon74</b></sub>
</a><br />
Artwork
</td>
<td align="center">
<a href="https://github.com/pixelyblah">
<img src="https://github.com/pixelyblah.png?size=80" width="60" /><br />
<sub><b>pixelyblah</b></sub>
</a><br />
Artwork
</td>
<td align="center">
<a href="https://github.com/qwroffc">
<img src="https://github.com/qwroffc.png?size=80" width="60" /><br />
<sub><b>qwroffc</b></sub>
</a><br />
Artwork
</td>
</tr>
</table>
---
## ☕ Support the Journey
If you find BoredOS interesting or useful, consider fueling development with a coffee!
<a href="https://buymeacoffee.com/boreddevhq" target="_blank">
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="50" style="border-radius: 8px;" />
</a>
</p>
###
---
## History
## This project was previously labeled as "BrewKernel"
Brewkernel was a text only very simple (and messy) project i started 3 years ago. It was my first work in OSDev and i absolutely loved it. It sadly just got too messy and i myself couldn't understand my own code anymore. About a year ago i started work on BoredOS, and pushed a *"working"* version of it a few days ago as of writing this *(Feb. 10 2026)*
Brewkernel has already been deprecated and will not be accepting any pull requests or fix any issues as it is now a public archive.
Thanks to everyone who helped me with Brewkernel, even if it were just ideas, and intend to keep working on this for the forseeable future!
**BoredOS** is the successor to **[BrewKernel](https://github.com/boreddevnl/brewkernel)**, a project started in 2023. BrewKernel served as the foundational learning ground but has since been officially deprecated and archived — it no longer receives updates, bug fixes, or pull request reviews.
BoredOS is a complete architectural reboot, applying years of lessons learned to build a cleaner, more modular, and more capable system.
> [!IMPORTANT]
> Please direct all issues, discussions, and contributions to this repository. Legacy BrewKernel code is preserved for historical purposes only and is not compatible with BoredOS.
---
## License
Copyright (C) 2024-2026 boreddevnl
**Copyright (C) 20232026 boreddevnl**
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Distributed under the **GNU General Public License v3**. See [`LICENSE`](LICENSE) for details.
NOTICE
------
This product includes software developed by Chris ("boreddevnl") as part of the BoredOS (Previously Brewkernel/BrewOS) project.
Copyright (C) 20242026 Chris / boreddevnl (previously boreddevhq)
All source files in this repository contain copyright and license
headers that must be preserved in redistributions and derivative works.
If you distribute or modify this project (in whole or in part),
you MUST:
- Retain all copyright and license headers at the top of each file.
- Include this NOTICE file along with any redistributions or
derivative works.
- Provide clear attribution to the original author in documentation
or credits where appropriate.
The above attribution requirements are informational and intended to
ensure proper credit is given. They do not alter or supersede the
terms of the GNU General Public License (GPL), which governs this work.
> [!IMPORTANT]
> You must retain all copyright headers and include the original attribution in any redistributions or derivative works. See the [`NOTICE`](NOTICE) file for more details.

Binary file not shown.

View File

@@ -1,4 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 130" width="100%">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 415 130" width="100%">
<style>
text {
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
branding/bOS10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
branding/bOS11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
branding/bOS12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
branding/bOS13.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
branding/bOS14.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
branding/bOS9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

BIN
branding/banner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

BIN
branding/screenshot.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

BIN
branding/splash.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

533
build.log
View File

@@ -1,533 +0,0 @@
mkdir -p build
mkdir -p build
Building Limine host utility...
make[1]: Nothing to be done for `all'.
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/cmd.c -o build/cmd.o
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/disk_manager.c -o build/disk_manager.o
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/e1000.c -o build/e1000.o
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/e1000_netif.c -o build/e1000_netif.o
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/elf.c -o build/elf.o
src/kernel/elf.c:12:13: warning: 'print_hex' defined but not used [-Wunused-function]
12 | static void print_hex(uint64_t n) {
| ^~~~~~~~~
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/explorer.c -o build/explorer.o
src/kernel/explorer.c: In function 'explorer_draw_file_icon':
src/kernel/explorer.c:887:73: warning: unused parameter 'color' [-Wunused-parameter]
887 | static void explorer_draw_file_icon(int x, int y, bool is_dir, uint32_t color, const char *filename, const char *current_path) {
| ~~~~~~~~~^~~~~
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/fat32.c -o build/fat32.o
src/kernel/fat32.c: In function 'fat32_normalize_path':
src/kernel/fat32.c:151:10: warning: unused variable 'drive' [-Wunused-variable]
151 | char drive = parse_drive_from_path(&p);
| ^~~~~
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/font_manager.c -o build/font_manager.o
In file included from src/kernel/font_manager.c:4:
src/kernel/stb_truetype.h: In function 'stbtt_FreeShape':
src/kernel/stb_truetype.h:2672:54: warning: unused parameter 'info' [-Wunused-parameter]
2672 | STBTT_DEF void stbtt_FreeShape(const stbtt_fontinfo *info, stbtt_vertex *v)
| ~~~~~~~~~~~~~~~~~~~~~~^~~~
src/kernel/stb_truetype.h: In function 'stbtt__hheap_alloc':
src/kernel/stb_truetype.h:2770:70: warning: unused parameter 'userdata' [-Wunused-parameter]
2770 | static void *stbtt__hheap_alloc(stbtt__hheap *hh, size_t size, void *userdata)
| ~~~~~~^~~~~~~~
src/kernel/stb_truetype.h: In function 'stbtt__hheap_cleanup':
src/kernel/stb_truetype.h:2797:58: warning: unused parameter 'userdata' [-Wunused-parameter]
2797 | static void stbtt__hheap_cleanup(stbtt__hheap *hh, void *userdata)
| ~~~~~~^~~~~~~~
src/kernel/stb_truetype.h: In function 'stbtt_FlattenCurves':
src/kernel/stb_truetype.h:3618:154: warning: unused parameter 'userdata' [-Wunused-parameter]
3618 | static stbtt__point *stbtt_FlattenCurves(stbtt_vertex *vertices, int num_verts, float objspace_flatness, int **contour_lengths, int *num_contours, void *userdata)
| ~~~~~~^~~~~~~~
src/kernel/stb_truetype.h: In function 'stbtt_FreeBitmap':
src/kernel/stb_truetype.h:3708:62: warning: unused parameter 'userdata' [-Wunused-parameter]
3708 | STBTT_DEF void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata)
| ~~~~~~^~~~~~~~
src/kernel/stb_truetype.h: In function 'stbtt_FreeSDF':
src/kernel/stb_truetype.h:4767:59: warning: unused parameter 'userdata' [-Wunused-parameter]
4767 | STBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, void *userdata)
| ~~~~~~^~~~~~~~
src/kernel/font_manager.c: In function 'font_manager_load':
src/kernel/font_manager.c:93:9: warning: unused variable 'read' [-Wunused-variable]
93 | int read = fat32_read(fh, buffer, fsize);
| ^~~~
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/gdt.c -o build/gdt.o
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/graphics.c -o build/graphics.o
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/idt.c -o build/idt.o
src/kernel/idt.c: In function 'pic_remap':
src/kernel/idt.c:110:17: warning: variable 'a2' set but not used [-Wunused-but-set-variable]
110 | uint8_t a1, a2;
| ^~
src/kernel/idt.c:110:13: warning: variable 'a1' set but not used [-Wunused-but-set-variable]
110 | uint8_t a1, a2;
| ^~
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/kutils.c -o build/kutils.o
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/licensewr.c -o build/licensewr.o
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip_port.c -o build/lwip_port.o
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/main.c -o build/main.o
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/memory_manager.c -o build/memory_manager.o
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/nanojpeg.c -o build/nanojpeg.o
src/kernel/nanojpeg.c: In function 'njGetVLC':
src/kernel/nanojpeg.c:686:24: warning: left shift of negative value [-Wshift-negative-value]
686 | value += ((-1) << bits) + 1;
| ^~
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/network.c -o build/network.o
src/kernel/network.c: In function 'network_dhcp_acquire':
src/kernel/network.c:181:9: warning: unused variable 'loops' [-Wunused-variable]
181 | int loops = 0;
| ^~~~~
src/kernel/network.c: In function 'network_init':
src/kernel/network.c:97:9: warning: 'ip.bytes[0]' may be used uninitialized [-Wmaybe-uninitialized]
97 | k_itoa(ip.bytes[0], buf); serial_write(buf); serial_write(".");
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/kernel/network.c:92:24: note: 'ip.bytes[0]' was declared here
92 | ipv4_address_t ip;
| ^~
src/kernel/network.c:98:9: warning: 'ip.bytes[1]' may be used uninitialized [-Wmaybe-uninitialized]
98 | k_itoa(ip.bytes[1], buf); serial_write(buf); serial_write(".");
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/kernel/network.c:92:24: note: 'ip.bytes[1]' was declared here
92 | ipv4_address_t ip;
| ^~
src/kernel/network.c:99:9: warning: 'ip.bytes[2]' may be used uninitialized [-Wmaybe-uninitialized]
99 | k_itoa(ip.bytes[2], buf); serial_write(buf); serial_write(".");
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/kernel/network.c:92:24: note: 'ip.bytes[2]' was declared here
92 | ipv4_address_t ip;
| ^~
src/kernel/network.c:100:9: warning: 'ip.bytes[3]' may be used uninitialized [-Wmaybe-uninitialized]
100 | k_itoa(ip.bytes[3], buf); serial_write(buf); serial_write("\n");
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/kernel/network.c:92:24: note: 'ip.bytes[3]' was declared here
92 | ipv4_address_t ip;
| ^~
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/nj_kernel.c -o build/nj_kernel.o
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/paging.c -o build/paging.o
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/panic.c -o build/panic.o
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/pci.c -o build/pci.o
src/kernel/pci.c: In function 'pci_enumerate_devices':
src/kernel/pci.c:52:31: warning: comparison is always true due to limited range of data type [-Wtype-limits]
52 | for (uint8_t bus = 0; bus < 256 && count < max_devices; bus++) {
| ^
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/platform.c -o build/platform.o
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/process.c -o build/process.o
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/ps2.c -o build/ps2.o
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/rtc.c -o build/rtc.o
src/kernel/rtc.c: In function 'rtc_get_datetime':
src/kernel/rtc.c:28:13: warning: unused variable 'last_century' [-Wunused-variable]
28 | uint8_t last_century;
| ^~~~~~~~~~~~
src/kernel/rtc.c:21:13: warning: unused variable 'century' [-Wunused-variable]
21 | uint8_t century;
| ^~~~~~~
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/syscall.c -o build/syscall.o
src/kernel/syscall.c: In function 'syscall_handler_inner':
src/kernel/syscall.c:399:28: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
399 | float scale = *(float*)&scale_bits;
| ^~~~~~~~~~~~~~~~~~~
src/kernel/syscall.c:509:28: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
509 | float scale = *(float*)&scale_bits;
| ^~~~~~~~~~~~~~~~~~~
src/kernel/syscall.c:528:28: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
528 | float scale = *(float*)&scale_bits;
| ^~~~~~~~~~~~~~~~~~~
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/vm.c -o build/vm.o
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/wallpaper.c -o build/wallpaper.o
src/kernel/wallpaper.c:83:13: warning: 'serial_num' defined but not used [-Wunused-function]
83 | static void serial_num(int n) {
| ^~~~~~~~~~
mkdir -p build/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/wm.c -o build/wm.o
src/kernel/wm.c: In function 'wm_handle_click':
src/kernel/wm.c:1570:29: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
1570 | if (col < 0) col = 0; if (row < 0) row = 0;
| ^~
src/kernel/wm.c:1570:51: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
1570 | if (col < 0) col = 0; if (row < 0) row = 0;
| ^~
src/kernel/wm.c: In function 'wm_handle_mouse':
src/kernel/wm.c:2214:41: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
2214 | if (col < 0) col = 0; if (row < 0) row = 0;
| ^~
src/kernel/wm.c:2214:63: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
2214 | if (col < 0) col = 0; if (row < 0) row = 0;
| ^~
src/kernel/wm.c: At top level:
src/kernel/wm.c:1124:13: warning: 'erase_cursor' defined but not used [-Wunused-function]
1124 | static void erase_cursor(int x, int y) {
| ^~~~~~~~~~~~
src/kernel/wm.c:1014:13: warning: 'draw_dock_editor' defined but not used [-Wunused-function]
1014 | static void draw_dock_editor(int x, int y) {
| ^~~~~~~~~~~~~~~~
src/kernel/wm.c:87:13: warning: 'cursor_visible' defined but not used [-Wunused-variable]
87 | static bool cursor_visible = true;
| ^~~~~~~~~~~~~~
src/kernel/wm.c:84:12: warning: 'desktop_refresh_timer' defined but not used [-Wunused-variable]
84 | static int desktop_refresh_timer = 0;
| ^~~~~~~~~~~~~~~~~~~~~
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/altcp.c -o build/lwip/core/altcp.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/altcp_alloc.c -o build/lwip/core/altcp_alloc.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/altcp_tcp.c -o build/lwip/core/altcp_tcp.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/def.c -o build/lwip/core/def.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/dns.c -o build/lwip/core/dns.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/inet_chksum.c -o build/lwip/core/inet_chksum.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/init.c -o build/lwip/core/init.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/ip.c -o build/lwip/core/ip.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/mem.c -o build/lwip/core/mem.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/memp.c -o build/lwip/core/memp.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/netif.c -o build/lwip/core/netif.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/pbuf.c -o build/lwip/core/pbuf.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/raw.c -o build/lwip/core/raw.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/stats.c -o build/lwip/core/stats.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/sys.c -o build/lwip/core/sys.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/tcp.c -o build/lwip/core/tcp.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/tcp_in.c -o build/lwip/core/tcp_in.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/tcp_out.c -o build/lwip/core/tcp_out.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/timeouts.c -o build/lwip/core/timeouts.o
mkdir -p build/lwip/core/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/udp.c -o build/lwip/core/udp.o
mkdir -p build/lwip/core/ipv4/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/ipv4/autoip.c -o build/lwip/core/ipv4/autoip.o
mkdir -p build/lwip/core/ipv4/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/ipv4/dhcp.c -o build/lwip/core/ipv4/dhcp.o
mkdir -p build/lwip/core/ipv4/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/ipv4/etharp.c -o build/lwip/core/ipv4/etharp.o
mkdir -p build/lwip/core/ipv4/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/ipv4/icmp.c -o build/lwip/core/ipv4/icmp.o
mkdir -p build/lwip/core/ipv4/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/ipv4/igmp.c -o build/lwip/core/ipv4/igmp.o
mkdir -p build/lwip/core/ipv4/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/ipv4/ip4.c -o build/lwip/core/ipv4/ip4.o
mkdir -p build/lwip/core/ipv4/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/ipv4/ip4_addr.c -o build/lwip/core/ipv4/ip4_addr.o
mkdir -p build/lwip/core/ipv4/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/core/ipv4/ip4_frag.c -o build/lwip/core/ipv4/ip4_frag.o
mkdir -p build/lwip/netif/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/netif/ethernet.c -o build/lwip/netif/ethernet.o
mkdir -p build/lwip/netif/
x86_64-elf-gcc -g -O2 -pipe -Wall -Wextra -std=gnu11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m64 -march=x86-64 -msse -msse2 -mstackrealign -mno-red-zone -Isrc/kernel -Isrc/kernel/lwip -c src/kernel/lwip/netif/bridgeif.c -o build/lwip/netif/bridgeif.o
nasm -f elf64 src/kernel/boot.asm -o build/boot.o
nasm -f elf64 src/kernel/gdt_asm.asm -o build/gdt_asm.o
nasm -f elf64 src/kernel/interrupts.asm -o build/interrupts.o
nasm -f elf64 src/kernel/process_asm.asm -o build/process_asm.o
nasm -f elf64 src/kernel/syscalls.asm -o build/syscalls.o
nasm -f elf64 src/kernel/test_syscall.asm -o build/test_syscall.o
nasm -f elf64 src/kernel/user_test.asm -o build/user_test.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -pie --no-dynamic-linker -z text -z max-page-size=0x1000 -T linker.ld -o build/boredos.elf build/cmd.o build/disk_manager.o build/e1000.o build/e1000_netif.o build/elf.o build/explorer.o build/fat32.o build/font_manager.o build/gdt.o build/graphics.o build/idt.o build/kutils.o build/licensewr.o build/lwip_port.o build/main.o build/memory_manager.o build/nanojpeg.o build/network.o build/nj_kernel.o build/paging.o build/panic.o build/pci.o build/platform.o build/process.o build/ps2.o build/rtc.o build/syscall.o build/vm.o build/wallpaper.o build/wm.o build/lwip/core/altcp.o build/lwip/core/altcp_alloc.o build/lwip/core/altcp_tcp.o build/lwip/core/def.o build/lwip/core/dns.o build/lwip/core/inet_chksum.o build/lwip/core/init.o build/lwip/core/ip.o build/lwip/core/mem.o build/lwip/core/memp.o build/lwip/core/netif.o build/lwip/core/pbuf.o build/lwip/core/raw.o build/lwip/core/stats.o build/lwip/core/sys.o build/lwip/core/tcp.o build/lwip/core/tcp_in.o build/lwip/core/tcp_out.o build/lwip/core/timeouts.o build/lwip/core/udp.o build/lwip/core/ipv4/autoip.o build/lwip/core/ipv4/dhcp.o build/lwip/core/ipv4/etharp.o build/lwip/core/ipv4/icmp.o build/lwip/core/ipv4/igmp.o build/lwip/core/ipv4/ip4.o build/lwip/core/ipv4/ip4_addr.o build/lwip/core/ipv4/ip4_frag.o build/lwip/netif/ethernet.o build/lwip/netif/bridgeif.o build/boot.o build/gdt_asm.o build/interrupts.o build/process_asm.o build/syscalls.o build/test_syscall.o build/user_test.o
x86_64-elf-ld: warning: build/boredos.elf has a LOAD segment with RWX permissions
/Library/Developer/CommandLineTools/usr/bin/make -C src/kernel/userland
mkdir -p bin
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c libc/libui.c -o bin/libui.o
libc/libui.c: In function 'ui_draw_string_scaled':
libc/libui.c:64:28: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
64 | uint32_t scale_bits = *(uint32_t*)&scale;
| ^~~~~~~~~~~~~~~~~
libc/libui.c: In function 'ui_get_string_width_scaled':
libc/libui.c:70:28: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
70 | uint32_t scale_bits = *(uint32_t*)&scale;
| ^~~~~~~~~~~~~~~~~
libc/libui.c: In function 'ui_get_font_height_scaled':
libc/libui.c:75:28: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
75 | uint32_t scale_bits = *(uint32_t*)&scale;
| ^~~~~~~~~~~~~~~~~
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c libc/stdlib.c -o bin/stdlib.o
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c libc/syscall.c -o bin/syscall.o
nasm -f elf64 crt0.asm -o bin/crt0.o
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c about.c -o bin/about.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/about.o -o bin/about.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c beep.c -o bin/beep.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/beep.o -o bin/beep.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c browser.c -o bin/browser.o
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c nanojpeg.c -o bin/nanojpeg.o
nanojpeg.c: In function 'njGetVLC':
nanojpeg.c:685:24: warning: left shift of negative value [-Wshift-negative-value]
685 | value += ((-1) << bits) + 1;
| ^~
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/browser.o bin/nanojpeg.o -o bin/browser.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c calculator.c -o bin/calculator.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/calculator.o -o bin/calculator.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c cat.c -o bin/cat.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/cat.o -o bin/cat.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c cc.c -o bin/cc.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/cc.o -o bin/cc.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c clear.c -o bin/clear.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/clear.o -o bin/clear.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c clock.c -o bin/clock.o
clock.c: In function 'clock_paint':
clock.c:89:36: warning: comparison of integer expressions of different signedness: 'tab_t' and 'int' [-Wsign-compare]
89 | uint32_t bg = (current_tab == i) ? COLOR_TAB_ACTIVE : COLOR_DARK_PANEL;
| ^~
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/clock.o -o bin/clock.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c cowsay.c -o bin/cowsay.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/cowsay.o -o bin/cowsay.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c cp.c -o bin/cp.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/cp.o -o bin/cp.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c crash.c -o bin/crash.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/crash.o -o bin/crash.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c curl.c -o bin/curl.o
curl.c: In function 'main':
curl.c:60:9: warning: unused variable 'host_len' [-Wunused-variable]
60 | int host_len = i;
| ^~~~~~~~
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/curl.o -o bin/curl.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c date.c -o bin/date.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/date.o -o bin/date.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c echo.c -o bin/echo.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/echo.o -o bin/echo.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c hello.c -o bin/hello.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/hello.o -o bin/hello.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c help.c -o bin/help.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/help.o -o bin/help.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c ls.c -o bin/ls.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/ls.o -o bin/ls.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c man.c -o bin/man.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/man.o -o bin/man.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c markdown.c -o bin/markdown.o
markdown.c:59:12: warning: 'md_strncpy' defined but not used [-Wunused-function]
59 | static int md_strncpy(char *dest, const char *src, int n) {
| ^~~~~~~~~~
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/markdown.o -o bin/markdown.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c math.c -o bin/math.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/math.o -o bin/math.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c meminfo.c -o bin/meminfo.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/meminfo.o -o bin/meminfo.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c minesweeper.c -o bin/minesweeper.o
minesweeper.c: In function 'minesweeper_handle_click':
minesweeper.c:195:50: warning: unused parameter 'win' [-Wunused-parameter]
195 | static void minesweeper_handle_click(ui_window_t win, int x, int y, int button) {
| ~~~~~~~~~~~~^~~
minesweeper.c: At top level:
minesweeper.c:17:13: warning: 'debug_print' defined but not used [-Wunused-function]
17 | static void debug_print(const char *msg) {
| ^~~~~~~~~~~
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/minesweeper.o -o bin/minesweeper.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c mkdir.c -o bin/mkdir.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/mkdir.o -o bin/mkdir.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c mv.c -o bin/mv.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/mv.o -o bin/mv.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c net.c -o bin/net.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/net.o -o bin/net.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c notepad.c -o bin/notepad.o
notepad.c: In function 'notepad_key':
notepad.c:149:37: warning: unused parameter 'win' [-Wunused-parameter]
149 | static void notepad_key(ui_window_t win, int h, char c) {
| ~~~~~~~~~~~~^~~
notepad.c: In function 'main':
notepad.c:234:14: warning: unused parameter 'argc' [-Wunused-parameter]
234 | int main(int argc, char **argv) {
| ~~~~^~~~
notepad.c:234:27: warning: unused parameter 'argv' [-Wunused-parameter]
234 | int main(int argc, char **argv) {
| ~~~~~~~^~~~
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/notepad.o -o bin/notepad.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c paint.c -o bin/paint.o
paint.c: In function 'wm_show_message':
paint.c:156:41: warning: unused parameter 'title' [-Wunused-parameter]
156 | static void wm_show_message(const char *title, const char *msg) {
| ~~~~~~~~~~~~^~~~~
paint.c:156:60: warning: unused parameter 'msg' [-Wunused-parameter]
156 | static void wm_show_message(const char *title, const char *msg) {
| ~~~~~~~~~~~~^~~
paint.c: At top level:
paint.c:38:13: warning: 'debug_print' defined but not used [-Wunused-function]
38 | static void debug_print(const char *msg) {
| ^~~~~~~~~~~
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/paint.o -o bin/paint.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c pci_list.c -o bin/pci_list.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/pci_list.o -o bin/pci_list.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c ping.c -o bin/ping.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/ping.o -o bin/ping.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c pwd.c -o bin/pwd.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/pwd.o -o bin/pwd.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c reboot.c -o bin/reboot.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/reboot.o -o bin/reboot.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c rm.c -o bin/rm.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/rm.o -o bin/rm.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c settings.c -o bin/settings.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/settings.o bin/nanojpeg.o -o bin/settings.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c shutdown.c -o bin/shutdown.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/shutdown.o -o bin/shutdown.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c sweden.c -o bin/sweden.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/sweden.o -o bin/sweden.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c sysfetch.c -o bin/sysfetch.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/sysfetch.o -o bin/sysfetch.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c telnet.c -o bin/telnet.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/telnet.o -o bin/telnet.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c touch.c -o bin/touch.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/touch.o -o bin/touch.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c txtedit.c -o bin/txtedit.o
txtedit.c: In function 'editor_paint':
txtedit.c:330:10: warning: unused variable 'status_text' [-Wunused-variable]
330 | char status_text[128];
| ^~~~~~~~~~~
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/txtedit.o -o bin/txtedit.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c uptime.c -o bin/uptime.o
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/uptime.o -o bin/uptime.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -c viewer.c -o bin/viewer.o
viewer.c: In function 'viewer_handle_click':
viewer.c:104:45: warning: unused parameter 'win' [-Wunused-parameter]
104 | static void viewer_handle_click(ui_window_t win, int x, int y) {
| ~~~~~~~~~~~~^~~
x86_64-elf-ld -m elf_x86_64 -nostdlib -static -no-pie -Ttext=0x40000000 --no-dynamic-linker -z text -z max-page-size=0x1000 -e _start bin/libui.o bin/stdlib.o bin/syscall.o bin/crt0.o bin/viewer.o bin/nanojpeg.o -o bin/viewer.elf
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -Wno-error -Idoom -c doom/am_map.c -o bin/am_map.o
doom/am_map.c: In function 'AM_initVariables':
doom/am_map.c:427:5: warning: missing initializer for field 'data4' of 'event_t' [-Wmissing-field-initializers]
427 | static event_t st_notify = { ev_keyup, AM_MSGENTERED, 0, 0 };
| ^~~~~~
In file included from doom/st_stuff.h:25,
from doom/am_map.c:27:
doom/d_event.h:67:30: note: 'data4' declared here
67 | int data1, data2, data3, data4;
| ^~~~~
doom/am_map.c: In function 'AM_Stop':
doom/am_map.c:543:5: warning: missing initializer for field 'data4' of 'event_t' [-Wmissing-field-initializers]
543 | static event_t st_notify = { 0, ev_keyup, AM_MSGEXITED, 0 };
| ^~~~~~
doom/d_event.h:67:30: note: 'data4' declared here
67 | int data1, data2, data3, data4;
| ^~~~~
doom/am_map.c: In function 'AM_drawThings':
doom/am_map.c:1293:9: warning: unused parameter 'colorrange' [-Wunused-parameter]
1293 | int colorrange)
| ~~~~~~^~~~~~~~~~
x86_64-elf-gcc -Wall -Wextra -std=gnu11 -ffreestanding -O2 -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -m64 -march=x86-64 -mno-80387 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Ilibc -Wno-error -Idoom -c doom/boredos_libc.c -o bin/boredos_libc.o
doom/boredos_libc.c:6:27: error: 'false' undeclared here (not in a function)
6 | static FILE _stderr = {2, false, false};
| ^~~~~
doom/boredos_libc.c:3:1: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
2 | #include <syscall.h>
+++ |+#include <stdbool.h>
3 |
doom/boredos_libc.c:6:1: warning: missing initializer for field 'eof' of 'FILE' [-Wmissing-field-initializers]
6 | static FILE _stderr = {2, false, false};
| ^~~~~~
In file included from doom/boredos_libc.c:1:
doom/boredos_libc.h:17:9: note: 'eof' declared here
17 | int eof;
| ^~~
doom/boredos_libc.c:7:1: warning: missing initializer for field 'eof' of 'FILE' [-Wmissing-field-initializers]
7 | static FILE _stdout = {1, false, false};
| ^~~~~~
doom/boredos_libc.h:17:9: note: 'eof' declared here
17 | int eof;
| ^~~
doom/boredos_libc.c: In function 'fread':
doom/boredos_libc.c:37:25: error: 'true' undeclared (first use in this function)
37 | stream->error = true;
| ^~~~
doom/boredos_libc.c:37:25: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
doom/boredos_libc.c:37:25: note: each undeclared identifier is reported only once for each function it appears in
doom/boredos_libc.c: In function 'fwrite':
doom/boredos_libc.c:52:25: error: 'true' undeclared (first use in this function)
52 | stream->error = true;
| ^~~~
doom/boredos_libc.c:52:25: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
doom/boredos_libc.c: In function 'rename':
doom/boredos_libc.c:73:24: warning: unused parameter 'oldpath' [-Wunused-parameter]
73 | int rename(const char *oldpath, const char *newpath) {
| ~~~~~~~~~~~~^~~~~~~
doom/boredos_libc.c:73:45: warning: unused parameter 'newpath' [-Wunused-parameter]
73 | int rename(const char *oldpath, const char *newpath) {
| ~~~~~~~~~~~~^~~~~~~
doom/boredos_libc.c: In function 'mkdir':
doom/boredos_libc.c:94:37: warning: unused parameter 'mode' [-Wunused-parameter]
94 | int mkdir(const char *pathname, int mode) {
| ~~~~^~~~
doom/boredos_libc.c: In function 'access':
doom/boredos_libc.c:98:38: warning: unused parameter 'mode' [-Wunused-parameter]
98 | int access(const char *pathname, int mode) {
| ~~~~^~~~
doom/boredos_libc.c: In function 'fprintf':
doom/boredos_libc.c:179:19: warning: unused parameter 'stream' [-Wunused-parameter]
179 | int fprintf(FILE *stream, const char *format, ...) { return 0; }
| ~~~~~~^~~~~~
doom/boredos_libc.c:179:39: warning: unused parameter 'format' [-Wunused-parameter]
179 | int fprintf(FILE *stream, const char *format, ...) { return 0; }
| ~~~~~~~~~~~~^~~~~~
doom/boredos_libc.c: In function 'sprintf':
doom/boredos_libc.c:180:19: warning: unused parameter 'str' [-Wunused-parameter]
180 | int sprintf(char *str, const char *format, ...) { return 0; }
| ~~~~~~^~~
doom/boredos_libc.c:180:36: warning: unused parameter 'format' [-Wunused-parameter]
180 | int sprintf(char *str, const char *format, ...) { return 0; }
| ~~~~~~~~~~~~^~~~~~
doom/boredos_libc.c: In function 'snprintf':
doom/boredos_libc.c:181:20: warning: unused parameter 'str' [-Wunused-parameter]
181 | int snprintf(char *str, size_t size, const char *format, ...) { return 0; }
| ~~~~~~^~~
doom/boredos_libc.c:181:32: warning: unused parameter 'size' [-Wunused-parameter]
181 | int snprintf(char *str, size_t size, const char *format, ...) { return 0; }
| ~~~~~~~^~~~
doom/boredos_libc.c:181:50: warning: unused parameter 'format' [-Wunused-parameter]
181 | int snprintf(char *str, size_t size, const char *format, ...) { return 0; }
| ~~~~~~~~~~~~^~~~~~
doom/boredos_libc.c: In function 'vsnprintf':
doom/boredos_libc.c:182:21: warning: unused parameter 'str' [-Wunused-parameter]
182 | int vsnprintf(char *str, size_t size, const char *format, va_list ap) { return 0; }
| ~~~~~~^~~
doom/boredos_libc.c:182:33: warning: unused parameter 'size' [-Wunused-parameter]
182 | int vsnprintf(char *str, size_t size, const char *format, va_list ap) { return 0; }
| ~~~~~~~^~~~
doom/boredos_libc.c:182:51: warning: unused parameter 'format' [-Wunused-parameter]
182 | int vsnprintf(char *str, size_t size, const char *format, va_list ap) { return 0; }
| ~~~~~~~~~~~~^~~~~~
doom/boredos_libc.c:182:67: warning: unused parameter 'ap' [-Wunused-parameter]
182 | int vsnprintf(char *str, size_t size, const char *format, va_list ap) { return 0; }
| ~~~~~~~~^~
doom/boredos_libc.c: In function 'sscanf':
doom/boredos_libc.c:183:24: warning: unused parameter 'str' [-Wunused-parameter]
183 | int sscanf(const char *str, const char *format, ...) { return 0; }
| ~~~~~~~~~~~~^~~
doom/boredos_libc.c:183:41: warning: unused parameter 'format' [-Wunused-parameter]
183 | int sscanf(const char *str, const char *format, ...) { return 0; }
| ~~~~~~~~~~~~^~~~~~
make[1]: *** [bin/boredos_libc.o] Error 1
rm bin/pwd.o bin/minesweeper.o bin/ls.o bin/echo.o bin/pci_list.o bin/date.o bin/mkdir.o bin/help.o bin/markdown.o bin/cc.o bin/sweden.o bin/rm.o bin/notepad.o bin/man.o bin/clock.o bin/clear.o bin/cat.o bin/cp.o bin/paint.o bin/crash.o bin/reboot.o bin/beep.o bin/meminfo.o bin/net.o bin/calculator.o bin/cowsay.o bin/telnet.o bin/hello.o bin/math.o bin/curl.o bin/uptime.o bin/about.o bin/sysfetch.o bin/ping.o bin/mv.o bin/txtedit.o bin/touch.o bin/shutdown.o
make: *** [build/boredos.elf] Error 2

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
disk.img

Binary file not shown.

71
docs/README.md Normal file
View File

@@ -0,0 +1,71 @@
<div align="center">
<h1>BoredOS Documentation</h1>
<p><em>Internal guides, architecture, and application development.</em></p>
</div>
---
Welcome to the documentation for BoredOS! This directory contains detailed guides on how the OS functions, how to build it, and how to develop applications for it.
## Table of Contents
The documentation is organized into three main categories:
### 1. [Architecture](architecture/)
Explains the logical layout of the kernel and internal components.
#### System
- [`Core`](architecture/system/core.md): Kernel source layout and the boot process (Limine, Multiboot2).
- [`Processes & Scheduling`](architecture/system/processes.md): Multitasking, context switching, and ELF loading.
- [`Interrupts & Exceptions`](architecture/system/interrupts.md): IDT, GDT, and exception handling.
#### Memory
- [`Memory (PMM/VMM)`](architecture/memory/memory.md): Physical Memory Management and Virtual Memory Management.
- [`Memory Manager`](architecture/memory/memory_manager.md): Slab allocator and block allocator for kernel heap.
#### Storage & Filesystems
- [`Filesystem`](architecture/storage/filesystem.md): Virtual File System (VFS) and the RAM-based FAT32 simulation.
- [`AHCI Drivers`](architecture/storage/ahci_drivers.md): Hardware communication for block storage devices.
#### Network
- [`Network Stack`](architecture/network/network_stack.md): TCP/IP implementation and socket APIs.
- [`Network Drivers`](architecture/network/network_drivers.md): Hardware interaction for network cards (e.g. e1000).
#### Graphics
- [`Window Manager`](architecture/graphics/window_manager.md): Compositor, events, and overlapping windows.
- [`Rendering`](architecture/graphics/rendering.md): Framebuffer, font rendering, and image loading.
#### Hardware
- [`PCI`](architecture/hardware/pci.md): PCI bus enumeration and device binding.
- [`Input`](architecture/hardware/input.md): PS/2 Keyboard and Mouse input handling.
#### Misc
- [`Versioning`](architecture/versioning.md): The OS date-based version scheme (`YY.M[.x]`) and kernel semantic versioning (`MAJOR.MINOR.PATCH`).
### 2. [Building and Deployment](build/)
Instructions for compiling the OS from source.
- [`Toolchain`](build/toolchain.md): Prerequisites and cross-compiler setup (`x86_64-elf-gcc`, `nasm`, `xorriso`).
- [`Usage`](build/usage.md): Understanding the Makefile targets, QEMU emulation, and flashing to bare metal hardware.
### 3. [Application Development](appdev/)
The SDK and toolchain guides for creating your own `.elf` userland binaries.
- [`SDK Reference`](appdev/sdk_reference.md): Overview hub for SDK layout, includes, and links to detailed libc/syscall docs.
- [`Syscalls`](appdev/syscalls.md): Current syscall numbers, FS/SYSTEM command IDs, and wrapper guidance.
- [`libc Reference`](appdev/libc_reference.md): Current libc headers, implemented APIs, and behavior notes.
- [`UI API`](appdev/ui_api.md): Drawing on the screen, creating windows, and polling the event loop using `libui.h`.
- [`Widget API`](appdev/widget_api.md): High-level UI components like buttons, textboxes, and scrollbars using `libwidget.h`.
- [`Custom Apps`](appdev/custom_apps.md): A step-by-step tutorial on writing a new graphical C application, editing the Makefile, and bundling it into the ISO.
- [`ELF App Metadata`](appdev/elf_metadata.md): How to declare app icons and descriptions using source annotations, how the build system embeds them into `.note.boredos.app` ELF sections, and how the kernel reads them at runtime.
- [`Example Apps`](appdev/examples/README.md): A collection of sample C applications ranging from basic terminal output to advanced TCP networking.
- [`Grapher`](appdev/grapher.md): Full reference for the built-in mathematical graphing application — equation syntax, keyboard controls, architecture, and configuration.
- [`Native TCC`](appdev/tcc.md): How to use the Tiny C Compiler (TCC) to build and run C applications directly on BoredOS.
### 4. [Usage](usage/)
General guides on how to interact with the OS.
- [`Booting`](usage/booting.md): How to use the Limine bootloader and toggle kernel boot flags like `-v`.
- [`Desktop`](usage/desktop.md): Window management, shortcuts, and desktop interaction.
- [`Lumos`](usage/lumos.md): Using the system-wide search (`Shift + Ctrl + Space`).
- [`Terminal`](usage/terminal.md): Command line interface, redirection, and common commands.
- [`Launching Apps`](usage/launching_apps.md): Ways to launch files and applications, plus a software overview.
---

View File

@@ -0,0 +1,90 @@
<div align="center">
<h1>Creating a Custom App</h1>
<p><em>A step-by-step tutorial on writing a new graphical C application.</em></p>
</div>
---
This guide explains how to write a new "Hello World" application locally, compile it as an `.elf` binary into the `bin/` folder, and launch it inside BoredOS.
> [!TIP]
> **Looking for working code?** Check out the [Examples Directory](examples/README.md) for full source code demonstrating basic CLI, Windows, Animations, and TCP Networking.
## Step 1: Write the C Source
Applications reside entirely in the `src/userland/` directory. Create a new file, for example, `src/userland/gui/hello.c`.
> [!TIP]
> Group CLI apps into `src/userland/cli/` and windowed apps into `src/userland/gui/` for organization.
```c
// src/userland/gui/hello.c
#include <stdlib.h>
#include <libui.h>
#include <syscall.h>
int main(void) {
// Attempt to open a 300x200 window
ui_window_t wid = ui_window_create("My Custom App", 100, 100, 300, 200);
if (wid < 0) {
printf("Error creating window!\n");
return 1;
}
// Write text in center
ui_draw_string(wid, 50, 90, "Hello, BoredOS!!", 0xFFFFFFFF);
// Commit drawing to screen
ui_mark_dirty(wid, 0, 0, 300, 200);
gui_event_t event;
while (1) {
if (ui_get_event(wid, &event)) {
if (event.type == GUI_EVENT_CLOSE) {
break; // Exit loop if 'X' is clicked
}
}
sys_yield();
}
return 0; // Returning 0 smoothly exits the process via crt0.asm
}
```
## Step 2: Edit the Makefile
Now you need to tell the build system to compile `hello.c`. Fortunately, the `src/userland/Makefile` is designed to detect new C files largely automatically!
1. Open `src/userland/Makefile`.
2. Find the line specifying `APP_SOURCES_FULL`:
```make
APP_SOURCES_FULL = $(wildcard cli/*.c gui/*.c sys/*.c games/*.c *.c)
```
Since you placed the file in `gui/hello.c`, the wildcard logic will pick it up automatically.
3. The Makefile will generate `bin/hello.elf` during the build phase.
## Step 3: Bundle it into the OS
The main overarching `Makefile` (in the project root) takes binaries from `src/userland/bin/*.elf` and places them into the `iso_root/bin/` directory, while also adding them to `limine.conf` as loadable boot modules.
1. Go back to the root of the OS:
```sh
cd ../..
```
2. Compile the entire project to build the ISO and test in QEMU:
```sh
make clean && make run
```
## Step 4: Run it inside BoredOS
1. When BoredOS boots, launch the **Terminal** application.
2. The OS automatically maps built applications to standard shell commands. Simply type your application's filename (without the `.elf` extension).
3. Type `hello` in the terminal and press Enter.
4. Your custom window will appear!
> [!NOTE]
> You can also open your app by opening the file explorer, navigating to the `bin` directory, and double-clicking the executable.
---

307
docs/appdev/elf_metadata.md Normal file
View File

@@ -0,0 +1,307 @@
<div align="center">
<h1>ELF App Metadata</h1>
<p><em>How BoredOS embeds and reads application identity and icon data from <code>.elf</code> binaries.</em></p>
</div>
---
BoredOS supports embedding **application metadata** including a display name, short description, and icon paths directly inside `.elf` executables using a standard ELF NOTE section. The kernel reads this metadata at runtime to display correct icons in the file explorer and on the desktop, without requiring any external sidecar files.
## Overview
When an ELF binary is compiled for BoredOS, the build system automatically injects a special ELF NOTE entry into a dedicated section called `.note.boredos.app`. This note holds a packed C struct (`boredos_app_metadata_t`) containing the app's metadata.
At runtime, the Window Manager (`wm.c`) and File Explorer (`explorer.c`) call `app_metadata_get_primary_image()` to extract the primary icon path from any `.elf` file before rendering its icon. This allows each app to display its own distinct icon instead of the generic binary icon.
---
## The `boredos_app_metadata_t` Structure
Defined in [`src/sys/elf.h`](../../src/sys/elf.h):
```c
typedef struct __attribute__((packed)) {
uint32_t magic; // Must be BOREDOS_APP_METADATA_MAGIC (0x414d4431)
uint16_t version; // Must be BOREDOS_APP_METADATA_VERSION (1)
uint16_t image_count; // Number of valid icon paths (04)
uint16_t reserved; // Padding, set to 0
char app_name[BOREDOS_APP_METADATA_MAX_APP_NAME]; // Up to 63 chars + NUL
char description[BOREDOS_APP_METADATA_MAX_DESCRIPTION]; // Up to 191 chars + NUL
char images[BOREDOS_APP_METADATA_MAX_IMAGES][BOREDOS_APP_METADATA_MAX_IMAGE_PATH]; // Up to 4 icon paths
} boredos_app_metadata_t;
```
### Field Reference
| Field | Size | Description |
|---|---|---|
| `magic` | 4 bytes | Magic number `0x414D4431` — validates the struct is a real metadata blob. |
| `version` | 2 bytes | Schema version. Currently always `1`. |
| `image_count` | 2 bytes | How many entries in `images[]` are valid (04). |
| `reserved` | 2 bytes | Must be 0. Reserved for future use. |
| `app_name` | 64 bytes | Null-terminated display name of the app (e.g., `"Terminal"`). |
| `description` | 192 bytes | Null-terminated short description (e.g., `"Terminal shell and command runner."`). |
| `images[4][160]` | 640 bytes | Up to 4 absolute VFS paths to PNG icons. First entry is the primary icon. |
### Limits
| Constant | Value | Meaning |
|---|---|---|
| `BOREDOS_APP_METADATA_MAX_APP_NAME` | 64 | Max bytes for `app_name` including NUL |
| `BOREDOS_APP_METADATA_MAX_DESCRIPTION` | 192 | Max bytes for `description` including NUL |
| `BOREDOS_APP_METADATA_MAX_IMAGES` | 4 | Max number of icon paths |
| `BOREDOS_APP_METADATA_MAX_IMAGE_PATH` | 160 | Max bytes per icon path including NUL |
---
## The ELF NOTE Format
The metadata is stored inside a standard ELF NOTE entry (defined by `Elf64_Nhdr` in `elf.h`) within the `.note.boredos.app` section.
```
+------------------+
| Elf64_Nhdr | namesz, descsz, type
+------------------+
| name: "BOREDOS\0"| 8 bytes (sizeof BOREDOS_APP_NOTE_NAME)
+------------------+
| boredos_app_ | sizeof(boredos_app_metadata_t)
| metadata_t |
+------------------+
```
### Note Constants
| Constant | Value | Description |
|---|---|---|
| `BOREDOS_APP_NOTE_OWNER` | `"BOREDOS"` | The note owner/name string |
| `BOREDOS_APP_NOTE_SECTION` | `".note.boredos.app"` | ELF section name |
| `BOREDOS_APP_NOTE_TYPE` | `0x41505031` | Note type identifier (`"APP1"` in ASCII) |
| `BOREDOS_APP_METADATA_MAGIC` | `0x414D4431` | Metadata struct magic (`"AMD1"`) |
| `BOREDOS_APP_METADATA_VERSION` | `1` | Current schema version |
---
## Embedding Metadata into your applications
Developers declare metadata using **special comment annotations** at the top of their C source file. The build system reads these automatically during compilation.
```c
// BOREDOS_APP_DESC: My application's short description.
// BOREDOS_APP_ICONS: /Library/images/icons/colloid/my-icon.png
```
### `BOREDOS_APP_DESC`
A single-line description of the application. Truncated to 191 characters.
### `BOREDOS_APP_ICONS`
A semicolon-separated list of absolute VFS paths to PNG icons. Up to 4 icons are supported. The **first** entry is used as the primary icon displayed in the File Explorer and on the Desktop.
```c
// BOREDOS_APP_ICONS: /Library/images/icons/colloid/primary.png;/Library/images/icons/colloid/alternate.png
```
> [!TIP]
> If no `BOREDOS_APP_ICONS` annotation is provided, the build tool falls back to `/Library/images/icons/colloid/xterm.png`.
> If no `BOREDOS_APP_DESC` annotation is provided, the build tool uses `"BoredOS userspace application."`.
---
## Build System Integration
### The `gen_userland_note.sh` Tool
Located at [`tools/gen_userland_note.sh`](../../tools/gen_userland_note.sh), this script is invoked automatically by the `src/userland/Makefile` for every compiled application.
**Usage:**
```sh
gen_userland_note.sh <app-name> <source-file> <icon-source-dir> <output.note.c>
```
| Argument | Description |
|---|---|
| `<app-name>` | The base name of the application (e.g., `terminal`) |
| `<source-file>` | Path to the main `.c` source to extract annotations from |
| `<icon-source-dir>` | Directory where icon files are expected to exist on the *host* (build-time validation) |
| `<output.note.c>` | Path for the generated C source file |
The script:
1. Reads `BOREDOS_APP_DESC` and `BOREDOS_APP_ICONS` from the source file.
2. Validates that each declared icon file exists in `<icon-source-dir>` at build time.
3. Generates a C file (e.g., `bin/terminal.note.c`) that defines a `__attribute__((section(".note.boredos.app")))` constant struct containing all metadata.
### Makefile Rules
In `src/userland/Makefile`, the following rules handle metadata generation and linking:
```make
# Generate the .note.c for each app from its source annotations
$(BIN_DIR)/%.note.c: $(APP_METADATA_TOOL) | $(BIN_DIR)
src="$(call app_source_for,$*)"; \
sh $(APP_METADATA_TOOL) "$*" "$$src" "$(APP_ICON_SOURCE_DIR)" "$@"
# Compile the generated note C file
$(BIN_DIR)/%.note.o: $(BIN_DIR)/%.note.c
$(CC) $(CFLAGS) -c $< -o $@
# Link note object into each ELF (generic rule)
$(BIN_DIR)/%.elf: $(LIBC_OBJS) $(BIN_DIR)/%.o $(BIN_DIR)/%.note.o
$(LD) $(LDFLAGS) $^ -o $@
```
Special-cased apps (`doom`, `lua`, `viewer`, `settings`, `browser`, `screenshot`) also link in their own `.note.o` explicitly.
> [!IMPORTANT]
> The `-I../sys` flag is added to `CFLAGS` so that generated `.note.c` files can `#include "elf.h"` when referencing the metadata constants.
---
## Runtime Parsing: `app_metadata.c`
At runtime, `src/sys/app_metadata.c` provides two public functions:
```c
bool app_metadata_read(const char *path, boredos_app_metadata_t *out_metadata);
bool app_metadata_get_primary_image(const char *path, char *out_path, size_t out_path_size);
```
### `app_metadata_read`
Opens the ELF at `path` via VFS and searches for the `.note.boredos.app` section. It uses a **two-pass strategy**:
1. **Raw scan** (`am_scan_raw_notes`): For files up to 16 MiB, loads the entire binary into memory and byte-scans for a NOTE header matching the `BOREDOS` owner and `BOREDOS_APP_NOTE_TYPE`. This handles cases where the section header table is missing or unreadable.
2. **Section-based scan** (`am_parse_note_section`): Reads the ELF section header table, locates the `.note.boredos.app` section by name, then parses NOTE entries within it.
After a successful parse, the struct is validated via `am_validate_metadata` (checks magic and version fields) and sanitized via `am_sanitize_metadata` (null-terminates all strings).
### `app_metadata_get_primary_image`
A convenience wrapper around `app_metadata_read` that returns just the first icon path:
```c
bool app_metadata_get_primary_image(const char *path, char *out_path, size_t out_path_size);
```
Returns `true` and populates `out_path` if the binary has at least one valid icon declared.
### Metadata Cache
To avoid re-reading ELF files on every frame redraw, results are stored in a **simple FIFO cache** of up to 64 entries:
```c
#define APP_METADATA_CACHE_SIZE 64
```
Both positive (metadata found) and negative (no metadata) results are cached. The cache uses a round-robin eviction strategy — no LRU, no invalidation. This is intentional for a kernel context where metadata does not change while the OS is running.
---
---
## Userspace API
Userspace applications can query the ELF metadata of any `.elf` binary on the VFS through two wrapper functions declared in [`src/userland/libc/syscall.h`](../../src/userland/libc/syscall.h).
### The `boredos_app_metadata_t` struct (userland)
The struct is redefined verbatim in the userland header so that apps do **not** need to include any kernel header:
```c
#define BOREDOS_APP_METADATA_MAX_APP_NAME 64
#define BOREDOS_APP_METADATA_MAX_DESCRIPTION 192
#define BOREDOS_APP_METADATA_MAX_IMAGES 4
#define BOREDOS_APP_METADATA_MAX_IMAGE_PATH 160
typedef struct __attribute__((packed)) {
uint32_t magic;
uint16_t version;
uint16_t image_count;
uint16_t reserved;
char app_name[BOREDOS_APP_METADATA_MAX_APP_NAME];
char description[BOREDOS_APP_METADATA_MAX_DESCRIPTION];
char images[BOREDOS_APP_METADATA_MAX_IMAGES][BOREDOS_APP_METADATA_MAX_IMAGE_PATH];
} boredos_app_metadata_t;
```
### Functions
#### `sys_get_elf_metadata`
```c
int sys_get_elf_metadata(const char *path, boredos_app_metadata_t *out_metadata);
```
Reads the full metadata blob from the `.note.boredos.app` section of the ELF at `path` and writes it into `*out_metadata`.
Returns `1` on success, `0` on failure (file not found, no metadata note, or validation failure).
#### `sys_get_elf_primary_image`
```c
int sys_get_elf_primary_image(const char *path, char *out_path, size_t out_path_size);
```
Convenience wrapper that returns only the first icon path from the metadata. Useful when you just need to display an application icon without allocating a full `boredos_app_metadata_t`.
Returns `1` and writes a null-terminated VFS path into `out_path` if at least one icon was declared. Returns `0` otherwise.
### Syscall IDs
Both functions route through `SYS_SYSTEM` using dedicated command IDs:
| ID | Macro | Function |
|---|---|---|
| 76 | `SYSTEM_CMD_GET_ELF_METADATA` | `sys_get_elf_metadata` |
| 77 | `SYSTEM_CMD_GET_ELF_PRIMARY_IMAGE` | `sys_get_elf_primary_image` |
### Caching
Both calls share the same kernel-side **64-entry FIFO metadata cache** used by the Window Manager and File Explorer. If the metadata for a path has already been read, the result is returned from cache without re-reading the file. Negative results (no metadata) are also cached.
### Example: reading full metadata
```c
#include "syscall.h"
#include "stdio.h"
void print_app_info(const char *elf_path) {
boredos_app_metadata_t meta;
if (!sys_get_elf_metadata(elf_path, &meta)) {
printf("%s: no metadata\n", elf_path);
return;
}
printf("Name: %s\n", meta.app_name);
printf("Description: %s\n", meta.description);
printf("Icons (%u):\n", meta.image_count);
for (int i = 0; i < (int)meta.image_count; i++) {
printf(" [%d] %s\n", i, meta.images[i]);
}
}
```
### Example: fetching just the icon path
```c
#include "syscall.h"
void load_icon_for(const char *elf_path, Image *out_icon) {
char icon_path[BOREDOS_APP_METADATA_MAX_IMAGE_PATH];
if (sys_get_elf_primary_image(elf_path, icon_path, sizeof(icon_path))) {
*out_icon = image_load(icon_path);
} else {
*out_icon = image_load("/Library/images/icons/colloid/xterm.png"); // fallback
}
}
```
> [!NOTE]
> The metadata is read **from the VFS**, so the ELF must already be present as a file. The kernel does **not** read metadata from an already-running process image in memory — it re-opens the file via the filesystem.
---
*See also: [`custom_apps.md`](custom_apps.md) for a full tutorial on building and bundling a new application, [`sdk_reference.md`](sdk_reference.md) for an overview of the SDK, and [`syscalls.md`](syscalls.md) for the complete SYSTEM command ID table.*

View File

@@ -0,0 +1,55 @@
<div align="center">
<h1>Example 01: Hello CLI</h1>
<p><em>The absolute basics. Writing a terminal program.</em></p>
</div>
---
This example demonstrates the bare minimum structure of a BoredOS application that outputs text to the standard output (usually the Terminal executing the binary).
## Concepts Introduced
* Including `stdlib.h` for basic IO.
* The `main()` entry point.
* Using `printf()` for formatted output.
* Declaring app metadata via source annotations.
---
## The Code (`src/userland/cli/hello_world.c`)
```c
// BOREDOS_APP_DESC: Hello World — a minimal CLI demo.
#include <stdlib.h>
int main(int argc, char **argv) {
// Standard library initialization is handled automatically by crt0.asm
// Print a simple string to the terminal
printf("Hello, World from BoredOS Userland!\n");
// Print some formatted data
int favorite_number = 67;
printf("Did you know my favorite number is %d?\n", favorite_number);
// Returning from main automatically terminates the process cleanly
return 0;
}
```
## How it Works
1. **`#include <stdlib.h>`**: We include the SDK's standard library header which gives us access to `printf`.
2. **`int main(...)`**: Every process begins execution here (managed transparently by `crt0.asm`).
3. **`printf(...)`**: The SDK routes this call internally directly to the `SYS_WRITE` system call, making it available on the terminal.
4. **`return 0`**: A successful exit code.
5. **`BOREDOS_APP_DESC` / `BOREDOS_APP_ICONS`**: These comment annotations are read by the build system (`gen_userland_note.sh`) and embedded as a `boredos_app_metadata_t` NOTE entry inside the compiled `.elf`. The File Explorer and Desktop use this to display the correct icon. See [`elf_metadata.md`](../elf_metadata.md) for full details.
## Running It
If you build the project, you can open the Terminal and type:
```sh
/ # hello_world
Hello, World from BoredOS Userland!
Did you know my favorite number is 67?
/ #
```

View File

@@ -0,0 +1,75 @@
<div align="center">
<h1>Example 02: Basic Window</h1>
<p><em>An introduction to libui and creating graphical apps.</em></p>
</div>
---
This example demonstrates how to create an empty window that stays active on the screen until the user explicitly closes it by clicking the 'X' button.
## Concepts Introduced
* Including `libui.h` and the event structure.
* Creating a `ui_window_t` handle.
* Creating an infinite event loop using `ui_get_event()`.
* Yielding CPU time via `sleep(ms)`.
* Declaring app metadata via source annotations.
---
## The Code (`src/userland/gui/basic_window.c`)
```c
// BOREDOS_APP_DESC: Basic Window — a minimal graphical window demo.
#include <stdlib.h>
#include <libui.h>
#include <syscall.h>
int main(void) {
// 1. Ask the Window Manager to create a new window
// Arguments are: Title, X Position, Y Position, Width, Height
ui_window_t wid = ui_window_create("My First GUI", 100, 100, 400, 300);
if (wid < 0) {
printf("Failed to create the window!\n");
return 1;
}
// 2. Define our event object
gui_event_t event;
// 3. Enter the main event loop
while (1) {
// ui_get_event is non-blocking. It returns true if an event was waiting.
if (ui_get_event(wid, &event)) {
// Check what type of event occurred
if (event.type == GUI_EVENT_CLOSE) {
// The user clicked the 'X' button in the titlebar!
printf("Window closed cleanly by user.\n");
break; // Break the infinite loop
}
}
// 4. CRITICAL: Throttle our loop to save CPU
// If we don't do this, the while(1) loop will consume 100% of the CPU
// and starve the rest of the OS! A 10ms sleep allows for ~100 FPS
// event polling while letting the CPU actually idle.
sys_system(SYSTEM_CMD_SLEEP, 10, 0, 0, 0);
}
// Returning from main will automatically destroy the window and exit the process.
return 0;
}
```
## 🛠️ How it Works
1. **Window Handle (`wid`)**: `ui_window_create` sends a request to the kernel. The kernel allocates the memory for the window and returns a numerical ID (the handle) that we use for all future interactions with that specific window.
2. **The Event Loop**: Graphical programs run forever until closed. The `while (1)` loop serves this purpose.
3. **Polling**: `ui_get_event` asks the kernel, "Hey, did the user click my window or press a key since the last time I asked?". It is non-blocking, so it immediately returns `false` if nothing happened.
4. **CPU Throttling**: Since we are constantly polling in a loop, we call `sys_system(SYSTEM_CMD_SLEEP, 10, ...)` at the end of the loop frame. This tells the OS scheduler, "I'm done checking for events, don't run me again for at least 10ms." This allows the CPU to actually enter a low-power state and makes the system much smoother.
5. **`BOREDOS_APP_DESC` / `BOREDOS_APP_ICONS`**: Embedded into the `.elf` by the build system as a BoredOS NOTE section. The Window Manager reads this at runtime to render the app's icon on the Desktop and in the File Explorer. See [`elf_metadata.md`](../elf_metadata.md) for full details.
## Running It
Launch the Terminal and type `basic_window`. You'll see an empty window appear that you can move around the screen!

View File

@@ -0,0 +1,96 @@
<div align="center">
<h1>Example 03: Bouncing Ball</h1>
<p><em>Animating graphics and managing application state.</em></p>
</div>
---
This example builds upon the `02_basic_window` guide. It demonstrates how to constantly update the screen to simulate a bouncing square moving freely inside the window bounds.
## Concepts Introduced
* Maintaining application state across frames (Velocity/Position).
* Drawing primitives (`ui_fill_rect`, `ui_draw_string`).
* The importance of clearing the screen on a new frame.
* Explicitly forcing standard visual updates via `ui_mark_dirty()`.
* Declaring app metadata via source annotations.
---
## The Code (`src/userland/gui/bounce.c`)
```c
// BOREDOS_APP_DESC: Bouncing ball animation demo.
// BOREDOS_APP_ICONS: /Library/images/icons/colloid/applications-games.png
#include <stdlib.h>
#include <libui.h>
#include <syscall.h>
// Window Dimensions
#define W_WIDTH 400
#define W_HEIGHT 300
// Square Dimensions
#define SQ_SIZE 30
int main(void) {
ui_window_t wid = ui_window_create("Bouncing Box Animation", 50, 50, W_WIDTH, W_HEIGHT);
if (wid < 0) return 1;
// Define object state variables
int pos_x = 50;
int pos_y = 50;
int vel_x = 2; // Move 2 pixels per frame horizontally
int vel_y = 2; // Move 2 pixels per frame vertically
gui_event_t event;
while (1) {
// 1. Process Events
while (ui_get_event(wid, &event)) {
if (event.type == GUI_EVENT_CLOSE) {
return 0; // Exit cleanly
}
}
// 2. Physics & Logic Update
pos_x += vel_x;
pos_y += vel_y;
// Collision logic (Bounce off edges)
// The window has a 20px title bar, so the usable client height is W_HEIGHT - 20.
if (pos_x <= 0 || pos_x + SQ_SIZE >= W_WIDTH) {
vel_x = -vel_x; // Reverse horizontal direction
}
if (pos_y <= 0 || pos_y + SQ_SIZE >= W_HEIGHT - 20) {
vel_y = -vel_y; // Reverse vertical direction
}
// 3. Rendering Update
// Step A: Clear the entire background to Black (0xFF000000)
ui_draw_rect(wid, 0, 0, W_WIDTH, W_HEIGHT, 0xFF000000);
// Step B: Draw our shape in Red (0xFFFF0000) at the new position
ui_draw_rect(wid, pos_x, pos_y, SQ_SIZE, SQ_SIZE, 0xFFFF0000);
// Step C: Draw some UI text over the animation in White
ui_draw_string(wid, 10, 10, "BoredOS Animation Demo!", 0xFFFFFFFF);
// Step D: Instruct the compositor to flush our drawing buffer to the physical screen
ui_mark_dirty(wid, 0, 0, W_WIDTH, W_HEIGHT);
// 4. Yield and throttle (targeting ~60 FPS)
sys_system(SYSTEM_CMD_SLEEP, 16, 0, 0, 0);
}
return 0;
}
```
## How it Works
1. **State Management**: We store `pos_x`, `pos_y`, `vel_x`, and `vel_y`. These variables represent the "physics" of our system. Notice that they update *outside* the event-checking logic so that the animation runs even if the user isn't clicking the mouse.
2. **Screen Clearing**: We *must* fill the screen with black (`ui_draw_rect(wid, 0, 0, W_WIDTH, W_HEIGHT, ...)`). If we don't clear the screen, the red square will leave a permanent trailing smear everywhere it goes!
3. **The Double Buffer**: `ui_draw_rect` and `ui_draw_string` do not immediately appear on your monitor. They just color a hidden buffer within the kernel.
4. **`ui_mark_dirty`**: This is the crucial command that tells the kernel Window Manager, "I'm done drawing my frame. Can you quickly copy my hidden buffer over to the real screen now?"
5. **`BOREDOS_APP_DESC` / `BOREDOS_APP_ICONS`**: Embedded into the compiled `.elf` as a BoredOS NOTE section. The Desktop and File Explorer read this to show the game's icon instead of the generic binary icon. See [`elf_metadata.md`](../elf_metadata.md) for full details.
> [!WARNING]
> Because `sys_system(SYSTEM_CMD_SLEEP, ...)`'s pause duration depends heavily on CPU load and how many other processes are running (or QEMU emulation speed), tying physics/movement strictly to loops can make the game run faster on faster computers. Advanced developers will want to calculate delta time (time elapsed since the last frame) for smooth motion.

View File

@@ -0,0 +1,96 @@
<div align="center">
<h1>Example 04: TCP HTTP Client</h1>
<p><em>Utilizing lwIP to establish an outbound TCP connection.</em></p>
</div>
---
This advanced example demonstrates the steps required to use the raw network system calls to establish a connection with an external HTTP server and dump the response over the terminal.
## 📝 Concepts Introduced
* Verifying the network state (`sys_network_is_initialized`, `sys_network_has_ip`).
* Performing DNS lookups manually via `sys_dns_lookup`.
* Managing strict TCP flow logic (`sys_tcp_connect`, send, block for receive).
* Using the terminal `SYS_WRITE` output for debugging.
* Declaring app metadata via source annotations.
---
## The Code (`src/userland/cli/http_get.c`)
```c
// BOREDOS_APP_DESC: HTTP GET client — fetches a webpage over TCP.
// BOREDOS_APP_ICONS: /Library/images/icons/colloid/network-wired.png
#include <stdlib.h>
#include <string.h>
#include <syscall.h>
int main(void) {
if (!sys_network_is_initialized() || !sys_network_has_ip()) {
printf("Network is unreachable! Make sure you inited the network first!\n");
return 1;
}
// 1. Resolve host name to IP
const char *target_host = "boreddev.nl";
net_ipv4_address_t server_ip;
printf("Resolving %s...\n", target_host);
if (sys_dns_lookup(target_host, &server_ip) < 0) {
printf("DNS Lookup failed.\n");
return 1;
}
printf("Resolved to: %d.%d.%d.%d\n", server_ip.bytes[0], server_ip.bytes[1],
server_ip.bytes[2], server_ip.bytes[3]);
// 2. Establish a TCP connection on port 80 (HTTP)
printf("Connecting...\n");
if (sys_tcp_connect(&server_ip, 80) < 0) {
printf("Connection failed.\n");
return 1;
}
printf("Connected! Sending GET request...\n");
// 3. Format and send the raw HTTP Request
char request[256];
strcpy(request, "GET / HTTP/1.1\r\nHost: ");
strcat(request, target_host);
strcat(request, "\r\nConnection: close\r\n\r\n");
if (sys_tcp_send(request, strlen(request)) < 0) {
printf("Failed to send data.\n");
sys_tcp_close();
return 1;
}
// 4. Block and wait for response data
char recv_buf[512];
int bytes_received;
printf("\n--- RESPONSE ---\n");
while ((bytes_received = sys_tcp_recv(recv_buf, sizeof(recv_buf) - 1)) > 0) {
recv_buf[bytes_received] = '\0'; // Null-terminate the chunk
printf("%s", recv_buf); // Print the chunk to stdout
}
// 5. Cleanup
printf("\n--- END RESPONSE ---\n");
sys_tcp_close();
printf("Connection closed.\n");
return 0;
}
```
## How it Works
1. **Network Setup**: First, we must ensure the host machine or QEMU environment gave BoredOS a valid IP address via DHCP. The `sys_network_has_ip()` check prevents our app from hanging trying to route data to nowhere.
2. **DNS (`sys_dns_lookup`)**: Since we want to connect to a domain name, not a raw IP, we query the DNS server configured by the OS (which it received via DHCP).
3. **Connection (`sys_tcp_connect`)**: We block the application thread while the OS performs the 3-way TCP handshake over port 80.
4. **Payload (`sys_tcp_send`)**: We format a compliant HTTP/1.1 payload representing a simple GET request for the root directory `/`.
5. **Chunked Receiving (`sys_tcp_recv`)**: The server's response might be larger than our `recv_buf` (512 bytes). Therefore, we loop. `sys_tcp_recv` blocks execution until data arrives. If it returns `0`, the remote server cleanly closed the connection (which happens automatically because we specified `Connection: close` in our request payload!).
6. **`BOREDOS_APP_DESC` / `BOREDOS_APP_ICONS`**: Embedded into the compiled `.elf` as a BoredOS NOTE section. The Desktop and File Explorer read this to display the app's icon. See [`elf_metadata.md`](../elf_metadata.md) for full details.
## Running It
Make sure QEMU is running with networking enabled. Launch the terminal and type `http_get`. You will see the raw headers and HTML source of the target webpage scroll down the CLI interface!

View File

@@ -0,0 +1,28 @@
<div align="center">
<h1>Example Applications</h1>
<p><em>From basic output to complex Graphical and Network applications.</em></p>
</div>
---
Welcome to the examples directory! These guides are designed to help you understand how to write C applications for the BoredOS userland, utilizing the custom `libc` SDK.
The examples are listed in order of increasing complexity. Click on a tutorial to view the complete source code and an explanation of the concepts it introduces.
## 🟢 Beginner
* **[`01_hello_cli.md`](01_hello_cli.md)**: The absolute basics. Learn how to write a simple Terminal program that outputs text and processes standard system calls.
* **[`02_basic_window.md`](02_basic_window.md)**: An introduction to `libui.h`. Learn how to create an empty window, set up a basic event loop, and handle the "Close" button cleanly.
## 🟡 Intermediate
* **[`03_bouncing_ball.md`](03_bouncing_ball.md)**: Dive deeper into graphical rendering. This example introduces the `ui_mark_dirty` command, framerate independence via `sys_yield()`, and state management to animate a shape moving around the screen and bouncing off the window edges.
## 🔴 Advanced
* **[`04_tcp_client.md`](04_tcp_client.md)**: Using the lwIP networking stack. This example demonstrates how to perform a DNS lookup, connect to an external server over TCP (like an HTTP server), send a raw request, and print the response to the terminal.
---
> [!TIP]
> If you want to test these out, simply create a new `.c` file in `src/userland/cli/` (for terminal apps) or `src/userland/gui/` (for windowed apps), paste the example code, then run `make clean && make run` from the project root!

345
docs/appdev/grapher.md Normal file
View File

@@ -0,0 +1,345 @@
<div align="center">
<h1>Grapher</h1>
<p><em>An interactive mathematical expression plotter for BoredOS, supporting both 2D and 3D visualizations.</em></p>
</div>
---
Grapher is a built-in GUI application that lets you type any mathematical equation and see it plotted in real time. It supports 2D explicit and implicit curves as well as full 3D surface visualization — including both explicit surfaces (`z = f(x, y)`) and implicit surfaces (`f(x, y, z) = c`).
> [!NOTE]
> Grapher is located at `src/userland/gui/grapher.c`. It runs as a standard BoredOS GUI process and can be launched from the terminal or from the dock.
---
## Features at a Glance
| Feature | Details |
|---|---|
| **2D Explicit** | Plot `y = f(x)` curves |
| **2D Implicit** | Plot any `f(x, y) = g(x, y)` contour via marching squares |
| **3D Explicit** | Plot `z = f(x, y)` surfaces |
| **3D Implicit** | Plot any `f(x, y, z) = c` surface |
| **Rendering modes** | Wireframe and filled polygon modes |
| **Height coloring** | Surfaces are colored by a blue→green→yellow→red gradient based on Z height |
| **Phong-style shading** | Filled mode computes per-face normals and applies diffuse + ambient lighting |
| **Parallel rendering** | Evaluation and projection are distributed across 4 worker threads via `sys_parallel_run` |
| **Preset equations** | 7 built-in presets accessible from the toolbar |
| **Auto-fit** | 2D view auto-fits the Y axis to the plotted curve on first plot |
| **Atomic Color-Depth Buffer** | All 3D drawing uses a 64-bit atomic buffer to prevent depth/color race conditions |
---
## Launching Grapher
From the BoredOS terminal:
```sh
grapher
```
Or click the **Grapher icon** in the system dock.
---
### Toolbar Controls
| Control | Function |
|---|---|
| **Equation box** | Type your mathematical expression, then press **Enter** or **Plot** |
| **Plot button** | Parse and render the current equation |
| **Wire / Filled button** | Toggle wireframe vs. shaded polygon mode (3D only) |
| **Presets button** | Open a dropdown of example equations |
### Status Bar Controls (3D mode)
| Control | Function |
|---|---|
| **`+` button** | Increase the 3D world range (zoom out in world space) |
| **`-` button** | Decrease the 3D world range (zoom in in world space) |
---
## Keyboard Shortcuts
| Shortcut | Action |
|---|---|
| **Enter** (in equation box) | Plot the equation |
| **Ctrl + R** | Reset the view to defaults |
| **F** | Toggle filled / wireframe rendering (3D mode) |
| **Scroll wheel** | Zoom in/out (2D mode adjusts viewport; 3D mode adjusts camera zoom) |
| **Right-click drag** | Rotate the 3D surface |
---
## Writing Equations
Grapher parses equations entered as plain text. It supports a subset of mathematical notation with automatic implicit multiplication.
### Supported Functions
| Syntax | Meaning |
|---|---|
| `sin(x)` | Sine |
| `cos(x)` | Cosine |
| `tan(x)` | Tangent |
| `sqrt(x)` | Square root |
| `abs(x)` | Absolute value |
| `log(x)` | Natural logarithm (base *e*) |
### Supported Operators
| Operator | Meaning |
|---|---|
| `+` `-` `*` `/` | Arithmetic |
| `^` | Exponentiation (right-associative) |
| `(` `)` | Grouping |
### Special Values
| Token | Value |
|---|---|
| `pi` or `PI` | π ≈ 3.14159… |
### Implicit Multiplication
Adjacent tokens that would normally require a `*` are multiplied automatically:
```
2x → 2 * x
3sin(x) → 3 * sin(x)
(x+1)(x) → (x+1) * x
```
### How Equations Are Classified
Grapher looks at which variables appear in your equation to automatically choose the rendering mode:
| Equation form | Auto-detected as |
|---|---|
| `y = f(x)` or just `f(x)` | 2D explicit |
| `f(x, y) = g(x, y)` | 2D implicit |
| `z = f(x, y)` | 3D explicit |
| `f(x, y, z) = c` | 3D implicit |
If you omit the `=` sign, Grapher treats the input as `y = <expression>` when no `y` or `z` is present, or as `<expression> = 0` otherwise.
---
## Example Equations
### 2D Examples
```
y = sin(x)
y = x^2
y = cos(x)*x
y = abs(x) - 2
x^2 + y^2 = 25 ← circle (implicit)
y = log(x)
```
### 3D Explicit Examples
```
z = sin(x)*cos(y)
z = x^2 - y^2 ← saddle surface
z = sqrt(25 - x^2 - y^2)
```
### 3D Implicit Examples
```
x^2 + y^2 + z^2 = 25 ← sphere
x^2 + y^2 = 16 ← cylinder
x^2 + y^2 - z^2 = 1 ← hyperboloid
```
---
## Navigation Controls
### 2D Mode
| Input | Action |
|---|---|
| **Scroll up** | Zoom in |
| **Scroll down** | Zoom out |
| **Ctrl+R** | Reset to default view (`x: [-10, 10]`) |
### 3D Mode
| Input | Action |
|---|---|
| **Right-click drag** | Rotate the surface (orbit camera) |
| **Scroll up** | Zoom camera in |
| **Scroll down** | Zoom camera out |
| **`+` / `-` buttons** | Increase / decrease world range |
| **Ctrl+R** | Reset rotation and zoom |
> [!TIP]
> In 3D mode, the surface auto-rotates slowly by default. This can be disabled by setting `#define ROTATE 0` in the source file.
---
## Architecture Overview
Grapher is implemented as a single self-contained C file. Below is a high-level breakdown of its major components:
### Math Library
Grapher uses the BoredOS freestanding **`libc/math.h`** library, which provides all the math functions it needs without depending on a host standard library:
| Function | Description |
|---|---|
| `sin`, `cos`, `tan` | Trigonometry via Taylor series (8 terms, range-reduced to `[-π, π]`) |
| `sqrt` | Newton-Raphson iteration (25 steps) |
| `log` | Natural logarithm via Padé-style series |
| `log2`, `log10` | Derived from `log` |
| `exp` | Range-reduced Taylor series for `e^x` |
| `pow` | Integer exponents use fast binary exponentiation; fractional exponents use `exp(e * log(b))` |
| `fabs`, `fmod` | Absolute value and floating-point remainder |
| `floor`, `ceil` | Rounding |
| `sinh`, `cosh`, `tanh` | Hyperbolic functions |
| `hypot`, `fmin`, `fmax`, `fclamp` | Utility helpers |
The constants `M_PI`, `M_E`, `M_LN2`, `M_SQRT2` are also defined in the header.
This library is automatically linked into every userland ELF — any app can `#include "math.h"` to use it.
### Expression Parser
Equations are parsed in three stages:
1. **Tokenizer** (`tokenize`) — converts the input string into a flat token array. Handles implicit multiplication by inserting `*` tokens where needed.
2. **Recursive Descent Parser** (`parse_expr`, `parse_term`, `parse_power`, `parse_unary`, `parse_atom`) — produces an Abstract Syntax Tree (AST) with up to `MAX_NODES = 128` nodes.
3. **Bytecode Compiler** (`compile_ast`) — walks the AST in post-order and emits a flat instruction sequence for a simple stack machine. This avoids recursive evaluation during rendering hot paths.
The resulting bytecode is then executed by `run_bc` for every sample point.
### Rendering Pipeline
#### 2D Rendering
- **Explicit** — evaluates `y = f(x)` at every pixel column and connects adjacent samples with Bresenham lines.
- **Implicit** — applies **marching squares** on a 200×130 grid to find sign changes in `f(x,y) - g(x,y)` and plots intersection pixels.
#### 3D Rendering
The 3D pipeline uses a multi-pass system parallelized across worker threads:
| Pass | Function | Description |
|---|---|---|
| 1 | **Evaluation** | Samples the surface at grid points. For implicit surfaces, this uses **tri-axis marching**. |
| 2 | **Projection** | Projects 3D world coordinates to 2D screen coordinates with perspective. |
| 3 | **Drawing** | Rasterizes wireframe lines or filled triangles with Z-buffering. |
##### Tri-Axis Marching (Implicit Surfaces)
Unlike explicit surfaces that only need one evaluation per grid point, implicit surfaces require finding roots of $f(x, y, z) = 0$. To ensure complete surface connectivity and eliminate "cracks," Grapher marches along all three primary axes:
1. **X-Axis Pass**: For every $(y, z)$ pair, march along $x$.
2. **Y-Axis Pass**: For every $(x, z)$ pair, march along $y$.
3. **Z-Axis Pass**: For every $(x, y)$ pair, march along $z$.
Each pass uses a multi-stage root finder (170 linear steps followed by 15 bisection iterations). By sampling along all three axes, the engine "catches" surfaces that are nearly parallel to any specific marching direction, ensuring that vertical walls and steep gradients are rendered solidly from any viewing angle.
##### Atomic Color-Depth Buffer
To prevent "z-fighting" and race conditions between parallel threads, Grapher uses a 64-bit atomic buffer (`graph_czb`). Each 64-bit word stores:
- **Upper 32 bits**: Z-depth (integer).
- **Lower 32 bits**: Pixel color (0xAARRGGBB).
A single `__atomic_compare_exchange_n` operation ensures that a pixel's color and depth are updated together only if the new depth is closer to the camera than the existing one.
Surface normals are estimated using central finite differences of the implicit function.
#### Filled Mod
When filled mode is active, each quad cell is split into two triangles. The average surface normal across the four corner vertices is computed and fed into `apply_shading`, which calculates:
```
intensity = ambient(0.3) + diffuse(0.7) * dot(normal, light_direction)
```
The light direction is fixed at `(0.577, 0.707, 0.408)` (normalized diagonal).
#### Z-Buffer
The depth buffer (`graph_zb`) stores integer depth values. `gfb_pixel_z` uses a **compare-and-swap (CAS) loop** via `__atomic_compare_exchange_n` so multiple parallel draw threads cannot produce race conditions.
### Coordinate Systems
#### 2D
World coordinates map linearly to screen pixels:
```c
screen_x = (wx - view_x_min) / (view_x_max - view_x_min) * graph_w
screen_y = (view_y_max - wy) / (view_y_max - view_y_min) * graph_h
```
#### 3D
Points are first rotated by two Euler angles (`rot_y`, `rot_x`) then projected with a simple perspective divide:
```
persp = d / (pz + d) // d = range_3d * 5
sx = px * scale * persp + screen_cx
sy = -py * scale * persp + screen_cy
```
---
## Configuration Constants
These can be changed at the top of `grapher.c` to tune behaviour:
| Constant | Default | Effect |
|---|---|---|
| `ROTATE` | `1` | Set to `0` to disable auto-rotation in 3D mode |
| `GRID_3D` | `41` | Grid resolution for 3D sampling. Higher = more detail, much slower |
> [!WARNING]
> Setting `GRID_3D` too high (e.g. 9000) will exhaust available memory. The `surf` grid and `surf_x`/`surf_y_3d` arrays are statically allocated at compile time: memory usage grows as **O(GRID_3D²)**. Values above ~512 are not recommended.
> [!TIP]
> `GRID_3D = 256` gives a good balance of detail and performance on typical BoredOS hardware emulation.
---
## Color Palette
3D surfaces are colored by height using a 4-stop rainbow ramp:
```
Low → Blue → Cyan → Green → Yellow → Red → High
```
---
## Preset Equations
The built-in presets are shown in the dropdown when you click **Presets**:
| Label | Type |
|---|---|
| `y = sin(x)` | 2D explicit |
| `y = x^2` | 2D explicit |
| `y = cos(x)*x` | 2D explicit |
| `z = sin(x)*cos(y)` | 3D explicit |
| `z = x^2 - y^2` | 3D explicit |
| `x^2+y^2+z^2=25` | 3D implicit (sphere) |
| `x^2+y^2=16` | 3D implicit (cylinder) |
---
## Known Limitations
- **No parameter slider** — equations are static; there is no way to animate a parameter.
- **No multiple equations** — only one equation can be graphed at a time.
- **Implicit surface precision** — extremely thin or high-frequency implicit surfaces may still have small artifacts if the grid resolution (`GRID_3D`) is too low.
- **3D implicit performance** — tri-axis marching evaluates the function significantly more times than explicit rendering; high resolutions will impact frame rate.
- **Integer axis labels only for large values** — very large axis values are capped at `>2G` or `<-2G` due to `itoa` limitations.

View File

@@ -0,0 +1,251 @@
# UTF-8 Library — Application Development Guide
## Overview
The userland libc provides a lightweight UTF-8 utility module located in:
- src/userland/libc/utf-8.c
- src/userland/libc/utf-8.h
This module is designed for **direct use in applications** requiring UTF-8 handling. It provides basic primitives for decoding, encoding, and traversing UTF-8 strings safely.
It is intended for:
- text rendering
- terminal input/output
- cursor movement
- string processing at the character level
---
## Synopsis
```c
#include "utf-8.h"
uint32_t text_decode_utf8(const char *s, int *advance);
int text_encode_utf8(uint32_t cp, char *out);
const char* text_next_utf8(const char *s);
const char* text_prev_utf8(const char *start, const char *s);
int text_strlen_utf8(const char *s);
```
---
## API Reference
### text_decode_utf8
```c
uint32_t text_decode_utf8(const char *s, int *advance);
```
Decodes a UTF-8 sequence into a Unicode code point.
- `s`: pointer to current position in a UTF-8 string
- `advance`: receives number of bytes consumed
Returns:
- decoded Unicode code point (`uint32_t`)
- `0` if input is null or empty
- `0xFFFD` for invalid sequences
---
### text_encode_utf8
```c
int text_encode_utf8(uint32_t cp, char *out);
```
Encodes a Unicode code point into UTF-8.
- `cp`: Unicode code point
- `out`: buffer receiving encoded bytes
Returns:
- number of bytes written (14)
- writes replacement character if `cp` is invalid
---
### text_next_utf8
```c
const char* text_next_utf8(const char *s);
```
Advances to the next UTF-8 character.
Returns a pointer to the next character boundary.
---
### text_prev_utf8
```c
const char* text_prev_utf8(const char *start, const char *s);
```
Moves backward to the previous UTF-8 character.
- `start`: beginning of the buffer
- `s`: current position
Used for reverse traversal and cursor movement.
---
### text_strlen_utf8
```c
int text_strlen_utf8(const char *s);
```
Counts UTF-8 characters (code points), not bytes.
---
## Usage Examples
### Iterating over UTF-8 characters
```c
const char *p = text;
while (*p) {
int adv;
uint32_t cp = text_decode_utf8(p, &adv);
/* process cp */
p += adv;
}
```
---
### Cursor movement
```c
cursor = text_next_utf8(cursor);
cursor = text_prev_utf8(buffer_start, cursor);
```
---
### Encoding a character
```c
char out[4];
int len = text_encode_utf8(0x20AC, out);
```
---
### Backspace handling
```c
char *prev = (char*)text_prev_utf8(buffer, cursor);
cursor = prev;
```
---
## Implementation Notes
### UTF-8 Encoding
The implementation supports:
- 1 byte: `0x00 0x7F`
- 2 bytes: `0x80 0x7FF`
- 3 bytes: `0x800 0xFFFF`
- 4 bytes: `0x10000 0x10FFFF`
---
### Replacement Character
Invalid sequences are replaced with:
- code point: `0xFFFD`
- UTF-8 encoding: `0xEF 0xBF 0xBD`
---
### UTF-8 Byte Structure
The following diagram illustrates how UTF-8 bytes are structured, including
ASCII, continuation bytes, and multi-byte sequence headers:
<img width="815" height="1003" alt="image" src="https://github.com/user-attachments/assets/0d289a94-6037-4039-87a3-125c0c0e83d0" />
<sub>Source: <a href="https://www.youtube.com/watch?v=vpSkBV5vydg">Nic Barker — "UTF-8, Explained Simply"</a> (YouTube)</sub>
---
### Control Signals
Some decoded code points correspond to control signals instead of printable characters.
ASCII control range:
- `0x00 0x1F`
Examples:
- `0x08` → Backspace
- `0x09` → Tab
- `0x0A` → Line Feed
- `0x0D` → Carriage Return
- `0x1B` → Escape
These are typically interpreted by:
- terminal logic
- shell input handling
- system interfaces
---
### Non-ASCII Characters
Characters outside the ASCII range (`0x00 0x7F`) are encoded using multi-byte UTF-8 sequences.
Examples:
- 'é' → `0xC3 0xA9`
- '€' → `0xE2 0x82 0xAC`
Decoded values:
- 'é' → `U+00E9`
- '€' → `U+20AC`
---
### Modifiers and Layout
Character output depends on:
- keyboard layout
- modifier keys (Shift, Ctrl, AltGr)
Example:
- `KEY_E` → 'e'
- `KEY_E + SHIFT` → 'E'
- `KEY_E + AltGr` → '€'
---
## Also worth watching
If you want to dive deeper or simply get a better intuitive understanding of UTF-8, the video below is highly recommended:
[Nic Barker — "UTF-8, Explained Simply"](https://www.youtube.com/watch?v=vpSkBV5vydg)

View File

@@ -0,0 +1,184 @@
# libc Reference
This page documents the current BoredOS userland libc surface from `src/userland/libc/`.
BoredOS libc is a compact implementation focused on the APIs used by in-tree apps. It is not a full glibc replacement.
## Header Overview
| Header | Focus |
|---|---|
| `stdlib.h` | allocation, conversion, process helpers |
| `string.h` | memory/string primitives |
| `stdio.h` | `FILE*` and formatted I/O |
| `unistd.h` | POSIX-like fd/process calls |
| `fcntl.h` | open/fcntl flags, `dup`, `pipe` |
| `input.h` | keyboard keycode constants |
| `signal.h` | signal handlers and masks |
| `sys/stat.h` | `stat`/`fstat` and file mode bits |
| `sys/types.h` | core typedefs (`pid_t`, `ssize_t`, ...) |
| `sys/wait.h` | `waitpid` and wait macros |
| `errno.h` | errno values |
| `time.h` | time/date utilities |
| `math.h` | floating-point math helpers |
| `libui.h` | GUI/window drawing API |
## stdlib.h
Implemented core functions:
- Memory: `malloc`, `free`, `calloc`, `realloc`
- Memory aliases: `memset`, `memcpy`
- Conversions: `atoi`, `itoa`, `strtod`, `abs`
- Output: `puts`, `printf`
- Process/environment: `exit`, `_exit`, `sleep`, `chdir`, `getcwd`, `access`, `system`, `getenv`, `abort`
Notes:
- `sleep` is millisecond-based and maps to kernel sleep command.
- `system` is a stub-style helper in this libc, not a full shell launcher equivalent.
## string.h
Implemented C string/memory set includes:
- Memory: `memmove`, `memcmp`, `memcpy`, `memset`, `memchr`
- Search: `strchr`, `strrchr`, `strpbrk`, `strstr`
- Span: `strspn`, `strcspn`
- Compare: `strcmp`, `strncmp`, `strcasecmp`, `strncasecmp`, `strcoll`
- Build/copy: `strlen`, `strcpy`, `strcat`, `strdup`
- Errors: `strerror`
## stdio.h
Provided API includes:
- Stream open/close: `fopen`, `freopen`, `fclose`
- Read/write: `fread`, `fwrite`, `fgets`, `fputs`, `getc`, `fputc`, `putchar`
- Positioning: `fseek`, `ftell`, `filelength`
- Formatting: `fprintf`, `vfprintf`, `snprintf`, `vsnprintf`, `sprintf`, `sscanf`
- Stream state: `feof`, `ferror`, `clearerr`, `fflush`, `ungetc`
- Temp/filesystem helpers: `remove`, `rename`, `tmpfile`, `tmpnam`
## unistd.h
Provided POSIX-like interfaces:
- FD I/O: `read`, `write`, `close`, `lseek`, `isatty`
- Filesystem: `unlink`
- Exec family: `execv`, `execve`, `execvp`, `execl`, `execlp`, `execle`
- Process wait: `waitpid`
Also defines:
- `SEEK_SET`, `SEEK_CUR`, `SEEK_END`
- `F_OK`, `X_OK`, `W_OK`, `R_OK`
## fcntl.h
Flags and fd control:
- Open flags: `O_RDONLY`, `O_WRONLY`, `O_RDWR`, `O_CREAT`, `O_EXCL`, `O_TRUNC`, `O_APPEND`, `O_NONBLOCK`, `O_ACCMODE`
- fcntl ops: `F_GETFL`, `F_SETFL`
- FD flag: `FD_CLOEXEC` (declared)
Functions:
- `open`
- `fcntl`
- `dup`
- `dup2`
- `pipe`
## input.h
Defines keyboard/control keycode constants used by apps that process
Current constants include:
- Arrow keys: `KEY_UP`, `KEY_DOWN`, `KEY_LEFT`, `KEY_RIGHT`
- Controls: `KEY_ENTER`, `KEY_BACKSPACE`, `KEY_ESCAPE`, `KEY_SPACE`, `KEY_ALT`, `KEY_CTRL_L`, `KEY_TAB`
## signal.h
Current signal surface:
- Basic handler API: `signal`, `raise`, `kill`
- POSIX-style API: `sigaction`, `sigprocmask`, `sigpending`
- Types: `sighandler_t`, `sigset_t`, `struct sigaction`
- Constants: `SIGINT`, `SIGTERM`, `SIGKILL`, `SIG_DFL`, `SIG_IGN`, `SIG_ERR`
- Mask ops: `SIG_BLOCK`, `SIG_UNBLOCK`, `SIG_SETMASK`
- Action flags: `SA_RESTART`, `SA_NODEFER`, `SA_RESETHAND`
## ctype.h
Character classification and case conversion:
- `isdigit`, `isalpha`, `isalnum`, `isspace`
- `isupper`, `islower`, `isxdigit`
- `iscntrl`, `ispunct`, `isprint`, `isgraph`
- `tolower`, `toupper`
## locale.h
Locale stubs and conventions:
- `struct lconv`
- `setlocale`
- `localeconv`
- `LC_ALL`
## limits.h
Integer and floating-point limit macros:
- `CHAR_BIT`, `INT_MIN`, `INT_MAX`, `UINT_MAX`
- `LONG_MIN`, `LONG_MAX`, `ULONG_MAX`
- `LLONG_MIN`, `LLONG_MAX`, `ULLONG_MAX`
- `DBL_MAX`
## setjmp.h
Non-local jump support:
- `jmp_buf`
- `setjmp`
- `longjmp`
## time.h
Time/date APIs and types:
- Types: `time_t`, `clock_t`, `struct tm`
- Constants: `CLOCKS_PER_SEC`
- Functions: `time`, `clock`, `localtime`, `gmtime`, `strftime`, `mktime`
## libui.h
Windowing and drawing API used by GUI apps:
- Window/event: `ui_window_create`, `ui_get_event`, `ui_mark_dirty`, `ui_window_set_title`, `ui_window_set_resizable`
- Drawing: `ui_draw_rect`, `ui_draw_rounded_rect_filled`, `ui_draw_string`, `ui_draw_string_bitmap`, `ui_draw_image`
- Text metrics/scaled text: `ui_get_string_width`, `ui_get_font_height`, `ui_draw_string_scaled`, `ui_draw_string_scaled_sloped`, `ui_get_string_width_scaled`, `ui_get_font_height_scaled`
- System UI helpers: `ui_get_screen_size`, `ui_set_font`
## sys/stat.h and sys/types.h
`sys/stat.h` provides:
- `struct stat`
- `stat`, `fstat`, `mkdir`
- mode/type macros (`S_IFREG`, `S_IFDIR`, `S_ISREG`, `S_ISDIR`, permission bits)
Note:
- `access` is declared in `stdlib.h` in this libc.
`sys/types.h` provides:
- `ssize_t`, `off_t`, `mode_t`, `pid_t`, `uid_t`, `gid_t`
## sys/wait.h
- `waitpid`
- `WNOHANG`
- status macros: `WEXITSTATUS`, `WIFEXITED`, `WTERMSIG`, `WIFSIGNALED`
## errno.h
Defined errno values include:
- Generic/input: `EINVAL`, `EDOM`, `ERANGE`, `E2BIG`
- File/path: `ENOENT`, `EEXIST`, `EISDIR`, `ENOTDIR`, `EBADF`
- Runtime/state: `ENOMEM`, `EACCES`, `EIO`, `EAGAIN`, `EINTR`, `ECHILD`, `EBUSY`, `EPIPE`, `ESPIPE`, `ENOSYS`, `ENOTSUP`
## Relationship to raw syscalls
- libc high-level I/O and process APIs are backed by wrappers in `src/userland/libc/syscall.c`.
- Full syscall command IDs and multiplexer details are documented in `docs/appdev/syscalls.md`.
## Practical Guidance
- Prefer libc APIs (`open`, `read`, `write`, `waitpid`, `sigaction`) for portability inside BoredOS userland.
- Use raw wrapper calls from `syscall.h` only for capabilities that do not yet have higher-level libc wrappers.
- Avoid numeric `sys_system(...)` command literals in app code; use `SYSTEM_CMD_*` macros.

View File

@@ -0,0 +1,53 @@
<div align="center">
<h1>Userland SDK Reference</h1>
<p><em>Overview and entry point for BoredOS userland development.</em></p>
</div>
---
BoredOS provides a compact userland SDK for building `.elf` applications.
This page is the high-level map; detailed API references now live in dedicated pages.
## SDK Structure
Primary headers are in `src/userland/libc/` and UI helpers are in `src/wm/`.
- `stdlib.h`, `string.h`, `stdio.h`, `unistd.h`: core libc surface
- `syscall.h`: raw syscall wrappers and command constants
- `libui.h`: window creation, drawing, and event polling
- `libwidget.h`: higher-level reusable widgets
- `math.h`: freestanding math helpers
## Detailed References
- [`libc Reference`](libc_reference.md): current libc headers and implemented APIs
- [`Syscalls`](syscalls.md): syscall numbers, FS/SYSTEM command IDs, and wrappers
- [`UI API`](ui_api.md): drawing and event APIs
- [`Widget API`](widget_api.md): common widgets and interaction helpers
- [`Native TCC`](tcc.md): Native C compilation directly on BoredOS
## Typical Include Set
```c
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <syscall.h>
```
For GUI apps:
```c
#include <libui.h>
#include <libwidget.h>
```
## Build and Packaging
- Add app source under `src/userland/` (CLI, GUI, or games subfolder).
- Ensure it is included in the userland build rules/targets.
- Build from repo root with `make`.
- Built binaries are copied into initrd under `/bin` by the top-level `Makefile`.

200
docs/appdev/syscalls.md Normal file
View File

@@ -0,0 +1,200 @@
# Syscall Reference
This page documents the current syscall surface in BoredOS as implemented in:
- `src/sys/syscall.h` (kernel command IDs)
- `src/userland/libc/syscall.h` (userland wrappers)
Use libc wrappers when possible instead of calling raw syscall numbers directly.
## Top-Level Syscall Numbers
| Number | Name | Purpose |
|---|---|---|
| 0 | `SYS_EXIT` (userland header) | Terminate current process |
| 1 | `SYS_WRITE` | Write to stdout/tty path |
| 3 | `SYS_GUI` | Window manager and drawing commands |
| 4 | `SYS_FS` | Filesystem and fd commands |
| 5 | `SYS_SYSTEM` | System-wide command multiplexer |
| 8 | `SYS_DEBUG_SERIAL` | Debug serial output (kernel only) |
| 9 | `SYS_SBRK` (userland header) | Heap break management |
| 10 | `SYS_KILL` (userland header) | Kill process by PID |
| 60 | `SYS_EXIT` (kernel header) | Internal kernel syscall number map |
Notes:
- Some numbers differ between kernel and userland headers for historical reasons. For app code, rely on wrapper functions in `src/userland/libc/syscall.c`.
- `SYS_GUI`, `SYS_FS`, and `SYS_SYSTEM` are command multiplexers.
## FS Command IDs (`SYS_FS`)
| ID | Macro | Meaning |
|---|---|---|
| 1 | `FS_CMD_OPEN` | Open file |
| 2 | `FS_CMD_READ` | Read from fd |
| 3 | `FS_CMD_WRITE` | Write to fd |
| 4 | `FS_CMD_CLOSE` | Close fd |
| 5 | `FS_CMD_SEEK` | Seek in file |
| 6 | `FS_CMD_TELL` | Current offset |
| 7 | `FS_CMD_LIST` | Directory listing |
| 8 | `FS_CMD_DELETE` | Delete file |
| 9 | `FS_CMD_SIZE` | File size |
| 10 | `FS_CMD_MKDIR` | Create directory |
| 11 | `FS_CMD_EXISTS` | Path exists check |
| 12 | `FS_CMD_GETCWD` | Get cwd |
| 13 | `FS_CMD_CHDIR` | Change cwd |
| 14 | `FS_CMD_GET_INFO` | File metadata |
| 15 | `FS_CMD_DUP` | `dup` fd |
| 16 | `FS_CMD_DUP2` | `dup2` fd |
| 17 | `FS_CMD_PIPE` | Create pipe |
| 18 | `FS_CMD_FCNTL` | `fcntl` flags ops |
## GUI Command IDs (`SYS_GUI`)
| ID | Macro | Meaning |
|---|---|---|
| 1 | `GUI_CMD_WINDOW_CREATE` | Create a new window |
| 2 | `GUI_CMD_DRAW_RECT` | Draw a rectangle |
| 3 | `GUI_CMD_DRAW_STRING` | Draw a string (TTF) |
| 4 | `GUI_CMD_MARK_DIRTY` | Mark region dirty / dual-buffer commit |
| 5 | `GUI_CMD_GET_EVENT` | Retrieve next GUI event |
| 6 | `GUI_CMD_DRAW_ROUNDED_RECT_FILLED` | Draw filled rounded rectangle |
| 7 | `GUI_CMD_DRAW_IMAGE` | Draw raw image data |
| 8 | `GUI_CMD_GET_STRING_WIDTH` | Get TTF string width |
| 9 | `GUI_CMD_GET_FONT_HEIGHT` | Get TTF font height |
| 10 | `GUI_CMD_DRAW_STRING_BITMAP` | Draw legacy bitmap string |
| 11 | `GUI_CMD_DRAW_STRING_SCALED` | Draw scaled TTF string |
| 12 | `GUI_CMD_GET_STRING_WIDTH_SCALED` | Get scaled TTF string width |
| 13 | `GUI_CMD_GET_FONT_HEIGHT_SCALED` | Get scaled TTF font height |
| 14 | `GUI_CMD_WINDOW_SET_RESIZABLE` | Toggle window resizability |
| 15 | `GUI_CMD_WINDOW_SET_TITLE` | Update window title |
| 16 | `GUI_CMD_SET_FONT` | Load/set window-specific font |
| 18 | `GUI_CMD_DRAW_STRING_SCALED_SLOPED` | Draw sloped/scaled TTF string |
| 50 | `GUI_CMD_GET_SCREEN_SIZE` | Get display resolution |
| 51 | `GUI_CMD_GET_SCREENBUFFER` | Copy screen contents to buffer |
| 52 | `GUI_CMD_SHOW_NOTIFICATION` | Show desktop notification |
| 53 | `GUI_CMD_GET_DATETIME` | Get RTC datetime |
## SYSTEM Command IDs (`SYS_SYSTEM`)
### Desktop and display
| ID | Macro | Meaning |
|---|---|---|
| 1 | `SYSTEM_CMD_SET_BG_COLOR` | Set desktop background color |
| 2 | `SYSTEM_CMD_SET_BG_PATTERN` | Set desktop background pattern |
| 3 | `SYSTEM_CMD_SET_WALLPAPER` | Legacy wallpaper command slot |
| 4 | `SYSTEM_CMD_SET_DESKTOP_PROP` | Set desktop behavior property |
| 5 | `SYSTEM_CMD_SET_MOUSE_SPEED` | Set mouse speed |
| 7 | `SYSTEM_CMD_GET_DESKTOP_PROP` | Get desktop property |
| 8 | `SYSTEM_CMD_GET_MOUSE_SPEED` | Get mouse speed |
| 9 | `SYSTEM_CMD_GET_WALLPAPER_THUMB` | Legacy wallpaper thumb slot |
| 10 | `SYSTEM_CMD_CLEAR_SCREEN` | Clear text console |
| 29 | `SYSTEM_CMD_SET_TEXT_COLOR` | Set console text color |
| 31 | `SYSTEM_CMD_SET_WALLPAPER_PATH` | Set wallpaper from path |
| 40 | `SYSTEM_CMD_SET_FONT` | Set active font |
| 47 | `SYSTEM_CMD_SET_RESOLUTION` | Set display mode |
| 49 | `SYSTEM_CMD_SET_KEYBOARD_LAYOUT` | Set active keyboard layout ID |
| 51 | `SYSTEM_CMD_GET_KEYBOARD_LAYOUT` | Get current keyboard layout ID |
| 52 | `SYSTEM_GET_CURSOR_SCALE` | Get the current BoredWM cursor scale |
| 53 | `SYSTEM_SET_CURSOR_SCALE` | Set the BoredWM cursor scale |
### Time, power, and system state
| ID | Macro | Meaning |
|---|---|---|
| 11 | `SYSTEM_CMD_RTC_GET` | Read RTC datetime |
| 12 | `SYSTEM_CMD_REBOOT` | Reboot machine |
| 13 | `SYSTEM_CMD_SHUTDOWN` | Power off machine |
| 14 | `SYSTEM_CMD_BEEP` | PC speaker beep |
| 15 | `SYSTEM_CMD_GET_MEM_INFO` | Return total/used memory |
| 16 | `SYSTEM_CMD_GET_TICKS` | Return scheduler/WM tick count |
| 28 | `SYSTEM_CMD_GET_SHELL_CONFIG` | Read shell config value |
| 32 | `SYSTEM_CMD_RTC_SET` | Set RTC datetime |
| 41 | `SYSTEM_CMD_SET_RAW_MODE` | Terminal raw-mode control |
| 43 | `SYSTEM_CMD_YIELD` | Yield scheduler timeslice (Not recommended for idle loops) |
| 46 | `SYSTEM_CMD_SLEEP` | Sleep current process (Recommended for throttling) |
### Network
| ID | Macro | Meaning |
|---|---|---|
| 6 | `SYSTEM_CMD_NETWORK_INIT` | Init networking |
| 17 | `SYSTEM_CMD_PCI_LIST` | PCI device list access |
| 18 | `SYSTEM_CMD_NETWORK_DHCP` | DHCP acquire |
| 19 | `SYSTEM_CMD_NETWORK_GET_MAC` | Read NIC MAC |
| 20 | `SYSTEM_CMD_NETWORK_GET_IP` | Read IPv4 |
| 21 | `SYSTEM_CMD_NETWORK_SET_IP` | Set static IPv4 |
| 22 | `SYSTEM_CMD_UDP_SEND` | Send UDP packet |
| 23 | `SYSTEM_CMD_NETWORK_GET_STATS` | Network stats |
| 24 | `SYSTEM_CMD_NETWORK_GET_GATEWAY` | Read gateway |
| 25 | `SYSTEM_CMD_NETWORK_GET_DNS` | Read DNS server |
| 26 | `SYSTEM_CMD_ICMP_PING` | ICMP ping |
| 27 | `SYSTEM_CMD_NETWORK_IS_INIT` | Network initialized flag |
| 30 | `SYSTEM_CMD_NETWORK_HAS_IP` | Has IPv4 address flag |
| 33 | `SYSTEM_CMD_TCP_CONNECT` | TCP connect |
| 34 | `SYSTEM_CMD_TCP_SEND` | TCP send |
| 35 | `SYSTEM_CMD_TCP_RECV` | TCP recv (blocking) |
| 36 | `SYSTEM_CMD_TCP_CLOSE` | TCP close |
| 37 | `SYSTEM_CMD_DNS_LOOKUP` | DNS lookup |
| 38 | `SYSTEM_CMD_SET_DNS` | Set DNS server |
| 39 | `SYSTEM_CMD_NET_UNLOCK` | Force net lock release |
| 42 | `SYSTEM_CMD_TCP_RECV_NB` | TCP recv (non-blocking) |
| 48 | `SYSTEM_CMD_NETWORK_GET_NIC_NAME` | NIC name |
### Process, tty, signals
| ID | Macro | Meaning |
|---|---|---|
| 50 | `SYSTEM_CMD_PARALLEL_RUN` | Dispatch parallel job |
| 60 | `SYSTEM_CMD_TTY_CREATE` | Create tty |
| 61 | `SYSTEM_CMD_TTY_READ_OUT` | Read tty output buffer |
| 62 | `SYSTEM_CMD_TTY_WRITE_IN` | Write tty input buffer |
| 63 | `SYSTEM_CMD_TTY_READ_IN` | Read input for current tty |
| 64 | `SYSTEM_CMD_SPAWN` | Spawn process |
| 65 | `SYSTEM_CMD_TTY_SET_FG` | Set tty foreground PID |
| 66 | `SYSTEM_CMD_TTY_GET_FG` | Get tty foreground PID |
| 67 | `SYSTEM_CMD_TTY_KILL_FG` | Kill tty foreground PID |
| 68 | `SYSTEM_CMD_TTY_KILL_ALL` | Kill tty process group |
| 69 | `SYSTEM_CMD_TTY_DESTROY` | Destroy tty |
| 70 | `SYSTEM_CMD_EXEC` | Exec replace current process |
| 71 | `SYSTEM_CMD_WAITPID` | Wait/reap child |
| 72 | `SYSTEM_CMD_KILL_SIGNAL` | Send signal |
| 73 | `SYSTEM_CMD_SIGACTION` | Set/get handler |
| 74 | `SYSTEM_CMD_SIGPROCMASK` | Signal mask ops |
| 75 | `SYSTEM_CMD_SIGPENDING` | Get pending signals |
### ELF app metadata
| ID | Macro | Meaning |
|---|---|---|
| 76 | `SYSTEM_CMD_GET_ELF_METADATA` | Read full app metadata from an ELF |
| 77 | `SYSTEM_CMD_GET_ELF_PRIMARY_IMAGE` | Read primary icon path from an ELF |
### Disk Management
| ID | Macro | Meaning |
|---|---|---|
| 100 | `SYSTEM_CMD_DISK_GET_COUNT` | Get number of detected disks |
| 101 | `SYSTEM_CMD_DISK_GET_INFO` | Get metadata for a specific disk/partition |
| 102 | `SYSTEM_CMD_DISK_WRITE_GPT` | Write GPT partition table to disk |
| 103 | `SYSTEM_CMD_DISK_WRITE_MBR` | Write MBR partition table to disk |
| 104 | `SYSTEM_CMD_DISK_MKFS_FAT32` | Format a partition as FAT32 |
| 105 | `SYSTEM_CMD_DISK_MOUNT` | Mount a filesystem |
| 106 | `SYSTEM_CMD_DISK_UMOUNT` | Unmount a filesystem |
| 107 | `SYSTEM_CMD_DISK_RESCAN` | Rescan disk for partition changes |
| 108 | `SYSTEM_CMD_DISK_REPLACE_KERNEL` | Copy new kernel to ESP / boot partition |
| 109 | `SYSTEM_CMD_DISK_SYNC` | Flush disk caches for a mountpoint |
## Common Wrapper API (`src/userland/libc/syscall.h`)
Typical wrappers used by apps:
- Process/system: `sys_exit`, `sys_yield`, `sys_system` (with `SYSTEM_CMD_SLEEP`), `sys_spawn`, `sys_exec`, `sys_waitpid`
- Filesystem: `sys_open`, `sys_read`, `sys_write_fs`, `sys_close`, `sys_seek`, `sys_tell`, `sys_size`, `sys_list`
- Network: `sys_network_init`, `sys_network_dhcp_acquire`, `sys_udp_send`, `sys_tcp_connect`, `sys_tcp_recv_nb`, `sys_dns_lookup`
- TTY: `sys_tty_create`, `sys_tty_read_out`, `sys_tty_write_in`, `sys_tty_set_fg`
- ELF metadata: `sys_get_elf_metadata`, `sys_get_elf_primary_image` — see [`elf_metadata.md`](elf_metadata.md) for full usage
## Best Practices
- Do not hardcode numeric command IDs in app code.
- Prefer high-level libc calls (`open`, `read`, `waitpid`, `sigaction`) where available.
- Use `syscall.h` macros when a raw `sys_system` call is still needed.

99
docs/appdev/tcc.md Normal file
View File

@@ -0,0 +1,99 @@
# Native Development with TCC
BoredOS includes a native port of the **Tiny C Compiler (TCC)**, allowing you to compile and run C programs directly within the operating system.
## Basic Usage
The compiler is available as `tcc`. You can use it much like you would on a standard Unix-like system.
### Compiling a Simple CLI Program
Create a file named `hello.c`:
```c
#include <stdio.h>
int main() {
printf("Hello from BoredOS native TCC!\n");
return 0;
}
```
Compile and run it:
```bash
tcc hello.c -o hello.elf
./hello.elf
```
## Developing GUI Applications
To develop applications that use the BoredOS Window Manager and UI library, you need to link against `libboredos`.
### Example GUI App (`hello_gui.c`)
```c
#include <libc/libui.h>
#include <libc/syscall.h>
int main() {
ui_window_t win = ui_window_create("Hello TCC", 100, 100, 300, 200);
if (!win) return 1;
gui_event_t ev;
while (1) {
if (ui_get_event(win, &ev)) {
if (ev.type == GUI_EVENT_PAINT) {
ui_draw_string(win, 20, 40, "Compiled natively!", 0xFFFFFFFF);
ui_mark_dirty(win, 0, 0, 300, 200);
} else if (ev.type == GUI_EVENT_CLOSE) {
break;
}
}
}
return 0;
}
```
### Compilation Command
```bash
tcc hello_gui.c -o hello_gui.elf -lboredos
```
> [!NOTE]
> The compiler automatically searches `/usr/include` for headers and `/usr/lib` for libraries. The BoredOS SDK headers and `libboredos.a` are pre-installed in these locations.
## Technical Details
### Standard Paths
- **Headers**: `/usr/include`, `/usr/local/include`
- **Libraries**: `/usr/lib`
- **TCC Internal**: `/usr/lib/tcc`
### Compilation Process
BoredOS TCC generates standard **ELF64** binaries. It automatically links with:
1. **`crt0.o`**: Entry point initialization.
2. **`crti.o` / `crtn.o`**: Constructor/Destructor support.
3. **`libc.a`**: The BoredOS standard C library.
4. **`libtcc1.a`**: TCC runtime support.
### Memory & Storage Requirements
- **Static Linking Only**: BoredOS currently only supports static linking for native binaries.
- **Live ISO Mode**: You are limited by the 128MB RAMFS capacity. Compiling very large projects may fail if this limit is reached.
- **Disk Installation**: The compiler writes directly to your persistent disk. Your storage capacity is limited only by the size of your partition, and your work persists across reboots.
- **System RAM**: The kernel statically reserves 128MB for the internal RAMFS regardless of boot mode, though this does not limit your storage on a disk install.
- **No JIT**: The `tcc -run` feature is currently unsupported due to kernel memory protection and the lack of `mmap` with execution permissions in userland.
## Troubleshooting
### I/O Error during compilation
If you encounter an "I/O Error" while writing the output file, you may have run out of space.
- **Live ISO**: You have exceeded the 128MB RAMFS limit.
- **Disk Installation**: Your disk partition is full.
### Missing Headers
Ensure that you are including headers using the standard syntax: `#include <stdio.h>`. If you are using custom paths, use the `-I` flag:
```bash
tcc myapp.c -I/root/my_headers -o myapp.elf
```

111
docs/appdev/ui_api.md Normal file
View File

@@ -0,0 +1,111 @@
<div align="center">
<h1>UI API (<code>libui.h</code>)</h1>
<p><em>Comprehensive manual for interacting with the Window Manager.</em></p>
</div>
---
The UI library (`libui.h`) is the sole mechanism for Graphical Userland Applications to draw to the screen and receive input events in BoredOS. It wraps `SYS_GUI` kernel calls.
## Window Management
A "Window" is a reserved drawing canvas managed by the compositor.
* `ui_window_t ui_window_create(const char *title, int x, int y, int w, int h);`
Creates a new window at `(x, y)` with dimensions `w`x`h`. Returns a window handle.
**Flags** are currently embedded in the syscall; standard windows include decorations (titlebar, borders).
* `void ui_window_set_title(ui_window_t win, const char *title);`
Dynamically update the text displayed in the window's titlebar.
* `void ui_window_set_resizable(ui_window_t win, bool resizable);`
Enable or disable the user's ability to resize the window by dragging its edges.
* `void ui_get_screen_size(uint64_t *out_w, uint64_t *out_h);`
Query the global screen resolution of the display.
## Drawing Primitives
All drawing functions write to an off-screen buffer associated with the window. **You must call `ui_mark_dirty()` to instruct the compositor to push your changes to the physical screen.**
* `void ui_draw_rect(ui_window_t win, int x, int y, int w, int h, uint32_t color);`
Draw a solid filled rectangle.
* `void ui_draw_rounded_rect_filled(ui_window_t win, int x, int y, int w, int h, int radius, uint32_t color);`
Fill a rectangle with rounded corners of a specified `radius`.
* `void ui_draw_image(ui_window_t win, int x, int y, int w, int h, uint32_t *image_data);`
Blit a raw ARGB pixel buffer (`image_data`) directly into the window canvas.
* `void ui_mark_dirty(ui_window_t win, int x, int y, int w, int h);`
Mark a specific rectangular region of the window as "dirty". The Window Manager will redraw this area on the next compositing pass.
> [!TIP]
> Colors are defined as 32-bit unsigned integers in **ARGB** format: `0xAARRGGBB`.
> E.g., `0xFF000000` is opaque black, `0xFFFF0000` is opaque red.
## Text Rendering
BoredOS provides multiple text rendering methodologies, including a default system font and scaled/bitmap alternatives.
* `void ui_draw_string(ui_window_t win, int x, int y, const char *str, uint32_t color);`
Draw text using the default system typeface.
* `void ui_draw_string_bitmap(ui_window_t win, int x, int y, const char *str, uint32_t color);`
Draw text using a secondary fast bitmap font renderer.
* `void ui_draw_string_scaled(ui_window_t win, int x, int y, const char *str, uint32_t color, float scale);`
Draw text scaled up or down by a floating-point multiplier.
* `void ui_draw_string_scaled_sloped(ui_window_t win, int x, int y, const char *str, uint32_t color, float scale, float slope);`
Draw scaled text with an italic-like slope/shear applied.
* `void ui_set_font(ui_window_t win, const char *path);`
Load and set a custom `.ttf` or bitmap font from the filesystem for this window.
### Font Metrics
Used for calculating layout bounds before drawing:
* `uint32_t ui_get_string_width(const char *str);`
* `uint32_t ui_get_font_height(void);`
* `uint32_t ui_get_string_width_scaled(const char *str, float scale);`
* `uint32_t ui_get_font_height_scaled(float scale);`
## Event Handling
Applications must continuously poll for events inside an infinite `$while(1)` loop.
* `bool ui_get_event(ui_window_t win, gui_event_t *ev);`
Returns `true` if an event was waiting in the queue, populating the `ev` structure. Returns `false` if the queue is empty.
> [!IMPORTANT]
> Because `ui_get_event` is non-blocking, you must call `sleep(ms);` or `sys_system(SYSTEM_CMD_SLEEP, ms, ...)` inside your event loop if no event was received.
>
> Historically, BoredOS used `sys_yield()`, but in the **Multi-Core (SMP)** architecture, yielding alone will still pin a CPU core to 100% usage. Using a short sleep (e.g., 5-10ms) ensures your app remains responsive while allowing the CPU to actually idle.
### Graphical Event Structure
```c
typedef struct {
int type; // Specifies the event class (see below)
int arg1; // Generic argument 1
int arg2; // Generic argument 2
int arg3; // Generic argument 3
} gui_event_t;
```
### Event Types & Arguments
| Event Constant | `type` ID | Trigger | `arg1` | `arg2` | `arg3` |
| :--- | :--- | :--- | :--- | :--- | :--- |
| `GUI_EVENT_NONE` | `0` | Empty event | - | - | - |
| `GUI_EVENT_PAINT` | `1` | Window needs redrawing | - | - | - |
| `GUI_EVENT_CLICK` | `2` | Mouse click down | X Coord | Y Coord | Button State |
| `GUI_EVENT_RIGHT_CLICK` | `3` | Mouse right-click down | X Coord | Y Coord | Button State |
| `GUI_EVENT_CLOSE` | `4` | User clicked 'X' button | - | - | - |
| `GUI_EVENT_KEY` | `5` | Keyboard key pressed | Keycode | Modifiers | - |
| `GUI_EVENT_KEYUP` | `10` | Keyboard key released | Keycode | Modifiers | - |
| `GUI_EVENT_MOUSE_DOWN` | `6` | Generic mouse button down | X Coord | Y Coord | Button State |
| `GUI_EVENT_MOUSE_UP` | `7` | Generic mouse button release | X Coord | Y Coord | Button State |
| `GUI_EVENT_MOUSE_MOVE` | `8` | Mouse cursor moved | X Coord | Y Coord | - |
| `GUI_EVENT_MOUSE_WHEEL` | `9` | Scroll wheel rotated | Scroll Delta | - | - |
| `GUI_EVENT_RESIZE` | `11` | Window dimensions changed| New Width | New Height | - |
*(Note: Coordinate arguments (`arg1`, `arg2`) for mouse events are typically relative to the top-left corner of the window's client area).*
---
> [!TIP]
> **Looking for Buttons, TextBoxes, or Scrollbars?**
> While `libui.h` provides the foundation for drawing, most applications should use the higher-level [**Widget API**](widget_api.md) (`libwidget.h`) for standard interactive components.
---

108
docs/appdev/widget_api.md Normal file
View File

@@ -0,0 +1,108 @@
<div align="center">
<h1>Widget API (<code>libwidget.h</code>)</h1>
<p><em>High-level UI components for BoredOS applications.</em></p>
</div>
---
The Widget library (`libwidget.h`) provides a set of reusable UI components built on top of `libui.h`. It uses an abstract `widget_context_t` to decouple component logic from specific drawing implementations, making it easier to build complex graphical interfaces.
## Widget Context
To use any widget, you must first define a `widget_context_t`. This structure contains function pointers for basic drawing operations (rects, strings) and theme preferences.
```c
typedef struct {
void *user_data;
void (*draw_rect)(void *user_data, int x, int y, int w, int h, uint32_t color);
void (*draw_rounded_rect_filled)(void *user_data, int x, int y, int w, int h, int r, uint32_t color);
void (*draw_string)(void *user_data, int x, int y, const char *str, uint32_t color);
int (*measure_string_width)(void *user_data, const char *str);
void (*mark_dirty)(void *user_data, int x, int y, int w, int h);
bool use_light_theme;
} widget_context_t;
```
> [!TIP]
> Usually, `user_data` is set to your `ui_window_t` handle, and the functions are simple wrappers around `ui_draw_rect`, `ui_draw_string`, etc.
---
## Button (`widget_button_t`)
Standard interactive button with hover and click states.
* `void widget_button_init(widget_button_t *btn, int x, int y, int w, int h, const char *text);`
* `void widget_button_draw(widget_context_t *ctx, widget_button_t *btn);`
* `bool widget_button_handle_mouse(widget_button_t *btn, int mx, int my, bool mouse_down, bool mouse_clicked, void *user_data);`
### Usage Example:
```c
widget_button_t my_btn;
widget_button_init(&my_btn, 10, 10, 80, 25, "Click Me");
my_btn.on_click = my_callback_func;
// In your event loop:
widget_button_handle_mouse(&my_btn, ev.arg1, ev.arg2, is_down, is_clicked, my_data);
```
---
## Scrollbar (`widget_scrollbar_t`)
Vertical scrollbar supporting dragging and track-paging.
* `void widget_scrollbar_init(widget_scrollbar_t *sb, int x, int y, int w, int h);`
* `void widget_scrollbar_update(widget_scrollbar_t *sb, int content_height, int scroll_y);`
* `void widget_scrollbar_draw(widget_context_t *ctx, widget_scrollbar_t *sb);`
* `bool widget_scrollbar_handle_mouse(widget_scrollbar_t *sb, int mx, int my, bool mouse_down, void *user_data);`
> [!NOTE]
> The scrollbar automatically calculates the "thumb" size based on the ratio of `h` to `content_height`.
---
## TextBox (`widget_textbox_t`)
Editable text field with focus support and keyboard handling.
* `void widget_textbox_init(widget_textbox_t *tb, int x, int y, int w, int h, char *buffer, int max_len);`
* `void widget_textbox_draw(widget_context_t *ctx, widget_textbox_t *tb);`
* `bool widget_textbox_handle_mouse(widget_textbox_t *tb, int mx, int my, bool mouse_clicked, void *user_data);`
* `bool widget_textbox_handle_key(widget_textbox_t *tb, char c, void *user_data);`
---
## Dropdown (`widget_dropdown_t`)
Selection menu for picking one item from a list.
* `void widget_dropdown_init(widget_dropdown_t *dd, int x, int y, int w, int h, const char **items, int count);`
* `void widget_dropdown_draw(widget_context_t *ctx, widget_dropdown_t *dd);`
* `bool widget_dropdown_handle_mouse(widget_dropdown_t *dd, int mx, int my, bool mouse_clicked, void *user_data);`
---
## Checkbox / Radio (`widget_checkbox_t`)
Toggleable options with support for circular "Radio" style or square "Checkbox" style.
* `void widget_checkbox_init(widget_checkbox_t *cb, int x, int y, int w, int h, const char *text, bool is_radio);`
* `void widget_checkbox_draw(widget_context_t *ctx, widget_checkbox_t *cb);`
* `bool widget_checkbox_handle_mouse(widget_checkbox_t *cb, int mx, int my, bool mouse_clicked, void *user_data);`
---
## Event Integration
Widgets are designed to be polled within your `libui` event loop. Most handle-mouse functions return `true` if the event was "consumed" by the widget, allowing you to stop further processing for that event.
```c
if (ui_get_event(win, &ev)) {
bool handled = false;
handled |= widget_button_handle_mouse(&btn, ev.arg1, ev.arg2, is_down, is_clicked, NULL);
if (!handled) {
// Handle global window events...
}
}
```

View File

@@ -0,0 +1,35 @@
<div align="center">
<h1>ACPI</h1>
<p><em>ACPI Power Interface</em></p>
</div>
ACPI Subsystem
BoredOS implements an ACPI subsystem which manages power state transitions.
The implementation lives
in `src/acpi/`
---
### Startup and Table Discovery
The first thing that ACPI does at boot time is to locate the RSDP.This can simply be requested fromlimine.
If the pointer is not present or the pointer is not valid we panic!It is a hardware requirement
If this is not present then we also check a checksum if that fails then the RSDP is also not valid and we panic
XSDT vs RSDT Fallback
When the RSDP specifies aRevision of 2 or greater, and we have a valid XSDT Address then we should try and use the XSDT instead,otherwise we use the RSDT.This is automatically abstracted by `acpi_get_sdt()`
---
### Shutdown and Power Off
This works by writing an appropriate value to PM1 Control Block register, and will prompt hardware to move into S5 power state.
### Performing the power off
Once the sleep types are identified and so on, this will continue as follows
On hardware that actually obeys ACPI standards this process should only perform step 1, and your machine should be turned off. To try and handle virtual machines or emulators that are known to fail at step 1,
we send the virtual machine interrupts second in case writing bytes makes our hardware think it is acting up and we do not wish to cause an unnecessary interrupt

View File

@@ -0,0 +1,32 @@
# BoredOS Architecture
This folder gathers the architecture documentation that explains how BoredOS is built from the kernel up.
## Architecture roadmap
The documentation is split by area so you can go directly to the subsystem you want to understand.
| Area | Document | Description |
| --- | --- | --- |
| Graphics | [`graphics/window_manager.md`](architecture/graphics/window_manager.md) | Window manager design and display composition. |
| Hardware | [`hardware/input.md`](architecture/hardware/input.md) | Hardware-level input support and device wiring. |
| Hardware | [`hardware/pci.md`](architecture/hardware/pci.md) | PCI bus management and device enumeration. |
| Input | [`input/keyboard.md`](architecture/input/keyboard.md) | Keyboard input handling and key mapping. |
| Memory | [`memory/memory.md`](architecture/memory/memory.md) | Memory architecture, paging, and address space layout. |
| Memory | [`memory/memory_manager.md`](architecture/memory/memory_manager.md) | Memory allocation and management systems. |
| Network | [`network/network_stack.md`](architecture/network/network_stack.md) | TCP/IP stack design, protocol flow, and packet handling. |
| Network | [`network/network_drivers.md`](architecture/network/network_drivers.md) | Network driver architecture and interface support. |
| Storage | [`storage/filesystem.md`](architecture/storage/filesystem.md) | File system structure and storage access. |
| Storage | [`storage/ahci_drivers.md`](architecture/storage/ahci_drivers.md) | AHCI driver implementation and disk controller support. |
| System | [`system/core.md`](architecture/system/core.md) | Core kernel architecture and main subsystems. |
| System | [`system/interrupts.md`](architecture/system/interrupts.md) | Interrupt handling and low-level event dispatch. |
| System | [`system/processes.md`](architecture/system/processes.md) | Process management, scheduling, and execution model. |
| General | [`versioning.md`](architecture/versioning.md) | Release versioning and project numbering conventions. |
## Quick start
- **Read `system/core.md` first** for the kernel overview.
- Then explore the subsystem area you need: `memory/`, `network/`, `storage/`, `graphics/`, or `system/`.
- Use `versioning.md` to understand BoredOS version rules.
> Note: The links above point directly to the most important architecture documents in this folder.

View File

@@ -0,0 +1,54 @@
<div align="center">
<h1>Window Manager (WM)</h1>
<p><em>The native graphical subsystem compositing and event routing.</em></p>
</div>
---
BoredOS features a fully custom, graphical Window Manager built directly into the kernel, residing in the `src/wm/` directory. It is responsible for compositing the screen, handling window logic, rendering text, and dispatching UI events.
## Framebuffer and Rendering
1. **Limine Framebuffer**: During boot, the Limine bootloader requests a graphical framebuffer from the hardware (e.g., GOP in UEFI environments) and passes a pointer to this linear memory buffer to the kernel.
2. **Double Buffering**: To prevent screen tearing, the WM does not draw directly to the screen. It allocates a "back buffer" in kernel memory equal to the size of the screen. All drawing operations (lines, rectangles, windows) happen on this back buffer.
3. **Compositing**: Once per frame or upon request, the entire back buffer (or dirty regions) is copied to the actual Limine physical framebuffer memory, making the changes visible instantly.
> [!TIP]
> The performance of the window manager heavily depends on minimizing the "dirty regions" drawn in the compositing loop rather than sweeping the whole screen.
## Window System (`wm.c`)
The windowing system is built around a linked list of `Window` structures.
- **Z-Ordering**: The list determines the draw order. Windows at the back of the list are drawn first, and the active window is drawn last (on top).
- **Window Structures**: Each window object tracks its dimensions (`x`, `y`, `width`, `height`), title, background color, and an internal buffer if it's acting as a canvas for userland apps.
- **Decorations**: The kernel handles drawing window borders, title bars, and close buttons automatically unless a borderless style is specified.
## Input Handling and Events
The WM acts as the central hub for input routing.
1. **Mouse Driver**: The PS/2 mouse driver (`dev/mouse.c`) detects movement and button clicks. It raises interrupts that update global cursor coordinates.
2. **Hit Testing**: The WM checks these coordinates against the bounding boxes of existing windows. It handles dragging logic (if the user clicks a title bar) or focus changes.
3. **Event Queue**: If a userland application owns the window that was clicked, the WM packages the input (coordinates, button state) into an event message and drops it into the owning process's event queue. The application can retrieve these via the custom libc UI functions.
- **Event Polling**: The UI loop inside an app continuously calls `ui_poll_event()` to respond to mouse clicks and window movement dispatched by the kernel WM.
## Multi-Core Safety & Performance
With the introduction of Symmetric Multi-Processing (SMP), the Window Manager (WM) was redesigned to ensure stability and high performance across multiple cores.
1. **Granular Window Locks**: Each `Window` object possesses its own `spinlock_t lock;`. User applications concurrently draw directly into their own window buffers without stalling the rest of the system. The global `wm_lock` is reserved strictly for altering global structures like window z-order or syncing buffers to the screen compositing layer.
2. **Per-CPU Rendering State**: To facilitate simultaneous GUI system calls across all CPU cores, the low-level rendering context (`g_render_target` array) is isolated per-CPU using the core ID. This allows completely lockless multi-core pixel rasterization, drastically reducing rendering bottlenecks.
3. **Deferred Compositing**: Final screen composition (`wm_paint`) is scheduled to the main kernel idle loop on the Bootstrap Processor (BSP). This enables application cores to continue processing logic seamlessly while the GUI asynchronously handles flipping the physical framebuffer.
## Cursor Rendering
The cursor is drawn by BoredWM rather than by userland. Its shape is a small bitmap mask where transparent cells are skipped, white cells draw the outline, and black cells draw the filled body. The WM expands each source cell by the active cursor scale before writing pixels into the back buffer.
The current scale is exposed to userland through `SYSTEM_GET_CURSOR_SCALE` and can be changed with `SYSTEM_SET_CURSOR_SCALE`. Settings uses those commands for the mouse panel, while the WM clamps the requested scale and forces a redraw so the new cursor size appears immediately.
> [!IMPORTANT]
> Because application rendering (rasterizing geometry into a window's backbuffer) is SMP-safe and lock-free across cores, GUI performance scales linearly with the number of CPUs active.
---

View File

@@ -0,0 +1,41 @@
# PCI Bus Subsystem
The Peripheral Component Interconnect (PCI) subsystem in BoredOS is responsible for discovering, enumerating, and configuring hardware devices connected to the motherboard. It provides the foundation for the OS to load specific device drivers (like Network Interface Cards or AHCI controllers).
## 1. Configuration Space Access
BoredOS interacts with the PCI bus via the legacy x86 I/O ports:
- **`0xCF8`**: Address Port (used to select a specific bus, device, function, and register offset).
- **`0xCFC`**: Data Port (used to read or write the 32-bit value at the selected address).
These are abstracted in `src/dev/pci.c` by the `pci_read_config()` and `pci_write_config()` functions. By writing a formatted 32-bit address to `0xCF8`, the CPU signals the PCI bridge to route the subsequent data read/write on `0xCFC` to the correct hardware device.
## 2. Device Enumeration
During boot, BoredOS recursively scans the PCI buses. The PCI bus topology is hierarchical:
- Up to **256 buses**.
- Each bus has up to **32 devices**.
- Each device has up to **8 functions** (for multi-function devices).
The enumeration process (`pci_enumerate_devices`):
1. Iterates through Bus 0 to 255.
2. For each bus, iterates through Devices 0 to 31.
3. For each device, it reads the `Vendor ID` at offset 0. If the value is `0xFFFF`, no device is present at that slot.
4. If a valid Vendor ID is found, it populates a `pci_device_t` structure containing the:
- `Vendor ID` and `Device ID` (used to uniquely identify the hardware model).
- `Class Code`, `Subclass`, and `Prog IF` (used to identify the generic type of the device, e.g., Network Controller, Mass Storage Controller).
## 3. Base Address Registers (BARs)
PCI devices expose memory-mapped I/O (MMIO) regions or I/O port ranges via Base Address Registers (BARs).
BoredOS provides the `pci_get_bar(dev, bar_num)` function to extract these base addresses.
Drivers use BARs to talk directly to the hardware. For example:
- The AHCI driver reads BAR5 to find the base address of the AHCI memory registers (ABAR).
- The E1000 driver uses a BAR to map the NIC's control registers into the kernel's virtual memory space.
## 4. Hardware Configuration
Once a device is found, drivers can call helper functions to enable specific PCI features:
- **`pci_enable_bus_mastering(dev)`**: Sets the Bus Master bit in the PCI Command Register. This is critical for drivers that use DMA (Direct Memory Access), allowing the hardware to read/write system RAM independently of the CPU (used heavily by AHCI and Network drivers).
- **`pci_enable_mmio(dev)`**: Sets the Memory Space Enable bit, allowing the CPU to access the device's MMIO regions.

View File

@@ -0,0 +1,273 @@
# Input Subsystem
## Overview
The input subsystem is responsible for handling user input, primarily from the keyboard.
It provides a structured pipeline that transforms low-level hardware signals into usable data for the kernel and higher-level components. This subsystem abstracts hardware-specific behavior and exposes a consistent interface to the rest of the operating system.
---
## Scope
The `/input` directory focuses on keyboard input. It includes:
- A keyboard driver responsible for handling hardware events
- A keycode layer used as an intermediate representation
- A keymap system that translates keycodes into characters
---
## Design Principles
- **Hardware abstraction**
Hardware-specific logic is isolated from higher-level components.
- **Simplicity**
The input path is kept minimal and efficient, especially in interrupt context.
- **Modularity**
Each stage of input processing is handled by a dedicated component.
- **Extensibility**
The system is designed to support additional input devices and layouts in the future.
---
## Directory Structure
```
input/
├── keyboard.c
├── keyboard.h
├── keycodes.h
├── keymap.c
├── keymap.h
```
---
## Input Processing Model
Keyboard input is processed in three distinct stages:
1. Raw scancodes are received from the hardware
2. Scancodes are converted into keycodes
3. Keycodes are translated into characters or control signals
Each stage is handled independently to ensure clarity and maintainability.
---
## Components
### Keyboard Driver
#### Overview
The keyboard driver interfaces directly with the keyboard hardware. It handles interrupts and processes raw input data from the controller.
#### Responsibilities
- Handle keyboard interrupts
- Read scancodes from the PS/2 controller
- Convert scancodes into keycodes
- Forward processed data to higher layers
#### Behavior
The driver operates in an interrupt-driven context. When a key event occurs, the hardware triggers an interrupt. The driver reads the corresponding scancode and processes it immediately.
Because this code runs at a low level, it must be fast, predictable, and minimal.
#### Integration
The keyboard driver depends on:
- The PS/2 controller driver for hardware communication
- The interrupt subsystem for event handling
It provides output to:
- The keycode system
- The keymap system
#### Constraints
- Must not block execution
- Must minimize processing time per interrupt
- Must correctly handle key press and key release events
---
### Keycodes
#### Overview
Keycodes define a hardware-independent representation of keyboard keys.
They serve as an abstraction layer between raw scancodes and higher-level logic.
#### Purpose
The keycode system standardizes keyboard input by mapping all physical key events to a consistent set of identifiers.
This allows the system to:
- Remain independent from specific hardware implementations
- Simplify input handling logic
- Support multiple layouts and configurations
#### Design
Each key is represented by a unique constant, such as:
- KEY_A
- KEY_ENTER
- KEY_SHIFT
#### Role in the System
Keycodes act as the intermediate layer between:
- Hardware-level scancodes
- Character-level or command-level input
#### Usage
- Generated by the keyboard driver
- Consumed by the keymap system
#### Extensibility
The keycode system can be extended to support:
- Additional keys (function keys, multimedia keys)
- Non-standard input devices
- Custom mappings
---
### Keymap
#### Overview
The keymap system translates keycodes into characters or control signals.
It defines how physical key presses are interpreted based on layout and modifier state.
#### Responsibilities
- Convert keycodes into ASCII or equivalent representations
- Apply modifier logic such as Shift and Control
- Provide consistent character output
#### Behavior
The keymap takes a keycode as input and produces an output depending on:
- The current keyboard layout
- Active modifier keys
The same keycode may produce different results depending on modifier state.
#### Integration
- Receives keycodes from the keyboard driver
- Outputs characters to the kernel or userland
---
## Control Signals
In addition to character generation, the input subsystem produces **control signals** representing non-printable keys and command-oriented input.
These signals are derived from keycodes that do not map directly to ASCII characters.
---
### Definition
A control signal is an abstract representation of a key event used to trigger system-level behavior rather than text output.
Typical control signals include:
- Enter
- Backspace
- Escape
- Tab
- Arrow keys
- Function keys
---
### Encoding
Control signals may be represented in different ways depending on the layer:
#### ASCII Control Characters (when applicable)
Some keys map to standard ASCII control codes:
- `ENTER``0x0A` (Line Feed) or `0x0D` (Carriage Return)
- `BACKSPACE``0x08`
- `TAB``0x09`
- `ESC``0x1B`
These values are part of the ASCII control range (`0x00``0x1F`).
---
#### Non-ASCII Keys
Keys that do not belong to the ASCII set are typically handled as **extended keycodes** or **internal constants**:
Examples:
- Arrow keys
- Insert / Delete
- Home / End
- Function keys (F1F12)
------
## Non-ASCII Characters
Non-ASCII characters include any character outside the standard 7-bit ASCII range (`0x00``0x7F`).
Examples:
- Accented characters: `é`, `à`, `ç`
- Symbols: `€`, `£`
- Unicode characters from non-Latin scripts
---
### Encoding Considerations
The current system typically assumes ASCII output. However, supporting non-ASCII characters requires:
- A wider character encoding (e.g. UTF-8)
- Extended keymaps capable of mapping key combinations to multi-byte sequences
Example:
- `'é'` in UTF-8 → `0xC3 0xA9`
---
### Modifier and Layout Impact
Non-ASCII characters are often produced through:
- Keyboard layout differences (AZERTY vs QWERTY)
- Modifier combinations (Shift, AltGr)
Example:
- `AltGr + E``'€'` (depending on layout)
- `KEY_E``'e'`
- `KEY_E + SHIFT``'E'`
---
### Usage
- Control signals are used for command handling and system interaction
- Non-ASCII characters are used for text input and require proper encoding support

View File

@@ -0,0 +1,40 @@
<div align="center">
<h1>Memory Management</h1>
<p><em>Physical and Virtual Memory coordination in x86_64 Long Mode.</em></p>
</div>
---
Memory management in BoredOS is split into physical and virtual layers, designed to support both kernel operations and userland isolation on the x86_64 architecture.
## Physical Memory Management (PMM)
The PMM is responsible for tracking which physical RAM frames (usually 4KB each) are free and which are in use.
1. **Memory Map**: During boot, Limine provides a memory map detailing the available, reserved, and unusable physical memory regions.
2. **Bitmap Allocator**: The core PMM uses a bitmap-based allocation strategy. Each bit in the bitmap represents a single physical page (frame). If a bit is `1`, the page is in use; if `0`, it is free.
3. **Allocation**: When a new page is requested (e.g., for userland space or kernel heap), the PMM scans the bitmap for the first available zero bit, marks it as used, and returns the physical address.
4. **SMP Safety**: In a multi-core environment, the PMM and VMM are protected by **Spinlocks** to prevent two CPUs from allocating the same frame or modifying page tables simultaneously.
> [!NOTE]
> 4KB frame sizes strike a balance between allocation speed and minimal memory fragmentation, fitting directly with the page tables.
## Virtual Memory Management (VMM) and Paging
BoredOS uses 4-level paging (PML4), a requirement for x86_64 long mode, dividing the virtual address space between the kernel and userland.
- **Kernel Space**: The kernel relies on a higher-half design where its code, data, and heap are mapped to high addresses (typically above `0xFFFF800000000000`).
- **Per-CPU Structures**: Each CPU core maintains its own architectural state in memory:
* **Per-CPU GDT**: Each core is initialized with its own Global Descriptor Table.
* **Per-CPU TSS**: Each core has a dedicated Task State Segment containing the `RSP0` pointer for its own kernel stack, ensuring safe interrupt handling across cores.
- **User Space**: Userland applications are loaded into lower virtual addresses.
- **Page Faults**: The `mem/` subsystem registers an Interrupt Service Routine (ISR) for page faults (Interrupt 14). If a process accesses unmapped memory, the handler determines whether to allocate a new frame or terminate the process.
## Kernel Heap
Dynamic allocation within the kernel (`kmalloc` and `kfree`) is layered on top of the physical allocator. The kernel maintains its own heap area in virtual memory. When the heap requires more space, it requests physical frames from the PMM and maps them into the kernel's virtual address space.
> [!IMPORTANT]
> The kernel heap is a shared resource; therefore, all `kmalloc` and `kfree` operations are guarded by a global spinlock to ensure thread safety during multi-core execution.
---

View File

@@ -0,0 +1,71 @@
# Kernel Memory Manager Architecture
BoredOS utilizes a highly optimized, two-tier kernel memory manager (`memory_manager.c`) designed for performance, concurrency safety, and long-term stability. The API provides the standard POSIX-like `kmalloc`, `krealloc`, and `kfree` functions used universally throughout the kernel.
## 1. High-Level Design
The memory manager delegates allocation requests to one of two internal sub-systems based on the requested size and alignment parameters:
1. **Slab Allocator**: Optimally handles all small allocations (<= 512 bytes) with an alignment restriction of <= 8 bytes.
2. **Block-List Allocator**: Handles large allocations (> 512 bytes) and any request requiring aggressive alignment (such as page-aligned buffers).
All operations within the memory manager are secured by a global interrupt-safe spinlock (`mm_lock`), rendering the memory subsystem completely atomic and safe to use from any CPU or interrupt handler without triggering a race condition.
---
## 2. The Slab Allocator (Small Objects)
For frequent, small data structures, the overhead of standard heap fragmentation is unacceptable. The Slab Allocator addresses this by pre-allocating blocks of identical size.
### Classes & Geometry
There are 7 active slab classes defined by `slab_sizes[]`: `8, 16, 32, 64, 128, 256, 512` bytes.
Whenever an allocation requests a size within these bounds, it is rounded up to the nearest valid class.
Each active slab page maps precisely to one standard system `PAGE_SIZE` (4096 bytes).
- The page header (`SlabPage`) is embedded at the very top (byte offset 0).
- The rest of the page is sliced seamlessly into perfectly sized object slots.
### Intrusive LIFO Free-List
To minimize metadata overhead, the Slab Allocator uses an *intrusive* LIFO (Last-In-First-Out) free-list to track empty object slots. The first 8 bytes of any unallocated slot act as a `next` pointer to the next free slot in that page. When a pointer is freed, it is immediately pushed back to the head of this list, making it the most likely candidate for the *next* allocation. This maximizes CPU cache locality.
### Guardrails & Safety
The Slab Allocator implements highly restrictive checks to guard against fatal kernel errors:
- **Canonical Address Checks:** The allocator verifies that the freelist head remains in the higher-half address space (`0xFFFF000000000000` or above), proactively detecting structural corruption.
- **Strict Pointer Admittance:** Before freeing a pointer to a slab, the allocator validates a dual magic-number footprint, limits the pointer's bounds to verify it belongs geographically to the page, and executes a linked-list walk.
- **Double-Free Detection:** When a slab is freed, the allocator walks the internal free-list. If the freed pointer is already in the free-list, the allocator intercepts the double-free attempt before the internal state can be damaged.
---
## 3. The Block-List Allocator (Large Objects)
If an allocation is larger than 512 bytes, the memory manager falls back to the Block-List allocator.
### First-Fit Search & Splitting
The Block Allocator tracks all system memory chunks using an array of `MemBlock` structs ordered dynamically by address.
- It iterates through the array utilizing a **First-Fit Search**. The first contiguous, unallocated block that satisfies the `size` requirement is immediately claimed.
- If the requested alignment dictates it, the allocator splits the parent block. It yields up to three new fragments: `[head padding | exact requested allocation | tail remainder]`.
### Bootstrapping & Heap Migration
To avoid infinite recursion when allocating memory to track new memory blocks, the block list is initially statically allocated in a `.bss` array (`_bootstrap_blocks`) with an initial capacity of 64 `MemBlocks`.
When the system runs out of capacity to track new blocks, the block list calls `grow_block_list()`, which reallocates the array space into the primary heap. It utilizes a `growing` lock-flag to prevent recursive faults while performing this relocation.
### Coalescing
Upon `kfree()`, the chunk is marked as unallocated. The allocator inspects its immediate left and right address neighbors. If they are also free, the adjacent blocks are merged (coalesced) into one continuous block to reduce overall memory fragmentation.
---
## 4. API Caveats & Contracts
### Alignment guarantees
`kmalloc` inherently returns a naturally aligned pointer (minimum 8-byte boundary) sufficient to satisfy scalar types natively on x86-64 without fetching faults. `kmalloc_aligned` can be utilized for strict power-of-two alignment boundaries (e.g., page directories that demand 4096 alignment).
### Resizing limits
`krealloc` accepts an existing allocated pointer and transforms it to meet a new size requirement. To prevent memory starvation over long lifetimes, `krealloc` employs aggressive optimization strategies depending on the allocator layer:
- **Block Allocator (Shrink-in-Place):** Large blocks actively support shrink-in-place maneuvers. If the reduction saves at least 32 bytes, the unused trailing memory is sliced off, injected into the free pool, and physically coalesced with adjacent free neighbors. The original pointer remains identical.
- **Slab Allocator (Down-Migration):** Since slab slots have rigid geometries, true shrink-in-place is impossible. However, if a pointer shrinks enough to cleanly fall into a smaller slab class, `krealloc` triggers an internal copy-migration. This instantly relinquishes the highly-contested larger slab slot back to the system.
---
## 5. Telemetry & Metrics
The `memory_get_stats()` API exports complete transparency over the current topological state of the system memory map. It calculates variables such as peak memory, overall fragmentation % (the ratio of stranded memory outside the largest single block), and explicit slab efficiency counters.

View File

@@ -0,0 +1,52 @@
# Networking Stack
BoredOS features a robust networking stack capable of handling Ethernet, IPv4, TCP, UDP, ICMP, DHCP, and DNS. The stack is built on top of the **lwIP (Lightweight IP)** library, which is integrated with a custom hardware driver layer.
## 1. Architecture Overview
The network stack is split into three main layers:
1. **Hardware/Driver Layer (`src/net/nic/`)**: Communicates with physical and virtual Network Interface Cards (NICs), handling raw Ethernet frame transmission and reception. Supported drivers include the Intel E1000 (`e1000.c`), Realtek RTL8139 (`rtl8139.c`), Realtek RTL8111 (`rtl8111.c`), and VirtIO network devices (`virtio_net.c`). A generic interface is provided via `nic.c`.
2. **Protocol Layer (lwIP)**: Processes Ethernet frames, handles ARP resolution, routes IPv4 packets, and manages TCP state machines.
3. **OS Interface Layer (`src/net/network.c`)**: Wraps the asynchronous lwIP API into a synchronous, easy-to-use API for BoredOS applications and the kernel.
## 2. Initialization & Polling
### `network_init()`
When the kernel boots, it initializes the network subsystem by:
1. Probing the PCI bus for supported NICs (e.g., the Intel E1000).
2. Initializing the lwIP core (`lwip_init()`) and DNS subsystem.
3. Binding the hardware NIC to lwIP using `netif_add`.
4. Automatically attempting to acquire an IP address via DHCP (`network_dhcp_acquire()`).
### The Polling Mechanism (`network_process_frames`)
Unlike some operating systems that process network packets entirely inside hardware interrupt handlers, BoredOS uses a **polled approach** to avoid re-entrancy issues in the TCP/IP stack.
The `network_process_frames()` function is called periodically (e.g., from the Window Manager loop or during blocking network calls). It calls:
- `nic_netif_poll()`: Pulls raw packets from the NIC ring buffer and feeds them to lwIP (`ethernet_input`).
- `sys_check_timeouts()`: Fires lwIP internal timers for TCP retransmissions, ARP cache expiration, and DHCP lease renewals.
A `network_processing` flag acts as a lightweight spinlock to prevent nested execution of the network poll loop.
## 3. TCP Implementation & Application API
While lwIP provides a callback-based raw API, BoredOS wraps this into a sequential API for userland applications.
Currently, the OS supports **one active TCP connection globally across the entire system**. The connection state is managed via a global Protocol Control Block (`current_tcp_pcb`). To prevent unauthorized cleanup, the OS tracks which process initiated the connection (`tcp_owner_pid`). If a new process attempts to connect while a connection is active, the existing connection is forcefully aborted.
### `network_tcp_connect(ip, port)`
1. Allocates a new Protocol Control Block (`tcp_new()`).
2. Registers callbacks for receive (`tcp_recv_callback`), error, and connection success.
3. Blocks (while polling the network) until the connection succeeds or times out after 15 seconds.
### `network_tcp_recv(buf, max_len)`
When packets arrive, `tcp_recv_callback` chains them into a `tcp_recv_queue` (`struct pbuf`).
The `network_tcp_recv` function blocks until data is available in this queue, then copies it into the application's buffer and frees the `pbuf`. A non-blocking variant (`network_tcp_recv_nb`) is also provided.
### Process Cleanup (`network_cleanup`)
If an application crashes or exits without closing its socket, the kernel's process manager calls `network_cleanup()`. This checks if the exiting process owns the current TCP PCB (`tcp_owner_pid`) and forcibly aborts the connection to prevent resource leaks.
## 4. Helper Protocols
- **DHCP:** Managed entirely by lwIP. BoredOS simply waits up to 10 seconds during boot for a lease.
- **DNS (`network_dns_lookup`):** Uses lwIP's `dns_gethostbyname`. It blocks and polls until the callback is triggered with the resolved IP address.
- **ICMP (Ping):** The kernel provides a `network_icmp_single_ping` function using an lwIP raw socket (`raw_pcb`) to construct, checksum, and transmit an ICMP Echo Request, blocking until a reply is received to calculate the Round-Trip Time (RTT).

View File

@@ -0,0 +1,40 @@
# AHCI Storage Driver
BoredOS implements an Advanced Host Controller Interface (AHCI) driver to interface with Serial ATA (SATA) mass storage devices. The driver is located in `src/dev/ahci.c` and allows the OS to read and write sectors directly to physical hard drives or solid-state drives using DMA (Direct Memory Access).
## 1. Discovery and Initialization
The AHCI initialization process (`ahci_init`) starts by querying the PCI subsystem:
1. It searches for a PCI device with Class `0x01` (Mass Storage) and Subclass `0x06` (SATA).
2. It calls `pci_enable_bus_mastering` and `pci_enable_mmio` to ensure the controller can perform DMA and its registers are accessible.
3. It retrieves the **ABAR** (AHCI Base Address Register) from PCI BAR5.
4. The ABAR points to the `HBA_MEM` structure (Host Bus Adapter Memory Registers). The kernel iterates through the `pi` (Ports Implemented) bitmask to find active SATA ports.
## 2. Port Configuration
For every active SATA port found, the driver must allocate memory structures that the hardware will use to process commands:
1. **Command List Base (`clb`)**: A 1KB memory region holding 32 Command Headers.
2. **FIS Base (`fb`)**: A 256-byte memory region where the HBA writes incoming Frame Information Structures (FIS) from the drive.
3. **Command Tables (`ctba`)**: A larger memory region allocated for each Command Header, containing the actual SATA command bytes and the scatter/gather lists (PRDT).
*Note:* All AHCI data structures must be allocated in physically contiguous memory and properly aligned (e.g., 1KB or 256-byte boundaries) because the HBA reads them directly from physical RAM via DMA.
## 3. Physical Region Descriptor Tables (PRDT)
When reading or writing data, BoredOS must tell the AHCI controller where in RAM the data should be stored or fetched. This is done using PRDT entries.
Each `HBA_PRDT_ENTRY` specifies:
- A physical Data Base Address (`dba`).
- A Byte Count (`dbc`), limited to a maximum of 4MB per entry.
If a read/write request spans multiple fragmented pages or exceeds 4MB, the driver constructs multiple PRDT entries within the Command Table to form a scatter/gather list. The AHCI hardware seamlessly processes these entries as a single contiguous disk operation.
## 4. Reading and Writing Sectors
To execute a command (e.g., `ahci_read_sectors` or `ahci_write_sectors`):
1. The driver finds a free slot in the Command List.
2. It populates the Command Header, setting the `cfl` (Command FIS Length) and `w` (Write) bit.
3. It builds a Host-to-Device Register FIS (`FIS_REG_H2D`) in the Command Table, issuing the `ATA_CMD_READ_DMA_EX` or `ATA_CMD_WRITE_DMA_EX` command and specifying the starting LBA (Logical Block Address) and sector count.
4. It sets up the PRDT entries pointing to the physical memory of the provided buffer.
5. It sets the corresponding bit in the Port's Command Issue register (`ci`).
6. The driver then polls the `ci` register (or waits for an interrupt) until the bit clears, indicating the hardware has completed the DMA transfer.

View File

@@ -0,0 +1,37 @@
<div align="center">
<h1>Filesystem Architecture</h1>
<p><em>Virtual File System layer and FAT32 abstraction in BoredOS.</em></p>
</div>
---
BoredOS implements a rudimentary but functional filesystem layer designed to support reading system assets and user applications during runtime.
## Virtual File System (VFS)
The Virtual File System acts as an abstraction layer across different underlying storage mechanisms (even if, currently, only one type is fully utilized). System calls targeting files (`SYS_FS`) route through the VFS rather than interacting with the disk directly.
Key VFS functionalities include:
- **File Descriptors**: Mapping integer IDs to internal file structures for userland processes.
- **Standard Operations**: Standardizing `open()`, `read()`, `write()`, `close()`, `seek()`, and directory listings.
- **Path Parsing**: Resolving absolute and relative paths.
- **SMP Safety**: All VFS and underlying FAT32 operations are protected by a global **Spinlock**. This ensures that multiple cores can safely read from the filesystem simultaneously without corrupting internal file seek pointers or directory cache states.
## FAT32 Implementation
The primary filesystem logic in `fat32.c` handles both in-memory RAM-based filesystem simulation and physical ATA block devices.
### Storage Support
BoredOS supports two main types of storage for its FAT32 implementation:
1. **RAMFS (Boot Modules)**: During boot, Limine loads necessary files (such as userland `.elf` binaries, fonts, and wallpapers) into memory as standard boot modules. The FAT32 code parses these loaded memory modules and automatically constructs a synthetic FAT32 directory tree inside RAM (mounted as `A:`).
2. **ATA Drives**: The kernel includes a basic PIO-based ATA driver that can detect and read/write to physical IDE/PATA hard disks.
- **GPT is NOT supported**: Currently, only **MBR (Master Boot Record)** partition tables or **raw (partitionless)** disks are supported.
- **Filesystem**: The partition must be formatted as **FAT32**.
### Auto-detection
The `Disk Manager` automatically probes primary and secondary IDE channels during initialization. If a valid FAT32 partition is found (either directly at sector 0 or via an MBR partition table), the disk is assigned a drive letter (starting from `B:`) and becomes accessible to the VFS.
---

View File

@@ -0,0 +1,58 @@
<div align="center">
<h1>Core Architecture</h1>
<p><em>Overview of BoredOS kernel layout, boot process, and userspace transition.</em></p>
</div>
---
BoredOS is a 64-bit hobbyist operating system designed for the x86_64 architecture. While it features kernel-space drivers and a built-in window manager, it supports fully-isolated userspace applications and includes a networking stack.
This document serves as an overview of the core architecture and the layout of the kernel source code.
## Source Code Layout (`src/`)
The OS heavily relies on module separation. The `src/` directory is logically split into several domains:
- **`arch/`**: Contains the assembly routines needed for bootstrapping the system (`boot.asm`) and setting up the CPU state for userland execution (`process_asm.asm`). It also handles architecture-specific mechanisms like the Global Descriptor Table (GDT) and Interrupt Descriptor Table (IDT).
- **`core/`**: The initialization sequence of the OS lives here. `main.c` is the entry point from the bootloader. This directory also contains essential kernel utilities (`kutils.c`), panic handlers (`panic.c`), and built-in command parsing logic (`cmd.c`).
- **`dev/`**: Device drivers. This includes the PCI scanner, disk management infrastructure, input drivers (keyboard and mouse), and the Real Time Clock (RTC).
- **`fs/`**: Filesystem implementations. The system uses a Virtual File System (VFS) abstraction alongside an in-memory FAT32 filesystem with support for drives over ATA that are formatted as FAT32 (plain/MBR).
- **`mem/`**: Physical and virtual memory management. It controls page frame allocation, paging, and kernel heap operations.
- **`net/`**: The networking stack. BoredOS relies on `lwIP` for processing IPv4 and TCP/UDP traffic, interacting with a range of NICs via `net/nic/`.
- **`sys/`**: System calls and process management. The ELF loader resides here, alongside the Symmetric Multi-Processing (**smp.c**) bringup and Local APIC (**lapic.c**) management logic.
- **`wm/`**: The graphical subsystem. It handles drawing primitives, window structures, font rendering, and double-buffering.
- **`userland/`**: Out-of-kernel components. This includes the custom SDK/compiler environment (`libc/`) and user applications (`cli/`, `gui/`, `games/`).
## Boot Process
BoredOS uses **Limine** as its primary bootloader.
1. **Limine Initialization**: The machine firmware (BIOS or UEFI) loads Limine. Limine parses `limine.conf`, sets up an early graphical framebuffer, and reads the kernel ELF file into memory.
2. **Multiboot2 & SMP Protocol**: The kernel expects the Limine boot protocol. It makes a specific **SMP Request** to Limine to locate and bring up all available CPU cores.
3. **Kernel Entry (`main.c`)**: The entry point `_start` is called on the Bootstrap Processor (BSP). It initializes the serial port, GDT/IDT, memory management, and paging.
4. **AP Bringup**: The BSP calls `smp_init()`, which sends the Startup Inter-Processor Interrupt (SIPI) sequence to all Application Processors (APs). Each AP initializes its own local GDT, TSS, and Page Tables before entering an idle loop.
5. **Driver Initialization**: PCI buses are scanned, finding the network card or disk controllers. The filesystem is mounted.
6. **Window Manager**: The UI is drawn on top of the Limine-provided framebuffer.
## Multi-Core & Scheduling
BoredOS utilizes Symmetric Multi-Processing (SMP) to distribute workloads across all available CPU cores.
- **LAPIC & IPIs**: Each CPU has its own Local APIC. The kernel uses Inter-Processor Interrupts (IPIs) for inter-core communication, specifically for triggering the scheduler on other cores (`vector 0x41`).
- **Scheduler**: A round-robin scheduler runs on each core. Processes are pinned to specific CPUs (CPU Affinity) to maintain cache locality. The BSP timer interrupt (`60Hz`) broadcasts a scheduling IPI to all core to ensure balanced execution.
- **Spinlocks**: Since multiple cores can access kernel structures (VFS, Process List) simultaneously, the kernel uses **interrupt-safe spinlocks** to prevent race conditions.
## Userland Transition
The OS supports privilege separation (Ring 0 vs. Ring 3). When an application is launched, the kernel:
1. Loads the ELF file from the filesystem.
2. Assigns the process to a CPU core via a round-robin distribution strategy.
3. Allocates a new virtual address space (Page Directory) for the process.
4. Maps the executable segments according to the ELF headers.
5. Switches to User Mode (Ring 3) via the `iretq` instruction.
> [!IMPORTANT]
> Programs interact with the core kernel using system calls (`syscall.c`). Multitasking is achieved by pre-empting user processes on their respective cores.
---

View File

@@ -0,0 +1,66 @@
# Process Management & Scheduling
BoredOS implements a lightweight, symmetric multiprocessing (SMP) capable multitasking environment. This document outlines the architecture of the scheduler, process structures, context switching, and ELF binary loading.
## 1. Process Structure (`process_t`)
The core of the process management system is the `process_t` structure, defined in `src/sys/process.h`. Due to kernel memory constraints, BoredOS supports a maximum of 16 concurrent processes (`MAX_PROCESSES`), stored in a statically allocated array.
Key fields include:
- **Identification:** `pid`, `parent_pid`, `pgid` (Process Group ID), and `name`.
- **Memory & Context:**
- `rsp`: The saved stack pointer during a context switch.
- `pml4_phys`: The physical address of the Page Map Level 4 table (VMM root) for this process.
- `kernel_stack` & `user_stack_alloc`: Pointers to allocated stack memory.
- **Scheduler State:** `ticks`, `sleep_until`, `is_idle`, `cpu_affinity`.
- **Resources:**
- `fds`: File descriptor table tracking open files, pipes, and sockets (up to `MAX_PROCESS_FDS` = 16).
- `gui_events`: A circular queue for Window Manager events (keyboard, mouse).
- **Signals:** POSIX-like signal tracking via `signal_mask` and `signal_pending`.
## 2. The Scheduler
BoredOS uses a **Preemptive Round-Robin** scheduler implemented as a circular linked list.
### Symmetric Multiprocessing (SMP)
Each CPU core maintains its own `current_process` pointer (`current_process[my_cpu]`). When a new user process is spawned via `process_create_elf`, the kernel assigns it to an Application Processor (AP) core using a simple round-robin assignment policy (`next_cpu_assign`), avoiding Core 0 (BSP) which is typically reserved for kernel tasks and driver interrupts.
### The `process_schedule` Loop
When the timer interrupt fires, it calls `process_schedule(current_rsp)`:
1. It saves the `current_rsp` into the current process's structure.
2. It handles cleanup of killed processes (`kill_pending`).
3. It traverses the circular linked list (`cur->next`) looking for a process where `cpu_affinity == my_cpu`.
4. It checks if the process is sleeping (`sleep_until > now`).
5. It switches the hardware context:
- Updates the Task State Segment (TSS) ring 0 stack pointer.
- Switches the page directory by writing the new `pml4_phys` to `CR3`.
- Returns the new process's `rsp`, which the interrupt handler then pops into registers.
## 3. Context Switching
Context switching is achieved by manually constructing an interrupt stack frame (IRETQ frame).
When a process is created, the kernel sets up the top of its kernel stack with:
- `SS` (Stack Segment: `0x1B` for user, `0x10` for kernel)
- `RSP` (The process's stack pointer)
- `RFLAGS` (`0x202` to ensure interrupts are enabled)
- `CS` (Code Segment: `0x23` for user, `0x08` for kernel)
- `RIP` (The entry point of the binary or function)
- Zeroed space for General Purpose Registers and a 512-byte `fxsave` region for FPU/SSE state.
When `process_schedule` returns the new `rsp`, the assembly interrupt stub uses `pop` instructions to restore the general-purpose registers, and finally executes `iretq`, transitioning execution to the new process seamlessly.
## 4. ELF Loading
Userland applications in BoredOS are standard 64-bit ELF binaries.
The function `process_create_elf` orchestrates this:
1. **Memory Allocation:** Creates a new PML4 page table for the user process.
2. **Parsing:** Calls `elf_load(filepath, pml4, &size)` to parse the ELF headers, allocate required physical memory, and copy the executable segments (text, data, bss) into the process's virtual address space at the locations specified by the ELF program headers.
3. **Stack Setup:** Allocates a 256KB user stack mapped at `0x800000`.
4. **Argument Passing:** Parses the `args_str` passed to the executable and pushes an `argv` array onto the newly allocated user stack.
5. **Execution:** Sets the stack frame's `RIP` to the ELF entry point and links the process into the scheduler's run queue.
## 5. Process Termination
When a process exits (or is killed), it is not immediately freed. The scheduler sets `kill_pending = true`. The actual destruction of the PML4 table and stack allocations is deferred to the next tick inside `process_schedule` to avoid freeing the memory of the code currently executing the cleanup.

View File

@@ -0,0 +1,110 @@
# BoredOS Versioning
BoredOS uses two independent version numbers: one for the **OS release** and one for the **kernel**. They evolve at different rates and follow different conventions.
---
## OS Version
The OS version follows a **date-based** scheme:
```
YY.M[.x]
```
| Component | Meaning |
|-----------|---------|
| `YY` | Two-digit year (e.g. `26` for 2026) |
| `M` | Month number, no leading zero (e.g. `4` for April, `12` for December) |
| `.x` | Optional patch identifier — a small sequential integer that has **no relation to a specific day** |
### Examples
| Version | Meaning |
|----------|---------|
| `26.4` | Base release for April 2026 |
| `26.5` | Base release for May 2026 |
| `26.5.1` | First patch on top of the May 2026 release |
| `26.5.2` | Second patch on top of the May 2026 release |
| `26.12` | Base release for December 2026 |
### Rules
- The **base release** (`YY.M`) is cut once per month when a milestone is ready.
- Patch releases (`YY.M.x`) are issued for fixes or smaller additions that land between two monthly milestones. The `.x` counter starts at `1` and increments sequentially — it is **not** tied to a calendar day.
- A `-dev` or `-rc` suffix may be appended to any version string during active development (e.g. `26.5-dev`, `26.5.1-rc1`).
- The version string is defined in [`src/core/version.c`](../../src/core/version.c) as `os_version`.
---
## Kernel Version
The kernel version follows **Semantic Versioning**:
```
MAJOR.MINOR.PATCH
```
| Component | When to increment |
|-----------|------------------|
| `MAJOR` | A breaking or fundamentally large architectural change (e.g. rewriting the syscall layer, introducing a new memory model) |
| `MINOR` | A meaningful new feature or a notable internal improvement that does not break existing interfaces |
| `PATCH` | A small fix, refactor, or incremental improvement |
### Examples
| Transition | Reason |
|---------------------|--------|
| `4.2.0``5.0.0` | Major kernel rework (e.g. full syscall dispatch-table refactor, new scheduler) |
| `4.2.0``4.3.0` | New subsystem or feature addition (e.g. adding Lua runtime, new VFS driver) |
| `4.2.0``4.2.1` | Small fix or minor tweak (e.g. PIT calibration fix, terminal newline correction) |
### Rules
- When `MAJOR` is bumped, `MINOR` and `PATCH` reset to `0`.
- When `MINOR` is bumped, `PATCH` resets to `0`.
- A `-dev` suffix may be appended during active development (e.g. `5.0.0-dev`).
- The version string is defined in [`src/core/version.c`](../../src/core/version.c) as `kernel_version`.
---
## Where Versions Are Declared
Both version strings live in a single file:
```c
// src/core/version.c
const char *os_version = "26.5-dev";
const char *kernel_version = "4.2.0-dev";
```
When cutting a release, update both strings, remove the `-dev` suffix, tag the commit (`git tag v26.5`), and then immediately bump to the next `-dev` version.
---
## Codename
Each release may carry an informal **codename**. A single word that gives the release a human-friendly identity. Codenames are stored in [`src/core/version.c`](../../src/core/version.c) as `os_codename` and exposed to userspace via the `get_os_info` syscall.
### Convention
- Codenames **generally change with each monthly base release** (`YY.M`), but this is not a hard rule. A codename may carry over into the next month if the release feels like a natural continuation of the previous one.
- Patch releases (`YY.M.x`) **always keep the same codename** as the base release they belong to.
- There is no enforced theme, but names tend to be short, memorable single words.
### Examples
| OS Version | Codename
|------------|-----------|
| `26.4` | Voyager
| `26.5` | Genesis
### Where It Is Declared
```c
// src/core/version.c
const char *os_codename = "Genesis";
```

194
docs/build/toolchain.md vendored Normal file
View File

@@ -0,0 +1,194 @@
# Build Toolchain
BoredOS is built cross-compiled from a host system (such as macOS or Linux) to target the generic `x86_64-elf` platform.
## Table of Contents
- [Prerequisites](#prerequisites)
- [Building the Cross-Compiler on Linux](#building-the-cross-compiler-on-linux)
- [Installing the Toolchain on Windows](#installing-the-toolchain-on-windows)
## Prerequisites
To build BoredOS, you need the following tools:
1. **x86_64 ELF GCC Cross-Compiler**:
- `x86_64-elf-gcc`: The C compiler targeting the freestanding overarching ELF environment.
- `x86_64-elf-ld`: The linker to combine object files into the final `boredos.elf` kernel and userland binaries.
2. **NASM**:
- Required to compile the `.asm` files in `src/arch/` and `src/userland/crt0.asm`. It formats the output as `elf64` objects to be linked alongside the C code.
3. **xorriso**:
- A specialized tool to create ISO 9660 filesystem images.
- *Why?* `xorriso` packages the compiled kernel, Limine bootloader, and asset files (fonts, images, userland binaries) into the final bootable `boredos.iso` CD-ROM image.
4. **QEMU** (Optional but highly recommended for testing):
- `qemu-system-x86_64` is used to virtualize the OS for testing or to mess around.
## Building the Cross-Compiler on Linux
### Availability Issue
On most Linux distributions, the `x86_64-elf-gcc` cross-compiler binary is **not pre-packaged** in standard repositories. The only notable exception is **Arch Linux** and Arch-based distributions (Manjaro, EndeavourOS, etc.), where it can be installed via `pacman`:
```bash
pacman -S x86_64-elf-gcc x86_64-elf-binutils
```
For all other Linux distributions (Debian, Ubuntu, Fedora, openSUSE, etc.), you **must build the cross-compiler from source**.
### Building from Source
To build the x86_64-ELF GCC cross-compiler:
1. **Download prerequisites**:
- GNU Binutils source
- GCC source
2. **Configure and build Binutils**:
```bash
../binutils-*/configure --target=x86_64-elf --prefix=/usr/local/cross
make && make install
```
3. **Configure and build GCC**:
```bash
../gcc-*/configure --target=x86_64-elf --prefix=/usr/local/cross \
--without-headers --enable-languages=c
make all-gcc && make install-gcc
```
4. **Add to PATH**:
```bash
export PATH="/usr/local/cross/bin:$PATH"
```
Verify the installation:
```bash
x86_64-elf-gcc --version
```
> **Note**: Building the cross-compiler can take 20-30 minutes depending on system performance. This is a one-time setup cost.
## Installing the Toolchain on Windows
### Recommended Environment: MSYS2
On Windows, the recommended way to build BoredOS is using **MSYS2**.
MSYS2 provides a Unix-like environment with the `pacman` package manager, making it easy to install the required development tools.
---
## 1. Install MSYS2
Download and install MSYS2 from the official website:
- https://www.msys2.org/
After installation, launch the **MSYS2 UCRT64** terminal.
---
## 2. Update MSYS2
Before installing packages, fully update the environment:
```bash
pacman -Syu
```
You may be asked to close the terminal after the first update.
If so:
1. Close the MSYS2 window
2. Reopen **MSYS2 UCRT64**
3. Run the update command again:
```bash
pacman -Syu
```
Repeat until no further updates are available.
---
## 3. Install Required Packages
Install the required development tools:
```bash
pacman -S make nasm xorriso git
```
---
## 4. Install QEMU for Windows
Download the Windows version of QEMU from:
- https://qemu.weilnetz.de/w64/
Install QEMU normally and make sure the installation directory is added to your Windows `PATH`.
Note that if it breaks when building, you need too add `qemu-img` to your `PATH`:
`export PATH="/c/Program Files/qemu:$PATH"`
You can verify the installation with:
```bash
qemu-system-x86_64 --version
```
---
## 5. Install the x86_64 ELF Cross Toolchain
Download the prebuilt `x86_64-elf` toolchain for Windows:
- https://github.com/lordmilko/i686-elf-tools/releases/download/15.2.0/x86_64-elf-tools-windows.zip
Extract the archive somewhere convenient.
---
## 6. Add the Toolchain to PATH
Inside the **MSYS2 UCRT64** terminal, add the toolchain binaries to your `PATH`:
```bash
export PATH="/c/Users/your/path/to/the/binaries/x86_64-elf-tools-windows/bin:$PATH"
```
To make this permanent, add the line to your `~/.bashrc` file:
```bash
echo 'export PATH="/c/Users/your/path/to/the/binaries/x86_64-elf-tools-windows/bin:$PATH"' >> ~/.bashrc
```
Then reload the shell:
```bash
source ~/.bashrc
```
---
## 7. Verify the Installation
Verify that the cross compiler is available:
```bash
x86_64-elf-gcc --version
```
You should also verify NASM and QEMU:
```bash
nasm -v
qemu-system-x86_64 --version
```
If all commands work, the development environment is correctly configured.

56
docs/build/usage.md vendored Normal file
View File

@@ -0,0 +1,56 @@
# Building, Running, and Deployment
BoredOS uses a single top-level `Makefile` to orchestrate the build process.
## The Build Process
When you run `make` in the root directory, the following stages occur automatically:
1. **Limine Setup (`limine-setup`)**:
If the Limine bootloader binaries are missing, the Makefile automatically clones the appropriate Limine binary release from GitHub and compiles its host utility.
2. **Kernel Compilation**:
All `.c` files in `src/core`, `src/mem`, `src/dev`, `src/sys`, `src/fs`, `src/wm`, and `src/net` are compiled into object files (`.o`) inside the `build/` directory using `x86_64-elf-gcc`.
3. **Kernel Assembly**:
All `.asm` files in `src/arch/` are assembled into object files using `nasm`.
4. **Kernel Linking**:
`x86_64-elf-ld` links the kernel object files together, instructed by the `linker.ld` script, outputting the `boredos.elf` kernel binary.
5. **Userland Compilation**:
The Makefile shifts into the `src/userland` directory, compiling the custom `libc` and generating `bin/*.elf` executable user applications.
6. **ISO Generation**:
The `iso_root` directory is staged. The kernel, Limine configuration, fonts, images, and userland applications are copied in. Finally, `xorriso` generates the `boredos.iso` bootable image.
## Minimum System Requirements
To run BoredOS successfully (either in emulation or on bare metal), your target machine should meet the following minimum requirements:
- **CPU**: An `x86_64` (64-bit) compatible processor.
- **Memory**: Approximately `~256 MB` of RAM.
- **Display**: A VGA-compatible display (required for the GUI Window Manager).
- **Networking (Optional)**: A compatible Network Interface Card (NIC) is required if you want to use the networking stack (e.g., an Intel E1000 or similar supported by the [`net/nic/`](../../src/net/nic/) drivers). Networking is not strictly required for the OS to boot or run offline applications.
## Running in Emulation
To test the generated ISO quickly without real hardware, use the QEMU emulator:
```sh
make run
```
This command automatically detects your operating system and invokes QEMU with specific arguments:
- `-m 4G`: Allocates 4 Gigabytes of RAM.
- `-cdrom boredos.iso`: Mounts the built OS image as a CD-ROM.
- `-smp 4`: Enables 4 CPU cores.
## Running on Bare Metal
> [!CAUTION]
> Running hobby operating systems on real hardware is at your own risk and may cause undefined behavior.
To boot BoredOS on a physical PC:
1. Build the OS to get `boredos.iso`.
2. Use a flashing tool like **Balena Etcher** or `dd` to write the ISO to a USB flash drive.
3. Reboot your target computer, enter the BIOS/UEFI setup.
4. **Boot Configuration**: BoredOS supports booting on both modern **UEFI** systems and legacy **BIOS** systems natively via Limine. Ensure **Secure Boot** is disabled in your firmware settings.
5. Select the USB drive from the boot menu.

View File

@@ -0,0 +1,27 @@
# BoredOS Installation
## Requirements
- Disk with at least **1 GB** (2,097,152 sectors)
- UEFI firmware
- A running BoredOS live environment (ISO)
## Quick Start (UEFI)
```
boredos_install --uefi /dev/sda
```
After installation, reboot and select the target disk from your firmware boot menu.
## Manual Steps
```
fdisk /dev/sda
mkfs_fat -F 32 -n EFI /dev/sda1
mkfs_fat -F 32 -n BOREDOS /dev/sda2
boredos_install --no-partition --no-format --uefi /dev/sda
```
See `install_guide.md` for a full walkthrough and `internals.md` for a deep dive into how the process works.

View File

@@ -0,0 +1,72 @@
# Advanced Installation
## Skipping Steps
All major phases can be skipped independently:
```
boredos_install --no-partition --no-format --uefi /dev/sda
```
The destructive warning is only shown when `--no-partition` AND `--no-format` are both absent.
## `/mnt/boot` Operations
The installer mounts the ESP at `/mnt/boot` and unmounts it when finished.
## FAT32 Limitations
FAT32 does not support Unix file permissions, ownership, or timestamps. These attributes are **not** preserved during installation. This is expected and documented.
## Custom Device Names
Use `--esp-dev` and `--root-dev` to bypass auto-detection:
```
boredos_install --uefi --esp-dev sda1 --root-dev sda2 /dev/sda --no-partition --no-format
```
Provided device names are still validated via `sys_disk_get_info` before use.
### Step 1: Partitioning
Run `fdisk` interactively on your target device.
```bash
fdisk /dev/sda
```
Inside the interactive shell:
1. Type `n` to create a new partition (the ESP).
2. Press Enter for the default start offset (1mb).
3. Enter the size using suffixes like `b`, `mb`, or `gb` (e.g., `512mb` for a 512 MB ESP).
4. Type `n` again for the second partition (the Root).
5. Press Enter for the default start offset (aligned after the ESP).
6. Press Enter for the default size (rest of the disk).
7. Type `w` to write the partition table.
8. Type 'Q' to quit.
### Step 2: Formatting
Initialize the partitions with FAT32. Use the labels `EFI` and `BOREDOS` to match the expected system layout.
```bash
mkfs_fat -F 32 -n EFI /dev/sda1
mkfs_fat -F 32 -n BOREDOS /dev/sda2
```
### Step 3: Installation
The easiest way to perform the file copy and bootloader setup is to use the installer in "copy only" mode. This ensures that hidden flags (like the root detection file) are placed correctly.
```bash
boredos_install --no-partition --no-format --uefi --esp-dev sda1 /dev/sda
```
#### What this step does:
1. **Mounts** `/dev/sda2` to `/mnt` and `/dev/sda1` to `/mnt/boot`.
2. **Identifies** the root by creating an empty file at `/mnt/Library/.boredos_root`.
3. **Copies** the system structure: `/bin`, `/Library`, `/docs`, and `/root` are mirrored to `/mnt`.
4. **Deploys** the kernel and initrd: `boredos.elf` and `initrd.tar` are copied to the ESP (`/mnt/boot/`).
5. **Configures** Limine: Writes a `limine.conf` to the ESP and copies the EFI bootloader to `/mnt/boot/EFI/BOOT/BOOTX64.EFI`.
For a deep dive into why these steps are performed, see the [Installation Internals](internals.md) guide.

View File

@@ -0,0 +1,30 @@
# Install Guide
## UEFI Installation
1. Boot from the BoredOS ISO.
2. Run `boredos_install --uefi /dev/sda`.
3. Type `y` when prompted and press Enter.
4. After completion, reboot and select the disk.
## limine.conf Notes
**UEFI** uses `boot():/boredos.elf` — the `boot():` URL scheme refers to the EFI System Partition.
**Root selection** uses `root=/dev/<partition>` in `cmdline:` to choose the writable root partition (for example `root=/dev/sda2`).
**Live vs disk override** supports `--live` and `--disk` in `cmdline:`. Use `--live` for ISO/USB live boots and `--disk` for installed systems.
## Options
| Flag | Description |
|---|---|
| `--no-partition` | Skip fdisk (use existing partitions) |
| `--no-format` | Skip mkfs (use existing filesystem) |
| `--no-files` | Skip file copy |
| `--no-bootloader` | Skip limine.conf and EFI file copy |
| `--esp-size N` | ESP size in MB (default: 512) |
| `--esp-dev DEV` | Explicit ESP device name |
| `--root-dev DEV` | Explicit root device name |
| `-y` | Auto-accept the destructive warning |

View File

@@ -0,0 +1,57 @@
# Installation Internals: How, Why, and What
This document explains the technical details of the BoredOS installation process, the design decisions behind it, and the resulting system layout.
## How the installation works
The BoredOS installation follows a strict five-phase sequence:
1. **Partitioning (GPT/MBR)**: The disk is prepared with a partition table. For UEFI systems, we use GPT (GUID Partition Table) and create at least two partitions: an EFI System Partition (ESP) and a data partition.
2. **Formatting (FAT32)**: Both partitions are formatted with FAT32.
- The ESP is labeled `EFI`.
- The root partition is labeled `BOREDOS`.
3. **Mounting & Flagging**: The root partition is mounted to `/mnt`. A special marker file is created at `/Library/.boredos_root`. This file is used by the kernel during boot to differentiate between a persistent disk and a live ISO/RAM disk.
4. **System Mirroring**: The installer performs a recursive copy of the live system's essential including but not limited to:
- `/bin`: All userland binaries.
- `/Library`: System assets, fonts, icons, and configuration.
- `/docs`: Documentation and manuals.
- `/root`: The default user home directory.
5. **Bootloader Setup**:
- The ESP is mounted to `/mnt/boot`.
- The kernel (`boredos.elf`) and the initial RAM disk (`initrd.tar`) are copied to the root of the ESP.
- The Limine EFI binary is placed at `/EFI/BOOT/BOOTX64.EFI`.
- A `limine.conf` is generated with the correct `root=/dev/sdXX` parameter.
## Why it works this way
### FAT32 for Everything
BoredOS currently uses FAT32 as its primary filesystem for both the boot partition and the root partition.
- **Universal Support**: FAT32 is natively understood by UEFI firmware, making it the only choice for the ESP.
- **Simplicity**: By using FAT32 for the root partition as well, the kernel only needs one robust filesystem driver to handle both boot-time loading and runtime persistent storage.
- **Interoperability**: You can easily mount BoredOS partitions on other operating systems (Windows, Linux, macOS) to transfer files.
### The ESP/Root Split
Even though both use FAT32, we split the disk into two partitions to follow the UEFI specification. The ESP is meant to be small and strictly for bootloader files, while the root partition contains the entire userland. This separation allows for cleaner upgrades and multi-boot scenarios.
### Limine Bootloader
We chose [Limine](https://limine-bootloader.org/) because of its excellent support for modern protocols, its simplicity in configuration, and its lightweight footprint. It handles the transition from UEFI/BIOS environment to the kernel seamlessly.
## What the installation does
After a successful installation, your disk will look like this:
### Partition 1: EFI System Partition (ESP)
- `/boredos.elf`: The actual kernel binary.
- `/initrd.tar`: The basic system image loaded into RAM at boot.
- `/limine.conf`: The bootloader configuration.
- `/EFI/BOOT/BOOTX64.EFI`: The bootloader entry point for UEFI firmware.
### Partition 2: BoredOS Root
- `/bin/`: Executables.
- `/Library/`: System data.
- `.boredos_root`: Hidden marker file.
- `fonts/`, `images/`, `man/`: System resources.
- `/docs/`: System documentation.
- `/root/`: Persistent user files.

90
docs/usage/commands/du.md Normal file
View File

@@ -0,0 +1,90 @@
# du
`du` (disk usage) reports the disk space used by files and directories.
## Usage
```sh
du [OPTIONS]... [FILE]...
```
## Description
By default, `du` prints human-readable sizes for each file and directory it encounters, starting from the current directory (`.`) if no path is given.
## Options
| Option | Description |
| :--- | :--- |
| `-s, --summarize` | Show only a total for each argument, suppressing per-entry output. |
| `-a, --all` | Write counts for all files, not just directories. |
| `-d, --max-depth=N` | Stop at depth N; show only entries at or above depth N. |
| `-c, --total` | Print a grand total after all arguments have been processed. |
| `-b, --bytes` | Print sizes in exact bytes instead of human-readable units. |
| `-H, --human-readable` | Accepted for compatibility; human-readable is the default. |
| `--help` | Display usage information and exit. |
## Output Format
Each line shows a size followed by the path:
```
SIZE PATH
```
Sizes are formatted as `B`, `KB`, `MB`, or `GB` by default, with one decimal place when appropriate (e.g., `1.5 GB`). The `-b` option overrides this to show exact byte counts.
## Examples
Show disk usage for the current directory:
```sh
du
```
Show disk usage for a specific path:
```sh
du /bin
```
Show only totals per argument (`-s`):
```sh
du -s /bin /home
```
Show all files and directories recursively (`-a`):
```sh
du -a /bin
```
Limit output to depth 1 (`-d`):
```sh
du -d 1 /
```
Print a grand total after processing (`-c`):
```sh
du -c /bin /home
```
Show exact byte counts (`-b`):
```sh
du -b /bin
```
## How It Works
`du` uses `sys_get_file_info()` to read file sizes and `sys_list()` to enumerate directory contents recursively. The command skips the synthetic `.` and `..` entries and continues processing remaining paths if one path is inaccessible, printing an error for the failed path.
The size reported is the **apparent file size** (the logical size stored in the directory entry), not the allocated disk blocks. This is consistent with how BoredOS reports file sizes through the filesystem API.
## Exit Status
- `0`: Success
- `1`: One or more paths could not be accessed or listed

View File

@@ -0,0 +1,106 @@
# lsblk
`lsblk` lists the block devices detected by BoredOS, including whole disks and their partitions.
## Usage
```sh
lsblk
lsblk /dev/sda
lsblk -r
lsblk --json
```
## Output
By default, `lsblk` prints a compact tree view:
```text
/dev/sda 2 GB disk
└─ sda1 2 GB part FAT32 BOREDOS
```
Fields shown by the default output:
- device name, such as `/dev/sda` or `sda1`
- human-readable size, such as `512 MB` or `2 GB`
- device type, either `disk` or `part`
- filesystem type, currently `FAT32` when detected
- volume label when available
- `[ESP]` flag for EFI System Partitions
> [!NOTE]
> Mount points are not shown yet because BoredOS does not currently expose mountpoint information through the disk info syscall.
## Options
| Option | Description |
| :--- | :--- |
| `-r` | Print raw output without tree characters. |
| `--json` | Print machine-readable JSON output. |
| `/dev/DEVICE` | Show only one disk or partition. |
## Examples
List all block devices:
```sh
lsblk
```
Example output:
```text
/dev/sda 2 GB disk
└─ sda1 2 GB part FAT32 BOREDOS
/dev/sdb 16 GB disk
```
Show one disk and its partitions:
```sh
lsblk /dev/sda
```
Example output:
```text
/dev/sda 2 GB disk
└─ sda1 2 GB part FAT32 BOREDOS
```
Print raw output for scripts:
```sh
lsblk -r
```
Example output:
```text
/dev/sda 2GB disk
/dev/sda1 2GB part FAT32 BOREDOS
```
Print JSON output:
```sh
lsblk --json
```
Example output:
```json
{"devices":[{"name":"/dev/sda","size":"2 GB","type":"disk","fstype":"","label":"","flags":[],"children":[{"name":"/dev/sda1","size":"2 GB","type":"part","fstype":"FAT32","label":"BOREDOS","flags":[]}]}]}
```
## How It Works
`lsblk` reads disk metadata through the disk syscalls exposed by BoredOS:
- `sys_disk_get_count()` gets the number of registered block devices.
- `sys_disk_get_info()` reads each device's name, size, type, FAT32 status, label, and flags.
The command treats non-partition entries as parent disks, then groups partition entries under the matching disk name. For example, `sda1` is displayed under `/dev/sda`.
Sizes are calculated from sector counts using 512-byte sectors, then formatted as `KB`, `MB`, or `GB`.

35
docs/usage/desktop.md Normal file
View File

@@ -0,0 +1,35 @@
# Using the Desktop
The BoredOS desktop environment is designed to be intuitive while providing powerful window management and icons for quick access to your files and applications.
## Window Management
BoredOS uses a stacking window manager (BoredWM) that allows you to overlap and organize multiple windows.
### Basic Actions
- **Focus**: Click anywhere on a window to bring it to the front and make it the active window.
- **Move**: Click and drag the **title bar** (the top bar of the window) to reposition it on the screen.
- **Close**: Click the red traffic light close button in the top-left corner of the window.
### System-wide Shortcuts
BoredOS includes several global shortcuts to help you manage your workflow:
- **`Ctrl + P`**: Take a screenshot. The image will be saved to `/root/Desktop` as `screenshot.jpg`.
- **`Shift + Ctrl + Space`**: Toggle **Lumos** search (see the [Lumos guide](lumos.md)).
## Desktop Icons
Your desktop represents the contents of the `/root/Desktop` directory.
- **Launching**: Double-click an icon to open the file or launch the application.
- **Snapping**: Icons automatically snap to a grid for a clean look. You can toggle "Snap to Grid" and "Auto Align" in the [Settings app](../launching_apps.md).
- **Context Menu**: Right-click on the desktop background to create new files, folders, or refresh the layout.
## The Bottom Dock
The dock at the bottom of the screen provides quick shortcuts to your most-used applications, with for example:
- **Files**: Browse the entire filesystem.
- **Terminal**: Access the command-line interface.
- **Calculator / Notepad / Grapher**: Essential productivity tools.
---
[Return to Documentation Index](../README.md)

View File

@@ -0,0 +1,31 @@
# Launching Applications
BoredOS provides several ways to launch applications and files, depending on your preferred workflow.
## 1. Using the File Explorer
The File Explorer is the primary way to navigate the filesystem and launch any `.elf` binary or associated document.
1. Open the **Explorer** from the dock or desktop.
2. Navigate to `/bin` for system applications or your own user folders.
3. **Double-click** any executable (`.elf`) to run it.
4. Standard files (like `.jpg` or `.txt`) will automatically open in their default viewer.
## 2. Desktop Shortcuts and Icons
Commonly used applications are placed directly on the desktop.
- Simply **Double-click** any icon on the desktop to launch it.
- You can also create desktop shortcuts by right-clicking on a file and selecting **"Create Shortcut"**.
## 3. Using Lumos (Global Search)
For the fastest access, use **Lumos** to search and launch by name:
1. Press **`Shift + Ctrl + Space`**.
2. Type the name of the app (e.g., "DOOM.elf").
3. Press **Enter** to launch.
---
[Return to Documentation Index](../README.md)

29
docs/usage/lumos.md Normal file
View File

@@ -0,0 +1,29 @@
# Lumos: System Search
**Lumos** is the powerful, system-wide search and launch assistant for BoredOS. It allows you to find applications, documents, and system files instantly without navigating through folders.
## Opening Lumos
To activate Lumos at any time, use the global keyboard shortcut:
**`Shift + Ctrl + Space`**
The Lumos search modal will appear in the center of your screen, ready for input.
## Features
- **Fuzzy Searching**: You don't need to type the exact name. Lumos uses fuzzy matching to find the most relevant results as you type.
- **Deep Indexing**: Lumos indexes files across the entire system.
- **Quick Launch**: Once you find what you're looking for, launching it is as simple as pressing `Enter`.
## Navigation
When the Lumos window is open:
- **Type**: Just start typing to filter results.
- **Arrow Keys (Up/Down)**: Move the selection highlight through the list of results.
- **Enter**: Launch the selected file or application.
- **Backspace**: Delete characters in your search query.
- **Escape**: Close Lumos and return to the desktop.
---
[Return to Documentation Index](../README.md)

100
docs/usage/settings.md Normal file
View File

@@ -0,0 +1,100 @@
# Settings
Settings is a system configuration application providing a graphical interface to manage BoredOS preferences across multiple categories.
## Main Menu
The Settings application presents seven configuration categories, each with its own icon and panel:
- **Wallpaper** — Manage desktop background images and patterns
- **Network** — Configure network interfaces and connectivity
- **Desktop** — Control desktop layout and icon alignment
- **Mouse** — Adjust mouse speed and cursor appearance
- **Fonts** — Browse and select system fonts
- **Display** — Configure screen resolution
- **Keyboard** — Select keyboard layout
## Wallpaper
### Image Selection
- Browse wallpapers stored in `/Library/images/Wallpapers/`
- Supported formats: JPEG (`.jpg`)
- Thumbnails (80×50 pixels) are generated for preview
- Selected wallpaper is applied immediately to the desktop background
### Patterns
The Wallpaper panel provides built-in pattern options:
- **Lumberjack Pattern** — Checkered pattern with red, dark grey, and black colors
- **Blue Diamond Pattern** — Geometric diamond design
Patterns are rendered procedurally (128×128 pixels) and can be applied as alternatives to image wallpapers.
### Color Settings
Six color presets are available for quick selection, with RGB textbox inputs for custom color values.
## Network
### Configuration
- Set static IP address via textbox input
- Configure DNS server address
- Network status is displayed after initialization
- Settings are applied through the `NET_INIT`, `NET_SET_IP`, and `NET_SET_DNS` controls
## Desktop
### Layout Control
- **Snap to Grid** — Enable/disable automatic icon alignment to grid positions
- **Auto Align** — Automatically reorganize icons when enabled
- **Columns** — Adjust maximum number of columns for icon layout (configurable with +/- buttons)
- **Rows per Column** — Set maximum rows within each column
Desktop grid settings are stored as `desktop_max_rows_per_col` and `desktop_max_cols`.
## Mouse
### Cursor Control
- **Mouse Speed** — Adjust pointer movement sensitivity
- **Cursor Scale** — Increase or decrease cursor size using +/ buttons
- Settings communicates with the kernel WM using `SYSTEM_GET_CURSOR_SCALE` and `SYSTEM_SET_CURSOR_SCALE` syscalls
- Cursor changes are applied instantly and visibly in real-time
## Fonts
### System Fonts
- Browse available fonts from `/Library/Fonts/`
- Font list is dynamically loaded with scrollbar for navigation
- Each font displays an icon and name
- Fonts are listed with entry structures containing path and name information
## Display
### Resolution Selection
- Choose from dynamic resolution options based on physical screen size:
- 50% of screen resolution
- 75% of screen resolution
- Full screen resolution (100%)
- Custom resolution entry via textbox (width and height)
- Apply button commits the selected resolution change
## Keyboard
### Layout Selection
- Available keyboard layouts can be selected from a dropdown
- Layout state is maintained as `keyboard_layout`
- Selection applies to system-wide keyboard input
---
[Return to Documentation Index](../README.md)

62
docs/usage/terminal.md Normal file
View File

@@ -0,0 +1,62 @@
# Terminal & Command Line
The BoredOS Terminal provides a powerful command-line interface (CLI) for advanced users and developers. It supports standard Unix-like features and provides direct access to the kernel's system calls.
## The Shell
The default shell in BoredOS is **BoredShell (Bsh)**, a userspace shell with a dedicated terminal app. It features:
- **ANSI Color Support**: Rich text output with colors and styles.
- **Command History**: Use the **Up** and **Down** arrow keys to navigate through your previous commands (up to 64 history entries).
- **Output Redirection**:
- `command > file`: Write output to a new file (or overwrite existing).
- `command >> file`: Append output to an existing file.
- **Piping**:
- `command1 | command2`: Pass the output of the first command as input to the second.
### Bsh Configuration
Bsh loads its configuration from:
`/Library/bsh/bshrc`
This file is similar to `.zshrc` or `.bashrc` and can define:
- `PATH` for command lookup
- `STARTUP` for interactive shell startup scripts
- `BOOT_SCRIPT` for a once-per-boot script
- prompt templates (`PROMPT_LEFT`, `PROMPT_RIGHT`)
Prompt tokens:
- `%n` username
- `%h` hostname
- `%~` cwd ("~" for `/root`)
- `%T` time (HH:MM)
Example:
```
PATH=/bin:/root/Apps
PROMPT_LEFT=%n@%h:%~$
STARTUP=/Library/bsh/startup.bsh
BOOT_SCRIPT=/Library/bsh/boot.bsh
```
## Common Commands
Below are some of the most used commands available in `/bin`:
| Command | Description |
| :--- | :--- |
| `ls` | List files and directories in the current path. |
| `cd` | Change the current working directory. |
| `cat` | Display the contents of a file. |
| `ls` | List directory contents. |
| `rm` | Remove a file. |
| `mkdir` | Create a new directory. |
| `man` | View the manual for a specific command (e.g., `man ls`). |
| `lsblk` | List block devices and partitions with size, type, filesystem, label, and flags. |
| `du` | Report disk usage for files and directories, recursively. |
| `sysfetch` | Display system and hardware information. |
---
[Return to Documentation Index](../README.md)

1
limine

Submodule limine deleted from 38ff2c855a

View File

@@ -13,3 +13,4 @@ backdrop: 000000
/BoredOS
protocol: limine
path: boot():/boredos.elf
cmdline: -v

BIN
limine/BOOTAA64.EFI Normal file

Binary file not shown.

BIN
limine/BOOTIA32.EFI Normal file

Binary file not shown.

BIN
limine/BOOTLOONGARCH64.EFI Normal file

Binary file not shown.

BIN
limine/BOOTRISCV64.EFI Normal file

Binary file not shown.

BIN
limine/BOOTX64.EFI Normal file

Binary file not shown.

22
limine/LICENSE Normal file
View File

@@ -0,0 +1,22 @@
Copyright (C) 2019-2026 Mintsuki and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

19
limine/Makefile Normal file
View File

@@ -0,0 +1,19 @@
.POSIX:
SHELL=/bin/sh
CC=cc
CFLAGS=-g -O2 -pipe
CPPFLAGS=
LDFLAGS=
LIBS=
.PHONY: all
all: limine
.PHONY: clean
clean:
rm -f limine limine.exe
limine: limine.c
$(CC) $(CFLAGS) -std=c99 $(CPPFLAGS) $(LDFLAGS) $< $(LIBS) -o $@

BIN
limine/limine-bios-cd.bin Normal file

Binary file not shown.

1368
limine/limine-bios-hdd.h Normal file

File diff suppressed because it is too large Load Diff

BIN
limine/limine-bios-pxe.bin Normal file

Binary file not shown.

BIN
limine/limine-bios.sys Normal file

Binary file not shown.

BIN
limine/limine-uefi-cd.bin Normal file

Binary file not shown.

1417
limine/limine.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.limine</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@@ -0,0 +1,5 @@
---
triple: 'arm64-apple-darwin'
binary-path: limine
relocations: []
...

Binary file not shown.

Before

Width:  |  Height:  |  Size: 317 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

BIN
src/.DS_Store vendored

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More