Tech News
← Back to articles

Ultimate-Linux: Userspace for Linux in Pure JavaScript

read original related products more articles

Ultimate Linux!!!

This is a fun tiny project for building a tiny Linux distribution in just JavaScript (and a tiny bit of C to enable mounting to get some fun results).

--- ULTIMATE LINUX SHELL --- Commands: ls, cd, cat, mkdir, mount, exit

Background context

I post a lot on X (Twitter) and if you don't follow me already, please follow now!

Lately I've been posting a lot about Unix, Linux, ideas of kernel syscall stability, etc.

In particular, I explored lately how Linux is more or less unique in the kernel/OS world for multiple reasons. First, it's a rare kernel that is shipped independently from the rest of the OS. BSDs, for example, ship the kernel in a coherent unit with the foundational userspace. Linux thus has a unique problem of defining its contract with software built on top of it. And Linux chose stable syscall ABI as this contract. This is in contrast with something like macOS, which is a Unix-certified OS, but which exposes only its system library as the public contract. Apple doesn't guarantee binary backwards compatibility.

Then I explored how pure Go binaries can interestingly target the kernel itself directly via syscalls for its static binaries, and not depend on the system libraries, at least on Linux. There were some explorations around u-root project, etc.

Every once in a while I get comments about how wrong I am when talking about C, Go, Rust, you name it. Comments like Go sucks because it does what it does, I'm wrong when I say "Linux is a kernel, not a complete OS", I don't understand Unix, POSIX, whatever you can think of.

So this time I'm doing something to get all their love. I'm creating a libc-less micro Linux distribution in... JavaScript! A standalone JavaScript binary no less! Of course, there's a transpilation step through C, but who cares -- this is the Ultimate Linux! 💪🐧

... continue reading