feat(isobuild): add multi-architecture build and Raspberry Pi support in installer and build tooling
This commit is contained in:
@@ -5,35 +5,101 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
# Parse arguments
|
||||
AUTO_MODE=false
|
||||
TARGET_ARCH="amd64"
|
||||
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
--auto)
|
||||
AUTO_MODE=true
|
||||
shift
|
||||
;;
|
||||
--arch=*)
|
||||
TARGET_ARCH="${arg#*=}"
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
echo "Usage: $0 [--arch=amd64|arm64|rpi] [--auto]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --arch=ARCH Target architecture (default: amd64)"
|
||||
echo " amd64 - x86_64 with UEFI/OVMF"
|
||||
echo " arm64 - Generic ARM64 with UEFI"
|
||||
echo " rpi - Raspberry Pi 3 emulation"
|
||||
echo " --auto Run in automatic mode for CI/testing"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Validate architecture
|
||||
case "$TARGET_ARCH" in
|
||||
amd64|arm64|rpi)
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: Invalid architecture '$TARGET_ARCH'"
|
||||
echo "Valid options: amd64, arm64, rpi"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
PROJECT_ROOT="$SCRIPT_DIR/.."
|
||||
VM_DIR="$PROJECT_ROOT/.nogit/vm"
|
||||
ISO_PATH="$PROJECT_ROOT/.nogit/iso/ecoos.iso"
|
||||
DISK_PATH="$VM_DIR/test-disk.qcow2"
|
||||
MONITOR_SOCK="$VM_DIR/qemu-monitor.sock"
|
||||
SERIAL_SOCK="$VM_DIR/serial.sock"
|
||||
SERIAL_LOG="$VM_DIR/serial.log"
|
||||
PID_FILE="$VM_DIR/qemu.pid"
|
||||
|
||||
# Architecture-specific settings
|
||||
case "$TARGET_ARCH" in
|
||||
amd64)
|
||||
ISO_PATH="$PROJECT_ROOT/.nogit/iso/ecoos.iso"
|
||||
DISK_PATH="$VM_DIR/test-disk.qcow2"
|
||||
QEMU_CMD="qemu-system-x86_64"
|
||||
QEMU_MACHINE=""
|
||||
QEMU_BIOS="-bios /usr/share/qemu/OVMF.fd"
|
||||
KVM_CHECK="/dev/kvm"
|
||||
DISK_IF="virtio"
|
||||
;;
|
||||
arm64)
|
||||
ISO_PATH="$PROJECT_ROOT/.nogit/iso/ecoos-arm64.iso"
|
||||
DISK_PATH="$VM_DIR/test-disk-arm64.qcow2"
|
||||
QEMU_CMD="qemu-system-aarch64"
|
||||
QEMU_MACHINE="-M virt -cpu cortex-a72"
|
||||
QEMU_BIOS="-bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd"
|
||||
KVM_CHECK="" # ARM KVM only works on ARM hosts
|
||||
DISK_IF="virtio"
|
||||
;;
|
||||
rpi)
|
||||
IMG_PATH="$PROJECT_ROOT/.nogit/iso/ecoos-rpi.img"
|
||||
DISK_PATH="" # RPi uses the image directly
|
||||
QEMU_CMD="qemu-system-aarch64"
|
||||
QEMU_MACHINE="-M raspi3b -cpu cortex-a53"
|
||||
QEMU_BIOS="" # RPi uses direct kernel boot
|
||||
KVM_CHECK=""
|
||||
DISK_IF="sd"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Create VM directory if not exists
|
||||
mkdir -p "$VM_DIR"
|
||||
|
||||
# Check if ISO exists
|
||||
if [ ! -f "$ISO_PATH" ]; then
|
||||
echo "ERROR: ISO not found at $ISO_PATH"
|
||||
echo "Run 'pnpm run build' first to create the ISO"
|
||||
exit 1
|
||||
# Check if image exists
|
||||
if [ "$TARGET_ARCH" = "rpi" ]; then
|
||||
if [ ! -f "$IMG_PATH" ]; then
|
||||
echo "ERROR: RPi image not found at $IMG_PATH"
|
||||
echo "Run 'pnpm run build:rpi' first to create the image"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if [ ! -f "$ISO_PATH" ]; then
|
||||
echo "ERROR: ISO not found at $ISO_PATH"
|
||||
echo "Run 'pnpm run build:$TARGET_ARCH' first to create the ISO"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create test disk if not exists
|
||||
if [ ! -f "$DISK_PATH" ]; then
|
||||
# Create test disk if not exists (not needed for RPi)
|
||||
if [ -n "$DISK_PATH" ] && [ ! -f "$DISK_PATH" ]; then
|
||||
echo "Creating test disk (20GB)..."
|
||||
qemu-img create -f qcow2 "$DISK_PATH" 20G
|
||||
fi
|
||||
@@ -48,15 +114,19 @@ if [ -f "$PID_FILE" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Starting QEMU with EcoOS ISO..."
|
||||
echo "Starting QEMU with EcoOS for $TARGET_ARCH..."
|
||||
|
||||
# Check if KVM is available
|
||||
# Check if KVM is available (only for amd64 on x86 hosts)
|
||||
KVM_OPTS=""
|
||||
if [ -e /dev/kvm ] && [ -r /dev/kvm ] && [ -w /dev/kvm ]; then
|
||||
if [ -n "$KVM_CHECK" ] && [ -e "$KVM_CHECK" ] && [ -r "$KVM_CHECK" ] && [ -w "$KVM_CHECK" ]; then
|
||||
KVM_OPTS="-enable-kvm -cpu host"
|
||||
echo "Using KVM acceleration"
|
||||
else
|
||||
echo "KVM not available, using software emulation (slower)"
|
||||
if [ "$TARGET_ARCH" = "amd64" ]; then
|
||||
echo "KVM not available, using software emulation (slower)"
|
||||
else
|
||||
echo "Running ARM emulation on x86 host (slower)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Cleanup function
|
||||
@@ -89,148 +159,206 @@ cleanup() {
|
||||
}
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
# Start QEMU with virtio-gpu multi-head (3 outputs)
|
||||
# Start QEMU based on architecture
|
||||
> "$SERIAL_LOG" # Clear old log
|
||||
qemu-system-x86_64 \
|
||||
$KVM_OPTS \
|
||||
-m 4G \
|
||||
-smp 4 \
|
||||
-bios /usr/share/qemu/OVMF.fd \
|
||||
-drive file="$ISO_PATH",media=cdrom \
|
||||
-drive file="$DISK_PATH",format=qcow2,if=virtio \
|
||||
-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vgamem_mb=64 \
|
||||
-device qxl,id=video1,ram_size=67108864,vram_size=67108864,vgamem_mb=64 \
|
||||
-device qxl,id=video2,ram_size=67108864,vram_size=67108864,vgamem_mb=64 \
|
||||
-display none \
|
||||
-spice port=5930,disable-ticketing=on \
|
||||
-device virtio-serial-pci \
|
||||
-chardev spicevmc,id=vdagent,name=vdagent \
|
||||
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \
|
||||
-serial unix:"$SERIAL_SOCK",server,nowait \
|
||||
-monitor unix:"$MONITOR_SOCK",server,nowait \
|
||||
-nic user,model=virtio-net-pci,hostfwd=tcp::3006-:3006,hostfwd=tcp::2222-:22 \
|
||||
-pidfile "$PID_FILE" &
|
||||
|
||||
if [ "$TARGET_ARCH" = "amd64" ]; then
|
||||
# AMD64 with multi-display support
|
||||
$QEMU_CMD \
|
||||
$KVM_OPTS \
|
||||
-m 4G \
|
||||
-smp 4 \
|
||||
$QEMU_BIOS \
|
||||
-drive file="$ISO_PATH",media=cdrom \
|
||||
-drive file="$DISK_PATH",format=qcow2,if=virtio \
|
||||
-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vgamem_mb=64 \
|
||||
-device qxl,id=video1,ram_size=67108864,vram_size=67108864,vgamem_mb=64 \
|
||||
-device qxl,id=video2,ram_size=67108864,vram_size=67108864,vgamem_mb=64 \
|
||||
-display none \
|
||||
-spice port=5930,disable-ticketing=on \
|
||||
-device virtio-serial-pci \
|
||||
-chardev spicevmc,id=vdagent,name=vdagent \
|
||||
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \
|
||||
-serial unix:"$SERIAL_SOCK",server,nowait \
|
||||
-monitor unix:"$MONITOR_SOCK",server,nowait \
|
||||
-nic user,model=virtio-net-pci,hostfwd=tcp::3006-:3006,hostfwd=tcp::2222-:22 \
|
||||
-pidfile "$PID_FILE" &
|
||||
|
||||
elif [ "$TARGET_ARCH" = "arm64" ]; then
|
||||
# ARM64 with UEFI
|
||||
$QEMU_CMD \
|
||||
$QEMU_MACHINE \
|
||||
-m 4G \
|
||||
-smp 4 \
|
||||
$QEMU_BIOS \
|
||||
-drive file="$ISO_PATH",media=cdrom,if=none,id=cdrom \
|
||||
-device virtio-blk-device,drive=cdrom \
|
||||
-drive file="$DISK_PATH",format=qcow2,if=none,id=hd0 \
|
||||
-device virtio-blk-device,drive=hd0 \
|
||||
-device virtio-gpu-pci \
|
||||
-display none \
|
||||
-serial unix:"$SERIAL_SOCK",server,nowait \
|
||||
-monitor unix:"$MONITOR_SOCK",server,nowait \
|
||||
-device virtio-net-device,netdev=net0 \
|
||||
-netdev user,id=net0,hostfwd=tcp::3006-:3006,hostfwd=tcp::2222-:22 \
|
||||
-pidfile "$PID_FILE" &
|
||||
|
||||
elif [ "$TARGET_ARCH" = "rpi" ]; then
|
||||
# Raspberry Pi 3B emulation
|
||||
# Note: raspi3b machine has limited support, uses direct kernel boot
|
||||
echo "NOTE: Raspberry Pi emulation is limited."
|
||||
echo " For full testing, use real hardware."
|
||||
|
||||
# Extract kernel and initrd from image for direct boot
|
||||
TEMP_MNT=$(mktemp -d)
|
||||
LOOP_DEV=$(sudo losetup --find --show --partscan "$IMG_PATH")
|
||||
sudo mount "${LOOP_DEV}p1" "$TEMP_MNT"
|
||||
|
||||
KERNEL="$TEMP_MNT/vmlinuz"
|
||||
INITRD="$TEMP_MNT/initrd.img"
|
||||
DTB="$TEMP_MNT/bcm2710-rpi-3-b.dtb"
|
||||
|
||||
if [ ! -f "$KERNEL" ]; then
|
||||
echo "ERROR: Kernel not found in RPi image"
|
||||
sudo umount "$TEMP_MNT"
|
||||
sudo losetup -d "$LOOP_DEV"
|
||||
rm -rf "$TEMP_MNT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Copy kernel/initrd to temp location for QEMU
|
||||
cp "$KERNEL" "$VM_DIR/rpi-kernel"
|
||||
cp "$INITRD" "$VM_DIR/rpi-initrd" 2>/dev/null || true
|
||||
cp "$DTB" "$VM_DIR/rpi-dtb" 2>/dev/null || true
|
||||
|
||||
sudo umount "$TEMP_MNT"
|
||||
sudo losetup -d "$LOOP_DEV"
|
||||
rm -rf "$TEMP_MNT"
|
||||
|
||||
$QEMU_CMD \
|
||||
$QEMU_MACHINE \
|
||||
-m 1G \
|
||||
-kernel "$VM_DIR/rpi-kernel" \
|
||||
-initrd "$VM_DIR/rpi-initrd" \
|
||||
-dtb "$VM_DIR/rpi-dtb" \
|
||||
-append "console=ttyAMA0,115200 root=LABEL=EcoOS rootfstype=ext4 rootwait" \
|
||||
-drive file="$IMG_PATH",format=raw,if=sd \
|
||||
-serial unix:"$SERIAL_SOCK",server,nowait \
|
||||
-display none \
|
||||
-pidfile "$PID_FILE" &
|
||||
fi
|
||||
|
||||
QEMU_PID=$!
|
||||
|
||||
echo ""
|
||||
echo "=== EcoOS Test VM Started ==="
|
||||
echo "=== EcoOS Test VM Started ($TARGET_ARCH) ==="
|
||||
echo "QEMU PID: $QEMU_PID"
|
||||
echo "Management UI: http://localhost:3006"
|
||||
if [ "$TARGET_ARCH" != "rpi" ]; then
|
||||
echo "Management UI: http://localhost:3006"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Wait for QEMU to start and SPICE to be ready
|
||||
echo "Waiting for SPICE server..."
|
||||
sleep 3
|
||||
# AMD64-specific display setup
|
||||
if [ "$TARGET_ARCH" = "amd64" ]; then
|
||||
# Wait for QEMU to start and SPICE to be ready
|
||||
echo "Waiting for SPICE server..."
|
||||
sleep 3
|
||||
|
||||
# Check if remote-viewer is available
|
||||
if ! command -v remote-viewer &> /dev/null; then
|
||||
echo "WARNING: remote-viewer not installed"
|
||||
echo "Install with: sudo apt install virt-viewer"
|
||||
# Check if remote-viewer is available
|
||||
if ! command -v remote-viewer &> /dev/null; then
|
||||
echo "WARNING: remote-viewer not installed"
|
||||
echo "Install with: sudo apt install virt-viewer"
|
||||
echo ""
|
||||
echo "Running without display viewer. Press Ctrl-C to stop."
|
||||
wait $QEMU_PID
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Set up virt-viewer settings for multi-display
|
||||
VIRT_VIEWER_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/virt-viewer"
|
||||
mkdir -p "$VIRT_VIEWER_CONFIG_DIR"
|
||||
if [ -f "$SCRIPT_DIR/virt-viewer-settings" ]; then
|
||||
cp "$SCRIPT_DIR/virt-viewer-settings" "$VIRT_VIEWER_CONFIG_DIR/settings"
|
||||
echo "Configured virt-viewer for 3 displays"
|
||||
fi
|
||||
|
||||
# Detect DISPLAY if not set
|
||||
if [ -z "$DISPLAY" ]; then
|
||||
if [ -S /tmp/.X11-unix/X0 ]; then
|
||||
export DISPLAY=:0
|
||||
elif [ -S /tmp/.X11-unix/X1 ]; then
|
||||
export DISPLAY=:1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Detect WAYLAND_DISPLAY if not set
|
||||
if [ -z "$WAYLAND_DISPLAY" ] && [ -z "$DISPLAY" ]; then
|
||||
if [ -S "$XDG_RUNTIME_DIR/wayland-0" ]; then
|
||||
export WAYLAND_DISPLAY=wayland-0
|
||||
elif [ -S "/run/user/$(id -u)/wayland-0" ]; then
|
||||
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
|
||||
export WAYLAND_DISPLAY=wayland-0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Launch remote-viewer
|
||||
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
|
||||
echo "No display found, starting headless X server with 3 virtual monitors..."
|
||||
|
||||
XDISPLAY=99
|
||||
while [ -S "/tmp/.X11-unix/X$XDISPLAY" ]; do
|
||||
XDISPLAY=$((XDISPLAY + 1))
|
||||
done
|
||||
|
||||
XORG_CONFIG="$SCRIPT_DIR/xorg-dummy.conf"
|
||||
Xorg :$XDISPLAY -config "$XORG_CONFIG" -noreset +extension GLX +extension RANDR +extension RENDER &
|
||||
XORG_PID=$!
|
||||
sleep 2
|
||||
|
||||
export DISPLAY=:$XDISPLAY
|
||||
|
||||
xrandr --newmode "1920x1080" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync 2>/dev/null || true
|
||||
xrandr --addmode DUMMY1 "1920x1080" 2>/dev/null || true
|
||||
xrandr --addmode DUMMY2 "1920x1080" 2>/dev/null || true
|
||||
xrandr --output DUMMY0 --mode 1920x1080 --pos 0x0 --primary
|
||||
xrandr --output DUMMY1 --mode 1920x1080 --pos 1920x0 2>/dev/null || true
|
||||
xrandr --output DUMMY2 --mode 1920x1080 --pos 3840x0 2>/dev/null || true
|
||||
|
||||
echo "Headless X server started on :$XDISPLAY"
|
||||
|
||||
remote-viewer --full-screen spice://localhost:5930 &
|
||||
VIEWER_PID=$!
|
||||
echo "remote-viewer running headlessly (PID: $VIEWER_PID)"
|
||||
else
|
||||
echo "Launching remote-viewer with fullscreen for multi-display..."
|
||||
remote-viewer --full-screen spice://localhost:5930 &
|
||||
VIEWER_PID=$!
|
||||
fi
|
||||
echo ""
|
||||
echo "Running without display viewer. Press Ctrl-C to stop."
|
||||
wait $QEMU_PID
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Set up virt-viewer settings for multi-display
|
||||
VIRT_VIEWER_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/virt-viewer"
|
||||
mkdir -p "$VIRT_VIEWER_CONFIG_DIR"
|
||||
if [ -f "$SCRIPT_DIR/virt-viewer-settings" ]; then
|
||||
cp "$SCRIPT_DIR/virt-viewer-settings" "$VIRT_VIEWER_CONFIG_DIR/settings"
|
||||
echo "Configured virt-viewer for 3 displays"
|
||||
fi
|
||||
|
||||
# Detect DISPLAY if not set
|
||||
if [ -z "$DISPLAY" ]; then
|
||||
# Try to find an active X display
|
||||
if [ -S /tmp/.X11-unix/X0 ]; then
|
||||
export DISPLAY=:0
|
||||
elif [ -S /tmp/.X11-unix/X1 ]; then
|
||||
export DISPLAY=:1
|
||||
# Enable all 3 displays via SPICE protocol
|
||||
if [ -f "$SCRIPT_DIR/enable-displays.py" ]; then
|
||||
echo "Enabling displays (waiting for SPICE agent, up to 5 minutes)..."
|
||||
python3 "$SCRIPT_DIR/enable-displays.py" --timeout 300 2>&1 &
|
||||
ENABLE_PID=$!
|
||||
fi
|
||||
fi
|
||||
|
||||
# Detect WAYLAND_DISPLAY if not set
|
||||
if [ -z "$WAYLAND_DISPLAY" ] && [ -z "$DISPLAY" ]; then
|
||||
# Try common Wayland sockets
|
||||
if [ -S "$XDG_RUNTIME_DIR/wayland-0" ]; then
|
||||
export WAYLAND_DISPLAY=wayland-0
|
||||
elif [ -S "/run/user/$(id -u)/wayland-0" ]; then
|
||||
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
|
||||
export WAYLAND_DISPLAY=wayland-0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Launch remote-viewer - use dummy X server with 3 monitors if no display available
|
||||
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
|
||||
echo "No display found, starting headless X server with 3 virtual monitors..."
|
||||
|
||||
# Find an available display number
|
||||
XDISPLAY=99
|
||||
while [ -S "/tmp/.X11-unix/X$XDISPLAY" ]; do
|
||||
XDISPLAY=$((XDISPLAY + 1))
|
||||
done
|
||||
|
||||
# Start Xorg with dummy driver config for 3 monitors
|
||||
XORG_CONFIG="$SCRIPT_DIR/xorg-dummy.conf"
|
||||
Xorg :$XDISPLAY -config "$XORG_CONFIG" -noreset +extension GLX +extension RANDR +extension RENDER &
|
||||
XORG_PID=$!
|
||||
sleep 2
|
||||
|
||||
export DISPLAY=:$XDISPLAY
|
||||
|
||||
# Configure 3 virtual monitors using xrandr
|
||||
# Add mode to disconnected DUMMY outputs and position them
|
||||
xrandr --newmode "1920x1080" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync 2>/dev/null || true
|
||||
|
||||
# Add mode to DUMMY1 and DUMMY2, then enable them
|
||||
xrandr --addmode DUMMY1 "1920x1080" 2>/dev/null || true
|
||||
xrandr --addmode DUMMY2 "1920x1080" 2>/dev/null || true
|
||||
|
||||
# Position the outputs side by side
|
||||
xrandr --output DUMMY0 --mode 1920x1080 --pos 0x0 --primary
|
||||
xrandr --output DUMMY1 --mode 1920x1080 --pos 1920x0 2>/dev/null || true
|
||||
xrandr --output DUMMY2 --mode 1920x1080 --pos 3840x0 2>/dev/null || true
|
||||
|
||||
echo "Headless X server started on :$XDISPLAY"
|
||||
|
||||
# Launch remote-viewer in fullscreen to request all monitors
|
||||
remote-viewer --full-screen spice://localhost:5930 &
|
||||
VIEWER_PID=$!
|
||||
echo "remote-viewer running headlessly (PID: $VIEWER_PID)"
|
||||
else
|
||||
echo "Launching remote-viewer with fullscreen for multi-display (DISPLAY=$DISPLAY, WAYLAND_DISPLAY=$WAYLAND_DISPLAY)..."
|
||||
remote-viewer --full-screen spice://localhost:5930 &
|
||||
VIEWER_PID=$!
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "=== Press Ctrl-C to stop ==="
|
||||
echo ""
|
||||
|
||||
# Enable all 3 displays via SPICE protocol (waits for agent automatically)
|
||||
# Using 300s timeout since ISO boot can take several minutes
|
||||
if [ -f "$SCRIPT_DIR/enable-displays.py" ]; then
|
||||
echo "Enabling displays (waiting for SPICE agent, up to 5 minutes)..."
|
||||
python3 "$SCRIPT_DIR/enable-displays.py" --timeout 300 2>&1 &
|
||||
ENABLE_PID=$!
|
||||
# Start screenshot loop in background
|
||||
echo "Starting screenshot loop..."
|
||||
(while true; do "$SCRIPT_DIR/screenshot.sh" 2>/dev/null; sleep 5; done) &
|
||||
SCREENSHOT_LOOP_PID=$!
|
||||
fi
|
||||
|
||||
echo "Tips:"
|
||||
echo " - http://localhost:3006 - Management UI"
|
||||
echo " - socat - UNIX-CONNECT:.nogit/vm/serial.sock - Serial console (login: ecouser/ecouser)"
|
||||
if [ "$TARGET_ARCH" != "rpi" ]; then
|
||||
echo " - http://localhost:3006 - Management UI"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Start screenshot loop in background (takes screenshots every 5 seconds)
|
||||
echo "Starting screenshot loop..."
|
||||
(while true; do "$SCRIPT_DIR/screenshot.sh" 2>/dev/null; sleep 5; done) &
|
||||
SCREENSHOT_LOOP_PID=$!
|
||||
|
||||
if [ "$AUTO_MODE" = true ]; then
|
||||
if [ "$AUTO_MODE" = true ] && [ "$TARGET_ARCH" = "amd64" ]; then
|
||||
echo "=== Auto mode: waiting for display setup ==="
|
||||
|
||||
# Wait for enable-displays.py to complete
|
||||
if [ -n "$ENABLE_PID" ]; then
|
||||
wait $ENABLE_PID
|
||||
ENABLE_EXIT=$?
|
||||
@@ -240,11 +368,9 @@ if [ "$AUTO_MODE" = true ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Take screenshot
|
||||
echo "Taking screenshot..."
|
||||
"$SCRIPT_DIR/screenshot.sh"
|
||||
|
||||
# Verify screenshot dimensions (should be 5760x1080 for 3 displays)
|
||||
SCREENSHOT="$PROJECT_ROOT/.nogit/screenshots/latest.png"
|
||||
if [ -f "$SCREENSHOT" ]; then
|
||||
WIDTH=$(identify -format "%w" "$SCREENSHOT" 2>/dev/null || echo "0")
|
||||
@@ -260,6 +386,7 @@ if [ "$AUTO_MODE" = true ]; then
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# Interactive mode - wait for QEMU to exit
|
||||
echo "=== Press Ctrl-C to stop ==="
|
||||
echo ""
|
||||
wait $QEMU_PID 2>/dev/null || true
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user