next: adapt Rust QEMU and FVP build configs
The 'next' project can now be built from the root directory.
Setup its new build configuration files according to this new way
of building.
In the future, the clippy test will be a separate job.
Change-Id: I0fa189646b5d3a929d18320ac18a3d1a352c8902
Signed-off-by: Zachary Leaf <zachary.leaf@arm.com>
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
diff --git a/group/tf-next-build/fvp-next:nil b/group/tf-next-build/fvp-next:nil
index 19363ec..1ca7bde 100644
--- a/group/tf-next-build/fvp-next:nil
+++ b/group/tf-next-build/fvp-next:nil
@@ -1,5 +1,39 @@
+#!/usr/bin/env bash
#
# Copyright (c) 2024 Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
+pre_tf_build() {
+ # pre_tf_build() and other call hooks are invoked from within subshells, so
+ # environment variables are lost when calling them (except $PATH somehow is
+ # retained)
+ # - use `set_hook_var` to propagate to other levels, e.g. the actual
+ # tf_build() stage
+ # - use `export $VAR=` for use inside this pre_tf_build() stage
+ #
+ # In the CI Dockerfile, rustup is installed by the root user in the
+ # non-default location /usr/local/rustup, so $RUSTUP_HOME is required to
+ # access rust config e.g. default toolchains and run cargo
+ #
+ # Leave $CARGO_HOME blank so when this script is run in CI by the buildslave
+ # user, it uses the default /home/buildslave/.cargo directory which it has
+ # write permissions for - that allows it to download new crates during
+ # compilation
+ #
+ # The buildslave user does not have write permissions to the default
+ # $CARGO_HOME=/usr/local/cargo dir and so will error when trying to download
+ # new crates otherwise
+ #
+ # note: $PATH still contains /usr/local/cargo/bin at this point so cargo is
+ # still run via the root installation
+ #
+ # see https://github.com/rust-lang/rustup/issues/1085
+ #
+ # set_hook_var propagates RUSTUP_HOME var to lower levels...
+ set_hook_var RUSTUP_HOME /usr/local/rustup
+ # ...but not to pre_tf_build() - explicit exporting is required to run
+ # clippy here
+ export RUSTUP_HOME=/usr/local/rustup
+ make PLAT=fvp -C "$tf_root/rust" clippy
+}
diff --git a/group/tf-next-build/qemu-next:nil b/group/tf-next-build/qemu-next:nil
index 7fa6f90..ec06601 100644
--- a/group/tf-next-build/qemu-next:nil
+++ b/group/tf-next-build/qemu-next:nil
@@ -6,26 +6,34 @@
#
pre_tf_build() {
# pre_tf_build() and other call hooks are invoked from within subshells, so
- # environment variables are lost when calling (except $PATH somehow is
+ # environment variables are lost when calling them (except $PATH somehow is
# retained)
+ # - use `set_hook_var` to propagate to other levels, e.g. the actual
+ # tf_build() stage
+ # - use `export $VAR=` for use inside this pre_tf_build() stage
#
- # rustup is installed by the root user in a non-default location
- # /usr/local/rustup, so $RUSTUP_HOME is required to access rust config
- # e.g. default toolchains and run cargo
+ # In the CI Dockerfile, rustup is installed by the root user in the
+ # non-default location /usr/local/rustup, so $RUSTUP_HOME is required to
+ # access rust config e.g. default toolchains and run cargo
#
- # leave $CARGO_HOME blank so when this is run by the buildslave user it uses
- # the default /home/buildslave/.cargo directory which it has write
- # permissions for - that allows it to download new crates during compilation
+ # Leave $CARGO_HOME blank so when this script is run in CI by the buildslave
+ # user, it uses the default /home/buildslave/.cargo directory which it has
+ # write permissions for - that allows it to download new crates during
+ # compilation
#
- # since rust was installed by root, buildslave user does not have write
- # access to /usr/local/cargo and will error when trying to download new
- # crates otherwise
+ # The buildslave user does not have write permissions to the default
+ # $CARGO_HOME=/usr/local/cargo dir and so will error when trying to download
+ # new crates otherwise
#
# note: $PATH still contains /usr/local/cargo/bin at this point so cargo is
# still run via the root installation
#
# see https://github.com/rust-lang/rustup/issues/1085
+ #
+ # set_hook_var propagates RUSTUP_HOME var to lower levels...
+ set_hook_var RUSTUP_HOME /usr/local/rustup
+ # ...but not to pre_tf_build() - explicit exporting is required to run
+ # clippy here
export RUSTUP_HOME=/usr/local/rustup
- make -C "$tf_root/rust"
- make -C "$tf_root/rust" clippy
+ make PLAT=qemu -C "$tf_root/rust" clippy
}
diff --git a/tf_config/fvp-next b/tf_config/fvp-next
index e69de29..cd0539f 100644
--- a/tf_config/fvp-next
+++ b/tf_config/fvp-next
@@ -0,0 +1,2 @@
+PLAT=fvp
+RUST=1
diff --git a/tf_config/qemu-next b/tf_config/qemu-next
index e69de29..f1c0df9 100644
--- a/tf_config/qemu-next
+++ b/tf_config/qemu-next
@@ -0,0 +1,2 @@
+PLAT=qemu
+RUST=1