refactor: re-use run config fragments for TC platform variants
Several platforms have multiple variants, yet, they share most of the
software binaries and hence can utilize common run fragments. This
removes the need to maintain run fragments on per-variant basis.
We do this by introducing an environment variable `plat_variant` that
is populated from build parameter `TARGET_PLATFORM`
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Change-Id: I4218942b33dd32440a1ce9f7e78627bbe6710a69
diff --git a/run_config/fvp-fip.tc0 b/run_config/fvp-fip.tc
similarity index 75%
rename from run_config/fvp-fip.tc0
rename to run_config/fvp-fip.tc
index e885793..244b9f1 100644
--- a/run_config/fvp-fip.tc0
+++ b/run_config/fvp-fip.tc
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
-# Copyright (c) 2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -11,7 +11,7 @@
# Use SCP binary from SCP build if it exists, or fetch pre-built ones.
if [ ! -f "$archive/scp_ramfw.bin" ]; then
- url="$scp_prebuilts/tc0/scp_ramfw.bin" fetch_file
+ url="$scp_prebuilts/tc$plat_variant/scp_ramfw.bin" fetch_file
archive_file "scp_ramfw.bin"
fi
diff --git a/run_config/fvp-fip.tc1 b/run_config/fvp-fip.tc1
deleted file mode 100644
index e5b630e..0000000
--- a/run_config/fvp-fip.tc1
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env bash
-#
-# Copyright (c) 2021, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-post_tf_build() {
- url="$tc_prebuilts/u-boot.bin" fetch_file
- archive_file "u-boot.bin"
-
- # Use SCP binary from SCP build if it exists, or fetch pre-built ones.
- if [ ! -f "$archive/scp_ramfw.bin" ]; then
- url="$scp_prebuilts/tc1/scp_ramfw.bin" fetch_file
- archive_file "scp_ramfw.bin"
- fi
-
- build_fip BL33="$archive/u-boot.bin" SCP_BL2="$archive/scp_ramfw.bin"
-}
diff --git a/run_config/fvp-linux.tc b/run_config/fvp-linux.tc
new file mode 100644
index 0000000..206a248
--- /dev/null
+++ b/run_config/fvp-linux.tc
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2019-2021 Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+fetch_tf_resource() {
+ kernel_type="fvp-tc-kernel" get_kernel
+ initrd_type="fvp-tc-ramdisk" get_initrd
+ uart="1" set_primary="1" file="linux-rd-busybox.exp" track_expect
+
+ payload_type="linux" gen_fvp_yaml_template
+ # Use SCP binary from SCP build if it exists, or fetch pre-built ones.
+ if [ ! -f "$archive/scp_romfw.bin" ]; then
+ # Pick the appropriate binary based on target platform variant
+ url="$scp_prebuilts/tc$plat_variant/scp_romfw.bin" fetch_file
+ archive_file "scp_romfw.bin"
+ fi
+
+ # Hold scp terminal_s0
+ uart="0" file="hold_uart.exp" track_expect
+}
diff --git a/run_config/fvp-linux.tc0 b/run_config/fvp-linux.tc0
deleted file mode 100644
index 09eea98..0000000
--- a/run_config/fvp-linux.tc0
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env bash
-#
-# Copyright (c) 2019-2020 Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-fetch_tf_resource() {
- kernel_type="fvp-tc-kernel" get_kernel
- initrd_type="fvp-tc-ramdisk" get_initrd
- uart="1" set_primary="1" file="linux-rd-busybox.exp" track_expect
-
- payload_type="linux" gen_fvp_yaml_template
-}
diff --git a/run_config/fvp-linux.tc1 b/run_config/fvp-linux.tc1
deleted file mode 100644
index a2ca995..0000000
--- a/run_config/fvp-linux.tc1
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env bash
-#
-# Copyright (c) 2020 Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-fetch_tf_resource() {
- kernel_type="fvp-tc-kernel" get_kernel
- initrd_type="fvp-tc-ramdisk" get_initrd
- uart="1" set_primary="1" file="linux-rd-busybox.exp" track_expect
-
- payload_type="linux" gen_fvp_yaml_template
-}
diff --git a/run_config/fvp-tc0 b/run_config/fvp-tc0
index d6c6b57..5932f25 100644
--- a/run_config/fvp-tc0
+++ b/run_config/fvp-tc0
@@ -1,21 +1,10 @@
#!/usr/bin/env bash
#
-# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2019-2021, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
-fetch_tf_resource() {
- # Use SCP binary from SCP build if it exists, or fetch pre-built ones.
- if [ ! -f "$archive/scp_romfw.bin" ]; then
- url="$scp_prebuilts/tc0/scp_romfw.bin" fetch_file
- archive_file "scp_romfw.bin"
- fi
-
- # Hold scp terminal_s0
- uart="0" file="hold_uart.exp" track_expect
-}
-
post_fetch_tf_resource() {
local model="tc0"
diff --git a/run_config/fvp-tc1 b/run_config/fvp-tc1
index af37cde..8f96eb6 100644
--- a/run_config/fvp-tc1
+++ b/run_config/fvp-tc1
@@ -5,17 +5,6 @@
# SPDX-License-Identifier: BSD-3-Clause
#
-fetch_tf_resource() {
- # Use SCP binary from SCP build if it exists, or fetch pre-built ones.
- if [ ! -f "$archive/scp_romfw.bin" ]; then
- url="$scp_prebuilts/tc1/scp_romfw.bin" fetch_file
- archive_file "scp_romfw.bin"
- fi
-
- # Hold scp terminal_s0
- uart="0" file="hold_uart.exp" track_expect
-}
-
post_fetch_tf_resource() {
local model="tc1"