Skip to content

Latest commit

 

History

History
163 lines (111 loc) · 5.86 KB

README.md

File metadata and controls

163 lines (111 loc) · 5.86 KB

bonsai

A tiny Linux distribution focused on simplicity.

Linux done differently.

For the idealists, for the hobbyists.

Notice February 2020

Project has been put on hold until further notice.
Thanks to all who have contributed.

Core Philosophy

"Software shouldn't come with compromise."

  1. Static Linking

All programs are statically linked.
No dependency hell, no searching through the filesystem.
Moving parts are minimized. Simpler is better.

  1. Sandboxing

Chroot sandboxes should be dead simple to setup simply by copying statically-linked binaries.

Running a chrooted service can be as easy as chroot /src/pkgs/myapp /bin/myapp

  1. A Better C Library

GNU's glibc is massively bloated and a poor choice for static linking.
musl-libc is a fresh lightweight alternative that was designed from the ground up to be used with static linking.

Just take a look at this hello world for a size comparison.

Applications statically-linked with musl carefully avoid pulling in large amounts of code or data that the application will not use and have no runtime dependencies. Many programs need patching to compile under musl-libc, however this almost always makes their code better.

  1. Simplicity

No matter how great, a system is hindered by its ability to be understood.

  • A modular automated build system with parts that can overridden simply by defining the given function in the pkgfile
  • Easy-to-understand "3-phase" prebuild(), build(), and postbuild()
  • Automatic detection of required flags, configs, patches, and workarounds
  • Extensive documentation, with unclear or missing manuals considered a bug (TODO)
  • Stay under 1000 SLOC
  1. Sane File System Hierarchy

Similar to GoboLinux, bonsai uses a custom directory scheme:

/include
/lib
/share
/local (applications not installed via bonsai)
/src (bonsai home)
/usr symlinked → /
/sbin symlinked → /bin

(directories left standard not shown)


A tree of /src looks like this:

/src
    ├── /config      ←  config files
    ├── /pkgs        ←  packages
    ├── /ports       ←  pkgfiles
    ├── /sources     ←  tarballs
    ├── bonsai.rc    ←  config file
    └── bonsai.db    ←  database file

Inside each package in pkgs is its own prefix with given /bin, /lib, etc

As a side effect of this, each $pkg is its own chroot filesystem that can be used at will.
In the future, this process is planned to be automated.

Symlinks are created from the package to the outside root for seamless integration and standards compatibility.

Example:

% readlink /bin/perl
/src/pkgs/perl/bin/perl
% readlink /share/man/man1/gcc.1
/src/pkgs/gcc/share/man1/gcc.1

With only symlinks, no actual data lives in /bin, /lib, /include, or /share on the root.

Thus removing data is as simple as removing a given $pkgdir from /src/pkgs.
The symlinks are then tracked and removed once the program is uninstalled.

  1. Lightweight

These are lightweight/embedded technologies incorporated into bonsai as to be more "suckless" alternatives to conventional GNU/Linux software.

C Library: musl-libc
Libraries: libressl libnl-tiny netbsd-curses libedit
Init System: sinit rc
Userland: sbase ubase hbase
Shell: dash
Build Automation: pkgconf slibtool samurai
Networking: dropbear
Compression: libarchive xz-embedded pigz
Misc Utilities: one-true-awk posix-bc mandoc

Installation

For installation instructions, see INSTALL.md

Special thanks to


Inspirations, technologies, and patches have all been taken from these wonderful projects.

Also:

  • Rich Felker's work on musl-crossmake for ease of musl toolchain compilation

Achtung!

This is heavily still a WIP.
There are bugs. There are snakes.
Do not use in production.


Support

Star it! 🌟

It helps get it higher in GitHub's search results and motivates us to continue development.

If you would like to contribute, look into submitting a pull request.