From: Romain Naour <romain.naour@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCHv4 3/4] board/qemu/post-image.sh: execute from BINARIES_DIR
Date: Tue, 24 Nov 2020 21:30:21 +0100 [thread overview]
Message-ID: <20201124203022.477461-3-romain.naour@gmail.com> (raw)
In-Reply-To: <20201124203022.477461-1-romain.naour@gmail.com>
Usually the qemu command line start directly with "qemu-system-<arch> ...".
But the command line for qemu_arm_vexpress_tz_defconfig start by doing
"cd output/images && ../host/bin/qemu-system-arm". This is necessary
since boot binaries, except BL1, are primarily loaded via semi-hosting
so all binaries has to reside in the same directory as QEMU is started
from [1].
To order to handle this case correctly, update the post-image.sh used
by all qemu defconfigs to execute qemu from BINARIES_DIR.
Since we have to change the current directory use a subshell to
restore the current directory after Qemu execution.
[1] https://github.com/ARM-software/arm-trusted-firmware/blob/4ebbea9592ab37fc62217d0ac62fa13a3e063527/docs/plat/qemu.rst
Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Yann E. MORIN <yann.morin.1998@free.fr>
---
v4: fix removing "output/images/"
v3: new patch
---
board/qemu/post-image.sh | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/board/qemu/post-image.sh b/board/qemu/post-image.sh
index f34bf5043a..404f77411c 100755
--- a/board/qemu/post-image.sh
+++ b/board/qemu/post-image.sh
@@ -19,9 +19,9 @@ if [ -z "${QEMU_CMD_LINE}" ]; then
exit 0
fi
-# Replace output/images path by ${BINARIES_DIR} since the script
-# will be in the same directory as the kernel and the rootfs images.
-QEMU_CMD_LINE="${QEMU_CMD_LINE//output\/images/\${BINARIES_DIR\}}"
+# Remove output/images path since the script will be in
+# the same directory as the kernel and the rootfs images.
+QEMU_CMD_LINE="${QEMU_CMD_LINE//output\/images\//}"
# Remove -serial stdio if present, keep it as default args
DEFAULT_ARGS="$(sed -r -e '/-serial stdio/!d; s/.*(-serial stdio).*/\1/' <<<"${QEMU_CMD_LINE}")"
@@ -40,7 +40,9 @@ esac
cat <<-_EOF_ > "${START_QEMU_SCRIPT}"
#!/bin/sh
+ (
BINARIES_DIR="\${0%/*}/"
+ cd \${BINARIES_DIR}
if [ "\${1}" = "serial-only" ]; then
EXTRA_ARGS='${SERIAL_ARGS}'
@@ -50,6 +52,7 @@ cat <<-_EOF_ > "${START_QEMU_SCRIPT}"
export PATH="${HOST_DIR}/bin:\${PATH}"
exec ${QEMU_CMD_LINE} \${EXTRA_ARGS}
+ )
_EOF_
chmod +x "${START_QEMU_SCRIPT}"
--
2.25.4
next prev parent reply other threads:[~2020-11-24 20:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-24 20:30 [Buildroot] [PATCHv4 1/4] support/scripts/boot-qemu-image.py: don't fail if start-qemu.sh is missing Romain Naour
2020-11-24 20:30 ` [Buildroot] [PATCHv4 2/4] board/qemu/post-image.sh: rename IMAGE_DIR to BINARIES_DIR Romain Naour
2020-11-24 20:30 ` Romain Naour [this message]
2020-11-24 20:30 ` [Buildroot] [PATCHv4 4/4] configs/qemu_arm_vexpress_tz_defconfig: build start-qemu.sh Romain Naour
2020-12-05 21:35 ` [Buildroot] [PATCHv4 1/4] support/scripts/boot-qemu-image.py: don't fail if start-qemu.sh is missing Thomas Petazzoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201124203022.477461-3-romain.naour@gmail.com \
--to=romain.naour@gmail.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.