by 0xEF · 2y ago · 0 comments
https://www.linuxfromscratch.org/
I failed tremendously, but I had a lot of incorrect ideas about what makes an operating system go. The learning experience was worth it, though.
The go-to guide for anyone that wants to build their own operating system has always been the OSDev community wiki and forum: https://wiki.osdev.org/Main_Page
It's just that Linux is kind of usable out of the box with just the kernel and /bin/sh. But for other OSes this isn't true, the kernel can expose a vastly different interface than the actual os which users interact with.
I actually came into this thread thinking, "damn, I have no idea specifically WHAT I would do/not do if I made an OS, or where to even start" not that I could at all. But I mean feature-wise, etc. Like, it's obviously a ton of apis that you call to invoke things at the system level but I have no idea what to do at the system level. Maybe you just communicate with APIs over there for everything on the motherboard. I know Nvidia has NVAPI I've used that a bunch through their SDK, not more low level. And you start with probably a super baby kernel..
There are also different styles of OS, like windows with the registry which I have broken and fixed thousands of times, and then nix which is pretty much file based. I don't know what else would be better than either of these, I hate the registry thing but maybe it has some huge benefit I haven't figured out.
When I look at C I see heiroglypics. Maybe me learning rust is helping with that. I do really need to learn it for security sake and (live)patching, etc. I write go and ruby so I don't touch memory much.
I'm the same about filesystems. I know a bunch of them and hve done tons of performance testing for SANs etc but couldn't tell you a thing about the lower level, making one, stuff.
edit: lol I guess a lot of this is installing drivers too
Would be interesting if someone with knowledge (e.g. David Chisnall) could help clarify whether this seeming of mine is seemly.
The reality is there have always been other languages[1], and not all of them codified the evil stream-of-bytes paradigm. We've been writing OSes in Ada since the 80s. Pascal variants were somewhat common back in the day (e.g. Charles River PERC, CDC Cyber NOS). Apple was on the Pascal train for a long time. Unisys Clearpath is still written (and sold) in their highly extended Algol variant (ESPOL)[2]. I've used OSes written in Modula-2 & Modula-3. There's a number of folks that are trying FreePascal as an OS language.
Of course, there was a healthy LispOS population at one brief, shining point in time (sigh...Genera). Tektronix and a few others had Smalltalk machines.
IBM still writes a lot of low-level stuff in PL/I dialects across it's proprietary product lines (i Series, z Series). Intel wrote it's first ones (e.g. iRMX, ISIS) in a PL/I dialect (PL/M). And CP/M is there too.
Then you can get to the really niche OS writing languages: JOVIAL, anyone?
[1] The source code for some of these legacy OSes is out there. Studying it might be instructive. [2] Clearpath is the current incarnation of MCP from the Burroughs Large System mainframes (e.g. B5000, B6500, etc.). Stack based and very interesting; now runs as a VM on top of Xeon servers. Not only can you still buy Clearpath, you can download a hobbyist version to try out locally: https://www.app5.unisys.com/library/gmmail/emails/documents/...