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
|
#!/bin/bash
# scripts/qemu-wrapper.sh
WORKSPACE_DIR=${1:-.}
BUILD_TYPE=${2:-Debug}
ISO_PATH=$3
IS_DEBUG=${4:-0}
if [ -z "$ISO_PATH" ]; then
echo "Usage: $0 <workspace_dir> <build_type> <iso_path> [is_debug]"
exit 1
fi
ARGS=(
"-m" "64M"
"-machine" "q35"
"-smp" "4,sockets=1,cores=4,threads=1"
"-object" "rng-random,filename=/dev/random,id=rng0"
"-device" "pcie-root-port,id=rp1,bus=pcie.0,chassis=1,slot=1"
"-device" "x3130-upstream,id=up1,bus=rp1"
"-device" "xio3130-downstream,id=down1,bus=up1,chassis=2,slot=0"
"-device" "virtio-rng-pci,bus=down1,rng=rng0"
"-display" "curses"
"-debugcon" "file:${WORKSPACE_DIR}/qemu-debugcon-${BUILD_TYPE}.log"
"-cdrom" "${ISO_PATH}"
)
if [ "$IS_DEBUG" == "1" ]; then
ARGS=( "-s" "-no-reboot" "-d" "int,cpu_reset" "${ARGS[@]}" )
fi
echo "QEMU WRAPPER: Executing TeachOS"
echo "Arguments: ${ARGS[@]}"
qemu-system-x86_64 "${ARGS[@]}" 2> "${WORKSPACE_DIR}/qemu-stderr-${BUILD_TYPE}.log"
|