mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-08 08:30:47 -09:00
board/qemu: define start qemu script outside of post-image script
The following moves the definition of the QEMU board's `start-qemu.sh` helper script from being inlined in the post-image script into its own file. This should, in theory, make it easier to maintain the script in the future. Signed-off-by: James Knight <james.d.knight@live.com> [yann.morin.1998@free.fr: - don't sub-shell in the script - merge all 3 sed calls into one - create dest file with the sed, don't cp first - also substitute HOST_DIR - fix shellcheck ] Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
committed by
Yann E. MORIN
parent
6a6a11f64b
commit
d9b244d8a3
@@ -41,21 +41,10 @@ case ${DEFCONFIG_NAME} in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
cat <<-_EOF_ > "${START_QEMU_SCRIPT}"
|
sed "s|@SERIAL_ARGS@|${SERIAL_ARGS}|g" \
|
||||||
#!/bin/sh
|
"s|@DEFAULT_ARGS@|${DEFAULT_ARGS}|g" \
|
||||||
(
|
"s|@QEMU_CMD_LINE@|${QEMU_CMD_LINE}|g" \
|
||||||
BINARIES_DIR="\${0%/*}/"
|
"s|@HOST_DIR@|${HOST_DIR}|g" \
|
||||||
cd \${BINARIES_DIR}
|
<"${QEMU_BOARD_DIR}/start-qemu.sh.in" \
|
||||||
|
>"${START_QEMU_SCRIPT}"
|
||||||
if [ "\${1}" = "serial-only" ]; then
|
|
||||||
EXTRA_ARGS='${SERIAL_ARGS}'
|
|
||||||
else
|
|
||||||
EXTRA_ARGS='${DEFAULT_ARGS}'
|
|
||||||
fi
|
|
||||||
|
|
||||||
export PATH="${HOST_DIR}/bin:\${PATH}"
|
|
||||||
exec ${QEMU_CMD_LINE} \${EXTRA_ARGS}
|
|
||||||
)
|
|
||||||
_EOF_
|
|
||||||
|
|
||||||
chmod +x "${START_QEMU_SCRIPT}"
|
chmod +x "${START_QEMU_SCRIPT}"
|
||||||
|
|||||||
14
board/qemu/start-qemu.sh.in
Normal file
14
board/qemu/start-qemu.sh.in
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
BINARIES_DIR="${0%/*}/"
|
||||||
|
# shellcheck disable=SC2164
|
||||||
|
cd "${BINARIES_DIR}"
|
||||||
|
|
||||||
|
if [ "${1}" = "serial-only" ]; then
|
||||||
|
EXTRA_ARGS='@SERIAL_ARGS@'
|
||||||
|
else
|
||||||
|
EXTRA_ARGS='@DEFAULT_ARGS@'
|
||||||
|
fi
|
||||||
|
|
||||||
|
export PATH="@HOST_DIR@/bin:${PATH}"
|
||||||
|
exec @QEMU_CMD_LINE@ ${EXTRA_ARGS}
|
||||||
Reference in New Issue
Block a user