Basic installation now working, system comes up talking.
This commit is contained in:
@@ -21,10 +21,34 @@
|
||||
|
||||
set -e
|
||||
|
||||
# Parse command line arguments
|
||||
bootInstalled=false
|
||||
while getopts "ih" opt; do
|
||||
case "$opt" in
|
||||
i) bootInstalled=true ;;
|
||||
h)
|
||||
echo "Usage: $0 [options]"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -i Boot from installed system (virtual disk) instead of ISO"
|
||||
echo " -h Show this help"
|
||||
echo
|
||||
echo "Without -i flag, boots from ISO with virtual disk attached for installation."
|
||||
echo "With -i flag, boots only from virtual disk (installed system)."
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Use -h for help"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Get the directory where this script is located
|
||||
scriptDir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
outDir="${scriptDir}/out"
|
||||
logDir="${scriptDir}/logs"
|
||||
diskFile="${scriptDir}/stormux-test-disk.qcow2"
|
||||
|
||||
# Create logs directory if it doesn't exist
|
||||
mkdir -p "$logDir"
|
||||
@@ -34,31 +58,54 @@ 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
|
||||
# Create virtual disk if it doesn't exist
|
||||
if [[ ! -f "$diskFile" ]]; then
|
||||
echo "Creating virtual disk: $diskFile (10GB)"
|
||||
qemu-img create -f qcow2 "$diskFile" 10G
|
||||
echo "Virtual disk created successfully"
|
||||
echo
|
||||
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-)
|
||||
# Find ISO file (only needed if not booting installed system)
|
||||
isoFile=""
|
||||
if [[ "$bootInstalled" == false ]]; then
|
||||
# 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
|
||||
|
||||
if [[ -z "$isoFile" ]]; then
|
||||
echo "Error: No ISO file found in $outDir"
|
||||
echo "Please build an ISO first using: sudo ./build.sh"
|
||||
exit 1
|
||||
# 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
|
||||
fi
|
||||
|
||||
echo "Found ISO: $isoFile"
|
||||
echo "Booting Stormux in QEMU with audio support..."
|
||||
if [[ "$bootInstalled" == true ]]; then
|
||||
echo "Booting installed system from: $diskFile"
|
||||
else
|
||||
echo "Found ISO: $isoFile"
|
||||
echo "Booting Stormux ISO in QEMU with virtual disk attached..."
|
||||
echo "Virtual disk: $diskFile"
|
||||
fi
|
||||
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."
|
||||
if [[ "$bootInstalled" == false ]]; then
|
||||
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 " Run 'sudo install-stormux' to install to the virtual disk."
|
||||
echo " After installation, use './qemu-boot.sh -i' to boot the installed system."
|
||||
else
|
||||
echo "Note: Booting from installed system on virtual disk."
|
||||
fi
|
||||
echo " You can monitor the serial console log in real-time with:"
|
||||
echo " tail -f $serialLog"
|
||||
echo
|
||||
@@ -66,6 +113,30 @@ echo
|
||||
# Export DISPLAY for console usage
|
||||
export DISPLAY="${DISPLAY:-:0}"
|
||||
|
||||
# Build QEMU command based on boot mode
|
||||
# Common options for both modes
|
||||
# shellcheck disable=SC2054
|
||||
qemuCmd=(
|
||||
qemu-system-x86_64
|
||||
-enable-kvm
|
||||
-m 2048
|
||||
-drive file="$diskFile",format=qcow2
|
||||
-audiodev pa,id=snd0
|
||||
-device intel-hda
|
||||
-device hda-duplex,audiodev=snd0
|
||||
-serial file:"$serialLog"
|
||||
-D "$qemuLog"
|
||||
-d guest_errors,cpu_reset
|
||||
-display gtk
|
||||
)
|
||||
|
||||
# Add ISO and boot order if booting from ISO
|
||||
if [[ "$bootInstalled" == false ]]; then
|
||||
qemuCmd+=(-cdrom "$isoFile" -boot order=dc)
|
||||
else
|
||||
qemuCmd+=(-boot c)
|
||||
fi
|
||||
|
||||
# Boot QEMU with audio support and logging
|
||||
# -D: QEMU debug log (shows QEMU errors, device issues)
|
||||
# -d: Debug categories (guest_errors, cpu_reset)
|
||||
@@ -73,15 +144,4 @@ export DISPLAY="${DISPLAY:-:0}"
|
||||
# -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
|
||||
exec "${qemuCmd[@]}"
|
||||
|
||||
Reference in New Issue
Block a user