Enable both Linux FF-A drivers in the same build

Warning: this change needs an updated manifest which makes both drivers
available under <workspace root>!
See: https://review.trustedfirmware.org/c/OP-TEE/manifest/+/15165

Before this change either the new arm-ffa-tee or the old arm-ffa-user
driver was built. Since the SmmGW tests need the old driver and all
other service needs the new one, either the UEFI or all other tests
could be run.
This change builds both drivers to enable running all TS tests with the
same binaries.

This change moves the install directory of the kernel modules to under
"<workspace root>/out", and adds an extra step copying the module
binaries to the shared directory and merging the two "load_module.sh"
scripts to the same place.

Change-Id: I31135986794b69c99bb8432fcba5bcc8391759ea
Signed-off-by: Gyorgy Szing <Gyorgy.Szing@arm.com>
diff --git a/fvp_ffa.mk b/fvp_ffa.mk
index 5ef3c04..6a4687a 100644
--- a/fvp_ffa.mk
+++ b/fvp_ffa.mk
@@ -261,14 +261,30 @@
 		head -c -1 > $(SHARED_DIR)/sp_uuid_list.txt
 
 # Add targets to build the "arm_ffa_user" Linux Kernel module.
-arm_ffa_user: sp_uuid_list linux
+arm_ffa_user: sp_uuid_list linux | $(OUT_PATH)
 	$(eval ROOT:=$(CURDIR)/..)
-	make -C $(CURDIR)/../linux_poc $(LINUX_COMMON_FLAGS) install
+	mkdir -p $(OUT_PATH)/arm_ffa_user
+	make -C $(CURDIR)/../linux_poc $(LINUX_COMMON_FLAGS) install TARGET_DIR=$(OUT_PATH)/arm_ffa_user
 
 arm_ffa_user_clean:
 	make -C $(CURDIR)/../linux_poc clean
 
-all: arm_ffa_user
+arm_ffa_tee: linux  | $(OUT_PATH)
+	$(eval ROOT:=$(CURDIR)/..)
+	mkdir -p $(OUT_PATH)/arm_ffa_tee
+	make -C $(CURDIR)/../linux_tee $(LINUX_COMMON_FLAGS) install TARGET_DIR=$(OUT_PATH)/arm_ffa_tee
+
+arm_ffa_tee_clean:
+	make -C $(CURDIR)/../linux_tee clean
+
+# Copy out-of-tree kernel modules to shared directory and concatenate module load scripts.
+arm_ffa_drivers: arm_ffa_tee arm_ffa_user | shared_directory
+	cat $(OUT_PATH)/arm_ffa_tee/load_module.sh $(OUT_PATH)/arm_ffa_user/load_module.sh > $(SHARED_DIR)/load_module.sh
+	chmod 775 $(SHARED_DIR)/load_module.sh
+	cp -u $(OUT_PATH)/arm_ffa_tee/arm-ffa-tee.ko $(SHARED_DIR)
+	cp -u $(OUT_PATH)/arm_ffa_user/arm-ffa-user.ko $(SHARED_DIR)
+
+all: arm_ffa_drivers
 
 # Disable CONFIG_STRICT_DEVMEM option in the Linux kernel config. This allows userspace access to
 # the whole NS physical address space through /dev/mem.