feat(userspace): programs in /bin w/o .elf; bin manifests (needs = display) so shell runs snake; Ctrl+C kills foreground via terminal interrupt notification; ctrl keys; sleep

This commit is contained in:
2026-10-27 21:16:00 +01:00
parent 1fc5a54f06
commit 83809bbe94
33 changed files with 608 additions and 121 deletions

View File

@@ -1,6 +1,6 @@
#!/bin/bash
# Builds the k-os disk: one ext4 filesystem holding every program init may
# start. Init and storage themselves are packed into the kernel image.
# start, in /bin. Init and storage themselves are packed into the kernel image.
set -euo pipefail
IMG="${IMG:-boot.img}"
@@ -17,31 +17,33 @@ trap 'rm -rf "${ROOT}"' EXIT
copy() {
local src="$1" dst="$2"
if [ -f "${BUILD_DIR}/${src}" ]; then
cp "${BUILD_DIR}/${src}" "${ROOT}/${dst}"
cp "${BUILD_DIR}/${src}" "${ROOT}/bin/${dst}"
fi
}
copy echo "echo.elf"
copy snake "snake.elf"
copy display-qemu "display.elf"
copy input-qemu "input.elf"
copy log-server "log.elf"
copy permission-manager "permis.elf"
copy session-server "session.elf"
copy terminal-server "terminal.elf"
copy shell "shell.elf"
copy cat "cat.elf"
copy ls "ls.elf"
# Files that ship on the disk.
mkdir -p "${ROOT}/bin"
copy echo echo
copy snake snake
copy display-qemu display
copy input-qemu input
copy log-server log
copy permission-manager permission
copy session-server session
copy terminal-server terminal
copy shell shell
copy cat cat
copy ls ls
copy sleep sleep
# Files that ship on the disk, programs' manifests among them.
cp -r disk/. "${ROOT}/"
# Only the test image: its presence makes init run the self-test.
if [ -n "${SMPTEST:-}" ]; then
copy smptest "smptest.elf"
copy spawntest "spawntst.elf"
copy hello "hello.elf"
copy smptest smptest
copy spawntest spawntest
copy hello hello
fi
rm -f "${IMG}"
mkfs.ext4 -q -F -b 4096 -L k-os -O "${FEATURES}" -d "${ROOT}" "${IMG}" "${SIZE}"
echo "=== ${IMG}: ext4, ${SIZE} ==="
ls -1 "${ROOT}"
ls -1 "${ROOT}" "${ROOT}/bin"