A Stripped-Down Limine Fork for LunaOS
π Minimal β’ π‘οΈ Proven β’ β‘ Fast β’ π LunaOS-Native
Features β’ What We Changed β’ What We Kept β’ Philosophy
Null is a minimal bootloader for LunaOS - a stripped-down fork of Limine with ~4,300 lines of dead code removed. It does exactly one thing: boot LunaOS kernels via the Limine protocol.
The numbers:
- ποΈ ~4,300 lines removed - Multiboot, Linux boot, Chainload, ISO9660
- π¦ 19 files deleted - unused protocol handlers and filesystems
- β 1 protocol supported - Limine (the only one LunaOS uses)
- π 0 regressions - boot process untouched
π‘ Philosophy: Use proven code. Remove unused code. Touch nothing else.
|
π₯οΈ Boot LunaOS
|
π Network & Storage
|
|
β Removed Protocols
|
β Removed Filesystems
|
π‘ Why?
|
| Component | Lines Removed | Status |
|---|---|---|
π multiboot1.c/h |
~560 | ποΈ Deleted |
π multiboot2.c/h |
~1,360 | ποΈ Deleted |
π linux_x86.c |
~630 | ποΈ Deleted |
π linux_risc.c |
~450 | ποΈ Deleted |
π chainload.c/h |
~370 | ποΈ Deleted |
π iso9660.s2.c/h |
~580 | ποΈ Deleted |
| π© Assembly files | ~220 | ποΈ Deleted |
π menu.c dispatch |
~30 | βοΈ Simplified |
| π Total | ~4,300 | β Gone |
| Component | Purpose | Status |
|---|---|---|
| π§ Limine protocol | Boot LunaOS kernels | β Essential |
| π Boot menu | Recovery mode, kernel selection | β Essential |
| π FAT32 | Read kernel from EFI partition | β Essential |
| π PXE/TFTP | Network boot (sister resurrection) | π‘ Useful |
| π PQCrypto | Post-quantum signatures & encryption | β Essential |
| πΊοΈ Memory map | DO NOT TOUCH | π Sacred |
| π SMP boot | DO NOT TOUCH | π Sacred |
| π Paging | DO NOT TOUCH | π Sacred |
We tried everything else:
| Attempt | Duration | Result |
|---|---|---|
| π¨ Custom bootloader from scratch | 1 week | π Crying, almost quit |
| π§ "Reorganizing" Limine memory | 1 day | π SMP disappeared |
| π¦ Translating to Rust | 2 days | π₯ Failed miserably |
π― Conclusion: Use proven bootloader, strip bloat, move on.
- π« Never touch memory map - It works. Don't ask how.
- π« Never touch SMP boot - It works. Don't ask why.
- π« Never touch paging - It works. Just be grateful.
- βοΈ Remove unused code - Less code = fewer bugs.
- π Keep the boot menu - Recovery mode saves lives.
Null includes a complete post-quantum cryptographic stack for secure boot.
./setup-pqcrypto.shThis single command will:
- Download pq-crystals reference implementations
- Build
luna_signandluna_crypttools - Generate signing and encryption keys
- Embed keys into the bootloader
- Build the bootloader
| Component | Algorithm | Security Level | Key Sizes |
|---|---|---|---|
| π Signatures | Dilithium-3 (ML-DSA) | NIST Level 3 (128-bit) | PK: 1952B, SK: 4032B, Sig: 3309B |
| π Key Encapsulation | Kyber-1024 (ML-KEM) | NIST Level 5 (256-bit) | PK: 1568B, SK: 3168B, CT: 1568B |
| π Symmetric AEAD | ChaCha20-Poly1305 | 256-bit | Key: 32B, Nonce: 12B, Tag: 16B |
Signing protects against kernel replacement (integrity):
Developer User's Machine
β β
β kernel.elf + secret key β
β β β
β [luna_sign] βββββββββββββββΊ kernel.signed
β β
β BOOTX64.EFI ββββββββββββββΊ Bootloader verifies
β (has public key) signature before
β executing kernel
Encryption protects against kernel reading (confidentiality):
Developer User's Machine
β β
β kernel.signed + public key β
β β β
β [luna_crypt] ββββββββββββββΊ kernel.enc
β β
β BOOTX64.EFI ββββββββββββββΊ Bootloader decrypts
β (has secret key) then verifies
# Sign a kernel (appends 3309-byte Dilithium-3 signature)
./tools/pqcrypto/dilithium-ref/ref/luna_sign sign kernel.elf keys/signing.sec kernel.signed
# Verify a signed kernel
./tools/pqcrypto/dilithium-ref/ref/luna_sign verify kernel.signed keys/signing.pub
# Encrypt a file (Kyber-1024 + ChaCha20-Poly1305)
./tools/pqcrypto/kyber-ref/ref/luna_crypt encrypt kernel.signed keys/encryption.pub kernel.enc
# Decrypt a file
./tools/pqcrypto/kyber-ref/ref/luna_crypt decrypt kernel.enc keys/encryption.sec kernel.decSigned kernel: [kernel data][Dilithium-3 signature (3309 bytes)]
Encrypted kernel (LUNAENC1 format):
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Magic: "LUNAENC1" (8 bytes) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Kyber-1024 Ciphertext (1568 bytes) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β ChaCha20 Nonce (12 bytes) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Poly1305 Authentication Tag (16 bytes) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Encrypted Data (variable length) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Header overhead: 1604 bytes
- Keys are per-developer - Each developer generates their own keypair
- Bootloader + kernel are paired - A bootloader only verifies kernels signed with its embedded public key
- Back up your secret keys - Store
keys/*.secfiles securely; if lost, you cannot sign new kernels - Never commit secret keys -
.secfiles are gitignored by default - Pre-built binaries are useless - A downloaded bootloader has someone else's keys embedded
./setup-pqcrypto.sh # Full setup (recommended)
./setup-pqcrypto.sh --tools-only # Only build tools
./setup-pqcrypto.sh --keys-only # Only generate keys
./setup-pqcrypto.sh --build-only # Only rebuild bootloader
./setup-pqcrypto.sh --clean # Clean and start fresh
./setup-pqcrypto.sh --no-kyber # Signing only (no encryption)
./setup-pqcrypto.sh --help # Show all options./setup-pqcrypto.sh./bootstrap
./configure --enable-uefi-x86-64
makeSee INSTALL.md for full build instructions.
Null follows the LunaOS unified versioning scheme:
- Version:
2025.12.100(YYYY.MM.BBB) - Increment: Bump BBB (100 β 101 β 102) per release
- Reset: Back to 100 each month
See VERSIONING.md for details.
Licensed under the BSD 2-Clause License
Based on Limine by mintsuki and contributors.
See COPYING for full details.
Null is a minimal fork of the legendary Limine bootloader. We're deeply grateful to mintsuki and the Limine community for creating such a robust foundation.
What we took:
- π§ Proven boot process (memory, SMP, paging)
- π¦ Limine protocol implementation
- π Boot menu system
- π FAT32 and PXE support
What we gave back:
- π A lesson in humility (don't rewrite bootloaders)
Null is a core component of LunaOS - the first operating system built on the Coherence Paradigm.
Null embodies the First Law of Computational Physics (LCP):
- π― Minimum viable code - Only what's needed to boot LunaOS
- π‘οΈ Proven foundations - Use Limine's battle-tested boot process
- π Zero entropy increase - Remove code, don't add it
"The best bootloader is the one that gets out of the way."
./configure --enable-uefi-x86-64 && makeπ Build Instructions β’ βοΈ Configuration β’ π Issues
Made with π by the LunaOS team
dΞ΅/dt β€ 0