-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·61 lines (56 loc) · 2.14 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·61 lines (56 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
#
# run.sh — Run NullBox in QEMU
#
# Usage:
# ./run.sh # boot with serial console in terminal
# ./run.sh --ports # boot with TCP port forwarding for interaction
# ./run.sh --test # boot, run e2e tests, exit
#
# Ctrl-A X to quit QEMU (or Ctrl-C)
set -euo pipefail
NULLBOX_ROOT="$(cd "$(dirname "$0")" && pwd)"
VMLINUZ="${NULLBOX_ROOT}/build/output/kernel/x86_64/vmlinuz"
INITRAMFS="${NULLBOX_ROOT}/build/output/initramfs/initramfs.cpio.gz"
ISO="${NULLBOX_ROOT}/build/output/nullbox-x86_64.iso"
MODE="${1:-}"
if [[ ! -f "${VMLINUZ}" || ! -f "${INITRAMFS}" ]]; then
echo "Build NullBox first:"
echo " cargo build --workspace --target x86_64-unknown-linux-musl --release"
echo " ./image/scripts/build-squashfs.sh"
echo " ./image/scripts/build-initramfs.sh"
exit 1
fi
case "${MODE}" in
--test)
exec bash "${NULLBOX_ROOT}/image/scripts/e2e-test.sh"
;;
--ports)
echo "NullBox running with port forwarding:"
echo " TCP 19100 → ctxgraph (9100)"
echo " TCP 19200 → test-harness (9200)"
echo ""
echo "Interact from another terminal:"
echo " echo '{\"method\":\"write\",\"agent_id\":\"me\",\"key\":\"hi\",\"value\":\"world\"}' | bash -c 'exec 3<>/dev/tcp/127.0.0.1/19100; cat >&3; read -t3 l <&3; echo \$l; exec 3>&-'"
echo ""
echo "Press Ctrl-A X to quit."
echo ""
exec qemu-system-x86_64 \
-enable-kvm -m 4G -cpu host -smp 4 \
-nographic -serial mon:stdio \
-kernel "${VMLINUZ}" -initrd "${INITRAMFS}" \
-append "console=ttyS0,115200 loglevel=4" \
-nic user,model=virtio,hostfwd=tcp::19100-:9100,hostfwd=tcp::19200-:9200,hostfwd=tcp::8080-:8080
;;
*)
echo "NullBox — The Operating System for AI Agents"
echo ""
echo "Press Ctrl-A X to quit."
echo ""
exec qemu-system-x86_64 \
-enable-kvm -m 4G -cpu host -smp 4 \
-nographic -serial mon:stdio \
-kernel "${VMLINUZ}" -initrd "${INITRAMFS}" \
-append "console=ttyS0,115200 loglevel=7"
;;
esac