feat(fwu): corrupted primary and secondary GPT headers
Adding testcase for primary and secondary GPT headers
corrupted. The boot should fail.
Signed-off-by: Xialin Liu <xialin.liu@arm.com>
Change-Id: I7d6f1bda09553cd786f69d6fbb38f3a766c624d5
diff --git a/fvp_utils.sh b/fvp_utils.sh
index c7fe4ac..d1b8296 100644
--- a/fvp_utils.sh
+++ b/fvp_utils.sh
@@ -678,8 +678,16 @@
seek=0
count=1
;;
+ "secondary-header")
+ # Secondary GPT header is present in LBA-1 last block before the
+ # end of the GPT image.
+ # Secondary GPT header is located after the backup FWU metadata,
+ # which is 1 sector in size.
+ seek=$(( $(gdisk -l "$bin" | grep " Bkup-FWU-Metadata$" | awk '{print $2}') + 1 ))
+ count=1
+ ;;
*)
- echo "Invalid $corrupt_data. Use 'header', 'partition-entries', 'fwu-metadata' or 'mbr'."
+ echo "Invalid $corrupt_data. Use 'header', 'partition-entries', 'fwu-metadata' or 'mbr', 'fwu-metadata' or 'secondary-header'."
return 1
;;
esac
diff --git a/group/tftf-l2-fvp/fvp-gpt,fvp-default:fvp-tftf.header_corrupt_gpt-aemv8a.gpt-debug b/group/tftf-l2-fvp/fvp-gpt,fvp-default:fvp-tftf.header_corrupt_gpt-aemv8a.gpt-debug
new file mode 100644
index 0000000..8e0db6b
--- /dev/null
+++ b/group/tftf-l2-fvp/fvp-gpt,fvp-default:fvp-tftf.header_corrupt_gpt-aemv8a.gpt-debug
@@ -0,0 +1,5 @@
+#
+# Copyright (c) 2025, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
diff --git a/run_config/fvp-tftf.header_corrupt_gpt b/run_config/fvp-tftf.header_corrupt_gpt
new file mode 100644
index 0000000..5beceff
--- /dev/null
+++ b/run_config/fvp-tftf.header_corrupt_gpt
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2025, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+post_tf_build() {
+ build_fip BL33="$archive/tftf.bin"
+}
+
+post_tf_archive() {
+ # Maximum FIP size is 2MiB = 2097152
+ gen_gpt_bin "$archive/fip.bin" 2097152
+
+ # Corrupt both primary and secondary GPT header
+ corrupt_gpt_bin "$archive/fip_gpt.bin" "header"
+ corrupt_gpt_bin "$archive/fip_gpt.bin" "secondary-header"
+}
+
+generate_lava_job_template() {
+ uart="0" file="crash_gpt.exp" track_expect
+ uart="1" file="crash_panic.exp" track_expect
+
+ payload_type="tftf" gen_yaml_template
+}