33 Commits

Author SHA1 Message Date
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
656 changed files with 5255 additions and 2043 deletions

BIN
.DS_Store vendored

Binary file not shown.

8
.gitignore vendored
View File

@@ -20,13 +20,13 @@ limine 2/limine.dSYM/Contents/Resources/DWARF/limine
limine 2/limine.exe
boredos.dump
qemu-debug.log
build/
iso_root/
limine/
src/kernel/userland/bin/
src/userland/bin/
boredos.iso
disk.img
limine
**/.DS_Store
.DS_Store
src/.DS_Store
limine
/build/
*.o

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\>.

107
Makefile
View File

@@ -10,27 +10,42 @@ 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
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)/net/*.c) \
$(wildcard $(SRC_DIR)/net/nic/*.c) \
$(wildcard $(SRC_DIR)/fs/*.c) \
$(wildcard $(SRC_DIR)/wm/*.c) \
$(wildcard $(SRC_DIR)/net/lwip/core/*.c) \
$(wildcard $(SRC_DIR)/net/lwip/core/ipv4/*.c) \
$(SRC_DIR)/net/lwip/netif/ethernet.c \
$(SRC_DIR)/net/lwip/netif/bridgeif.c
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))
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)/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/lwip/%.c, $(BUILD_DIR)/lwip/%.o, $(filter $(SRC_DIR)/net/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/lwip -I$(SRC_DIR)/core -I$(SRC_DIR)/sys -I$(SRC_DIR)/mem -I$(SRC_DIR)/dev -I$(SRC_DIR)/net -I$(SRC_DIR)/net/nic -I$(SRC_DIR)/fs -I$(SRC_DIR)/wm
LDFLAGS = -m elf_x86_64 -nostdlib -static -pie --no-dynamic-linker \
-z text -z max-page-size=0x1000 -T linker.ld
@@ -54,9 +69,9 @@ limine-setup:
rm -rf limine; \
git clone https://github.com/limine-bootloader/limine.git --branch=v$(LIMINE_VERSION)-binary --depth=1 limine; \
fi
@if [ ! -f $(SRC_DIR)/limine.h ]; then \
@if [ ! -f $(SRC_DIR)/core/limine.h ]; then \
echo "Copying limine.h..."; \
cp limine/limine.h $(SRC_DIR)/limine.h; \
cp limine/limine.h $(SRC_DIR)/core/limine.h; \
fi
@echo "Building Limine host utility..."; \
$(MAKE) -C limine
@@ -65,18 +80,52 @@ $(BUILD_DIR)/%.o: $(SRC_DIR)/%.c | $(BUILD_DIR) limine-setup
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/core/%.c | $(BUILD_DIR) limine-setup
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/sys/%.c | $(BUILD_DIR) limine-setup
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
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/dev/%.c | $(BUILD_DIR) limine-setup
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/net/%.c | $(BUILD_DIR) limine-setup
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/net/nic/%.c | $(BUILD_DIR) limine-setup
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/fs/%.c | $(BUILD_DIR) limine-setup
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/wm/%.c | $(BUILD_DIR) limine-setup
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/lwip/%.o: $(SRC_DIR)/net/lwip/%.c | $(BUILD_DIR) limine-setup
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/arch/%.asm | $(BUILD_DIR)
$(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)
$(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)
$(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)
$(NASM) $(NASMFLAGS) $< -o $@
$(KERNEL_ELF): $(OBJ_FILES)
@@ -100,9 +149,9 @@ $(ISO_IMAGE): $(KERNEL_ELF) limine.conf limine-setup
done
@if [ -f README.md ]; then cp README.md $(ISO_DIR)/; fi
@if [ -f $(SRC_DIR)/userland/doom/doom1.wad ]; then \
@if [ -f $(SRC_DIR)/userland/games/doom/doom1.wad ]; then \
mkdir -p $(ISO_DIR)/Library/DOOM; \
cp $(SRC_DIR)/userland/doom/doom1.wad $(ISO_DIR)/Library/DOOM/; \
cp $(SRC_DIR)/userland/games/doom/doom1.wad $(ISO_DIR)/Library/DOOM/; \
echo " module_path: boot():/Library/DOOM/doom1.wad" >> $(ISO_DIR)/limine.conf; \
fi
@@ -125,6 +174,16 @@ $(ISO_IMAGE): $(KERNEL_ELF) limine.conf limine-setup
fi \
done
mkdir -p $(ISO_DIR)/docs
@for f in $$(find docs -name '*.md'); do \
if [ -f "$$f" ]; then \
dir=$$(dirname "$$f"); \
mkdir -p $(ISO_DIR)/"$$dir"; \
cp "$$f" $(ISO_DIR)/"$$dir"/; \
echo " module_path: boot():/$$f" >> $(ISO_DIR)/limine.conf; \
fi \
done
cp limine/limine-bios.sys $(ISO_DIR)/
cp limine/limine-bios-cd.bin $(ISO_DIR)/
cp limine/limine-uefi-cd.bin $(ISO_DIR)/
@@ -141,6 +200,16 @@ $(ISO_IMAGE): $(KERNEL_ELF) limine.conf limine-setup
fi \
done
@if [ -f README.md ]; then \
cp README.md $(ISO_DIR)/; \
echo " module_path: boot():/README.md" >> $(ISO_DIR)/limine.conf; \
fi
@if [ -f LICENSE ]; then \
cp LICENSE $(ISO_DIR)/; \
echo " module_path: boot():/LICENSE" >> $(ISO_DIR)/limine.conf; \
fi
$(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 \
@@ -157,7 +226,7 @@ run: $(ISO_IMAGE)
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 \
-netdev user,id=net0,hostfwd=udp::12346-:12345 -device virtio-net-pci,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 \

View File

@@ -31,86 +31,15 @@ It features a DE (and WM), a FAT32 filesystem, customizable UI and much much mor
- CLI
- (Limited) C Compiler
## Prerequisites
## Documentation
To build BoredOS, you'll need the following tools installed:
BoredOS has comprehensive documentation available in the [`docs/`](docs/) directory covering architecture, the build system, and application development SDKs.
- **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
- **[Index / Table of Contents](docs/README.md)**
- **[Architecture Overview](docs/architecture/core.md)**
- **[Building and Running](docs/build/usage.md)**
- **[Application Development Guide](docs/appdev/custom_apps.md)**
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.**
## 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

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

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.

Binary file not shown.

BIN
disk.img

Binary file not shown.

25
docs/README.md Normal file
View File

@@ -0,0 +1,25 @@
# BoredOS Documentation
Welcome to the internal 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.
- [`Core`](architecture/core.md): Kernel source layout and the boot process (Limine, Multiboot2).
- [`Memory`](architecture/memory.md): Physical Memory Management (PMM) and Virtual Memory Management (VMM).
- [`Filesystem`](architecture/filesystem.md): Virtual File System (VFS) and the RAM-based FAT32 simulation.
- [`Window Manager`](architecture/window_manager.md): How the built-in Window Manager natively handles graphics, events, and compositing.
### 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): Explanation of the custom `libc` wrappers (`stdlib.h`, `string.h`) and system calls.
- [`UI API`](appdev/ui_api.md): Drawing on the screen, creating windows, and polling the event loop using `libui.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.

View File

@@ -0,0 +1,79 @@
# Creating a Custom App (Step-by-Step)
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.
## 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!
*you can also open your app by opening the file explorer and navigating to the bin directory and double clicking the executable.*

View File

@@ -0,0 +1,36 @@
# Userland SDK Reference
BoredOS provides a custom `libc` implementation necessary for writing userland applications (`.elf` binaries). By avoiding a full-blown standard library like `glibc`, the OS ensures a minimal executable footprint tailored strictly to the existing kernel features.
## The Custom libc Structure (`src/userland/libc/`)
The SDK comprises a few key files containing wrappers around kernel system calls:
- `stdlib.h` / `stdlib.c`: Memory allocation (`malloc`, `free`), integer conversion (`itoa`, `atoi`), printing (`printf`, `sprintf`), and random numbers (`rand`, `srand`).
- `string.h` / `string.c`: String manipulation utilities (`strlen`, `strcpy`, `strcmp`, `memset`, `memcpy`).
- `syscall.h` / `syscall.c`: The raw interface to issue `syscall` assembly instructions, routing requests to the kernel.
- `libui.h` / `libui.c`: Graphical interface commands (creating windows, drawing pixels, events).
## System Calls Overview
When a userland application wants to interact with the hardware (print to screen, read a file, create a window), it must ask the kernel via a **System Call**.
In BoredOS (`x86_64`), system calls are issued using the `syscall` instruction. The kernel intercepts this instruction and inspects the processor's RAX register to figure out *what* the application wants to do.
The custom `libc` provides `syscallX` wrapper functions that abstract the assembly details:
```c
// Example: Performing a minimal system call from userland
int sys_write(int fd, const char *buf, int len) {
return syscall3(SYS_WRITE, fd, (uint64_t)buf, len);
}
```
### Notable System Calls
- **`SYS_WRITE` (1)**: Currently acts as a generic output mechanism for `printf`, typically routing text to the kernel's serial output for debugging, or to an active text-mode console.
- **`SYS_GUI` (3)**: The primary multiplexer for all window manager operations. The arguments define subcommands (like `UI_CREATE_WINDOW`, `UI_FILL_RECT`).
- **`SYS_FS` (4)**: Interacts with the virtual filesystem (e.g., `FS_CMD_OPEN`, `FS_CMD_READ`). Under the hood, this reads from the loaded RAMFS or an attached physical ATA disk via the native FAT32 driver.
- **`SYS_EXIT` (60)**: Terminates the current process and returns control to the kernel.
- **`SYSTEM_CMD_YIELD` (43)**: Instructs the process scheduler to pause the current process and let another process run.
If you are developing a new application, **do not invoke syscalls manually**. Instead, include `stdlib.h` and use the C functions provided.

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

@@ -0,0 +1,85 @@
# UI API (`libui.h`)
For an application to be visible on the screen, it must interact with the BoredOS Window Manager (WM). The tools required for this are located in `src/userland/libc/libui.h` and `libui.c`.
## Core Concepts
The UI library sends requests (via `SYS_GUI`) to the kernel to reserve an area on the screen (a `Window`) and then issues commands to color specific pixels within that area. The kernel is responsible for compositing this area over other windows.
## Example: Creating a Window
First, include the library and define an event structure:
```c
#include <libui.h>
#include <stdlib.h>
int main(void) {
// 1. Create the window
// Arguments: Title, Width, Height, Flags (e.g. 0 for bordered window)
int window_id = ui_create_window("Hello World App", 400, 300, 0);
if (window_id < 0) {
printf("Failed to create window!\n");
return 1;
}
// ... Event loop will go here ...
return 0;
}
```
## Drawing Primitives
The library offers functions to mutate the window's internal buffer. After issuing drawing commands, you **must** instruct the kernel to push the changes onto the screen.
```c
// Fill the entire window with a solid blue background
// Arguments: Window ID, X, Y, Width, Height, ARGB Color value
ui_fill_rect(window_id, 0, 0, 400, 300, 0xFF0000FF);
// Tell the kernel to commit the drawing commands to the screen
ui_swap_buffers(window_id);
```
Available rendering methods:
- `ui_fill_rect(id, x, y, w, h, color)`: Draw a solid rectangle.
- `ui_draw_rect(id, x, y, w, h, color)`: Draw an outline of a rectangle.
- `ui_draw_line(id, x0, y0, x1, y1, color)`: Bresenham line algorithm.
- `ui_draw_string(id, string, x, y, color)`: Render text using the kernel's built-in font.
- `ui_update_region(id, x, y, w, h)`: A targeted version of `ui_swap_buffers` that only updates a specific area, saving performance.
## Handling the Event Loop
Graphical applications are event-driven. They stay alive inside a `while (1)` loop, periodically asking the kernel if the user clicked the mouse or pressed a key inside their window.
```c
ui_event_t event;
// Main UI Loop
while (1) {
// ui_poll_event is non-blocking. It returns 1 if an event occurred, 0 otherwise.
if (ui_poll_event(&event)) {
// The WM dispatch sets event.window_id
// We only care about events meant for our specific window
if (event.window_id == window_id) {
if (event.type == UI_EVENT_MOUSE_DOWN) {
printf("User clicked at X:%d Y:%d\n", event.mouse_x, event.mouse_y);
// Respond visually to the click
ui_fill_rect(window_id, event.mouse_x, event.mouse_y, 10, 10, 0xFFFF0000); // Red dot
ui_swap_buffers(window_id);
}
else if (event.type == UI_EVENT_WINDOW_CLOSE) {
// Start tearing down the application safely
break;
}
}
}
// Prevent 100% CPU usage by yielding execution time back to the OS scheduler
syscall1(SYSTEM_CMD_YIELD, 0);
}
```

39
docs/architecture/core.md Normal file
View File

@@ -0,0 +1,39 @@
# Core Architecture
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, parsing userland binaries and setting them up for execution.
- **`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 Protocol**: The kernel expects the Limine boot protocol (which is compatible with modern Multiboot specifications). Passing a framebuffer and memory map is handled natively by Limine's request structures (defined locally via `limine.h`).
3. **Kernel Entry (`main.c`)**: The entry point `_start` is called. It immediately initializes the serial port for debugging, sets up core structures (GDT/IDT), initializes the physical memory manager based on the Limine memory map, and starts the virtual memory manager.
4. **Driver Initialization**: PCI buses are scanned, finding the network card or disk controllers. The filesystem is mounted.
5. **Window Manager**: The UI is drawn on top of the Limine-provided framebuffer.
## Userland Transition
The OS supports privilege separation (Ring 0 vs. Ring 3). When an application (like `browser.elf` or `viewer.elf`) is launched, the kernel:
1. Loads the ELF file from the filesystem using the ELF parser in `sys/elf.c`.
2. Allocates a new virtual address space (Page Directory) for the process.
3. Maps the executable segments according to the ELF headers.
4. Switches to User Mode (Ring 3) via the `iretq` instruction, jumping into the application's entry point (`crt0.asm`).
Programs then interact with the core kernel using system calls (`syscall.c`).

View File

@@ -0,0 +1,28 @@
# Filesystem Architecture
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.
## FAT32 Implementation
The primary filesystem logic in `fat32.c` has a dual nature, supporting both an in-memory RAM filesystem for booting and standard block devices for external storage.
### Booting and the RAMFS
Since BoredOS boots from a CD-ROM ISO image generated by `xorriso`, it does not read directly off the CD to execute applications.
1. **ISO Booting**: During boot, Limine loads necessary files (such as userland `.elf` binaries, fonts, and wallpapers) into memory as standard boot modules.
2. **RAM Simulation**: The FAT32 filesystem code parses these loaded memory modules and automatically constructs a synthetic FAT32 directory tree inside RAM.
3. **Root Filesystem**: All active execution of built-in GUI and CLI apps occurs off this read-only, in-memory FAT32 simulation.
### ATA Disk Support
Beyond the core RAMFS used for booting, the FAT32 implementation natively supports interacting with permanent storage:
1. **ATA Block Driver**: The kernel features an ATA block device driver capable of communicating with physical hard disks (or raw disk images attached via QEMU).
2. **Partition Compatibility**: The driver can recognize and natively mount external ATA disks formatted as single FAT32 filesystems or structured with a Master Boot Record (MBR) partition table.
3. **VFS Integration**: When external storage is mounted, the VFS delegates operations down directly to the FAT32 driver, which will read native sectors across the ATA interface.

View File

@@ -0,0 +1,23 @@
# Memory Management
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.
## 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`). This ensures the kernel remains mapped and accessible regardless of which user process is currently active.
- **User Space**: Userland applications are loaded into lower virtual addresses (starting frequently around `0x40000000`).
- **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 (e.g., for stack growth or lazy loading) or terminate the process for a segmentation fault.
## 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 using the VMM.

View File

@@ -0,0 +1,33 @@
# Window Manager (WM)
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.
## 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.
## Userland API (`libui.c`)
Applications do not talk to the hardware directly. Instead, they use a library (`libui.c`) which makes specialized system calls (`SYS_GUI`).
- **Window Creation**: `ui_create_window()` asks the kernel to instantiate a new window object and returns a handle.
- **Drawing**: Applications can request the kernel to fill rectangles or plot pixels inside their designated window area.
- **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.

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

@@ -0,0 +1,52 @@
# Build Toolchain
BoredOS is built cross-compiled from a host system (such as macOS or Linux) to target the generic `x86_64-elf` platform.
## 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 binary and userland variables.
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 for rapid emulation and testing.
## Installation (macOS)
You can easily install the complete toolchain using Homebrew:
```sh
brew install x86_64-elf-binutils x86_64-elf-gcc nasm xorriso qemu
```
## Installation (Linux)
Depending on your distribution, the installation commands vary. Note that some distributions may require you to build the `x86_64-elf` cross-compiler from source if it isn't available in their default repositories.
### Debian / Ubuntu
```sh
sudo apt update
sudo apt install build-essential bison flex libgmp3-dev libmpc-dev libmpfr-dev texinfo nasm xorriso qemu-system-x86
```
*(Note: You will need to build the `x86_64-elf` cross-compiler from source or find a compatible PPA, as it is not in the default Debian/Ubuntu repositories.)*
### Arch Linux
Arch Linux provides the regular tools in its standard repositories and the cross-compiler via the AUR:
```sh
sudo pacman -S nasm xorriso qemu-full
yay -S x86_64-elf-gcc x86_64-elf-binutils
```
### Fedora
```sh
sudo dnf install make gcc gcc-c++ bison flex gmp-devel mpfr-devel libmpc-devel texinfo nasm xorriso qemu
```

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

@@ -0,0 +1,58 @@
# 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 invokes QEMU with specific arguments:
- `-m 4G`: Allocates 4 Gigabytes of RAM.
- `-cdrom boredos.iso`: Mounts the built OS image as a CD-ROM.
- `-netdev user...`: Sets up a basic NAT network interface for the OS's networking stack.
- `-smp 4`: Enables 4 CPU cores.
- `-drive file=disk.img...`: Attaches a raw disk image included in this release of BoredOS.
## 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.

1
limine

Submodule limine deleted from 38ff2c855a

Binary file not shown.

Before

Width:  |  Height:  |  Size: 317 KiB

After

Width:  |  Height:  |  Size: 342 KiB

BIN
src/.DS_Store vendored

Binary file not shown.

View File

@@ -10,7 +10,6 @@
#include "fat32.h"
#include "disk.h"
#include "kutils.h"
#include "licensewr.h"
#include <stddef.h>
#include "memory_manager.h"
#include "process.h"
@@ -2260,105 +2259,7 @@ static void create_ramfs_files(void) {
// Always try to write README to ensure content exists
FAT32_FileHandle *fh = fat32_open("README.md", "w");
if (fh) {
const char *content =
"# Bored OS 1.50\n\n"
"BoredOS is now in a Beta stage as i have brought over all apps from boredkernel and have made the DE a lot more usable and stable.\n"
"## Boredkernel is now BoredOS!\n"
"Boredkernel will from now on be deprecated as it's core became too messy. I have built a less bloated kernel and wrote a DE above it, which is why it is now an OS instead of a kernel (in my opinion).\n\n"
"Bored Kernel is a simple x86_64 hobbyist operating system.\n"
"It features a DE (and WM), a FAT32 filesystem, customizable UI and much much more!\n\n"
"## Features\n"
"- Bored WM\n"
"- Fat 32 FS\n"
"- 64-bit long mode support\n"
"- Multiboot2 compliant\n"
"- Text editor\n"
"- IDT\n"
"- Ability to run on actual x86_64 hardware\n"
"- CLI\n\n"
"## Prerequisites\n\n"
"To build BoredOS, you'll need the following tools installed:\n\n"
"- **x86_64 ELF Toolchain**: `x86_64-elf-gcc`, `x86_64-elf-ld`\n"
"- **NASM**: Netwide Assembler for compiling assembly code\n"
"- **xorriso**: For creating bootable ISO images\n"
"- **QEMU** (optional): For testing the kernel in an emulator\n\n"
"On macOS, you can install these using Homebrew:\n"
"```sh\n"
"brew install x86_64-elf-binutils x86_64-elf-gcc nasm xorriso qemu\n"
"```\n\n"
"## Building\n\n"
"Simply run `make` from the project root:\n\n"
"```sh\n"
"make\n"
"```\n\n"
"This will:\n"
"1. Compile all kernel C sources and assembly files\n"
"2. Link the kernel ELF binary\n"
"3. Generate a bootable ISO image (`boredos.iso`)\n\n"
"The build output is organized as follows:\n"
"- Compiled object files: `build/`\n"
"- ISO root filesystem: `iso_root/`\n"
"- Final ISO image: `boredos.iso`\n\n"
"## Running\n\n"
"### QEMU Emulation\n\n"
"Run the kernel in QEMU:\n\n"
"```sh\n"
"make run\n"
"```\n\n"
"Or manually:\n"
"```sh\n"
"qemu-system-x86_64 -m 2G -serial stdio -cdrom boredos.iso -boot d\n"
"```\n\n"
"### Running on Real Hardware\n\n"
"*Warning: This is at YOUR OWN RISK. This software comes with ZERO warranty and may break your system.*\n\n"
"1. **Create bootable USB**: Use [Balena Etcher](https://www.balena.io/etcher/) to flash `boredos.iso` to a USB drive\n\n"
"2. **Prepare the system**:\n"
" - Enable legacy (BIOS) boot in your system BIOS/UEFI settings\n"
" - Disable Secure Boot if needed\n\n"
"3. **Boot**: Insert the USB drive and select it in the boot menu during startup\n\n"
"4. **Tested Hardware**:\n"
" - HP EliteDesk 705 G4 DM (AMD Ryzen 5 PRO 2400G, Radeon Vega)\n"
" - Lenovo ThinkPad A475 20KL002VMH (AMD Pro A12-8830B, Radeon R7)\n\n"
"## Project Structure\n\n"
"- `src/kernel/` - Main kernel implementation\n"
" - `boot.asm` - Boot assembly code\n"
" - `main.c` - Kernel entry point\n"
" - `*.c / *.h` - Core kernel modules (graphics, interrupts, filesystem, etc.)\n"
" - `cli_apps/` - Command-line applications\n"
" - `wallpaper.ppm` - Default desktop wallpaper\n"
"- `build/` - Compiled object files (generated during build)\n"
"- `iso_root/` - ISO filesystem layout (generated during build)\n"
"- `limine/` - Limine bootloader files (downloaded automatically)\n"
"- `linker.ld` - Linker script for x86_64 ELF\n"
"- `limine.conf` - Limine bootloader configuration\n"
"- `Makefile` - Build configuration and targets\n\n"
"## License\n\n"
"Copyright (C) 2024-2026 boreddevnl\n\n"
"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.\n\n"
"NOTICE\n"
"------\n\n"
"This product includes software developed by Chris (\"boreddevnl\") as part of the BoredOS project.\n\n"
"Copyright (C) 20242026 Chris / boreddevnl (previously boreddevhq)\n\n"
"All source files in this repository contain copyright and license\n"
"headers that must be preserved in redistributions and derivative works.\n\n"
"If you distribute or modify this project (in whole or in part),\n"
"you MUST:\n\n"
" - Retain all copyright and license headers at the top of each file.\n"
" - Include this NOTICE file along with any redistributions or\n"
" derivative works.\n"
" - Provide clear attribution to the original author in documentation\n"
" or credits where appropriate.\n\n"
"The above attribution requirements are informational and intended to\n"
"ensure proper credit is given. They do not alter or supersede the\n"
"terms of the GNU General Public License (GPL), which governs this work.\n";
fat32_write(fh, (void *)content, cmd_strlen(content));
fat32_close(fh);
}
fh = fat32_open("Apps/README.md", "w");
FAT32_FileHandle *fh = fat32_open("Apps/README.md", "w");
if (fh) {
const char *content =
"# All compiled C files in this directory are openable from any other directory by typing in the name of the compiled file by typing in the name of the compiled file.\n\n"
@@ -2368,10 +2269,6 @@ static void create_ramfs_files(void) {
fat32_close(fh);
}
write_license_file();
fh = fat32_open("Documents/notes.txt", "w");
if (fh) {
const char *content = "My Notes\n\n- First note\n- Second note\n";

View File

@@ -108,17 +108,40 @@ void k_reboot(void) {
}
void k_shutdown(void) {
outw(0x604, 0x2000);
outw(0xB004, 0x2000); // QEMU older / some pc machines
outw(0x604, 0x2000); // QEMU newer (i440fx/q35)
outw(0x4004, 0x3400); // VirtualBox fallback
}
volatile uint64_t beep_end_tick = 0;
bool beep_active = false;
void k_beep(int freq, int ms) {
if (freq <= 0) return;
if (freq <= 0) {
outb(0x61, inb(0x61) & 0xFC);
beep_active = false;
return;
}
int div = 1193180 / freq;
outb(0x43, 0xB6);
outb(0x42, div & 0xFF);
outb(0x42, (div >> 8) & 0xFF);
outb(0x61, inb(0x61) | 0x03);
k_sleep(ms);
outb(0x61, inb(0x61) & 0xFC);
uint32_t ticks = ms / 16;
if (ticks == 0 && ms > 0) ticks = 1;
extern volatile uint64_t kernel_ticks;
beep_end_tick = kernel_ticks + ticks;
beep_active = true;
}
void k_beep_process(void) {
if (beep_active) {
extern volatile uint64_t kernel_ticks;
if (kernel_ticks >= beep_end_tick) {
outb(0x61, inb(0x61) & 0xFC);
beep_active = false;
}
}
}

View File

@@ -6,6 +6,7 @@
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
// Kernel string utilities
void k_memset(void *dest, int val, size_t len);
@@ -23,5 +24,6 @@ void k_sleep(int ms);
void k_reboot(void);
void k_shutdown(void);
void k_beep(int freq, int ms);
void k_beep_process(void);
#endif

View File

@@ -93,6 +93,32 @@ void serial_write_hex(uint64_t n) {
}
// Kernel Entry Point
static void fat32_mkdir_recursive(const char *path) {
char temp[256];
int i = 0;
// Skip initial slash
if (path[0] == '/') {
temp[0] = '/';
i = 1;
}
while (path[i] && i < 255) {
temp[i] = path[i];
if (path[i] == '/') {
temp[i] = '\0';
fat32_mkdir(temp);
temp[i] = '/';
}
i++;
}
if (i > 0 && temp[i-1] != '/') {
temp[i] = '\0';
fat32_mkdir(temp);
}
}
void kmain(void) {
init_serial();
serial_write("\n[DEBUG] Entering kmain...\n");
@@ -158,6 +184,7 @@ void kmain(void) {
fat32_mkdir("/Library/images/gif");
fat32_mkdir("/Library/Fonts");
fat32_mkdir("/Library/DOOM");
fat32_mkdir("/docs");
if (module_request.response == NULL) {
serial_write("[DEBUG] ERROR: Limine Module Response is NULL!\n");
@@ -172,6 +199,17 @@ void kmain(void) {
if (fs_starts_with(clean_path, "boot():")) clean_path += 7;
else if (fs_starts_with(clean_path, "boot:///")) clean_path += 8;
char dir_path[256];
int last_slash = -1;
for (int j = 0; clean_path[j]; j++) {
if (clean_path[j] == '/') last_slash = j;
}
if (last_slash > 0) {
for (int j = 0; j < last_slash; j++) dir_path[j] = clean_path[j];
dir_path[last_slash] = '\0';
fat32_mkdir_recursive(dir_path);
}
FAT32_FileHandle *fh = fat32_open(clean_path, "w");
if (fh && fh->valid) {
fat32_write(fh, mod->address, mod->size);

33
src/core/version.c Normal file
View File

@@ -0,0 +1,33 @@
// 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.
#include "syscall.h"
#include <stddef.h>
extern void mem_memcpy(void *dest, const void *src, size_t len);
void get_os_info(os_info_t *info) {
if (!info) return;
char *p = (char *)info;
for (size_t i = 0; i < sizeof(os_info_t); i++) p[i] = 0;
const char *os_name = "BoredOS";
const char *os_version = "1.72";
const char *os_codename = "Retrowave";
const char *kernel_name = "Boredkernel";
const char *kernel_version = "3.1.2";
const char *build_date = __DATE__;
const char *build_time = __TIME__;
const char *build_arch = "x86_64";
int j;
j = 0; while (os_name[j] && j < 63) { info->os_name[j] = os_name[j]; j++; } info->os_name[j] = '\0';
j = 0; while (os_version[j] && j < 63) { info->os_version[j] = os_version[j]; j++; } info->os_version[j] = '\0';
j = 0; while (os_codename[j] && j < 63) { info->os_codename[j] = os_codename[j]; j++; } info->os_codename[j] = '\0';
j = 0; while (kernel_name[j] && j < 63) { info->kernel_name[j] = kernel_name[j]; j++; } info->kernel_name[j] = '\0';
j = 0; while (kernel_version[j] && j < 63) { info->kernel_version[j] = kernel_version[j]; j++; } info->kernel_version[j] = '\0';
j = 0; while (build_date[j] && j < 63) { info->build_date[j] = build_date[j]; j++; } info->build_date[j] = '\0';
j = 0; while (build_time[j] && j < 63) { info->build_time[j] = build_time[j]; j++; } info->build_time[j] = '\0';
j = 0; while (build_arch[j] && j < 63) { info->build_arch[j] = build_arch[j]; j++; } info->build_arch[j] = '\0';
}

View File

@@ -18,6 +18,9 @@ uint64_t timer_handler(registers_t *regs) {
wm_timer_tick();
network_process_frames();
extern void k_beep_process(void);
k_beep_process();
outb(0x20, 0x20); // EOI after processing to prevent nested timer interrupts
extern uint64_t process_schedule(uint64_t current_rsp);
return process_schedule((uint64_t)regs);

View File

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

View File

Before

Width:  |  Height:  |  Size: 4.2 MiB

After

Width:  |  Height:  |  Size: 4.2 MiB

View File

Before

Width:  |  Height:  |  Size: 301 KiB

After

Width:  |  Height:  |  Size: 301 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 600 KiB

After

Width:  |  Height:  |  Size: 600 KiB

View File

Before

Width:  |  Height:  |  Size: 159 KiB

After

Width:  |  Height:  |  Size: 159 KiB

View File

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 110 KiB

BIN
src/kernel/.DS_Store vendored

Binary file not shown.

View File

@@ -1,9 +0,0 @@
#ifndef E1000_NETIF_H
#define E1000_NETIF_H
#include "lwip/netif.h"
err_t e1000_netif_init(struct netif *netif);
void e1000_netif_poll(struct netif *netif);
#endif

Binary file not shown.

Binary file not shown.

View File

@@ -1,576 +0,0 @@
// 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.
#include "fat32.h"
#include <stddef.h>
// Helper function to calculate string length
static size_t lic_strlen(const char *str) {
size_t len = 0;
while (str[len]) len++;
return len;
}
void write_license_file(void) {
FAT32_FileHandle *fh = fat32_open("LICENSE", "w");
if (fh) {
const char *content =
" GNU GENERAL PUBLIC LICENSE\n"
" Version 3, 29 June 2007\n\n"
" Copyright(C) Chris (boreddevnl) 2024-2026\n\n"
" Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n"
" Everyone is permitted to copy and distribute verbatim copies\n"
" of this license document, but changing it is not allowed.\n\n"
" Preamble\n\n"
" The GNU General Public License is a free, copyleft license for\n"
"software and other kinds of works.\n\n"
" The licenses for most software and other practical works are designed\n"
"to take away your freedom to share and change the works. By contrast,\n"
"the GNU General Public License is intended to guarantee your freedom to\n"
"share and change all versions of a program--to make sure it remains free\n"
"software for all its users. We, the Free Software Foundation, use the\n"
"GNU General Public License for most of our software; it applies also to\n"
"any other work released this way by its authors. You can apply it to\n"
"your programs, too.\n\n"
" When we speak of free software, we are referring to freedom, not\n"
"price. Our General Public Licenses are designed to make sure that you\n"
"have the freedom to distribute copies of free software (and charge for\n"
"them if you wish), that you receive source code or can get it if you\n"
"want it, that you can change the software or use pieces of it in new\n"
"free programs, and that you know you can do these things.\n\n"
" To protect your rights, we need to prevent others from denying you\n"
"these rights or asking you to surrender the rights. Therefore, you have\n"
"certain responsibilities if you distribute copies of the software, or if\n"
"you modify it: responsibilities to respect the freedom of others.\n\n"
" For example, if you distribute copies of such a program, whether\n"
"gratis or for a fee, you must pass on to the recipients the same\n"
"freedoms that you received. You must make sure that they, too, receive\n"
"or can get the source code. And you must show them these terms so they\n"
"know their rights.\n\n"
" Developers that use the GNU GPL protect your rights with two steps:\n"
"(1) assert copyright on the software, and (2) offer you this License\n"
"giving you legal permission to copy, distribute and/or modify it.\n\n"
" For the developers' and authors' protection, the GPL clearly explains\n"
"that there is no warranty for this free software. For both users' and\n"
"authors' sake, the GPL requires that modified versions be marked as\n"
"changed, so that their problems will not be attributed erroneously to\n"
"authors of previous versions.\n\n"
" Some devices are designed to deny users access to install or run\n"
"modified versions of the software inside them, although the manufacturer\n"
"can do so. This is fundamentally incompatible with the aim of\n"
"protecting users' freedom to change the software. The systematic\n"
"pattern of such abuse occurs in the area of products for individuals to\n"
"use, which is precisely where it is most unacceptable. Therefore, we\n"
"have designed this version of the GPL to prohibit the practice for those\n"
"products. If such problems arise substantially in other domains, we\n"
"stand ready to extend this provision to those domains in future versions\n"
"of the GPL, as needed to protect the freedom of users.\n\n"
" Finally, every program is threatened constantly by software patents.\n"
"States should not allow patents to restrict development and use of\n"
"software on general-purpose computers, but in those that do, we wish to\n"
"avoid the special danger that patents applied to a free program could\n"
"make it effectively proprietary. To prevent this, the GPL assures that\n"
"patents cannot be used to render the program non-free.\n\n"
" The precise terms and conditions for copying, distribution and\n"
"modification follow.\n\n"
" TERMS AND CONDITIONS\n\n"
" 0. Definitions.\n\n"
" \"This License\" refers to version 3 of the GNU General Public License.\n\n"
" \"Copyright\" also means copyright-like laws that apply to other kinds of\n"
"works, such as semiconductor masks.\n\n"
" \"The Program\" refers to any copyrightable work licensed under this\n"
"License. Each licensee is addressed as \"you\". \"Licensees\" and\n"
"\"recipients\" may be individuals or organizations.\n\n"
" To \"modify\" a work means to copy from or adapt all or part of the work\n"
"in a fashion requiring copyright permission, other than the making of an\n"
"exact copy. The resulting work is called a \"modified version\" of the\n"
"earlier work or a work \"based on\" the earlier work.\n\n"
" A \"covered work\" means either the unmodified Program or a work based\n"
"on the Program.\n\n"
" To \"propagate\" a work means to do anything with it that, without\n"
"permission, would make you directly or secondarily liable for\n"
"infringement under applicable copyright law, except executing it on a\n"
"computer or modifying a private copy. Propagation includes copying,\n"
"distribution (with or without modification), making available to the\n"
"public, and in some countries other activities as well.\n\n"
" To \"convey\" a work means any kind of propagation that enables other\n"
"parties to make or receive copies. Mere interaction with a user through\n"
"a computer network, with no transfer of a copy, is not conveying.\n\n"
" An interactive user interface displays \"Appropriate Legal Notices\"\n"
"to the extent that it includes a convenient and prominently visible\n"
"feature that (1) displays an appropriate copyright notice, and (2)\n"
"tells the user that there is no warranty for the work (except to the\n"
"extent that warranties are provided), that licensees may convey the\n"
"work under this License, and how to view a copy of this License. If\n"
"the interface presents a list of user commands or options, such as a\n"
"menu, a prominent item in the list meets this criterion.\n\n"
" 1. Source Code.\n\n"
" The \"source code\" for a work means the preferred form of the work\n"
"for making modifications to it. \"Object code\" means any non-source\n"
"form of a work.\n\n"
" A \"Standard Interface\" means an interface that either is an official\n"
"standard defined by a recognized standards body, or, in the case of\n"
"interfaces specified for a particular programming language, one that\n"
"is widely used among developers working in that language.\n\n"
" The \"System Libraries\" of an executable work include anything, other\n"
"than the work as a whole, that (a) is included in the normal form of\n"
"packaging a Major Component, but which is not part of that Major\n"
"Component, and (b) serves only to enable use of the work with that\n"
"Major Component, or to implement a Standard Interface for which an\n"
"implementation is available to the public in source code form. A\n"
"\"Major Component\", in this context, means a major essential component\n"
"(kernel, window system, and so on) of the specific operating system\n"
"(if any) on which the executable work runs, or a compiler used to\n"
"produce the work, or an object code interpreter used to run it.\n\n"
" The \"Corresponding Source\" for a work in object code form means all\n"
"the source code needed to generate, install, and (for an executable\n"
"work) run the object code and to modify the work, including scripts to\n"
"control those activities. However, it does not include the work's\n"
"System Libraries, or general-purpose tools or generally available free\n"
"programs which are used unmodified in performing those activities but\n"
"which are not part of the work. For example, Corresponding Source\n"
"includes interface definition files associated with source files for\n"
"the work, and the source code for shared libraries and dynamically\n"
"linked subprograms that the work is specifically designed to require,\n"
"such as by intimate data communication or control flow between those\n"
"subprograms and other parts of the work.\n\n"
" The Corresponding Source need not include anything that users\n"
"can regenerate automatically from other parts of the Corresponding\n"
"Source.\n\n"
" The Corresponding Source for a work in source code form is that\n"
"same work.\n\n"
" 2. Basic Permissions.\n\n"
" All rights granted under this License are granted for the term of\n"
"copyright on the Program, and are irrevocable provided the stated\n"
"conditions are met. This License explicitly affirms your unlimited\n"
"permission to run the unmodified Program. The output from running a\n"
"covered work is covered by this License only if the output, given its\n"
"content, constitutes a covered work. This License acknowledges your\n"
"rights of fair use or other equivalent, as provided by copyright law.\n\n"
" You may make, run and propagate covered works that you do not\n"
"convey, without conditions so long as your license otherwise remains\n"
"in force. You may convey covered works to others for the sole purpose\n"
"of having them make modifications exclusively for you, or provide you\n"
"with facilities for running those works, provided that you comply with\n"
"the terms of this License in conveying all material for which you do\n"
"not control copyright. Those thus making or running the covered works\n"
"for you must do so exclusively on your behalf, under your direction\n"
"and control, on terms that prohibit them from making any copies of\n"
"your copyrighted material outside their relationship with you.\n\n"
" Conveying under any other circumstances is permitted solely under\n"
"the conditions stated below. Sublicensing is not allowed; section 10\n"
"makes it unnecessary.\n\n"
" 3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n"
" No covered work shall be deemed part of an effective technological\n"
"measure under any applicable law fulfilling obligations under article\n"
"11 of the WIPO copyright treaty adopted on 20 December 1996, or\n"
"similar laws prohibiting or restricting circumvention of such\n"
"measures.\n\n"
" When you convey a covered work, you waive any legal power to forbid\n"
"circumvention of technological measures to the extent such circumvention\n"
"is effected by exercising rights under this License with respect to\n"
"the covered work, and you disclaim any intention to limit operation or\n"
"modification of the work as a means of enforcing, against the work's\n"
"users, your or third parties' legal rights to forbid circumvention of\n"
"technological measures.\n\n"
" 4. Conveying Verbatim Copies.\n\n"
" You may convey verbatim copies of the Program's source code as you\n"
"receive it, in any medium, provided that you conspicuously and\n"
"appropriately publish on each copy an appropriate copyright notice;\n"
"keep intact all notices stating that this License and any\n"
"non-permissive terms added in accord with section 7 apply to the code;\n"
"keep intact all notices of the absence of any warranty; and give all\n"
"recipients a copy of this License along with the Program.\n\n"
" You may charge any price or no price for each copy that you convey,\n"
"and you may offer support or warranty protection for a fee.\n\n"
" 5. Conveying Modified Source Versions.\n\n"
" You may convey a work based on the Program, or the modifications to\n"
"produce it from the Program, in the form of source code under the\n"
"terms of section 4, provided that you also meet all of these conditions:\n\n"
" a) The work must carry prominent notices stating that you modified\n"
" it, and giving a relevant date.\n\n"
" b) The work must carry prominent notices stating that it is\n"
" released under this License and any conditions added under section\n"
" 7. This requirement modifies the requirement in section 4 to\n"
" \"keep intact all notices\".\n\n"
" c) You must license the entire work, as a whole, under this\n"
" License to anyone who comes into possession of a copy. This\n"
" License will therefore apply, along with any applicable section 7\n"
" additional terms, to the whole of the work, and all its parts,\n"
" regardless of how they are packaged. This License gives no\n"
" permission to license the work in any other way, but it does not\n"
" invalidate such permission if you have separately received it.\n\n"
" d) If the work has interactive user interfaces, each must display\n"
" Appropriate Legal Notices; however, if the Program has interactive\n"
" interfaces that do not display Appropriate Legal Notices, your\n"
" work need not make them do so.\n\n"
" A compilation of a covered work with other separate and independent\n"
"works, which are not by their nature extensions of the covered work,\n"
"and which are not combined with it such as to form a larger program,\n"
"in or on a volume of a storage or distribution medium, is called an\n"
"\"aggregate\" if the compilation and its resulting copyright are not\n"
"used to limit the access or legal rights of the compilation's users\n"
"beyond what the individual works permit. Inclusion of a covered work\n"
"in an aggregate does not cause this License to apply to the other\n"
"parts of the aggregate.\n\n"
" 6. Conveying Non-Source Forms.\n\n"
" You may convey a covered work in object code form under the terms\n"
"of sections 4 and 5, provided that you also convey the\n"
"machine-readable Corresponding Source under the terms of this License,\n"
"in one of these ways:\n\n"
" a) Convey the object code in, or embodied in, a physical product\n"
" (including a physical distribution medium), accompanied by the\n"
" Corresponding Source fixed on a durable physical medium\n"
" customarily used for software interchange.\n\n"
" b) Convey the object code in, or embodied in, a physical product\n"
" (including a physical distribution medium), accompanied by a\n"
" written offer, valid for at least three years and valid for as\n"
" long as you offer spare parts or customer support for that product\n"
" model, to give anyone who possesses the object code either (1) a\n"
" copy of the Corresponding Source for all the software in the\n"
" product that is covered by this License, on a durable physical\n"
" medium customarily used for software interchange, for a price no\n"
" more than your reasonable cost of physically performing this\n"
" conveying of source, or (2) access to copy the\n"
" Corresponding Source from a network server at no charge.\n\n"
" c) Convey individual copies of the object code with a copy of the\n"
" written offer to provide the Corresponding Source. This\n"
" alternative is allowed only occasionally and noncommercially, and\n"
" only if you received the object code with such an offer, in accord\n"
" with subsection 6b.\n\n"
" d) Convey the object code by offering access from a designated\n"
" place (gratis or for a charge), and offer equivalent access to the\n"
" Corresponding Source in the same way through the same place at no\n"
" further charge. You need not require recipients to copy the\n"
" Corresponding Source along with the object code. If the place to\n"
" copy the object code is a network server, the Corresponding Source\n"
" may be on a different server (operated by you or a third party)\n"
" that supports equivalent copying facilities, provided you maintain\n"
" clear directions next to the object code saying where to find the\n"
" Corresponding Source. Regardless of what server hosts the\n"
" Corresponding Source, you remain obligated to ensure that it is\n"
" available for as long as needed to satisfy these requirements.\n\n"
" e) Convey the object code using peer-to-peer transmission, provided\n"
" you inform other peers where the object code and Corresponding\n"
" Source of the work are being offered to the general public at no\n"
" charge under subsection 6d.\n\n"
" A separable portion of the object code, whose source code is excluded\n"
"from the Corresponding Source as a System Library, need not be\n"
"included in conveying the object code work.\n\n"
" A \"User Product\" is either (1) a \"consumer product\", which means any\n"
"tangible personal property which is normally used for personal, family,\n"
"or household purposes, or (2) anything designed or sold for incorporation\n"
"into a dwelling. In determining whether a product is a consumer product,\n"
"doubtful cases shall be resolved in favor of coverage. For a particular\n"
"product received by a particular user, \"normally used\" refers to a\n"
"typical or common use of that class of product, regardless of the status\n"
"of the particular user or of the way in which the particular user\n"
"actually uses, or expects or is expected to use, the product. A product\n"
"is a consumer product regardless of whether the product has substantial\n"
"commercial, industrial or non-consumer uses, unless such uses represent\n"
"the only significant mode of use of the product.\n\n"
" \"Installation Information\" for a User Product means any methods,\n"
"procedures, authorization keys, or other information required to install\n"
"and execute modified versions of a covered work in that User Product from\n"
"a modified version of its Corresponding Source. The information must\n"
"suffice to ensure that the continued functioning of the modified object\n"
"code is in no case prevented or interfered with solely because\n"
"modification has been made.\n\n"
" If you convey an object code work under this section in, or with, or\n"
"specifically for use in, a User Product, and the conveying occurs as\n"
"part of a transaction in which the right of possession and use of the\n"
"User Product is transferred to the recipient in perpetuity or for a\n"
"fixed term (regardless of how the transaction is characterized), the\n"
"Corresponding Source conveyed under this section must be accompanied\n"
"by the Installation Information. But this requirement does not apply\n"
"if neither you nor any third party retains the ability to install\n"
"modified object code on the User Product (for example, the work has\n"
"been installed in ROM).\n\n"
" The requirement to provide Installation Information does not include a\n"
"requirement to continue to provide support service, warranty, or updates\n"
"for a work that has been modified or installed by the recipient, or for\n"
"the User Product in which it has been modified or installed. Access to a\n"
"network may be denied when the modification itself materially and\n"
"adversely affects the operation of the network or violates the rules and\n"
"protocols for communication across the network.\n\n"
" Corresponding Source conveyed, and Installation Information provided,\n"
"in accord with this section must be in a format that is publicly\n"
"documented (and with an implementation available to the public in\n"
"source code form), and must require no special password or key for\n"
"unpacking, reading or copying.\n\n"
" 7. Additional Terms.\n\n"
" \"Additional permissions\" are terms that supplement the terms of this\n"
"License by making exceptions from one or more of its conditions.\n"
"Additional permissions that are applicable to the entire Program shall\n"
"be treated as though they were included in this License, to the extent\n"
"that they are valid under applicable law. If additional permissions\n"
"apply only to part of the Program, that part may be used separately\n"
"under those permissions, but the entire Program remains governed by\n"
"this License without regard to the additional permissions.\n\n"
" When you convey a copy of a covered work, you may at your option\n"
"remove any additional permissions from that copy, or from any part of\n"
"it. (Additional permissions may be written to require their own\n"
"removal in certain cases when you modify the work.) You may place\n"
"additional permissions on material, added by you to a covered work,\n"
"for which you have or can give appropriate copyright permission.\n\n"
" Notwithstanding any other provision of this License, for material you\n"
"add to a covered work, you may (if authorized by the copyright holders of\n"
"that material) supplement the terms of this License with terms:\n\n"
" a) Disclaiming warranty or limiting liability differently from the\n"
" terms of sections 15 and 16 of this License; or\n\n"
" b) Requiring preservation of specified reasonable legal notices or\n"
" author attributions in that material or in the Appropriate Legal\n"
" Notices displayed by works containing it; or\n\n"
" c) Prohibiting misrepresentation of the origin of that material, or\n"
" requiring that modified versions of such material be marked in\n"
" reasonable ways as different from the original version; or\n\n"
" d) Limiting the use for publicity purposes of names of licensors or\n"
" authors of the material; or\n\n"
" e) Declining to grant rights under trademark law for use of some\n"
" trade names, trademarks, or service marks; or\n\n"
" f) Requiring indemnification of licensors and authors of that\n"
" material by anyone who conveys the material (or modified versions of\n"
" it) with contractual assumptions of liability to the recipient, for\n"
" any liability that these contractual assumptions directly impose on\n"
" those licensors and authors.\n\n"
" All other non-permissive additional terms are considered \"further\n"
"restrictions\" within the meaning of section 10. If the Program as you\n"
"received it, or any part of it, contains a notice stating that it is\n"
"governed by this License along with a term that is a further\n"
"restriction, you may remove that term. If a license document contains\n"
"a further restriction but permits relicensing or conveying under this\n"
"License, you may add to a covered work material governed by the terms\n"
"of that license document, provided that the further restriction does\n"
"not survive such relicensing or conveying.\n\n"
" If you add terms to a covered work in accord with this section, you\n"
"must place, in the relevant source files, a statement of the\n"
"additional terms that apply to those files, or a notice indicating\n"
"where to find the applicable terms.\n\n"
" Additional terms, permissive or non-permissive, may be stated in the\n"
"form of a separately written license, or stated as exceptions;\n"
"the above requirements apply either way.\n\n"
" 8. Termination.\n\n"
" You may not propagate or modify a covered work except as expressly\n"
"provided under this License. Any attempt otherwise to propagate or\n"
"modify it is void, and will automatically terminate your rights under\n"
"this License (including any patent licenses granted under the third\n"
"paragraph of section 11).\n\n"
" However, if you cease all violation of this License, then your\n"
"license from a particular copyright holder is reinstated (a)\n"
"provisionally, unless and until the copyright holder explicitly and\n"
"finally terminates your license, and (b) permanently, if the copyright\n"
"holder fails to notify you of the violation by some reasonable means\n"
"prior to 60 days after the cessation.\n\n"
" Moreover, your license from a particular copyright holder is\n"
"reinstated permanently if the copyright holder notifies you of the\n"
"violation by some reasonable means, this is the first time you have\n"
"received notice of violation of this License (for any work) from that\n"
"copyright holder, and you cure the violation prior to 30 days after\n"
"your receipt of the notice.\n\n"
" Termination of your rights under this section does not terminate the\n"
"licenses of parties who have received copies or rights from you under\n"
"this License. If your rights have been terminated and not permanently\n"
"reinstated, you do not qualify to receive new licenses for the same\n"
"material under section 10.\n\n"
" 9. Acceptance Not Required for Having Copies.\n\n"
" You are not required to accept this License in order to receive or\n"
"run a copy of the Program. Ancillary propagation of a covered work\n"
"occurring solely as a consequence of using peer-to-peer transmission\n"
"to receive a copy likewise does not require acceptance. However,\n"
"nothing other than this License grants you permission to propagate or\n"
"modify any covered work. These actions infringe copyright if you do\n"
"not accept this License. Therefore, by modifying or propagating a\n"
"covered work, you indicate your acceptance of this License to do so.\n\n"
" 10. Automatic Licensing of Downstream Recipients.\n\n"
" Each time you convey a covered work, the recipient automatically\n"
"receives a license from the original licensors, to run, modify and\n"
"propagate that work, subject to this License. You are not responsible\n"
"for enforcing compliance by third parties with this License.\n\n"
" An \"entity transaction\" is a transaction transferring control of an\n"
"organization, or substantially all assets of one, or subdividing an\n"
"organization, or merging organizations. If propagation of a covered\n"
"work results from an entity transaction, each party to that\n"
"transaction who receives a copy of the work also receives whatever\n"
"licenses to the work the party's predecessor in interest had or could\n"
"give under the previous paragraph, plus a right to possession of the\n"
"Corresponding Source of the work from the predecessor in interest, if\n"
"the predecessor has it or can get it with reasonable efforts.\n\n"
" You may not impose any further restrictions on the exercise of the\n"
"rights granted or affirmed under this License. For example, you may\n"
"not impose a license fee, royalty, or other charge for exercise of\n"
"rights granted under this License, and you may not initiate litigation\n"
"(including a cross-claim or counterclaim in a lawsuit) alleging that\n"
"any patent claim is infringed by making, using, selling, offering for\n"
"sale, or importing the Program or any portion of it.\n\n"
" 11. Patents.\n\n"
" A \"contributor\" is a copyright holder who authorizes use under this\n"
"License of the Program or a work on which the Program is based. The\n"
"work thus licensed is called the contributor's \"contributor version\".\n\n"
" A contributor's \"essential patent claims\" are all patent claims\n"
"owned or controlled by the contributor, whether already acquired or\n"
"hereafter acquired, that would be infringed by some manner, permitted\n"
"by this License, of making, using, or selling its contributor version,\n"
"but do not include claims that would be infringed only as a\n"
"consequence of further modification of the contributor version. For\n"
"purposes of this definition, \"control\" includes the right to grant\n"
"patent sublicenses in a manner consistent with the requirements of\n"
"this License.\n\n"
" Each contributor grants you a non-exclusive, worldwide, royalty-free\n"
"patent license under the contributor's essential patent claims, to\n"
"make, use, sell, offer for sale, import and otherwise run, modify and\n"
"propagate the contents of its contributor version.\n\n"
" In the following three paragraphs, a \"patent license\" is any express\n"
"agreement or commitment, however denominated, not to enforce a patent\n"
"(such as an express permission to practice a patent or covenant not to\n"
"sue for patent infringement). To \"grant\" such a patent license to a\n"
"party means to make such an agreement or commitment not to enforce a\n"
"patent against the party.\n\n"
" If you convey a covered work, knowingly relying on a patent license,\n"
"and the Corresponding Source of the work is not available for anyone\n"
"to copy, free of charge and under the terms of this License, through a\n"
"publicly available network server or other readily accessible means,\n"
"then you must either (1) cause the Corresponding Source to be so\n"
"available, or (2) arrange to deprive yourself of the benefit of the\n"
"patent license for this particular work, or (3) arrange, in a manner\n"
"consistent with the requirements of this License, to extend the patent\n"
"license to downstream recipients. \"Knowingly relying\" means you have\n"
"actual knowledge that, but for the patent license, your conveying the\n"
"covered work in a country, or your recipient's use of the covered work\n"
"in a country, would infringe one or more identifiable patents in that\n"
"country that you have reason to believe are valid.\n\n"
" If, pursuant to or in connection with a single transaction or\n"
"arrangement, you convey, or propagate by procuring conveyance of, a\n"
"covered work, and grant a patent license to some of the parties\n"
"receiving the covered work authorizing them to use, propagate, modify\n"
"or convey a specific copy of the covered work, then the patent license\n"
"you grant is automatically extended to all recipients of the covered\n"
"work and works based on it.\n\n"
" A patent license is \"discriminatory\" if it does not include within\n"
"the scope of its coverage, prohibits the exercise of, or is\n"
"conditioned on the non-exercise of one or more of the rights that are\n"
"specifically granted under this License. You may not convey a covered\n"
"work if you are a party to an arrangement with a third party that is\n"
"in the business of distributing software, under which you make payment\n"
"to the third party based on the extent of your activity of conveying\n"
"the work, and under which the third party grants, to any of the\n"
"parties who would receive the covered work from you, a discriminatory\n"
"patent license (a) in connection with copies of the covered work\n"
"conveyed by you (or copies made from those copies), or (b) primarily\n"
"for and in connection with specific products or compilations that\n"
"contain the covered work, unless you entered into that arrangement,\n"
"or that patent license was granted, prior to 28 March 2007.\n\n"
" Nothing in this License shall be construed as excluding or limiting\n"
"any implied license or other defenses to infringement that may\n"
"otherwise be available to you under applicable patent law.\n\n"
" 12. No Surrender of Others' Freedom.\n\n"
" If conditions are imposed on you (whether by court order, agreement or\n"
"otherwise) that contradict the conditions of this License, they do not\n"
"excuse you from the conditions of this License. If you cannot convey a\n"
"covered work so as to satisfy simultaneously your obligations under this\n"
"License and any other pertinent obligations, then as a consequence you may\n"
"not convey it at all. For example, if you agree to terms that obligate you\n"
"to collect a royalty for further conveying from those to whom you convey\n"
"the Program, the only way you could satisfy both those terms and this\n"
"License would be to refrain entirely from conveying the Program.\n\n"
" 13. Use with the GNU Affero General Public License.\n\n"
" Notwithstanding any other provision of this License, you have\n"
"permission to link or combine any covered work with a work licensed\n"
"under version 3 of the GNU Affero General Public License into a single\n"
"combined work, and to convey the resulting work. The terms of this\n"
"License will continue to apply to the part which is the covered work,\n"
"but the special requirements of the GNU Affero General Public License,\n"
"section 13, concerning interaction through a network will apply to the\n"
"combination as such.\n\n"
" 14. Revised Versions of this License.\n\n"
" The Free Software Foundation may publish revised and/or new versions of\n"
"the GNU General Public License from time to time. Such new versions will\n"
"be similar in spirit to the present version, but may differ in detail to\n"
"address new problems or concerns.\n\n"
" Each version is given a distinguishing version number. If the\n"
"Program specifies that a certain numbered version of the GNU General\n"
"Public License \"or any later version\" applies to it, you have the\n"
"option of following the terms and conditions either of that numbered\n"
"version or of any later version published by the Free Software\n"
"Foundation. If the Program does not specify a version number of the\n"
"GNU General Public License, you may choose any version ever published\n"
"by the Free Software Foundation.\n\n"
" If the Program specifies that a proxy can decide which future\n"
"versions of the GNU General Public License can be used, that proxy's\n"
"public statement of acceptance of a version permanently authorizes you\n"
"to choose that version for the Program.\n\n"
" Later license versions may give you additional or different\n"
"permissions. However, no additional obligations are imposed on any\n"
"author or copyright holder as a result of your choosing to follow a\n"
"later version.\n\n"
" 15. Disclaimer of Warranty.\n\n"
" THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\n"
"APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\n"
"HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\n"
"OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\n"
"THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n"
"PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\n"
"IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\n"
"ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n"
" 16. Limitation of Liability.\n\n"
" IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\n"
"WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\n"
"THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\n"
"GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\n"
"USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\n"
"DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\n"
"PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\n"
"EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\n"
"SUCH DAMAGES.\n\n"
" 17. Interpretation of Sections 15 and 16.\n\n"
" If the disclaimer of warranty and limitation of liability provided\n"
"above cannot be given local legal effect according to their terms,\n"
"reviewing courts shall apply local law that most closely approximates\n"
"an absolute waiver of all civil liability in connection with the\n"
"Program, unless a warranty or assumption of liability accompanies a\n"
"copy of the Program in return for a fee.\n\n"
" END OF TERMS AND CONDITIONS\n\n"
" How to Apply These Terms to Your New Programs\n\n"
" If you develop a new program, and you want it to be of the greatest\n"
"possible use to the public, the best way to achieve this is to make it\n"
"free software which everyone can redistribute and change under these terms.\n\n"
" To do so, attach the following notices to the program. It is safest\n"
"to attach them to the start of each source file to most effectively\n"
"state the exclusion of warranty; and each file should have at least\n"
"the \"copyright\" line and a pointer to where the full notice is found.\n\n"
" <one line to give the program's name and a brief idea of what it does.>\n"
" Copyright (C) <year> <name of author>\n\n"
" This program is free software: you can redistribute it and/or modify\n"
" it under the terms of the GNU General Public License as published by\n"
" the Free Software Foundation, either version 3 of the License, or\n"
" (at your option) any later version.\n\n"
" This program is distributed in the hope that it will be useful,\n"
" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
" GNU General Public License for more details.\n\n"
" You should have received a copy of the GNU General Public License\n"
" along with this program. If not, see <https://www.gnu.org/licenses/>.\n\n"
"Also add information on how to contact you by electronic and paper mail.\n\n"
" If the program does terminal interaction, make it output a short\n"
"notice like this when it starts in an interactive mode:\n\n"
" <program> Copyright (C) <year> <name of author>\n"
" This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n"
" This is free software, and you are welcome to redistribute it\n"
" under certain conditions; type `show c' for details.\n\n"
"The hypothetical commands `show w' and `show c' should show the appropriate\n"
"parts of the General Public License. Of course, your program's commands\n"
"might be different; for a GUI interface, you would use an \"about box\".\n\n"
" You should also get your employer (if you work as a programmer) or school,\n"
"if any, to sign a \"copyright disclaimer\" for the program, if necessary.\n"
"For more information on this, and how to apply and follow the GNU GPL, see\n"
"<https://www.gnu.org/licenses/>.\n\n"
" The GNU General Public License does not permit incorporating your program\n"
"into proprietary programs. If your program is a subroutine library, you\n"
"may consider it more useful to permit linking proprietary applications with\n"
"the library. If this is what you want to do, use the GNU Lesser General\n"
"Public License instead of this License. But first, please read\n"
"<https://www.gnu.org/licenses/why-not-lgpl.html>.\n";
fat32_write(fh, (void *)content, lic_strlen(content));
fat32_close(fh);
}
}

View File

@@ -1,9 +0,0 @@
// 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.
#ifndef LICENSEWR_H
#define LICENSEWR_H
void write_license_file(void);
#endif

View File

@@ -1,450 +0,0 @@
// 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.
#include "libc/syscall.h"
#include "libc/libui.h"
#include "libc/stdlib.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#define MD_MAX_CONTENT 16384
#define MD_MAX_LINES 256
#define MD_CHAR_WIDTH 8
#define MD_LINE_HEIGHT 16
#define COLOR_DARK_PANEL 0xFF202020
#define COLOR_DARK_BG 0xFF121212
#define COLOR_DARK_TEXT 0xFFE0E0E0
#define COLOR_DARK_TITLEBAR 0xFF303030
#define COLOR_BLACK 0xFF000000
typedef enum {
MD_LINE_NORMAL,
MD_LINE_HEADING1,
MD_LINE_HEADING2,
MD_LINE_HEADING3,
MD_LINE_BOLD,
MD_LINE_ITALIC,
MD_LINE_LIST,
MD_LINE_BLOCKQUOTE,
MD_LINE_CODE
} MDLineType;
typedef struct {
char content[256];
int length;
MDLineType type;
int indent_level;
} MDLine;
static MDLine lines[MD_MAX_LINES];
static int line_count = 0;
static int scroll_top = 0;
static char open_filename[256] = "";
static int win_w = 600;
static int win_h = 400;
static size_t md_strlen(const char *str) {
size_t len = 0;
while (str[len]) len++;
return len;
}
static void md_strcpy(char *dest, const char *src) {
while (*src) *dest++ = *src++;
*dest = 0;
}
static int md_strncpy(char *dest, const char *src, int n) {
int i = 0;
while (i < n && src[i]) {
dest[i] = src[i];
i++;
}
dest[i] = 0;
return i;
}
static void md_parse_line(const char *raw_line, char *output, MDLineType *type, int *indent) {
int i = 0;
int out_idx = 0;
*indent = 0;
*type = MD_LINE_NORMAL;
while (raw_line[i] == ' ' || raw_line[i] == '\t') {
if (raw_line[i] == '\t') *indent += 2;
else *indent += 1;
i++;
}
if (raw_line[i] == '#') {
int hash_count = 0;
while (raw_line[i] == '#') {
hash_count++;
i++;
}
if (raw_line[i] == ' ') i++;
if (hash_count == 1) *type = MD_LINE_HEADING1;
else if (hash_count == 2) *type = MD_LINE_HEADING2;
else if (hash_count <= 6) *type = MD_LINE_HEADING3;
} else if (raw_line[i] == '-' || raw_line[i] == '*') {
if ((raw_line[i] == '-' || raw_line[i] == '*') && (raw_line[i+1] == ' ' || raw_line[i+1] == '\t')) {
*type = MD_LINE_LIST;
i += 2;
while (raw_line[i] == ' ' || raw_line[i] == '\t') i++;
}
} else if (raw_line[i] == '>') {
*type = MD_LINE_BLOCKQUOTE;
i++;
if (raw_line[i] == ' ') i++;
}
while (raw_line[i] && out_idx < 255) {
if (raw_line[i] == '*' && raw_line[i+1] == '*') {
i += 2;
while (raw_line[i] && !(raw_line[i] == '*' && raw_line[i+1] == '*') && out_idx < 255) {
output[out_idx++] = raw_line[i++];
}
if (raw_line[i] == '*' && raw_line[i+1] == '*') i += 2;
continue;
}
if ((raw_line[i] == '*' || raw_line[i] == '_') && out_idx > 0 && raw_line[i-1] != '\\') {
char delim = raw_line[i];
i++;
while (raw_line[i] && raw_line[i] != delim && out_idx < 255) {
output[out_idx++] = raw_line[i++];
}
if (raw_line[i] == delim) i++;
continue;
}
if (raw_line[i] == '`') {
i++;
while (raw_line[i] && raw_line[i] != '`' && out_idx < 255) {
output[out_idx++] = raw_line[i++];
}
if (raw_line[i] == '`') i++;
continue;
}
if (raw_line[i] == '[') {
i++;
while (raw_line[i] && raw_line[i] != ']' && out_idx < 255) {
output[out_idx++] = raw_line[i++];
}
if (raw_line[i] == ']') i++;
if (raw_line[i] == '(') {
while (raw_line[i] && raw_line[i] != ')') i++;
if (raw_line[i] == ')') i++;
}
continue;
}
output[out_idx++] = raw_line[i++];
}
output[out_idx] = 0;
}
static void md_clear_all(void) {
for (int i = 0; i < MD_MAX_LINES; i++) {
lines[i].content[0] = 0;
lines[i].length = 0;
lines[i].type = MD_LINE_NORMAL;
lines[i].indent_level = 0;
}
line_count = 0;
scroll_top = 0;
open_filename[0] = 0;
}
void markdown_open_file(const char *filename) {
md_clear_all();
md_strcpy(open_filename, filename);
int fd = sys_open(filename, "r");
if (fd < 0) return;
static char buffer[MD_MAX_CONTENT];
int bytes_read = sys_read(fd, buffer, sizeof(buffer) - 1);
sys_close(fd);
if (bytes_read <= 0) return;
buffer[bytes_read] = 0;
int line = 0;
int col = 0;
char raw_line[256] = "";
bool in_code_block = false;
for (int i = 0; i < bytes_read && line < MD_MAX_LINES; i++) {
char ch = buffer[i];
if (ch == '\n') {
raw_line[col] = 0;
if (raw_line[0] == '`' && raw_line[1] == '`' && raw_line[2] == '`') {
in_code_block = !in_code_block;
} else {
if (in_code_block) {
md_strcpy(lines[line].content, raw_line);
lines[line].length = md_strlen(raw_line);
lines[line].type = MD_LINE_CODE;
lines[line].indent_level = 0;
line++;
} else {
char parsed_content[256];
MDLineType type;
int indent;
md_parse_line(raw_line, parsed_content, &type, &indent);
md_strcpy(lines[line].content, parsed_content);
lines[line].length = md_strlen(parsed_content);
lines[line].type = type;
lines[line].indent_level = indent;
line++;
}
}
col = 0;
raw_line[0] = 0;
} else if (col < 255) {
raw_line[col++] = ch;
}
}
if (col > 0 && line < MD_MAX_LINES) {
raw_line[col] = 0;
if (raw_line[0] == '`' && raw_line[1] == '`' && raw_line[2] == '`') {
} else if (in_code_block) {
md_strcpy(lines[line].content, raw_line);
lines[line].length = md_strlen(raw_line);
lines[line].type = MD_LINE_CODE;
lines[line].indent_level = 0;
line++;
} else {
char parsed_content[256];
MDLineType type;
int indent;
md_parse_line(raw_line, parsed_content, &type, &indent);
md_strcpy(lines[line].content, parsed_content);
lines[line].length = md_strlen(parsed_content);
lines[line].type = type;
lines[line].indent_level = indent;
line++;
}
}
line_count = line;
}
static void md_draw_text_bold(ui_window_t win, int x, int y, const char *text, uint32_t color) {
ui_draw_string(win, x, y, text, color);
ui_draw_string(win, x + 1, y, text, color);
}
static void md_paint(ui_window_t win) {
int offset_x = 4;
int offset_y = 0;
int content_width = win_w - 8;
int content_height = win_h - 28;
ui_draw_rounded_rect_filled(win, offset_x, offset_y, content_width, 20, 6, COLOR_DARK_PANEL);
ui_draw_string(win, offset_x + 4, offset_y + 4, "File", COLOR_DARK_TEXT);
ui_draw_string(win, offset_x + 50, offset_y + 4, open_filename, COLOR_DARK_TEXT);
int btn_x_up = offset_x + content_width - 50;
int btn_y = offset_y + 2;
ui_draw_rounded_rect_filled(win, btn_x_up, btn_y, 20, 16, 4, COLOR_DARK_TITLEBAR);
ui_draw_string(win, btn_x_up + 6, btn_y, "^", COLOR_DARK_TEXT);
ui_draw_rounded_rect_filled(win, btn_x_up + 24, btn_y, 20, 16, 4, COLOR_DARK_TITLEBAR);
ui_draw_string(win, btn_x_up + 30, btn_y, "v", COLOR_DARK_TEXT);
int content_start_y = offset_y + 24;
int content_start_x = offset_x + 4;
int usable_content_width = content_width - 8 - 20;
int usable_content_height = content_height - 28;
int max_display_lines = usable_content_height / MD_LINE_HEIGHT;
ui_draw_rounded_rect_filled(win, 4, content_start_y, win_w - 24, usable_content_height, 6, COLOR_DARK_BG);
int display_line = 0;
int i = scroll_top;
while (i < line_count && display_line < max_display_lines) {
MDLine *line = &lines[i];
int line_height = MD_LINE_HEIGHT;
int extra_spacing = 0;
uint32_t text_color = COLOR_DARK_TEXT;
bool use_bold = false;
switch (line->type) {
case MD_LINE_HEADING1:
line_height = MD_LINE_HEIGHT * 2;
text_color = 0xFF87CEEB;
use_bold = true;
extra_spacing = 4;
break;
case MD_LINE_HEADING2:
line_height = MD_LINE_HEIGHT + 6;
text_color = 0xFF4A90E2;
use_bold = true;
extra_spacing = 2;
break;
case MD_LINE_HEADING3:
line_height = MD_LINE_HEIGHT + 2;
text_color = 0xFF87CEEB;
use_bold = false;
break;
case MD_LINE_BLOCKQUOTE:
text_color = 0xFFA0A0A0;
break;
case MD_LINE_CODE:
text_color = 0xFF90EE90;
break;
default:
text_color = COLOR_DARK_TEXT;
break;
}
if (display_line + (line_height / MD_LINE_HEIGHT) > max_display_lines) break;
int x_offset = content_start_x + (line->indent_level * 4);
int available_width = usable_content_width - (line->indent_level * 4);
int max_chars_per_line = available_width / MD_CHAR_WIDTH;
if (max_chars_per_line < 1) max_chars_per_line = 1;
const char *text = line->content;
int text_len = line->length;
int char_idx = 0;
int local_display_line = 0;
int wrapped_line_count = 0;
while (char_idx < text_len || (text_len == 0 && local_display_line == 0)) {
int line_y = content_start_y + display_line * MD_LINE_HEIGHT + (local_display_line * MD_LINE_HEIGHT);
char line_segment[256];
int segment_len = 0;
int segment_start = char_idx;
while (char_idx < text_len && segment_len < max_chars_per_line) {
line_segment[segment_len++] = text[char_idx++];
}
line_segment[segment_len] = 0;
if (char_idx < text_len && segment_len > 0) {
int last_space = -1;
for (int j = segment_len - 1; j >= 0; j--) {
if (line_segment[j] == ' ') {
last_space = j; break;
}
}
if (last_space > 0) {
segment_len = last_space;
line_segment[segment_len] = 0;
char_idx = segment_start + last_space + 1;
while (char_idx < text_len && text[char_idx] == ' ') char_idx++;
}
}
if (line->type == MD_LINE_CODE && segment_len > 0) {
ui_draw_rect(win, x_offset - 2, line_y - 2, (segment_len * MD_CHAR_WIDTH) + 4, 12, COLOR_BLACK);
}
if (local_display_line == 0) {
switch (line->type) {
case MD_LINE_LIST:
ui_draw_rect(win, x_offset, line_y + MD_LINE_HEIGHT/2 - 1, 2, 2, COLOR_BLACK);
x_offset += 12;
if (segment_len > 0 && line_segment[0] == ' ') {
for (int j = 0; j < segment_len - 1; j++) line_segment[j] = line_segment[j + 1];
segment_len--;
}
break;
case MD_LINE_BLOCKQUOTE:
ui_draw_rect(win, x_offset - 4, line_y, 2, line_height, 0xFF404080);
break;
default: break;
}
}
if (segment_len > 0) {
if (use_bold) {
md_draw_text_bold(win, x_offset, line_y + extra_spacing, line_segment, text_color);
} else {
ui_draw_string(win, x_offset, line_y, line_segment, text_color);
}
}
local_display_line++;
wrapped_line_count++;
if (char_idx >= text_len) break;
}
display_line += (wrapped_line_count > 0 ? wrapped_line_count : 1);
i++;
}
}
static void md_handle_key(char c, bool pressed) {
if (!pressed) return;
if (c == 'w' || c == 'W' || c == 17) {
scroll_top -= 3;
if (scroll_top < 0) scroll_top = 0;
} else if (c == 's' || c == 'S' || c == 18) {
scroll_top += 3;
int max_scroll = line_count - 10;
if (scroll_top > max_scroll) scroll_top = max_scroll;
if (scroll_top < 0) scroll_top = 0;
}
}
static void md_handle_click(int x, int y) {
int content_width = win_w - 8;
int btn_x_up = 4 + content_width - 50;
int btn_y = 2;
if (x >= btn_x_up && x < btn_x_up + 20 && y >= btn_y && y < btn_y + 16) {
scroll_top -= 3;
if (scroll_top < 0) scroll_top = 0;
return;
}
int btn_x_down_top = 4 + content_width - 50 + 24;
if (x >= btn_x_down_top && x < btn_x_down_top + 20 && y >= btn_y && y < btn_y + 16) {
scroll_top += 3;
int max_scroll = line_count - 10;
if (scroll_top > max_scroll) scroll_top = max_scroll;
if (scroll_top < 0) scroll_top = 0;
return;
}
}
int main(int argc, char **argv) {
ui_window_t win = ui_window_create("Markdown Viewer", 150, 180, win_w, win_h);
if (!win) return 1;
md_clear_all();
if (argc > 1) {
markdown_open_file(argv[1]);
}
gui_event_t ev;
while (1) {
if (ui_get_event(win, &ev)) {
if (ev.type == GUI_EVENT_PAINT) {
md_paint(win);
ui_mark_dirty(win, 0, 0, win_w, win_h - 20);
} else if (ev.type == GUI_EVENT_CLICK) {
md_handle_click(ev.arg1, ev.arg2);
md_paint(win);
ui_mark_dirty(win, 0, 0, win_w, win_h - 20);
} else if (ev.type == GUI_EVENT_KEY) {
md_handle_key((char)ev.arg1, true);
md_paint(win);
ui_mark_dirty(win, 0, 0, win_w, win_h - 20);
} else if (ev.type == GUI_EVENT_KEYUP) {
md_handle_key((char)ev.arg1, false);
} else if (ev.type == GUI_EVENT_CLOSE) {
sys_exit(0);
}
} else {
sleep(10);
}
}
return 0;
}

View File

@@ -1,33 +0,0 @@
// 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.
#include <stdlib.h>
#include <syscall.h>
static void beep(int freq, int ms) {
sys_system(14, freq, ms, 0, 0);
}
int main(int argc, char **argv) {
(void)argc; (void)argv;
printf("Playing Sweden - C418 (Minecraft)...\n");
// Main melody (simplified pattern)
beep(392, 400); // G4
beep(440, 400); // A4
beep(493, 800); // B4
beep(440, 400); // A4
beep(392, 800); // G4
beep(329, 800); // E4
beep(392, 400); // G4
beep(440, 400); // A4
beep(493, 800); // B4
beep(440, 400); // A4
beep(392, 1200); // G4
printf("Done.\n");
return 0;
}

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