# NT-Lite -- an x86-64 kernel “UNIX has three operations: read, write, and lie through ioctl.” ## what is it? NT-Lite is a 64-bit operating system kernel written from scratch. It boots into a shell, launches programs, runs Doom, talks TCP/IP, and occasionally reminds you that it is still a hobby kernel. ## paths You thought it would be easy, would you? ```text "apps/shell_native.exe" -> current working directory "/SystemRoot/apps/shell_native.exe" -> system volume, symlink to /Device/HarddiskVolumeN "/Device/HarddiskVolume1/boot.ini" -> system volume "C:\apps\doom.exe" -> /SystemRoot/apps/doom.exe through win32.dll "\apps\doom.exe" -> /SystemRoot/apps/doom.exe through win32.dll "/apps/video.exe" -> /SystemRoot/apps/video.exe through posix.dll ``` ## networking The socket syscalls are BSD-shaped, but not BSD-compatible. Same nouns (AF_INET, SOCK_STREAM, IPPROTO_TCP), none of the baggage: one fixed-size tagged address struct instead of the sockaddr_in/sockaddr_storage casting dance, no htons/ntohl conversions, and DNS resolution is a syscall rather than a userspace library call. That's right microkernel purists, cry some more. Ergonomics. Async is first-class here too, same machinery as the filesystem. Except the DNS resolver. Ergonomics, am I right? ## how to build - get mtools - open the VS x64 build tools - change into this directory - run `build.bat` - use one of: - `run.bat` — IDE - `rund.bat` — IDE, debug - `runa.bat` — AHCI - `runad.bat` — AHCI, debug ## how it looks when built The ESP is just the boot anchor: ```text efi/boot/ bootx64.efi efi/ntlite/fs/ ... boot.ini ``` The configured system volume carries the OS: ```text system/ colonel.exe hal.dll init.exe rssrv.exe syscall.dll win32.dll posix.dll settings.ini drivers/ drivers.ini ahci.sys ata.sys fat.sys hda.sys lwip.sys ntfs.sys ext4.sys pci.sys ps2.sys rtl816x.sys rtl8139.sys cereal.sys usb.sys vmwaresvga.sys apps/ shell_native.exe shell_win32.exe shell_posix.exe doom.exe video.exe edit.exe httpget.exe tcpserve.exe udp.exe resolve.exe ping.exe memtop.exe ``` ## screenshots ![video.exe running bink video 2](image.png) ## faq Q: Is it secure? A: Don't connect to the internet with it. Q: Who is this for? A: Me. Q: What's next? A: Whatever I fixate on next. Q: Does it run Doom? A: `doom.exe` Q: Can it play Crysis? A: Into the bucket list. Q: Does USB work? A: It did for everything I threw at it. Q: If I write a program now, will it run in the future? A: WE DO, in fact, BREAK USERSPACE. Q: Can you read and write files? A: As far as I'm aware. Q: Does it have async I/O? A: The best you'll get. Q: Does the networking actually work? A: It didn't crash yet. Q: Does it really have SMP? A: Watch out. It bites. Q: Is the Win32 layer real? A: API wise, yes. Binary compatibility wise, close but no. Q: Are processes isolated? A: No. But IPC is free. And you can't steal handles. Is this how a serious modern OS should isolate processes? No. Are we a serious OS? No. Is it very convenient? Absolutely. Q: How often does it crash? A: It doesn't if you don't touch it. Q: Can it recover from a crash? A: Works on my machine. Q: Is this finished? A: Does it look finished? Q: Will it corrupt my data? A: It shouldn't. Q: Why is the path syntax so weird? A: It makes sense to me. Q: Why are the logs so verbose? A: Try debugging an interrupt path with vibes. Q: What should I read first? A: This document. Q: How do I contribute? A: `maksw@maksw.pl` Q: Can I use this in production? A: Don't. #### Project dedicated to the honorable, esteemed Professor Leszek Wójcik through whom I came to hate Unix.