board/qemu/post-image.sh: execute from BINARIES_DIR
authorRomain Naour <romain.naour@gmail.com>
Tue, 24 Nov 2020 20:30:21 +0000 (21:30 +0100)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sat, 5 Dec 2020 21:34:28 +0000 (22:34 +0100)
commit3fc3289a3f83e1b8193a34e2b48957034deaa873
treef5f33a698fc1db21d10f5dc2ed57ddb844e9eb5e
parent7c48c677a9f5f9113b38d21030e7b103749d2463
board/qemu/post-image.sh: execute from BINARIES_DIR

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>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
board/qemu/post-image.sh