sources | ||
.gitignore | ||
build.sh | ||
get_packages.sh | ||
packages.sh | ||
README.md | ||
run |
Format Appliance OS Thing
A mistake cool thing.
This appliance OS has one goal in life: to put a new MBR disk label and format a FAT32 partition on the first partition of that new labeled disk, then sync the writes to disk and power off.
This is accomplished with a very minimal Linux kernel configuration and static builds of multiple open source software packages, along with a custom "init" written in C++ which does the magic.
This appliance is designed to be used with QEMU's "microvm" machine; a sample run script to test it is provided in ./run
. It boots very quickly, and performs its work in under 3 seconds.
Why make this?
Two answers:
-
While it is true that a "template image" set would be easier, this would quickly begin to fall apart if multiple filesystems are desired. A single appliance that can catch-all safely is a better approach.
-
I wanted to learn about microvms and building special-cased appliance OSes, and do so hands-on with a task that I needed at the time. This is, honestly, 90% of why I did it, but hey; learning isn't a bad thing.
Building
-
Download the x86_64 musl toolchain from musl-cross's Releases page. Extract it and rename the directory it output to
/toolchain
. This will be the toolchain used for the build. -
Copy
sources/crossfile.sample.txt
tosources/crossfile.txt
, and alter the system root path to match where you placed this repository. (probably at some point this will be generated, but for now this step has to exist) -
Run
./get_packages.sh
to get and extract all the external packages. -
Use
./build.sh
to build everything. -
...
-
profit? (
output/
will contain the bzImage and initramfs image).
Usage
./run
provides a good starting point for using the appliance.
Quiet down the log level (the minimum required is probably console=ttyS0 reboot=t
), and that should be enough to get going.