upvote
Your idea sounds fun, too!

Here's my thing: Crazierl https://github.com/russor/crazierl/ demo (desktop recommended) at https://crazierl.org/demo/

Here's the other one: Tyn https://github.com/tyn-os/kernel

I haven't studied Tyn, I think from the high level we both have the same goals; enough kernel to run BEAM, and then BEAM does the rest. I wrote in C because learning Rust and bare metal OS stuff at the same time seemed like too much. Crazierl does much less in my kernel; my kernel handles time keeping, memory paging, interrupts, fallback console output, and a simple read only filesystem. Tyn includes device drivers and tcp/ip in the kernel as well. Crazierl runs BEAM compiled for FreeBSD and Tyn runs BEAM compiled for Linux (musl). Crazierl is x86 32-bit, Tyn is x86 64-bit.

IMHO, regardless of what your eventual target is, I would consider running on x86 with bios boot, because it means you can run in v86, which is handy for sending links to demos.

I think building a multiboot capable OS and relying on other people's loaders is a good step to reduce effort.

Starting with serial console also helps a little. VGA text isn't too bad, but UEFI (or other) framebuffer means you need a font renderer and all that. That might be fun and interesting, but it doesn't need to be in the critical path.

If you want to run on hardware, test frequently. Most of the emulators aren't super accurate in early boot, and let you get away with stuff that won't run on hardware. Serial console helps here, because on a pc, writing to the serial port is easy and your output will stay in the terminal even if the pc reboots.

Fully automated PXE boot is helpful too, if you get into a boot loop, it just keeps pulling the latest, and you can push a new binary and wait for the output without having to touch the device under test. Also handy once you get it working a bit... just reboot to pull in new code.

reply
I built an x86 kernel 25 years ago at this point, this time around I chose RISC-V because it's much simpler to get it running, and speed of iteration is paramount on a prototype. There's less documentation but much less cruft. I eventually would like to try porting it to x86, and also to run the same programs — unmodified — on Linux. My first prototype was on Linux actually, but trying to figure out how to fit userspace preemptive scheduling with async IO/io_uring and the complexities of signal handling was literally more complicated than just writing a kernel.

Thank you for the links! I'll have a look when I have a moment in the next weeks and I might send you an email to discuss this further

reply