mirror of
https://github.com/pithings/unkernel.git
synced 2026-12-02 10:09:47 +08:00
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.
27 lines
1.3 KiB
Bash
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/=")
|