Updated parameter handling and added functionality.
This commit is contained in:
parent
10a6806fad
commit
606c2579e5
62
boot.sh
62
boot.sh
@ -1,40 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
set -ex
|
||||||
|
|
||||||
show_help () {
|
QEMU_KERNEL_PARAMS="$@"
|
||||||
echo "Usage: $0 [QEMU options]"
|
|
||||||
echo "Options:"
|
|
||||||
echo " -h Show this help message."
|
|
||||||
echo " --kernelp {bench2|debug2} Kernel parameter:"
|
|
||||||
echo " bench2: to execute benchmark suite at boot stage 2."
|
|
||||||
echo " debug2: to get an interactive shell at boot stage 2."
|
|
||||||
}
|
|
||||||
|
|
||||||
QEMU_KERNEL_PARAMS=""
|
|
||||||
OPTIONS=$(getopt -o h -l help,kernelp: -n "$0" -- "$@")
|
|
||||||
|
|
||||||
eval set -- "$OPTIONS"
|
|
||||||
|
|
||||||
while true
|
|
||||||
do
|
|
||||||
case "$1" in
|
|
||||||
--kernelp)
|
|
||||||
QEMU_KERNEL_PARAMS="$2"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
-h|--help)
|
|
||||||
show_help
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
--)
|
|
||||||
shift
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
set -x
|
|
||||||
|
|
||||||
#export PATH=/nix/store/c5xwy0rllg4lcw61mh20glairjz7ibv4-qemu-8.0.4/bin/:$PATH
|
#export PATH=/nix/store/c5xwy0rllg4lcw61mh20glairjz7ibv4-qemu-8.0.4/bin/:$PATH
|
||||||
|
|
||||||
@ -81,8 +49,9 @@ cd "$TMPDIR"
|
|||||||
#DEBUG_CPU="-d cpu_reset"
|
#DEBUG_CPU="-d cpu_reset"
|
||||||
#DEBUG_CPU="-d in_asm,cpu,cpu_reset"
|
#DEBUG_CPU="-d in_asm,cpu,cpu_reset"
|
||||||
|
|
||||||
run_qemu () {
|
run_qemu () {
|
||||||
qemu-system-riscv64 \
|
|
||||||
|
CMD='qemu-system-riscv64 \
|
||||||
$DEBUG_GDB \
|
$DEBUG_GDB \
|
||||||
$DEBUG_CPU \
|
$DEBUG_CPU \
|
||||||
-name nixos-riscv \
|
-name nixos-riscv \
|
||||||
@ -104,13 +73,19 @@ run_qemu () {
|
|||||||
-device vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid=123 \
|
-device vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid=123 \
|
||||||
-serial mon:stdio \
|
-serial mon:stdio \
|
||||||
-append "$(cat $system/kernel-params) init=$system/init console=ttyS0 loglevel=7 $QEMU_KERNEL_PARAMS" \
|
-append "$(cat $system/kernel-params) init=$system/init console=ttyS0 loglevel=7 $QEMU_KERNEL_PARAMS" \
|
||||||
$QEMU_OPTS
|
$QEMU_OPTS \
|
||||||
"$@" 2>&1
|
"$@"'
|
||||||
|
|
||||||
|
if [[ "$QEMU_KERNEL_PARAMS" =~ bench2 ]]; then
|
||||||
|
eval "$CMD &"
|
||||||
|
echo "$!" > qemu.pid
|
||||||
|
else
|
||||||
|
eval "$CMD"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $QEMU_KERNEL_PARAMS == "bench2" ]; then
|
if [[ "$QEMU_KERNEL_PARAMS" =~ bench2 ]]; then
|
||||||
run_qemu | awk -f $CDIR/verify_rvb.awk
|
run_qemu | awk -f $CDIR/verify-bench2.awk
|
||||||
echo "The exit status value is $?"
|
|
||||||
else
|
else
|
||||||
run_qemu
|
run_qemu
|
||||||
fi
|
fi
|
||||||
@ -131,8 +106,7 @@ fi
|
|||||||
# -net nic,netdev=user.0,model=virtio -netdev user,id=user.0,"$QEMU_NET_OPTS" \
|
# -net nic,netdev=user.0,model=virtio -netdev user,id=user.0,"$QEMU_NET_OPTS" \
|
||||||
#console=tty0
|
#console=tty0
|
||||||
#console=ttyS0,115200n8
|
#console=ttyS0,115200n8
|
||||||
#
|
|
||||||
# -fsdev local,id=fsdev1,path=/nix/store,security_model=none \
|
|
||||||
# -device virtio-9p-pci,fsdev=fsdev1,mount_tag=store,bus=pcie.1 \
|
# -device virtio-9p-pci,fsdev=fsdev1,mount_tag=store,bus=pcie.1 \
|
||||||
#
|
#
|
||||||
# -drive cache=writeback,file="$NIX_DISK_IMAGE",id=drive1,if=none,index=1,werror=report -device virtio-blk-pci,drive=drive1 \
|
# -drive cache=writeback,file="$NIX_DISK_IMAGE",id=drive1,if=none,index=1,werror=report -device virtio-blk-pci,drive=drive1 \
|
||||||
|
Loading…
Reference in New Issue
Block a user