A build system for compiling your own C applications to run as BareMetal apps: a musl libc port (syscalls dispatched into libBareMetal calls instead of trapped), a BMFS file I/O layer, and lwIP-based TCP/IP networking. See OPENISSUES.md for what's supported and what isn't.
gcc, ld, make, curl, tar, unzip (a standard Linux toolchain works).
Run once, from this directory:
./setup.sh
This downloads musl 1.2.6 and applies the BareMetal port patch, then downloads lwIP 2.2.0 (used as-is, unmodified), creating build/musl-1.2.6/ and build/lwip-2.2.0/. Both are pinned versions -- the patch and the port/lwip_port/ glue are written against these exact releases. (setup.sh just runs scripts/get-musl.sh and scripts/get-lwip.sh in turn, if you want to re-run one on its own.)
./build-app.sh myapp.c # builds your own app -> myapp.app
Downloaded sources and intermediate .o files live under build/; the final .app is placed here in the top-level directory. It's a flat binary linked at 0xFFFF800000000000 (see port/c.ld), ready to load as a BareMetal app (e.g. copy it onto a BMFS disk image and load it from the BareMetal monitor or run it as a unikernel).
./clean.sh removes library code and build artifacts (.o/.a/.app) from this directory and build/ without touching the fetched musl-1.2.6//lwip-2.2.0/ zip/tarball.
setup.sh-- fetches musl and lwIP (see Setup above).build-app.sh-- builds an app (see Building an app above).clean.sh-- removes build artifacts.helloc.c-- minimal demo app (muslprintf, argc/argv/envp).port/-- the port glue every app links against:crt0.c,c.ld-- startup and linker script for the flat-binary, ring-0, fixed-address BareMetal environment (no ELF loader, no syscall trap).posix_shim.c/.h-- the syscall dispatcher musl's patchedsyscall_arch.hcalls into, plus the heap (brk/mmap) backing it.bmfs.c/.h-- POSIX file I/O (open/read/write/stat/...) on top of BMFS, the on-disk format BareMetal uses.net_glue.c/.h,net_shim.c/.h,lwip_port/-- a blocking BSD-socket-shaped layer over lwIP's raw callback API, plus the Ethernet netif driver and port config.libBareMetal.c/.h/.asm-- the low-level calls into the BareMetal kernel (b_output,b_net_tx, ...) everything above is built on.
scripts/-- the fetch scriptssetup.shcalls:get-musl.sh-- downloads musl 1.2.6 and appliespatches/musl-1.2.6-baremetal.patch, the 3-file patch (syscall transport, TLS bootstrap, cancellation-point syscalls), then installspatches/musl-1.2.6-config.makas musl'sconfig.mak(equivalent to running musl's./configurewith the flags this port needs, without you having to runconfigureyourself).get-lwip.sh-- downloads lwIP 2.2.0. lwIP is vendored unmodified; all lwIP-side port work lives inport/lwip_port/andport/net_glue.c/net_shim.cinstead of patches to lwIP itself.
This is not a general-purpose POSIX environment: no fork/exec, no threads (yet), no signals (yet?), flat BMFS namespace (no subdirectories), TCP/UDP only (no raw sockets exposed), 30s timeout on blocking socket calls. See OPENISSUES.md for the full list and the reasoning behind each cut.