[arch][riscv] restructure the qemu starter script to share the embedded and non embedded logic
This commit is contained in:
@@ -36,7 +36,6 @@ SMP=1
|
|||||||
MEMSIZE=512
|
MEMSIZE=512
|
||||||
SUDO=""
|
SUDO=""
|
||||||
PROJECT=""
|
PROJECT=""
|
||||||
BIOS="none"
|
|
||||||
|
|
||||||
while getopts bdhm:cMmnteu6p:s:S FLAG; do
|
while getopts bdhm:cMmnteu6p:s:S FLAG; do
|
||||||
case $FLAG in
|
case $FLAG in
|
||||||
@@ -62,6 +61,9 @@ done
|
|||||||
|
|
||||||
shift $((OPTIND-1))
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
|
CPU=""
|
||||||
|
BIOS=""
|
||||||
|
|
||||||
if (( $DO_UNLEASHED == 1 )); then
|
if (( $DO_UNLEASHED == 1 )); then
|
||||||
QEMU="qemu-system-riscv64"
|
QEMU="qemu-system-riscv64"
|
||||||
MACHINE="sifive_u"
|
MACHINE="sifive_u"
|
||||||
@@ -72,12 +74,12 @@ if (( $DO_UNLEASHED == 1 )); then
|
|||||||
if (( $MEMSIZE == 512 )); then
|
if (( $MEMSIZE == 512 )); then
|
||||||
MEMSIZE=8192
|
MEMSIZE=8192
|
||||||
fi
|
fi
|
||||||
CPU="sifive-u54"
|
|
||||||
BIOS="default"
|
|
||||||
elif (( $DO_EMBEDDED == 1 )); then
|
elif (( $DO_EMBEDDED == 1 )); then
|
||||||
QEMU="qemu-system-riscv32"
|
QEMU="qemu-system-riscv32"
|
||||||
MACHINE="sifive_e"
|
MACHINE="sifive_e"
|
||||||
_PROJECT="sifive-e-test"
|
_PROJECT="sifive-e-test"
|
||||||
|
MEMSIZE=0
|
||||||
|
SMP=0
|
||||||
elif (( $DO_64BIT )); then
|
elif (( $DO_64BIT )); then
|
||||||
QEMU="qemu-system-riscv64"
|
QEMU="qemu-system-riscv64"
|
||||||
CPU="rv64"
|
CPU="rv64"
|
||||||
@@ -87,14 +89,16 @@ elif (( $DO_64BIT )); then
|
|||||||
BIOS="default"
|
BIOS="default"
|
||||||
else
|
else
|
||||||
_PROJECT="qemu-virt-riscv64-test"
|
_PROJECT="qemu-virt-riscv64-test"
|
||||||
|
BIOS="none"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
QEMU="qemu-system-riscv32"
|
QEMU="qemu-system-riscv32"
|
||||||
CPU="rv32"
|
CPU="rv32"
|
||||||
MACHINE="virt"
|
MACHINE="virt"
|
||||||
_PROJECT="qemu-virt-riscv32-test"
|
_PROJECT="qemu-virt-riscv32-test"
|
||||||
|
BIOS="none"
|
||||||
fi
|
fi
|
||||||
if [ "$PROJECT" == "" ]; then
|
if [[ -z "$PROJECT" ]]; then
|
||||||
PROJECT=$_PROJECT
|
PROJECT=$_PROJECT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -104,28 +108,33 @@ NET_TAP_ARGS=" -netdev tap,id=vmnic -device virtio-net-device,netdev=vmnic"
|
|||||||
NO_DISPLAY_ARGS=" -nographic"
|
NO_DISPLAY_ARGS=" -nographic"
|
||||||
DISPLAY_ARGS=" -device virtio-gpu-device -serial stdio"
|
DISPLAY_ARGS=" -device virtio-gpu-device -serial stdio"
|
||||||
|
|
||||||
# the following args only really make sense on non embedded versions
|
# construct a list of args based on previous variables
|
||||||
if (( ! $DO_EMBEDDED )); then
|
ARGS=" -machine $MACHINE -kernel build-${PROJECT}/lk.elf"
|
||||||
ARGS=" -cpu $CPU -m $MEMSIZE -smp $SMP -machine $MACHINE -kernel build-${PROJECT}/lk.elf"
|
if [[ ! -z "$CPU" ]]; then
|
||||||
|
ARGS+=" -cpu $CPU"
|
||||||
|
fi
|
||||||
|
if (( $MEMSIZE )); then
|
||||||
|
ARGS+=" -m $MEMSIZE"
|
||||||
|
fi
|
||||||
|
if (( $SMP )); then
|
||||||
|
ARGS+=" -smp $SMP"
|
||||||
|
fi
|
||||||
|
if [[ ! -z "$BIOS" ]]; then
|
||||||
ARGS+=" -bios $BIOS"
|
ARGS+=" -bios $BIOS"
|
||||||
if (( $DO_BLOCK )); then
|
fi
|
||||||
ARGS+=$BLOCK_ARGS
|
if (( $DO_BLOCK )); then
|
||||||
fi
|
ARGS+=$BLOCK_ARGS
|
||||||
if (( $DO_NET )); then
|
fi
|
||||||
ARGS+=$NET_ARGS
|
if (( $DO_NET )); then
|
||||||
fi
|
ARGS+=$NET_ARGS
|
||||||
if (( $DO_NET_TAP )); then
|
fi
|
||||||
ARGS+=$NET_TAP_ARGS
|
if (( $DO_NET_TAP )); then
|
||||||
SUDO="sudo "
|
ARGS+=$NET_TAP_ARGS
|
||||||
fi
|
SUDO="sudo "
|
||||||
if (( $DO_DISPLAY )); then
|
fi
|
||||||
ARGS+=$DISPLAY_ARGS
|
if (( $DO_DISPLAY )); then
|
||||||
else
|
ARGS+=$DISPLAY_ARGS
|
||||||
ARGS+=$NO_DISPLAY_ARGS
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
# embedded machine is more fixed and only get these options
|
|
||||||
ARGS="-machine $MACHINE -kernel build-${PROJECT}/lk.elf"
|
|
||||||
ARGS+=$NO_DISPLAY_ARGS
|
ARGS+=$NO_DISPLAY_ARGS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user