88 lines
2.8 KiB
Bash
Executable File
88 lines
2.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Copyright 2025, Stormux, <storm_dragon@stormux.org>
|
|
#
|
|
# This is free software; you can redistribute it and/or modify it under the
|
|
# terms of the GNU General Public License as published by the Free
|
|
# Software Foundation; either version 3, or (at your option) any later
|
|
# version.
|
|
#
|
|
# This software is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
# General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this package; see the file COPYING. If not, write to the Free
|
|
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
# 02110-1301, USA.
|
|
#
|
|
# Boot Stormux x86_64 ISO in QEMU with audio support
|
|
|
|
set -e
|
|
|
|
# Get the directory where this script is located
|
|
scriptDir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
outDir="${scriptDir}/out"
|
|
logDir="${scriptDir}/logs"
|
|
|
|
# Create logs directory if it doesn't exist
|
|
mkdir -p "$logDir"
|
|
|
|
# Generate timestamp for log files
|
|
timestamp=$(date +%Y%m%d_%H%M%S)
|
|
qemuLog="${logDir}/qemu-boot_${timestamp}.log"
|
|
serialLog="${logDir}/serial-console_${timestamp}.log"
|
|
|
|
# Find the most recent ISO in the out directory
|
|
if [[ ! -d "$outDir" ]]; then
|
|
echo "Error: Output directory not found: $outDir"
|
|
echo "Please build an ISO first using: sudo ./build.sh"
|
|
exit 1
|
|
fi
|
|
|
|
# Find the most recent ISO file
|
|
isoFile=$(find "$outDir" -name "*.iso" -type f -printf '%T@ %p\n' 2>/dev/null | sort -rn | head -1 | cut -d' ' -f2-)
|
|
|
|
if [[ -z "$isoFile" ]]; then
|
|
echo "Error: No ISO file found in $outDir"
|
|
echo "Please build an ISO first using: sudo ./build.sh"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Found ISO: $isoFile"
|
|
echo "Booting Stormux in QEMU with audio support..."
|
|
echo
|
|
echo "Logging to:"
|
|
echo " QEMU log: $qemuLog"
|
|
echo " Serial console: $serialLog"
|
|
echo
|
|
echo "Note: After boot, press Ctrl+Alt+F2 to switch to tty2"
|
|
echo " where the stormux user will be logged in with Fenrir screen reader."
|
|
echo " You can monitor the serial console log in real-time with:"
|
|
echo " tail -f $serialLog"
|
|
echo
|
|
|
|
# Export DISPLAY for console usage
|
|
export DISPLAY="${DISPLAY:-:0}"
|
|
|
|
# Boot QEMU with audio support and logging
|
|
# -D: QEMU debug log (shows QEMU errors, device issues)
|
|
# -d: Debug categories (guest_errors, cpu_reset)
|
|
# -serial: Capture guest serial console (systemd messages, boot logs)
|
|
# -audiodev: PulseAudio backend for audio
|
|
# -device intel-hda: Intel HD Audio controller
|
|
# -device hda-duplex: HD Audio codec with input/output, connected to audiodev
|
|
exec qemu-system-x86_64 \
|
|
-enable-kvm \
|
|
-m 2048 \
|
|
-cdrom "$isoFile" \
|
|
-boot d \
|
|
-audiodev pa,id=snd0 \
|
|
-device intel-hda \
|
|
-device hda-duplex,audiodev=snd0 \
|
|
-serial file:"$serialLog" \
|
|
-D "$qemuLog" \
|
|
-d guest_errors,cpu_reset \
|
|
-display gtk
|