Skip to content

About

A small Linux distribution for PCs with little memory (16 MB): made for the Tab5 PC's emulated PC

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Sprig Linux

A small Linux distribution for PCs with little memory: a current kernel, BusyBox and a few programs that run in 16 MB of RAM. It is made for the emulated PC of Tab5 PC (tiny386 on the M5Stack Tab5), and boots in tiny386 elsewhere too.

Try it in your browser: yejun.github.io/sprig-linux runs the latest release on tiny386 compiled to WebAssembly (nothing is saved, and there is no network beyond the page).

  • Linux 7.3.3, BusyBox 1.37 (static, musl), on an ext4 root file system with a 16 MB swap file
  • nano, htop, Lua, tcc (a C compiler), MicroPython, an SSH server and client (dropbear), the console mouse (gpm), lynx (a web browser, HTTPS with OpenSSL and checked certificates, compressed pages)
  • Midnight Commander (mc, a two-pane file manager, with its editor and viewer), ncdu (disk use), sqlite3, and frotz with Zork I, II and III (zork1, zork2, zork3; Infocom's games, open source under the MIT licence since 2025)
  • Bywater BASIC (basic), and cmatrix (characters raining down the screen)
  • menu: the programs in a list (dialog), in colour, with the mouse (tap one on the Tab5) and a description of the highlighted one at the bottom; the list comes back when a program ends
  • network over the PC's NE2000 card (DHCP at boot)
  • a text console, or a graphics console (800 x 600, 256 colours) with the boot logo
  • at the end of startup and at SSH logins, a card with the version, memory, swap, disk, network and a few commands, beside a sprig (sh /usr/share/sprig/banner shows it again)

The kernel is booted directly by tiny386's loader (linuxstart), without a BIOS. It needs a Pentium-class CPU (Linux no longer supports the 486): gen = 5 in tiny386's settings.

guest RAM free after boot
16 MB 7.2 MB + 16 MB swap
18 MB (the settings here) 9.1 MB + 16 MB swap
20 MB 11.4 MB + 16 MB swap

Build

On Linux (x86-64), with gcc (with -m32), make, flex, bison, bc, libelf, git, curl, fakeroot and e2fsprogs; for the programs also tic (ncurses), autoconf, automake, libtool and python3. BusyBox and the programs are built for i386 + musl with zig's zig cc; the scripts download it (a pinned version, like every source).

./extras.sh           # the programs beyond BusyBox -> work/extras (optional)
./build.sh            # kernel, loader, root file system (BusyBox, and the programs if built) -> out/
FB=1 ./build.sh       # or: the same and the graphics console's kernel and settings

The results in out/: bzImage, linuxstart.bin, root.img (128 MB), tiny386-linux.ini (and with FB=1 bzImage-fb, tiny386-linux-fb.ini). Downloads are kept in work/dl, each checked against its SHA-256. A patch that doesn't apply stops the build.

A release is built from a clean checkout with every source unpacked anew, and package.sh checks that the images are such a build of the current commit (BUILDINFO records what they were built from and with):

RELEASE=1 ./extras.sh && RELEASE=1 FB=1 ./build.sh && ./package.sh    # -> release/

release/ then holds the images (root.img gzipped), BUILDINFO, THIRD_PARTY_NOTICES.md, the licences, the sources archive (this repository and every upstream archive: it builds again without a network) and SHA256SUMS.

GitHub builds releases too (.github/workflows/build.yml): by hand from the Actions tab (release/ as an artifact for 3 days), or for a version tag (git tag v0.1 && git push origin v0.1): a draft release to look over and publish.

Web page

web/ is the page that runs Sprig Linux in a browser: web/build.sh <release files> <version> compiles tiny386's WebAssembly port (its wasm/ directory, with zig) and puts it beside the release's bzImage-fb, linuxstart.bin and root.img.gz in web/site/. The page downloads them, unpacks the root file system in memory and starts the PC. .github/workflows/pages.yml publishes it on GitHub Pages whenever a release is published.

Install on the Tab5 PC

Decompress the release's root.img.gz first (gunzip root.img.gz, or 7-Zip on Windows): the Tab5 PC needs root.img itself. Copy bzImage, linuxstart.bin and root.img to /linux on the card, and tiny386-linux.ini (or tiny386-linux-fb.ini, with bzImage-fb) as /tiny386.ini (keep the DOS one to switch back). The first start makes BusyBox's links (a few minutes); after that Linux is at the prompt in about 30 s.

root has no password. The SSH server is off: sshd start starts it, sshd enable starts it at every boot (sshd disable, sshd stop, sshd status). It lets root in once root has a password (passwd); on the Tab5 PC from another computer: ssh -p 2222 root@<the Tab5's address>.

poweroff ends Linux cleanly (services stopped, the swap file off, the disk read-only) and turns the PC off: the Tab5 PC shows "The PC is off", and its POWER button starts it again. reboot starts Linux again.

Notes

How it is set up and why (kernel options, the console, memory, speed): docs/NOTES.md.

Licence

The build scripts and configuration here are under the MIT licence (LICENSE). The kernel and the programs keep their own licences: see THIRD_PARTY_NOTICES.md (the texts are in the image's /usr/share/licenses). patches/ and busybox-patches/ are changes to the kernel and BusyBox under their licence (GPL-2.0). Binary releases come with the exact sources they were built from.

About

A small Linux distribution for PCs with little memory (16 MB): made for the Tab5 PC's emulated PC

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages