Writing a Unix clone in about a month
I needed a bit of a break from real work" recently, so I started a new programming project that was low-stakes and purely recreational. On April 21st, I set out to see how much of a Unix-like operating system for x86_64 targets that I could put together in about a month. The result is Bunnix. Not including days I didn't work on Bunnix for one reason or another, I spent 27 days on this project.
Drew DeVault
Bunnix' creator, Drew DeVault, has quite a bit of experience with writing operating systems, as they're also the creator of Helios, an experimental microkernel operating system. Bunnix is remarkably capable for a 30-day project, and comes with support for both BIOS and UEFI boot, and it'll boot on real hardware too. It doesn't have USB support though, so if you're going the real hardware route, you'll need to take that into account for mouse and keyboard input.
Bunnix has a relatively solid set of drivers, taking the short development time into account: among other things, there's PCI, AHCI block devices, serial ports, framebuffers, and ext4 support. The kernel supports a virtual filesystem, a /dev filled with block devices, a terminal emulator, and more. Bunnix is single-user for now, so it doesn't enforce file permissions, but DeVault states it should be relatively easy to implement multiuser support.
A unique characteristic of Bunnix is that's written mostly in Hare, complemented by some C. Hare is a relatively new programming language, which we touched on late last year when it was ported to OpenBSD. Implementing file systems proved to be one of the difficulties during development, partly due to Hare.
I also learned a lot about mixing source languages into a Hare project, since the kernel links together Hare, assembly, and C sources - it works remarkably well but there are some pain points I noticed, particularly with respect to building the ABI integration riggings. It'd be nice to automate conversion of C headers into Hare forward declaration modules. Some of this work already exists in hare-c, but has a ways to go. If I were to start again, I would probably be more careful in my design of the filesystem layer.
Drew DeVault
DeVault's post about Bunnix gives a lot more insight into the development of Bunnix, so I'd highly suggest to head on over to read more. Do note that DeVault considers Bunnix done", in the sense that the learning experience is over, and aside from a few random developments here and there, they won't be doing any work on it anymore.