mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-10-01 06:21:56 -09:00
board/qemu/start-qemu.sh.in: rework argument handling
Provides the ability to forward command line options directly to QEMU. When invoking `start-qemu.sh`, users can forward arguments by adding a double dash (`--`) into the argument set, and any trailing arguments will be forwarded into QEMU. For example, `start-qemu.sh -- --help`. The original implementation supported a "serial-only" command line argument to help run in a non-graphical mode for some use cases. These changes try to promote a newly added `--serial-only` argument to drive this mode; that being said, a `serial-only` argument will still be accepted for backwards compatibility. Signed-off-by: James Knight <james.d.knight@live.com> [yann.morin.1998@free.fr: - drop the warning: unknown options cause 'exit 1' already, and any leftover is explicitly for qemu. - use false/true instead of 0/1 ] Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
committed by
Yann E. MORIN
parent
b32d7c99c6
commit
16c497e0a6
@@ -4,11 +4,20 @@ BINARIES_DIR="${0%/*}/"
|
|||||||
# shellcheck disable=SC2164
|
# shellcheck disable=SC2164
|
||||||
cd "${BINARIES_DIR}"
|
cd "${BINARIES_DIR}"
|
||||||
|
|
||||||
if [ "${1}" = "serial-only" ]; then
|
mode_serial=false
|
||||||
|
while [ "$1" ]; do
|
||||||
|
case "$1" in
|
||||||
|
--serial-only|serial-only) mode_serial=true; shift;;
|
||||||
|
--) shift; break;;
|
||||||
|
*) echo "unknown option: $1" >&2; exit 1;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if ${mode_serial}; then
|
||||||
EXTRA_ARGS='@SERIAL_ARGS@'
|
EXTRA_ARGS='@SERIAL_ARGS@'
|
||||||
else
|
else
|
||||||
EXTRA_ARGS='@DEFAULT_ARGS@'
|
EXTRA_ARGS='@DEFAULT_ARGS@'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export PATH="@HOST_DIR@/bin:${PATH}"
|
export PATH="@HOST_DIR@/bin:${PATH}"
|
||||||
exec @QEMU_CMD_LINE@ ${EXTRA_ARGS}
|
exec @QEMU_CMD_LINE@ ${EXTRA_ARGS} "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user