feat(rme) : introduce new build flag for RME stack
* Introduce new build flag ENABLE_REALM_PAYLOAD_TESTS to build
Realm Payload Tests and pack realm image to tftf.bin.
* Also enable PAuth for TFTF and Realm Payload by default
for RME stack.
* This commit deprecates the use of `pack_realm` build target.
* The patch also modifies the user guide instructions to build
and pack realm payload tests.
NOTE: The `pack_realm` build target, even though deprecated,
is still available for compatibility reasons. It will be
removed in a future commit.
Signed-off-by: Shruti Gupta <shruti.gupta@arm.com>
Change-Id: Iaa83651c2f41152a5a2bf4d0b9caa550f302da6b
diff --git a/Makefile b/Makefile
index 34ed34f..0a1ae9e 100644
--- a/Makefile
+++ b/Makefile
@@ -106,6 +106,11 @@
@echo "Building ${PLAT}"
@echo "Selected set of tests: ${TESTS}"
+# Set flags for Realm Payload Tests
+ifeq (${ENABLE_REALM_PAYLOAD_TESTS},1)
+BRANCH_PROTECTION := 2
+endif
+
# Include test images makefiles.
include tftf/framework/framework.mk
include tftf/tests/tests.mk
@@ -148,6 +153,8 @@
$(eval $(call assert_boolean,FWU_BL_TEST))
$(eval $(call assert_boolean,NEW_TEST_SESSION))
$(eval $(call assert_boolean,USE_NVM))
+$(eval $(call assert_numeric,BRANCH_PROTECTION))
+$(eval $(call assert_boolean,ENABLE_REALM_PAYLOAD_TESTS))
################################################################################
# Process build options
@@ -537,8 +544,6 @@
--redefine-sym _binary___build_$(PLAT)_$(BUILD_TYPE)_smcf_dtb_end=_binary___dtb_end
endif
-$(eval $(call MAKE_IMG,tftf))
-
ifeq ($(FIRMWARE_UPDATE), 1)
$(eval $(call MAKE_IMG,ns_bl1u))
$(eval $(call MAKE_IMG,ns_bl2u))
@@ -548,11 +553,25 @@
$(eval $(call MAKE_IMG,cactus_mm))
$(eval $(call MAKE_IMG,cactus))
$(eval $(call MAKE_IMG,ivy))
+endif
+
+ifeq (${ENABLE_REALM_PAYLOAD_TESTS},1)
$(eval $(call MAKE_IMG,realm))
endif
+.PHONY : tftf
+ $(eval $(call MAKE_IMG,tftf))
+
+ifeq (${ENABLE_REALM_PAYLOAD_TESTS},1)
+tftf: realm
+ @echo " PACK REALM PAYLOAD"
+ $(shell dd if=$(BUILD_PLAT)/realm.bin of=$(BUILD_PLAT)/tftf.bin obs=1 \
+ seek=$(TFTF_MAX_IMAGE_SIZE))
+endif
+
ifeq (${ARCH}-${PLAT},aarch64-fvp)
.PHONY : pack_realm
+$(eval $(call MAKE_IMG,realm))
pack_realm: realm tftf
@echo " PACK REALM PAYLOAD"
$(shell dd if=$(BUILD_PLAT)/realm.bin of=$(BUILD_PLAT)/tftf.bin obs=1 \
@@ -595,7 +614,7 @@
.SILENT: help
help:
echo "usage: ${MAKE} PLAT=<${PLATFORMS}> \
-<all|tftf|ns_bl1u|ns_bl2u|cactus|ivy|realm|pack_realm|el3_payload|distclean|clean|checkcodebase|checkpatch|help_tests>"
+<all|tftf|ns_bl1u|ns_bl2u|cactus|ivy|el3_payload|distclean|clean|checkcodebase|checkpatch|help_tests>"
echo ""
echo "PLAT is used to specify which platform you wish to build."
echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}"
@@ -606,8 +625,6 @@
echo " tftf Build the TFTF image"
echo " ns_bl1u Build the NS_BL1U image"
echo " ns_bl2u Build the NS_BL2U image"
- echo " realm Build the Realm image (Test R-EL1 payload)."
- echo " pack_realm Pack the realm image to tftf.bin."
echo " cactus Build the Cactus image (FF-A S-EL1 test payload)."
echo " cactus_mm Build the Cactus-MM image (SPM-MM S-EL0 test payload)."
echo " ivy Build the Ivy image (FF-A S-EL0 test payload)."
diff --git a/branch_protection.mk b/branch_protection.mk
index c16cdad..86f197f 100644
--- a/branch_protection.mk
+++ b/branch_protection.mk
@@ -10,9 +10,6 @@
# poised to handle dependencies, as all build variables would have a default
# value by then.
-# Select the branch protection features to use.
-BRANCH_PROTECTION := 0
-
# Flag to enable Branch Target Identification in the TFTF.
# Internal flag not meant for direct setting.
# Use BRANCH_PROTECTION to enable BTI.
diff --git a/docs/getting_started/build-options.rst b/docs/getting_started/build-options.rst
index a891380..8e62380 100644
--- a/docs/getting_started/build-options.rst
+++ b/docs/getting_started/build-options.rst
@@ -107,6 +107,9 @@
- ``V``: Verbose build. If assigned anything other than 0, the build commands
are printed. Default is 0.
+- ``ENABLE_REALM_PAYLOAD_TESTS``: This option builds and packs Realm payload tests for
+ RME enabled stack. Default is 0.
+
Arm FVP Platform Specific Build Options
---------------------------------------
@@ -152,7 +155,7 @@
- ``TFTF_MAX_IMAGE_SIZE``: The option needs to be either set by the user or
by the platform makefile to specify the maximum size of TFTF binary. This
is needed so that the Realm payload binary can be appended to TFTF binary
- via ``make pack_realm`` build command.
+ via ``make ENABLE_REALM_PAYLOAD_TESTS=1 tftf`` build command.
FWU-specific Build Options
--------------------------
diff --git a/docs/getting_started/build.rst b/docs/getting_started/build.rst
index 034a99e..70b7edc 100644
--- a/docs/getting_started/build.rst
+++ b/docs/getting_started/build.rst
@@ -111,14 +111,10 @@
::
- make PLAT=<platform> realm
+ make PLAT=<platform> ENABLE_REALM_PAYLOAD_TESTS=1 tftf
-The generated ``realm.bin`` needs to be packaged as part of ``tftf.bin`` to
-be used as a single BL33 image and can be done using the following command:
-
-::
-
- make PLAT=<platform> pack_realm
+The generated ``realm.bin`` is packaged as part of ``tftf.bin``
+to be used as a single BL33 image.
Please refer to the `TF-A RME documentation`_ for build and run instructions.
diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk
index 5cd8bc6..e12f8e2 100644
--- a/make_helpers/build_macros.mk
+++ b/make_helpers/build_macros.mk
@@ -18,6 +18,22 @@
$(and $(patsubst 0,,$(value $(1))),$(patsubst 1,,$(value $(1))),$(error $(1) must be boolean))
endef
+0-9 := 0 1 2 3 4 5 6 7 8 9
+
+# Function to verify that a given option $(1) contains a numeric value
+define assert_numeric
+$(if $($(1)),,$(error $(1) must not be empty))
+$(eval __numeric := $($(1)))
+$(foreach d,$(0-9),$(eval __numeric := $(subst $(d),,$(__numeric))))
+$(if $(__numeric),$(error $(1) must be numeric))
+endef
+
+# Convenience function for verifying options have numeric values
+# $(eval $(call assert_numerics,FOO BOO)) will assert FOO and BOO contain numeric values
+define assert_numerics
+ $(foreach num,$1,$(eval $(call assert_numeric,$(num))))
+endef
+
# CREATE_SEQ is a recursive function to create sequence of numbers from 1 to
# $(2) and assign the sequence to $(1)
define CREATE_SEQ
diff --git a/make_helpers/defaults.mk b/make_helpers/defaults.mk
index 2e18d67..3605d01 100644
--- a/make_helpers/defaults.mk
+++ b/make_helpers/defaults.mk
@@ -45,3 +45,9 @@
# Build verbosity
V := 0
+
+# Select the branch protection features to use
+BRANCH_PROTECTION := 0
+
+# Build RME stack
+ENABLE_REALM_PAYLOAD_TESTS := 0