Skip to content

Commit ed73480

Browse files
authored
Fix install directory for FVP crypto plugin. (#577)
Before this patch, running get_fvps.sh --non-interactive would make a weirdly named directory in the user's home, with a name like "". or "." (depending on circumstances), with the crypto plugins installed in it. Now --non-interactive installs the plugins under fvp/install in your git checkout of this repository, which is where they should have been. The problem was because of this construction in get_fvps.sh: INSTALLER_FLAGS_CRYPTO="... --basepath \"$(dirname \"$0\")\"" which has multiple shell errors. Firstly, the \" around $0 are taken literally, so dirname is handed a path beginning with a double quote, which propagates into the path it returns. Secondly, the \" around $(dirname) are also literal, but _not_ reprocessed when $INSTALLER_FLAGS_CRYPTO is expanded on to the installer command line (because quote processing happens before variable expansion). The net effect is to give setup.bin a --basepath directory containing lots of confusing double quotes. For extra confusion, setup.bin appears to change directory to $HOME before interpreting that path, so you don't even get a strangely named directory under the FVP install directory – it appears in your home dir instead. Since this script already commits to bash rather than plain POSIX sh, the sensible fix for the quoting issues is to use a bash array variable to accumulate the extra arguments, and expand it via "${INSTALLER_FLAGS_CRYPTO[@]}". Also, the --basepath will need to be absolute rather than relative, to avoid confusion when setup.bin changes directory to $HOME. The easiest approach to _that_ is to use the fact that we were already issuing a `cd $(dirname "$0")` command to change into the fvp directory: do that earlier, and then we can use `$PWD` to retrieve the absolute path. This fixes --non-interactive. But another problem is that if you run setup.bin interactively, you'll have to enter the pathname by hand, and we don't give the user any guidance on what path to enter. So I've also updated the docs to explain the interactive installation more fully. This is all very error-prone, so I've also extended run_fvp.py so that it actually finds and loads the crypto plugin. That way, if it hasn't been installed in the right place, we find that out early, and can figure out what went wrong. (Finally, in this commit, I've also fixed a spelling error in one of the script's internal variables: CORSTONE, not CORSONE.)
1 parent dbe235a commit ed73480

File tree

3 files changed

+35
-16
lines changed

3 files changed

+35
-16
lines changed

arm-runtimes/test-support/run_fvp.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,26 @@
1212
class FVP:
1313
model_exe: str
1414
tarmac_plugin: str
15+
crypto_plugin: str
1516
cmdline_param: str
1617

1718
MODELS = {
1819
"corstone-310": FVP(
1920
"Corstone-310/models/Linux64_GCC-9.3/FVP_Corstone_SSE-310",
2021
"Corstone-310/plugins/Linux64_GCC-9.3/TarmacTrace.so",
22+
"FastModelsPortfolio_11.27/plugins/Linux64_GCC-9.3/Crypto.so",
2123
"cpu0.semihosting-cmd_line",
2224
),
2325
"aem-a": FVP(
2426
"Base_RevC_AEMvA_pkg/models/Linux64_GCC-9.3/FVP_Base_RevC-2xAEMvA",
2527
"Base_RevC_AEMvA_pkg/plugins/Linux64_GCC-9.3/TarmacTrace.so",
28+
"FastModelsPortfolio_11.27/plugins/Linux64_GCC-9.3/Crypto.so",
2629
"cluster0.cpu0.semihosting-cmd_line",
2730
),
2831
"aem-r": FVP(
2932
"AEMv8R_base_pkg/models/Linux64_GCC-9.3/FVP_BaseR_AEMv8R",
3033
"AEMv8R_base_pkg/plugins/Linux64_GCC-9.3/TarmacTrace.so",
34+
"FastModelsPortfolio_11.27/plugins/Linux64_GCC-9.3/Crypto.so",
3135
"cluster0.cpu0.semihosting-cmd_line",
3236
),
3337
}
@@ -56,6 +60,7 @@ def run_fvp(
5660
command.extend(["--config-file", path.join(fvp_config_dir, config + ".cfg")])
5761
command.extend(["--application", image])
5862
command.extend(["--parameter", f"{model.cmdline_param}={shlex.join(arguments)}"])
63+
command.extend(["--plugin", path.join(fvp_install_dir, model.crypto_plugin)])
5964
if tarmac_file is not None:
6065
command.extend([
6166
"--plugin",

docs/building-from-source.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,22 @@ which will prompt you to agree to their licenses. Some of the packages do not
4747
have installers, instead they place their license file into the
4848
`fvp/license_terms` directory, which you should read before continuing.
4949

50+
The installer for the cryptography plugin requires a graphical display to run:
51+
it cannot run in a pure terminal session such as you might start via SSH. Also,
52+
it will prompt for a directory to install the plugin into. You should enter the
53+
pathname `fvp/install` relative to the root of your checkout. The installer
54+
will automatically append a subdirectory `FastModelsPortfolio_11.27` to the end
55+
of that, and respond with a warning such as 'Directory [...] not found (but in
56+
patch mode). Continue installation?' Say yes to this prompt, and continue
57+
clicking 'Next' until installation is complete.
58+
5059
For non-interactive use (for example in CI systems), `get_fvps.sh` can be run
51-
with the `--non-interactive` option, which causes it to implcitly accept all of
52-
the EULAs. If you have previously downloaded and installed the FVPs outside of
53-
the source tree, you can set the `-DFVP_INSTALL_DIR=...` cmake option to set
54-
the path to them.
60+
with the `--non-interactive` option, which causes it to implicitly accept all
61+
of the EULAs and set up the correct install directories.
62+
63+
If you have previously downloaded and installed the FVPs outside of the source
64+
tree, you can set the `-DFVP_INSTALL_DIR=...` cmake option to set the path to
65+
them.
5566

5667
If the FVPs are not installed, tests which need them will be skipped, but QEMU
5768
tests will still be run, and all library variants will still be built.

fvp/get_fvps.sh

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@ set -euxo pipefail
1515
args=$(getopt --options "" --longoptions "non-interactive" -- "${@}") || exit
1616
eval "set -- ${args}"
1717

18-
INSTALLER_FLAGS_CORSTONE=""
19-
INSTALLER_FLAGS_CRYPTO=""
18+
# Change into the directory containing this script. We'll make
19+
# "download" and "install" subdirectories below that.
20+
cd "$(dirname "$0")"
21+
22+
INSTALLER_FLAGS_CORSTONE=()
23+
INSTALLER_FLAGS_CRYPTO=()
2024

2125
while true; do
2226
case "${1}" in
2327
(--non-interactive)
24-
INSTALLER_FLAGS_CORSTONE="--i-agree-to-the-contained-eula --no-interactive --force"
25-
INSTALLER_FLAGS_CRYPTO="--i-accept-the-end-user-license-agreement --basepath \"$(dirname \"$0\")\""
28+
INSTALLER_FLAGS_CORSTONE=(--i-agree-to-the-contained-eula --no-interactive --force)
29+
INSTALLER_FLAGS_CRYPTO=(--i-accept-the-end-user-license-agreement --basepath "$PWD/install")
2630
shift 1
2731
;;
2832
(--)
@@ -34,17 +38,15 @@ while true; do
3438
esac
3539
done
3640

37-
URL_CORSONE_310='https://developer.arm.com/-/media/Arm%20Developer%20Community/Downloads/OSS/FVP/Corstone-310/FVP_Corstone_SSE-310_11.24_13_Linux64.tgz?rev=c370b571bdff42d3a0152471eca3d798&hash=1E388EE3B6E8F675D02D2832DBE61946DEC0386A'
41+
URL_CORSTONE_310='https://developer.arm.com/-/media/Arm%20Developer%20Community/Downloads/OSS/FVP/Corstone-310/FVP_Corstone_SSE-310_11.24_13_Linux64.tgz?rev=c370b571bdff42d3a0152471eca3d798&hash=1E388EE3B6E8F675D02D2832DBE61946DEC0386A'
3842
URL_BASE_AEM_A='https://developer.arm.com/-/cdn-downloads/permalink/Fixed-Virtual-Platforms/FM-11.27/FVP_Base_RevC-2xAEMvA_11.27_19_Linux64.tgz'
3943
URL_BASE_AEM_R='https://developer.arm.com/-/cdn-downloads/permalink/Fixed-Virtual-Platforms/FM-11.27/FVP_Base_AEMv8R_11.27_19_Linux64.tgz'
4044
URL_CRYPTO='https://developer.arm.com/-/cdn-downloads/permalink/Fast-Models-Crypto-Plug-in/FM-11.27/FastModels_crypto_11.27.019_Linux64.tgz'
4145

42-
cd "$(dirname "$0")"
43-
4446
mkdir -p download
4547
pushd download
4648
DOWNLOAD_DIR="$(pwd)"
47-
wget --content-disposition --no-clobber "${URL_CORSONE_310}"
49+
wget --content-disposition --no-clobber "${URL_CORSTONE_310}"
4850
wget --content-disposition --no-clobber "${URL_BASE_AEM_A}"
4951
wget --content-disposition --no-clobber "${URL_BASE_AEM_R}"
5052
wget --content-disposition --no-clobber "${URL_CRYPTO}"
@@ -55,7 +57,7 @@ pushd install
5557

5658
if [ ! -d "Corstone-310" ]; then
5759
tar -xf ${DOWNLOAD_DIR}/FVP_Corstone_SSE-310_11.24_13_Linux64.tgz
58-
./FVP_Corstone_SSE-310.sh --destination ./Corstone-310 $INSTALLER_FLAGS_CORSTONE
60+
./FVP_Corstone_SSE-310.sh --destination ./Corstone-310 "${INSTALLER_FLAGS_CORSTONE[@]}"
5961
fi
6062

6163
if [ ! -d "Base_RevC_AEMvA_pkg" ]; then
@@ -72,9 +74,10 @@ if [ ! -d "FastModelsPortfolio_11.27" ]; then
7274
tar -xf ${DOWNLOAD_DIR}/FastModels_crypto_11.27.019_Linux64.tgz
7375
# SDDKW-93582: Non-interactive installation fails if cwd is different.
7476
pushd FastModels_crypto_11.27.019_Linux64
75-
# This installer doesn't allow providing a default path for interactive
76-
# installation.
77-
./setup.bin $INSTALLER_FLAGS_CRYPTO
77+
# This installer doesn't allow providing a default path for
78+
# interactive installation. The user will have to enter the install
79+
# directory as the target by hand.
80+
./setup.bin "${INSTALLER_FLAGS_CRYPTO[@]}"
7881
popd
7982
fi
8083

0 commit comments

Comments
 (0)