- Mojo 84.4%
- Assembly 7.3%
- Makefile 2.8%
- Shell 2.8%
- Linker Script 2.7%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .gitignore | ||
| .python-version | ||
| boot.s | ||
| build.sh | ||
| kernel.mojo | ||
| linker.ld | ||
| Makefile | ||
| pyproject.toml | ||
| README.md | ||
| run-qemu.sh | ||
| stubs.s | ||
mos
Small x86 hobby OS experiment built from a Multiboot entry stub, a 64-bit bootstrap path, and a Mojo kernel.
What is here
boot.s: Multiboot header and early bootstrap that enables paging and jumps into long mode.stubs.s: Runtime shims expected by the Mojo toolchain plus theinbwrapper used for keyboard input.kernel.mojo: VGA plus serial-console kernel prototype with a tiny Linux-shaped process model.linker.ld: Kernel linker script placing the image at1 MiB.Makefile: Rebuilds the kernel with the checked-in Mojo SDK and system assembler/linker.build.sh: Shell build path using the exact commands verified in this repo.
Current behavior
The kernel:
- enters 64-bit mode from the Multiboot loader
- writes directly to VGA text memory at
0xb8000 - initializes COM1 and mirrors console output to serial
- exposes four process slots with PID, PPID, state, and tick counters
- boots with
pid 1 = initandpid 2 = kthreadd - models runnable, sleeping, stopped, and zombie task states
- lets
initreap zombies and reparent tasks when their parent exits
Current serial controls:
h: helps: spawn a worker underinitn: select the next non-empty slott: run one scheduler tick on the selected taskp: toggle stop/run for the selected taskz: toggle sleep/wake for the selected taskk: terminate the selected task into zombie stater: letinitreap one zombie1234: directly select a slot
This is still a prototype. It is not close to Linux feature parity: there is no memory management subsystem, userspace ABI, ELF loader, syscall layer, VFS, driver model, interrupts, or real init process execution. What exists now is a small step toward that shape, not a 1:1 Linux clone.
Existing build artifacts
This repository currently contains generated outputs from local builds:
boot.ostubs.okernel.okernel64.binmyos.binkgen.trace.json.time-events.txtkgen.trace.json.time-trace
kernel64.bin is the reproducible linked ELF64 kernel image produced by the
current Makefile.
myos.bin is a legacy checked-in artifact from an older flow and is not
currently regenerated by the new build target.
Build
Run:
./build.sh
Or, if make is installed on the machine:
make
Both routes rebuild:
boot.ofromboot.sstubs.ofromstubs.skernel.sfromkernel.mojousing the checked-in Mojo SDKkernel.ofromkernel.skernel64.binfrom the linker script plus all objects
make clean removes the generated build outputs when make is available.
Run
Best-effort QEMU launcher:
./run-qemu.sh
Notes:
- this environment has
qemu-system-x86_64 - this environment does not have
grub-mkrescueor ISO tooling - the direct QEMU ELF loader path is the only local option wired here
- the kernel build is verified; the headless QEMU boot path is still experimental and may need a proper Multiboot/GRUB handoff to be fully reliable
Next useful work
- add a real boot path with GRUB or a 32-bit Multiboot wrapper image
- replace the fixed process slots with kernel task structs and queues
- add interrupts, timers, and a real scheduler tick
- introduce a syscall boundary and a genuine
inituserspace program