How to Build Levinux - The Tiny Virtual Server

Any technology sufficiently advanced is indistinguishable from magic. The time has come the walrus said to speak of many things. Abandon all hope ye who enter here. And other vaguely appropriate quotes.

Build Linux LightsaberGreetings! Levinux is a lightweight generic version of Linux that can survive disruptions in the industry, preserving your code and continuing your productive momentum—perhaps throughout your entire life. The lightweight QEMU virtual machine that requires no install or admin rights to work on your machine key, and most of this page explains how to gather the parts and connect the dots. Levinux is a type of lightsaber for tech — perhaps not as “hard core” as the Linux From Scratch project, but is more accessible and less time-consuming for “newbs”.

However, I have insufficient momentum in my life to work on the bits that are most difficult for me—namely, compiling new-ish QEMU binaries that support the curses text-only interface and have all the extra QEMU optional hardware support bloat stripped out. I produced the video below that describes what I’m broadly trying to accomplish.

A Call For Help Compiling Modern Minimal QEMU Binaries

I need your help, and to that end, I’m going to lay out the step-by-step procedure to building the most modern Levinux-style distribution/remix, and maybe we can all settle in on the best one to take the project past Beta. I will also start this in github so we can reach out to a lot more people.

For a broader idea of the technology education that I have in mind, check out this video series: [syg_gallery id=2]

Latest Status

I was asked on the forum:

> What are the chances that the TCL kernel and Extensions can be updated while the search is on for help with QEMU compiling?

…to which I replied:

My plans is to update everything from latest sources: Linux kernel, version of Tiny Core Linux, and qemu binaries. The challenge of Levinux is that it is a difficult to reproduce magic cocktail, and that the old versions have many fewer dependencies and run very well. Moving to the new stuff always topples the house of cards. Error messages get generated and the recipe build-times become many times longer.

To solve this, I am very inspired by the Aboriginal Linux project by Rob Landley http://landley.net/aboriginal/. My idea is to make Levinux self-build all its components, so it can effectively freshen itself up. I will create the cross-compiling environment to make the Mac, Windows and Linux qemu binaries INSIDE Levinux (yes, compiles will take forever), but it will also gather all the other latest components from source, such as Tiny Core Linux version 5, with it’s new Linux kernel (the vmlinuz file) included.

I’ll probably switch everything over to Python 3. The trick is to do this while preserving everything special about Levinux. The deflated distro is still under 20 megs, and it only inflates to about 60. This updating may make the resulting size over 100 MB, mostly due to dependency-bloat of the latest QEMU’s and bloat from Python 2.x to Python 3.x.

Anyway I’m pretty determined to do it, and the real motivation is how cool and interesting it’s going to be to make Levinux self-freshening. My plan is to make a hidden menu option: Rebuild Levinux for Mac, Windows, Linux. When you make your choice, a process starts that could take 12 hours, but when it’s done you will be able to surf to a localhost-accessible website and grab the new zip file and copy it off the guest onto the host, and see if its any better. Because it’s all scripted, I will be able to perpetually refine it and keep Levinux modern.

I’ll probably also be able to offer different spins on Levinux with optimizations for different host platforms, and versions that feature different Linux than Tiny Core, and different languages than Python.

ETA: Who knows? I’ll do my best.

Genesis of The Project

I made Levinux for my own education and pleasure. You don’t fully understand a thing until you take it apart, strip it down and examine the parts, and rebuild it. And that’s what I did with Levinux — except I rebuilt to fill a niche in educational technology that I don’t think is being met — and that is, a “core” Unix/Linux education for semi-technical people, or “newbs” just getting started. It’s what I wish someone had provided for me when I was getting started, to avoid all the proprietary platform vendor pitfalls that send you down the short-term license encumbered dead ends.

Core Unix/Linux is some of the most useful tech to know, underlying so many things, but is so inaccessible, requiring a sort of “initiation” that so far I believe no one has bottled. I hereby bottle it. And bottling it includes instructions on how to build it, and explanations of its design principles.

Levinux is designed to be a self-contained, no-install, no admin-rights distribution of Linux on an extremely tiny virtual machine that resembles an embedded Linux system (like a phone or wearable) more than it resembles a stripped-down desktop system. As a side effect of learning and using it, you should be able to be productive on a variety of other platforms that share a great many parts that you become familiar with, by virtue of not being isolated from them through higher level abstraction “desktop” systems.

Such a Linux distro needs to exist for “nearly-from-scratch” technology education, and for making available extremely minimal stripped-down special-purpose virtual appliances available. Whenever you need a server, for purposes as diverse as mocking-up your empire to having a local server to help with JavaScript Web development, Levinux is there helping get you to the point where you could switch to the next wave of local microservers like Raspberry Pi, or the Amazon Web Services EC2 cloud.

The Problem with QEMU

QEMU is one of those free and open source projects that has crossed over into the realm of “important public resource” — like the Linux kernel itself. The world would not crumble without QEMU, but it is becoming increasingly necessary to various endeavors like Android app development. Therefore, QEMU is going going to be around for a long time. Combine that with the fact that it can run on Windows, OS X or Linux desktops, it is the compelling choice as the foundation for the Levinux project.

The problem with QEMU is quite how large its grown in recent years, and how many different dependencies hit has. Compiling QEMU for each target operating system (Windows, OS X and Linux) are full of their own nuances and sub-challenges. This page is to systematically tackle these challenges for others to follow in my footsteps, perchance do it better.

Gathering The Parts

I will try to advance these pages the best I can, as this is the big hurdle keeping Levinux from moving significantly forward. The parts in building Levinux are for the most part easy to gather, except for modern QEMU binaries that support curses mode (text-only) and have most fancy hardware support stripped out to keep the size of the binary down. It’s also worth noting that gathering up external dependency files like libraries that can’t be static-compiled into the binary and having them accessible (with no install or admin rights on the host machine) is a part of the challenge that’s very related to the QEMU binary challenge.

The GNU General Public (and other) Licenses

Levinux is derived from other peoples’ work — most of it under either the GNU 2 or GNU 3 GPL, but some may be under the MIT, Apache or other permissive licenses designed to promote the free and open source software (FOSS) movement. Before Levinux comes out of beta, I have to make it compliant with the licenses of the software components it’s built on. That’s a big part of the purpose of these pages, for how can you come into compliance without a meticulous accounting of what goes into building the software — especially with a project like this that has dependence on dozens of non-standard common libraries that gets “bundled in” with a special packaging technique that prevents the need for a traditional software install. In short, Levinux uses LOTS of software that needs their licensing requirements met.

GNU Tool Chains For Each Host OS

Building QEMU

Virtual Drive Arrangement

Host Space vs. Guest Space

Support Scripts in Host Space

Support Scripts in Guest Space

Initial Boot Server-building Recipes

Persistence & Python pip Installs

Respinning Levinux Your Way