Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

coreutils

The unprivileged file / text / process utilities for LoricaOS, a capability-based, no-ambient-authority x86-64 operating system built on the from-scratch Aegis kernel.

These are the leaf commands — ls, cat, cp, grep, ps, find, … — that make up the base userland. They hold no capability policy and no privilege: the kernel gates every privileged operation (chown to another uid, killing another process, setting the clock) at the syscall boundary regardless of which binary calls it, so compromising one of these grants nothing the caller didn't already hold. That's exactly why they're peeled out of the trusted base — the things that do carry authority (init, the shell's elevation path, login/auth, the package manager, system-control and network-config tools) stay in the OS repo; these don't.

A clean coreutils built against the Aegis syscall ABI also doubles as a reference userland for that ABI.

Build

make MUSL_CC=/path/to/musl-gcc        # build every util + pack coreutils.hpkg

make compiles each src/<name>/*.c against musl and packs a class=system herald package that installs each binary at /bin/<name> (plus /bin/[, the same program as /bin/test). HERALD_KEY optionally signs it.

Multiplexed build (lean / static targets)

The default build ships one dynamic binary per util (they share a libc.so via ld-musl). For a target with no dynamic loader — a microVM or PicoCalc rootfs built fully static — 67 separate static binaries re-embed musl 67 times (~2.9 MB). The multiplexed build is the busybox answer: compile a chosen set of applets into one static binary (mux/cu) that shares a single musl, installed as /bin/cu plus a /bin/<applet> symlink each — all 67 applets in ~300 KB, ~10× smaller.

make mux                       # all applets -> one static binary
make mux-microvm               # curated headless-guest subset (~59 applets)
make mux APPLETS="ls cat cp mv rm grep sed"   # explicit set
make mux-pack                  # + herald package (cu + symlinks)

No source changes: each util's main() is renamed to <name>_main per translation unit via -Dmain=, and a generated dispatcher (tools/gen-dispatch.sh) selects the applet from argv[0] (the symlink name) or from cu <applet> …. mux-microvm drops what a single-purpose headless guest has no use for — the interactive pagers (less/more/clear) and the multi-user account tools (passwd/useradd/…); override APPLETS to tier it however you like. This is applet selection, not a fork: one source tree serves the full desktop and the leanest microVM.

Layout

src/<name>/          one directory per utility (single C source each)
tools/pack.sh        build the signed .hpkg (every binary -> /bin/<name>)
tools/gen-dispatch.sh generate the multiplexer main() for a set of applets
tools/pack-mux.sh    package the multiplexed cu + /bin/<applet> symlinks
Makefile             build-all -> pack; `mux` / `mux-microvm` / `mux-pack`
VERSION              package version

The OS consumes coreutils.hpkg as a fetched artifact and unpacks it into the base rootfs — see LoricaOS.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages