-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathstart-gui.sh
More file actions
98 lines (82 loc) · 2.97 KB
/
start-gui.sh
File metadata and controls
98 lines (82 loc) · 2.97 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
# TensorAgent OS — smart display startup
# WhaleOS IS a Wayland compositor — no need for Cage.
# Runs directly on the framebuffer via EGLFS.
LOGFILE=/tmp/tensoragent-gui.log
# Simple logging — no process substitution pipes that block VT
log() { echo "[TensorAgent] $*" | tee -a "$LOGFILE"; }
log "=== TensorAgent GUI starting at $(date) ==="
# Create XDG_RUNTIME_DIR if it doesn't exist
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
if [ ! -d "$XDG_RUNTIME_DIR" ]; then
mkdir -p "$XDG_RUNTIME_DIR"
chmod 0700 "$XDG_RUNTIME_DIR"
fi
# Qt rendering config — software rendering for VM compatibility
export QT_QPA_PLATFORM=eglfs
export QSG_RENDER_LOOP=basic
export QT_QUICK_BACKEND=software
export QML2_IMPORT_PATH=/usr/lib/aarch64-linux-gnu/qt6/qml:/usr/lib/qt6/qml
# EGLFS config — use linuxfb fallback if no working EGL
export QT_QPA_EGLFS_INTEGRATION=eglfs_kms
export QT_QPA_EGLFS_ALWAYS_SET_MODE=1
export LIBGL_ALWAYS_SOFTWARE=1
# Disable GTK client-side decorations — WhaleOS provides server-side title bars
export GTK_CSD=0
export XDG_CURRENT_DESKTOP=WhaleOS
# Detect hypervisor
HYPERVISOR=$(systemd-detect-virt 2>/dev/null || echo "none")
log "Detected hypervisor: $HYPERVISOR"
case "$HYPERVISOR" in
vmware)
log "VMware detected — using software renderer with linuxfb fallback"
export GALLIUM_DRIVER=llvmpipe
modprobe vmwgfx 2>/dev/null || true
# Try eglfs first, fall back to linuxfb if it fails
export QT_QPA_EGLFS_KMS_CONFIG=""
;;
qemu|kvm)
log "QEMU/KVM detected — using virtio-gpu"
;;
*)
log "Bare metal or unknown — auto-detecting display"
;;
esac
# Wait for DRM device (up to 10 seconds)
for i in $(seq 1 20); do
if ls /dev/dri/card* 2>/dev/null; then
log "DRM device found"
ls /dev/dri/ >> "$LOGFILE" 2>&1
break
fi
log "Waiting for DRM device... ($i/20)"
sleep 0.5
done
# If no DRM device, fall back to linuxfb
if ! ls /dev/dri/card* 2>/dev/null; then
log "No DRM device — falling back to linuxfb"
export QT_QPA_PLATFORM=linuxfb
fi
# Pre-flight checks
log "Checking WhaleOS binary..."
if [ ! -x /opt/ainux/whaleos/whaleos ]; then
log "ERROR: WhaleOS binary not found or not executable"
ls -la /opt/ainux/whaleos/ >> "$LOGFILE" 2>&1 || echo " whaleos directory missing" >> "$LOGFILE"
exit 1
fi
log "Checking main.qml..."
if [ ! -f /opt/ainux/whaleos/main.qml ]; then
log "ERROR: main.qml not found"
exit 1
fi
log "Environment:"
log " QT_QPA_PLATFORM=$QT_QPA_PLATFORM"
log " QT_QUICK_BACKEND=$QT_QUICK_BACKEND"
log " QSG_RENDER_LOOP=$QSG_RENDER_LOOP"
log " XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR"
# Launch WhaleOS directly — it IS a Wayland compositor
# No Cage needed. WhaleOS renders via EGLFS to the DRM device.
log "Starting WhaleOS compositor directly..."
# Refresh apt cache in background so Package Store works immediately
apt-get update -qq &>/dev/null &
exec /opt/ainux/whaleos/whaleos >> "$LOGFILE" 2>&1