How the young leaf of the reimplementation tree, Linux, gave its first cry ── up close in 1991
gcc on top of MINIX." This time we look at that moment at the resolution of version numbers. From the baby v0.01, which couldn't run on its own, to v0.11, where Linux could compile Linux itself ── the four months of leaving the nest of the delivery room (MINIX).
In 1991, the Finnish student Linus Torvalds was using MINIX as his development environment (the delivery room of Episode 1) on a 386 PC he had just bought. GNU's tools ── the C compiler gcc and the shell bash ── had been ported onto it. That gcc is the "parent" that compiled the first Linux. But newborn Linux couldn't yet compile itself. The loop (Episode 0) was still piggybacking on MINIX. How does that baby learn to stand on its own two feet? First, from the very first "heartbeat."
Linux didn't begin from a blueprint saying "let's build an OS." What came first were two small programs that tested the 386's features. One relentlessly printed A to the screen, the other relentlessly printed B. When he succeeded in getting the CPU to rapidly switch between them and run them alternately ── that was the first heartbeat of an OS's heart (task switching).
Add a terminal driver, make it possible to dial up from home to the university's computer, and ── the features grow like a snowball. Not "let's build an OS," but "I was messing around with the 386 and it somehow turned into an OS." And on August 25, 1991, that famous post went out to comp.os.minix.
gcc, bash) had already been made by GNU. So the first Linux was compiled by GNU's tools, and later combined with GNU's tools to become one OS ("GNU/Linux"). A self-deprecating joke turned out to be an accurate self-introduction of the lineage.
The first publicly released v0.01 was about 10,239 lines. But it was not a finished product that runs when you turn on the power. To compile it, and to set it up, you need MINIX. The loop had not yet ignited; it was completely piggybacking on the delivery room.
• Compiling: done by gcc on MINIX (Linux itself doesn't yet carry a compiler).
• Preparation: use MINIX's filesystem and tools to prepare the disk.
• In other words, to get Linux ready, MINIX must be running first. In Episode 0's words, this is the stage where "something outside the loop (= MINIX + gcc) is still holding it up."
Here is this episode's main act. With the slider below, advance through v0.01 → 0.02 → 0.11 → 0.12. You'll see the dependence on MINIX shrink, and at one point switch over to self-hosting, where it "can compile itself". That moment is leaving the nest of the delivery room.
v0.01 (September)
Compiled by gcc on MINIX. Not practical on its own. Piggybacking.
v0.02 (October 5)
bash and gcc start running on Linux. It began to run its own tools on itself.
v0.11 (December 19) ── leaving the nest
Self-hosting achieved. Linux could compile Linux on Linux. The moment the loop began to spin. Its own tools like mkfs and fdisk also came together.
v0.11's self-hosting does not mean "it no longer relies on anything." Correctly, it means ── you no longer have to bring out MINIX to build Linux (it can spin the loop by itself). The compiler itself is still GNU's gcc. As we saw in Episode 0, self-hosting means "you can remove the external ignition device (MINIX)," not "it stands from nothing, all alone."
The technical leaving-the-nest was v0.11. But what spread Linux to the world was a single move in the next release, v0.12 (January 5, 1992, just under about 20,000 lines) ── changing the license to GPLv2. Before that it was a restricted license Torvalds had written himself, which forbade commercial redistribution.
(1) v0.11's "self-hosting" means the kernel and the build complete on Linux; the compiler is still GNU's gcc (or clang). The "Linux" we use daily is a collaboration of the Linux kernel + GNU userland ── which is why it's also called "GNU/Linux" (Episode 1, "swapping leaves at the crowns"). It's not complete solo independence.
(2) Saying v0.01 "doesn't run" is an overstatement; more precisely, it means the bare minimum runs, but preparation and modification presuppose MINIX and it isn't practical. (3) Dates vary by source (v0.01 is mid-September 1991; the common account is September 17). (4) The "AAAA/BBBB" anecdote is a famous episode widely told in Torvalds' autobiography Just for Fun and elsewhere; the fine details may be embellished.
Linux began not from a blueprint but from the heartbeat of task switching (AAAA/BBBB) on the 386. The development environment was MINIX (the delivery room), and GNU's gcc ported onto it compiled the first Linux. v0.01 (September 1991, about 10,000 lines) needed MINIX both to compile and to set up ── a "piggybacking" state where the loop was still spun by the outside (MINIX).
At v0.02 (October), bash and gcc began running on Linux too, and at v0.11 (December 19), self-hosting was achieved ── Linux compiled Linux, and it left the nest of the delivery room. Standing on its own here doesn't mean "zero dependencies," but "being able to remove the external ignition device (to spin the loop by itself)." The next month's v0.12 was the second-stage rocket of GPLv2, pushing Linux up into worldwide collaborative development. ── So what, then, compiled that first parent gcc? Down one more step of the staircase.
gcc that gave birth to Linux ── that gcc itself is also a program written in C. So, where there's no compiler yet, what made the first gcc? The answer: "lift it once with the machine's existing cc, then it builds itself from there." We look at the three-stage bootstrap ── the "right way to spin the loop."
Printing / making a PDF: ⌘+P (on Windows, Ctrl+P). On screen, use "▶ Run it" in Figure 1 for task switching, and the slider in Figure 2 to follow the leaving-the-nest from v0.01→0.12. "Show answer" opens each solution.