The high-level OS challenge
14 points by wofo
14 points by wofo
The less ambiguous way to say this would be a “userland from scratch challenge” since it starts with an existing kernel. Established examples include Gokrazy.
I think the Linux kernel is harder to setup. I’m looking into doing my own OS project, and Netbsd seems like a nice place to start.
Bootstrapping Netbsd is very easy compared to Linux. And if you’re not married to using Rust, you could load the netbsd lua module and use lua as your programming language (or maybe even fennel and make it a lisp machine).
I recently did something like this. This video was extremely helpful: https://www.youtube.com/watch?v=u2Juz5sQyYQ
Or you could do the easiest path to writing an operating system and starting from the optimal basic:
https://github.com/ironmeld/builder-hex0
Just re-implement the functionality of builder-hex0 in the high language of your choice and instantly you have a full path to all of the tooling in a Modern Linux (or to the subset that you want)
As it is literally a useful operating system kernel, shell and everything you need to build C compilers, Lisp interpreters, a FORTH, proper shells, tar, unxz, ungz, unbz2, sha256sum and editors (or even other operating systems)
That was written in HEX0 so literally done the hardest way possible, so it is as simple and efficient as possible.
Perhaps I’m missing something, or being overly pedantic, but the definition of an “operating system” the author is working with seems to be different than what I learned. As I learned, an operating system is the code (it’s not exactly a program, not exactly a library, something like both) that manages the hardware (initializes, multiplexes, hides details) on behalf of other programs (even MS-DOS does this, mostly for disks). What the author describes sounds more like a shell than an operating system, which is still a worthy project.
I think the term is not as rigidly defined as that. The SE question Why do people call Linux a kernel rather than an OS? provides IMO a nuanced take.
What is the difference with the kernel by that definition?
The way I learned it, the operating system is the kernel. As I said, perhaps I’m being pedantic or missing something. What is your definition of an “operating system”?
My rough definition would be the kernel + default userspace. Basically the “complete package”. I think when we say MacOS, we don’t really mean just XNU (if that’s what they’re using these days) for example.
I mean, there’s the whole
I’d just like to interject for a moment. What you’re refering to as Linux, is in fact, GNU/Linux, or as I’ve recently taken to calling it, GNU plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.
rant explicitly about that :)
This is not a definition but an example that gestures at the idea: I think things like “/etc/passwd and the protocols around reading/writing it” can be considered part of the operating system without being part of the kernel. Similarly init, similarly /etc/fstab.