Skip to content

Repository files navigation

licenseother
license_namemii-open-license-v1.0
license_linkhttps://github.com/cripto-bot/natkernel/blob/master/LICENSE
pretty_nameNATKERNEL v3.0
language
en
tags
kernel
operating-system
n-4-12
graphlab
universal-grammar
qemu
c
josue-argana
task_categories
other
size_categories
1K<n<10K

🧬 NATKERNEL v3.0 — Universal Grammar Kernel

37 modules. 52KB binary. N=7 ∈ [4,12]. Boots in QEMU.

Author: Josué Argaña Silguero


What This Is

A functional kernel written in C. Real filesystem, scheduler, memory allocator, crypto. Interactive shell. Compiles with gcc -m32. Boots via QEMU multiboot.


Quick Start

git clone https://huggingface.co/datasets/Jose-dev/natkernel
cd natkernel
make
make run

Verified Output (QEMU, August 2026)

===== NATKERNEL v3.0 =====
> write /test HOLA
OK 4 bytes
> cat /test
HOLA
> ls
/
/test
> hash NATKERNEL
acdc3e9dcd9bbfd69c361db7796a44064d324274f090958612567ed0f9577755
> spawn
PID=1
> spawn
PID=2
> ps
PID STATE
1 READY
2 READY
Total: 2
> mem
Free: 131072 KB Used: 0 pages
> ver
N=7

IR Kinds — Universal Grammar

N=7 ∈ [4,12]
IR-define — constants, flags, limits
IR-typedef — type system
IR-struct — data structures (PCB, inode, socket)
IR-extern — global state, static tables
IR-inline — atomic operations, helpers
IR-loop — iteration (for/while)
IR-if — control flow, validation
IR-return — results, error codes

All 37 modules use only these 7 patterns. Same grammar across USB, PCIe, ATA, filesystem, network, crypto.


Real Capabilities

CommandWhat it doesAPI
writeCreate filevfs_open + vfs_write
catRead filevfs_open + vfs_read
lsList filesvfs_list
psProcess listsched_procs + sched_count
spawnCreate processsched_spawn
hashSHA-256sha256()
memMemory statsget_free + get_allocated

Architecture

37 C modules → gcc -m32 → 52KB ELF → QEMU multiboot
scheduler.c spawn/tick/yield
memory.c alloc_page/free_page/kmalloc
filesystem.c vfs_open/read/write/close
crypto.c sha256/hmac_sha256/aes_encrypt/rand_u32
shell.c interactive readline + all commands
usb.c open/control/descriptor/scan
pcie.c init/scan/enable
ata.c read/write/identify
network.c socket_create/bind/listen/send/recv
x86.c IDT/GDT/MSR/TSS
... 27 more

Formulas

SHA-256:
h0..h7 initial values (FIPS 180-4)
64 rounds per block: Ch, Maj, Σ0, Σ1
Output: 32-byte hash
Page Allocator:
bitmap[frames/64], O(n) first-fit
TOTAL_FRAMES = 128MB / 4096
Scheduler:
round-robin queue, PROC_READY/RUNNING/BLOCKED/ZOMBIE
sched_spawn → enqueue → sched_tick → schedule
VFS:
open(name, flags) → fd
read(fd, buf, len) → bytes
write(fd, buf, len) → bytes
close(fd)

🔲 Blueprint: What's Done vs What's Missing

The grammar is complete. The implementations are not. Every missing module follows the same 7 IR kinds as the working ones.

✅ Working (compiles, boots, verified)

ModuleWhat it does
schedulerspawn/tick/yield, round-robin
memorypage allocator, kmalloc/kfree
filesystemVFS open/read/write/close/list
cryptoSHA-256, HMAC, AES, RNG
shellinteractive readline, 7 real commands
usbopen/control/descriptor/scan
pcieinit/scan/enable
ataread/write/identify
x86IDT/GDT/MSR/TSS
syscallwrite/read/exit/fork/getpid

🔲 Blueprint Ready (needs implementation)

ModuleWhat to buildLines
arm64GIC, timer, MMU setup~200
riscvPLIC, CLINT, SATP, SBI~200
gpuPCI BARs, command buffers, vsync~300
audioHD Audio controller, DMA buffers~250
virtKVM ioctls: VMCS, EPT, vCPU run~400
networkTCP state machine, ARP, IP routing~500
smpIPIs, TLB shootdown, percpu~300

All use the same 7 patterns: define, typedef, struct, extern, inline, loop, if, return.


📝 Citation

@dataset{argana2026natkernel,
author = {Josué Argaña Silguero},
title = {NATKERNEL v3.0 — Universal Grammar Kernel},
year = {2026},
publisher = {HuggingFace},
url = {https://huggingface.co/datasets/Jose-dev/natkernel}
}

"The universe speaks a grammar. N is its alphabet size." — Josué Argaña Silguero

About

NATKERNEL — Universal Grammar Kernel. N=7 ∈ [4,12]. Designed by law. Autonomous kernel engineering system with SAI. Author: Josué Argaña Silguero.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages