ci: add capability to clone and build RF-A
* Add support to clone the RF-A repository using
local CI and also add necessary hooks to build RF-A.
* Update run_local_ci script to pass missing paramters
like no_rfa.
Change-Id: Icad55bc3321f524009636f554f6d751cc536eaf6
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
diff --git a/expect-lava/tfa-next-rme.exp b/expect-lava/rfa-rme.exp
similarity index 100%
rename from expect-lava/tfa-next-rme.exp
rename to expect-lava/rfa-rme.exp
diff --git a/expect-lava/tfa-next.exp b/expect-lava/rfa.exp
similarity index 100%
rename from expect-lava/tfa-next.exp
rename to expect-lava/rfa.exp
diff --git a/expect/tfa-next-rme.exp b/expect/rfa-rme.exp
similarity index 100%
rename from expect/tfa-next-rme.exp
rename to expect/rfa-rme.exp
diff --git a/expect/tfa-next.exp b/expect/rfa.exp
similarity index 100%
rename from expect/tfa-next.exp
rename to expect/rfa.exp
diff --git a/group/tf-next-build/fvp-next.rme:nil b/group/rfa-build/fvp.rme:nil
similarity index 100%
rename from group/tf-next-build/fvp-next.rme:nil
rename to group/rfa-build/fvp.rme:nil
diff --git a/group/tf-next-build/fvp-next:nil b/group/rfa-build/fvp:nil
similarity index 100%
rename from group/tf-next-build/fvp-next:nil
rename to group/rfa-build/fvp:nil
diff --git a/group/tf-next-build/qemu-next:nil b/group/rfa-build/qemu:nil
similarity index 100%
rename from group/tf-next-build/qemu-next:nil
rename to group/rfa-build/qemu:nil
diff --git a/group/rfa-fvp/fvp-next:fvp-next b/group/rfa-fvp/fvp-next:fvp-next
deleted file mode 100644
index e69de29..0000000
--- a/group/rfa-fvp/fvp-next:fvp-next
+++ /dev/null
diff --git a/group/rfa-fvp/fvp-next.rme:fvp-next.rme b/group/rfa-fvp/fvp.rme:fvp-rfa.rme
similarity index 100%
rename from group/rfa-fvp/fvp-next.rme:fvp-next.rme
rename to group/rfa-fvp/fvp.rme:fvp-rfa.rme
diff --git a/group/rfa-fvp/fvp-next.rme:fvp-next.rme b/group/rfa-fvp/fvp:fvp-rfa
similarity index 100%
copy from group/rfa-fvp/fvp-next.rme:fvp-next.rme
copy to group/rfa-fvp/fvp:fvp-rfa
diff --git a/model/fvp_common.sh b/model/fvp_common.sh
index 42a09f9..6ced4e0 100644
--- a/model/fvp_common.sh
+++ b/model/fvp_common.sh
@@ -121,7 +121,7 @@
# runs, so that FVP trace log was properly dumped (and parsed by LAVA).
# Don't use it for other OpenCI runs, as it may lead to race condition
# with LAVA's capturing of FVP output.
-if echo "$RUN_CONFIG" | grep -Eiq 'tftf|spm|next'; then
+if echo "$RUN_CONFIG" | grep -Eiq 'tftf|spm|rfa'; then
is_arm_env=0
if is_arm_jenkins_env; then
is_arm_env=1
diff --git a/tf_config/fvp-next b/rfa_config/fvp
similarity index 91%
rename from tf_config/fvp-next
rename to rfa_config/fvp
index db2cec1..02e36c9 100644
--- a/tf_config/fvp-next
+++ b/rfa_config/fvp
@@ -1,3 +1,2 @@
PLAT=fvp
-RUST=1
TFA_FLAGS="FVP_TRUSTED_SRAM_SIZE=512 SPD=spmd SPMD_SPM_AT_SEL2=0 NEED_BL31=no"
diff --git a/tf_config/fvp-next.rme b/rfa_config/fvp.rme
similarity index 92%
rename from tf_config/fvp-next.rme
rename to rfa_config/fvp.rme
index e0525a3..ee9d8d0 100644
--- a/tf_config/fvp-next.rme
+++ b/rfa_config/fvp.rme
@@ -1,4 +1,3 @@
PLAT=fvp
-RUST=1
FEATURES=sel2,rme
TFA_FLAGS="FVP_TRUSTED_SRAM_SIZE=512 ENABLE_RME=1 NEED_BL31=no"
diff --git a/rfa_config/qemu b/rfa_config/qemu
new file mode 100644
index 0000000..c3eac58
--- /dev/null
+++ b/rfa_config/qemu
@@ -0,0 +1 @@
+PLAT=qemu
diff --git a/run_config/fvp-next b/run_config/fvp-rfa
similarity index 92%
rename from run_config/fvp-next
rename to run_config/fvp-rfa
index 05bf41a..3e5507d 100644
--- a/run_config/fvp-next
+++ b/run_config/fvp-rfa
@@ -11,7 +11,7 @@
generate_lava_job() {
local model="base-aemv8a"
- uart="0" file="tfa-next.exp" track_expect
+ uart="0" file="rfa.exp" track_expect
# Track the rest of the UARTs to aid in debugging.
uart="1" file="hold_uart.exp" track_expect
uart="2" file="hold_uart.exp" track_expect
diff --git a/run_config/fvp-next.rme b/run_config/fvp-rfa.rme
similarity index 96%
rename from run_config/fvp-next.rme
rename to run_config/fvp-rfa.rme
index 205b380..ebc840a 100644
--- a/run_config/fvp-next.rme
+++ b/run_config/fvp-rfa.rme
@@ -15,7 +15,7 @@
# scripts to work properly and not hang up waiting for BL1->BL31.
uart="0" set_expect_variable "skip_early_boot_msgs" "1"
- uart="0" file="tfa-next-rme.exp" track_expect
+ uart="0" file="rfa-rme.exp" track_expect
# Track the rest of the UARTs to aid in debugging.
uart="1" file="hold_uart.exp" track_expect
uart="2" file="hold_uart.exp" track_expect
diff --git a/script/build_package.sh b/script/build_package.sh
index bb01678..8d3723e 100755
--- a/script/build_package.sh
+++ b/script/build_package.sh
@@ -19,6 +19,7 @@
# Directory to where the source code e.g. for Trusted Firmware is checked out.
export tf_root="${tf_root:-$workspace/trusted_firmware}"
+export rfa_root="${rfa_root:-$workspace/rusted-firmware-a}"
export tftf_root="${tftf_root:-$workspace/trusted_firmware_tf}"
export scp_root="${scp_root:-$workspace/scp}"
scp_tools_root="${scp_tools_root:-$workspace/scp_tools}"
@@ -35,6 +36,7 @@
scp_tools_commit="${SCP_TOOLS_COMMIT:-master}"
spm_refspec="$SPM_REFSPEC"
rmm_refspec="$RMM_REFSPEC"
+rfa_refspec="$RFA_REFSPEC"
test_config="${TEST_CONFIG:?}"
test_group="${TEST_GROUP:?}"
@@ -527,6 +529,16 @@
)
}
+get_rfa_opt() {
+ (
+ name="${1:?}"
+ if config_valid "$rfa_config_file"; then
+ source "$rfa_config_file"
+ echo "${!name}"
+ fi
+ )
+}
+
get_rmm_opt() {
(
name="${1:?}"
@@ -624,20 +636,20 @@
build_rfa() {
(
- config_file="${tf_build_config:-$tf_config_file}"
+ config_file="${rfa_build_config:-$rfa_config_file}"
# Build the 'all' target by default.
- build_targets="${tf_build_targets:-all}"
+ build_targets="${rfa_build_targets:-all}"
source "$config_file"
- cd "$tf_root"
+ cd "$rfa_root"
# Always distclean when running on Jenkins. Skip distclean when running
# locally and explicitly requested.
if upon "$jenkins_run" || not_upon "$dont_clean"; then
echo "Cleaning TF-A..."
- make -C "$TFA" distclean &>>"$build_log" || fail_build
+ make -C "$tf_root" distclean &>>"$build_log" || fail_build
echo 'Cleaning RF-A...'
cargo clean &>>"$build_log" || fail_build
@@ -1019,6 +1031,11 @@
set_hook_var "tf_build_targets" "$targets"
}
+set_rfa_build_targets() {
+ echo "Set build target to '${targets:?}'"
+ set_hook_var "rfa_build_targets" "$targets"
+}
+
set_tftf_build_targets() {
echo "Set build target to '${targets:?}'"
set_hook_var "tftf_build_targets" "$targets"
@@ -1284,10 +1301,13 @@
scp_tools_config_file="$ci_root/scp_tools_config/$scp_tools_config"
spm_config_file="$ci_root/spm_config/$spm_config"
rmm_config_file="$ci_root/rmm_config/$rmm_config"
+rfa_config_file="$ci_root/rfa_config/$rfa_config"
+
# File that keeps track of applied patches
tf_patch_record="$workspace/tf_patches"
tftf_patch_record="$workspace/tftf_patches"
+rfa_patch_record="$workspace/rfa_patches"
pushd "$workspace"
@@ -1300,6 +1320,15 @@
echo
fi
+if ! config_valid "$rfa_config"; then
+ rfa_config=
+else
+ echo "RF-A config:"
+ echo
+ sort "$rfa_config_file" | sed '/^\s*$/d;s/^/\t/'
+ echo
+fi
+
if ! config_valid "$tftf_config"; then
tftf_config=
else
@@ -1360,6 +1389,16 @@
show_head "$tf_root"
fi
+if [ "$rfa_config" ] && assert_can_git_clone "rfa_root"; then
+ # If the Rusted Firmware repository has already been checked out, use
+ # that location. Otherwise, clone one ourselves.
+ echo "Cloning Rusted Firmware..."
+
+ clone_url="${RFA_CHECKOUT_LOC:-$rfa_src_repo_url}" where="$rfa_root" \
+ refspec="$RFA_REFSPEC" clone_repo &>>"$build_log"
+ show_head "$rfa_root"
+fi
+
if [ "$tftf_config" ] && assert_can_git_clone "tftf_root"; then
# If the Trusted Firmware TF repository has already been checked out,
# use that location. Otherwise, clone one ourselves.
@@ -1709,6 +1748,84 @@
)
fi
+ # RF-A build
+ if config_valid "$rfa_config"; then
+ (
+ echo "##########"
+
+ plat="$(get_rfa_opt PLAT)"
+ plat_utils="$ci_root/${plat}_utils.sh"
+ if [ -f "$plat_utils" ]; then
+ source "$plat_utils"
+ fi
+
+ fvp_tsram_size="$(get_rfa_opt FVP_TRUSTED_SRAM_SIZE)"
+ fvp_tsram_size="${fvp_tsram_size:-256}"
+
+ archive="$build_archive"
+
+ # Clone TF-A repo if required. Save its path into the
+ # special variable "TFA", which is used by RF-A build
+ # system.
+ export TFA="${TFA:-$tf_root}"
+ if assert_can_git_clone "TFA"; then
+ echo "Cloning TF-A..."
+ clone_url="$tf_src_repo_url" where="$TFA" clone_repo
+ fi
+ show_head "$TFA"
+ poetry -C "$TFA" install --without docs
+
+ rfa_build_root="$rfa_root/target"
+ echo "Building Rusted Firmware ($mode) ..." |& log_separator
+
+ if not_upon "$local_ci"; then
+ # 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 "RUSTUP_HOME" "/usr/local/rustup"
+ fi
+
+ # Call pre-build hook
+ call_hook pre_rfa_build
+
+ build_rfa
+
+ # Call post-build hook
+ call_hook post_rfa_build
+
+ # Pre-archive hook
+ call_hook pre_rfa_archive
+
+ from="$rfa_build_root" to="$archive" collect_rfa_artefacts
+
+ # Post-archive hook
+ call_hook post_rfa_archive
+
+ call_hook fetch_rfa_resource
+ call_hook post_fetch_rfa_resource
+
+ # Generate LAVA job files if necessary
+ call_hook generate_lava_job_template
+ call_hook generate_lava_job
+
+ echo "##########"
+ )
+ fi
+
# TF build
if config_valid "$tf_config"; then
(
@@ -1734,60 +1851,17 @@
fvp_tsram_size="$(get_tf_opt FVP_TRUSTED_SRAM_SIZE)"
fvp_tsram_size="${fvp_tsram_size:-256}"
- if not_upon "$(get_tf_opt RUST)"; then
- poetry -C "$tf_root" install --without docs
- fi
+ poetry -C "$tf_root" install --without docs
archive="$build_archive"
- if not_upon "$(get_tf_opt RUST)"; then
- tf_build_root="$tf_root/build"
- echo "Building Trusted Firmware ($mode) ..." |& log_separator
- else
- # Clone TF-A repo if required. Save its path into the
- # special variable "TFA", which is used by RF-A build
- # system.
- export TFA="${TFA-$workspace/tfa}"
- if assert_can_git_clone "TFA"; then
- echo "Cloning TF-A..."
- clone_url="$tf_src_repo_url" where="$TFA" clone_repo
- fi
- show_head "$TFA"
- poetry -C "$TFA" install --without docs
-
- rfa_build_root="$tf_root/target"
- echo "Building Rusted Firmware ($mode) ..." |& log_separator
-
- if not_upon "$local_ci"; then
- # 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 "RUSTUP_HOME" "/usr/local/rustup"
- fi
- fi
+ tf_build_root="$tf_root/build"
+ echo "Building Trusted Firmware ($mode) ..." |& log_separator
# Call pre-build hook
call_hook pre_tf_build
- if upon "$(get_tf_opt RUST)"; then
- build_rfa
- else
- build_tf
- fi
+ build_tf
# Call post-build hook
call_hook post_tf_build
@@ -1795,11 +1869,7 @@
# Pre-archive hook
call_hook pre_tf_archive
- if not_upon "$(get_tf_opt RUST)"; then
- from="$tf_build_root" to="$archive" collect_build_artefacts
- else
- from="$rfa_build_root" to="$archive" collect_rfa_artefacts
- fi
+ from="$tf_build_root" to="$archive" collect_build_artefacts
# Post-archive hook
call_hook post_tf_archive
diff --git a/script/clone_repos.sh b/script/clone_repos.sh
index bf6cb3d..2a88e6a 100755
--- a/script/clone_repos.sh
+++ b/script/clone_repos.sh
@@ -400,6 +400,13 @@
clone_and_sync
fi
+RFA_REFSPEC="${rfa_refspec:-$RFA_REFSPEC}"
+if not_upon "$no_rfa"; then
+ url="$rfa_src_repo_url" name="rusted-firmware-a" ref="RFA_REFSPEC" \
+ loc="RFA_CHECKOUT_LOC" \
+ clone_and_sync
+fi
+
TFTF_REFSPEC="${tftf_refspec:-$TFTF_REFSPEC}"
if not_upon "$no_tftf"; then
# Clone Trusted Firmware TF repository
diff --git a/script/run_local_ci.sh b/script/run_local_ci.sh
index ba3156f..d67502f 100755
--- a/script/run_local_ci.sh
+++ b/script/run_local_ci.sh
@@ -361,6 +361,15 @@
let "++local_count"
fi
+if [ -z "$rfa_root" ]; then
+ in_red "NOTE: NOT using local work tree for RF-A"
+else
+ rfa_root="$(readlink -f $rfa_root)"
+ rfa_refspec=
+ in_green "Using local work tree for RF-A"
+ let "++local_count"
+fi
+
if [ -z "$tfm_tests_root" ]; then
in_red "NOTE: NOT using local work tree for TF-M-TESTS"
else
@@ -419,7 +428,7 @@
fi
# Use clone_repos.sh to clone and share repositories that aren't local.
-no_tf="$tf_root" no_tftf="$tftf_root" no_spm="$spm_root" no_rmm="$rmm_root" \
+no_tf="$tf_root" no_tftf="$tftf_root" no_spm="$spm_root" no_rmm="$rmm_root" no_rfa="$rfa_root" \
no_ci="$ci_root" no_cc="$import_cc" no_tfm_tests="$tfm_tests_root" no_tfm_extras="$tfm_extras_root" \
bash $minus_x "$ci_root/script/clone_repos.sh"
diff --git a/tf_config/qemu-next b/tf_config/qemu-next
deleted file mode 100644
index f1c0df9..0000000
--- a/tf_config/qemu-next
+++ /dev/null
@@ -1,2 +0,0 @@
-PLAT=qemu
-RUST=1
diff --git a/utils.sh b/utils.sh
index 13751b0..f5f4e66 100644
--- a/utils.sh
+++ b/utils.sh
@@ -574,6 +574,8 @@
spm_src_repo_url="${spm_src_repo_url:-https://$tforg_gerrit_url/hafnium/hafnium}"
rmm_src_repo_url="${rmm_src_repo_url:-$RMM_SRC_REPO_URL}"
rmm_src_repo_url="${rmm_src_repo_url:-https://$tforg_gerrit_url/TF-RMM/tf-rmm}"
+rfa_src_repo_url="${rfa_src_repo_url:-$RFA_SRC_REPO_URL}"
+rfa_src_repo_url="${rfa_src_repo_url:-https://$tforg_gerrit_url/RF-A/rusted-firmware-a}"
tf_m_tests_src_repo_url="${tf_m_tests_src_repo_url:-$TF_M_TESTS_REPO_URL}"
tf_m_tests_src_repo_url="${tf_m_tests_src_repo_url:-https://$tforg_gerrit_url/TF-M/tf-m-tests}"
tf_m_extras_src_repo_url="${tf_m_extras_src_repo_url:-$TF_M_EXTRAS_REPO_URL}"