Files
unkernel/guest/lib/env.sh
Pooya Parsa 97f8d9e5f1 guest: distroless base initramfs and separate Alpine and Debian erofs images
The bundle (unkernel.wasm) carries a small busybox initramfs that mounts a
distro image labelled kwroot under an overlay root, or starts the base shell
without one. guest/ replaces kernel/guest/: base/, distro/NAME/, shared lib/
and tools/. Images are laid out for their boot by a patched mkfs.erofs and a
recorded boot file list, with a prefetch hint in the image header. Debian
bakes its apt lists and cache, a set of everyday packages and a
command-not-found installer.
2026-11-19 14:46:13 +00:00

27 lines
1.3 KiB
Bash

# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2026 Pooya Parsa <pooya@pi0.io>
# Sourced by the guest/ build scripts (bash). Sources kernel/tools/env.sh
# (root, vendor, build, zig, fetch_verified, need_zig, ...) and sets:
# guest this directory's parent (guest/)
# dl vendor/downloads
# base_out the base initramfs's outputs (base.cpio, base-test.cpio and
# their staging trees): $KW_BASE_OUT if set, else
# $build/initramfs
# base_bundle the distroless bundle the base build ends in (kernel/build.sh
# base): $KW_BASE_OUT/unkernel.wasm if set, else
# $build/bundle/unkernel.wasm
# cc_guest zig cc for the guest programs: static aarch64 musl for the
# generic CPU (ARMv8.0, what kwemu runs), with no build
# directory in the output
. "$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)/kernel/tools/env.sh"
guest="$root/guest"
dl="$vendor/downloads"
if [ -n "${KW_BASE_OUT:-}" ]; then
base_out="$(realpath -m "$KW_BASE_OUT")"
base_bundle="$base_out/unkernel.wasm"
else
base_out="$build/initramfs"
base_bundle="$build/bundle/unkernel.wasm"
fi
cc_guest=("$zig" cc -target aarch64-linux-musl -mcpu=generic -static -O2 -s "-ffile-prefix-map=$root/=")