1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/bin/bash qemu_args=() while [[ "$1" != "" ]] do case "$1" in -Wq,*) qemu_args+=("$(echo "$1" | cut -d, -f2-)");; *) break;; esac shift done xlen="$(readelf -h $1 | grep 'Class' | cut -d: -f 2 | xargs echo | sed 's/^ELF//')" QEMU_CPU=${QEMU_CPU} qemu-riscv$xlen -r 5.10 "${qemu_args[@]}" -L ${RISC_V_SYSROOT} "$@"