Updated parameter handling and added functionality.
This commit is contained in:
parent
10a6806fad
commit
606c2579e5
58
boot.sh
58
boot.sh
@ -1,40 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -ex
|
||||
|
||||
show_help () {
|
||||
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
|
||||
QEMU_KERNEL_PARAMS="$@"
|
||||
|
||||
#export PATH=/nix/store/c5xwy0rllg4lcw61mh20glairjz7ibv4-qemu-8.0.4/bin/:$PATH
|
||||
|
||||
@ -82,7 +50,8 @@ cd "$TMPDIR"
|
||||
#DEBUG_CPU="-d in_asm,cpu,cpu_reset"
|
||||
|
||||
run_qemu () {
|
||||
qemu-system-riscv64 \
|
||||
|
||||
CMD='qemu-system-riscv64 \
|
||||
$DEBUG_GDB \
|
||||
$DEBUG_CPU \
|
||||
-name nixos-riscv \
|
||||
@ -104,13 +73,19 @@ run_qemu () {
|
||||
-device vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid=123 \
|
||||
-serial mon:stdio \
|
||||
-append "$(cat $system/kernel-params) init=$system/init console=ttyS0 loglevel=7 $QEMU_KERNEL_PARAMS" \
|
||||
$QEMU_OPTS
|
||||
"$@" 2>&1
|
||||
$QEMU_OPTS \
|
||||
"$@"'
|
||||
|
||||
if [[ "$QEMU_KERNEL_PARAMS" =~ bench2 ]]; then
|
||||
eval "$CMD &"
|
||||
echo "$!" > qemu.pid
|
||||
else
|
||||
eval "$CMD"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ $QEMU_KERNEL_PARAMS == "bench2" ]; then
|
||||
run_qemu | awk -f $CDIR/verify_rvb.awk
|
||||
echo "The exit status value is $?"
|
||||
if [[ "$QEMU_KERNEL_PARAMS" =~ bench2 ]]; then
|
||||
run_qemu | awk -f $CDIR/verify-bench2.awk
|
||||
else
|
||||
run_qemu
|
||||
fi
|
||||
@ -131,8 +106,7 @@ fi
|
||||
# -net nic,netdev=user.0,model=virtio -netdev user,id=user.0,"$QEMU_NET_OPTS" \
|
||||
#console=tty0
|
||||
#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 \
|
||||
#
|
||||
# -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