factorize 'filelist' and 'update_rootfs' rules

Factorize embedded file list and rootfs generation for fvp, juno,
mediatek, qemu, qemu_v8 and rpi3.

busybox is madatory to all 'common' rootfs.
optee-client, xtestn helloworld are always embedded: moved to common.

Remove obsolete CFG_DEV_PATH.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (HiKey)
Tested-by: Joakim Bech <joakim.bech@linaro.org> (RPi3, MTK8173)
Tested-by: Etienne Carriere <etienne.carriere@linaro.org> (qemu_v7/v8)
diff --git a/juno.mk b/juno.mk
index a19df94..4e6cc53 100644
--- a/juno.mk
+++ b/juno.mk
@@ -138,36 +138,11 @@
 ################################################################################
 # Root FS
 ################################################################################
-.PHONY: filelist-tee
-filelist-tee:
-	@echo "# xtest / optee_test" > $(GEN_ROOTFS_FILELIST)
-	@find $(OPTEE_TEST_OUT_PATH) -type f -name "xtest" | sed 's/\(.*\)/file \/bin\/xtest \1 755 0 0/g' >> $(GEN_ROOTFS_FILELIST)
-	@echo "file /bin/hello_world $(HELLOWORLD_PATH)/host/hello_world 755 0 0" >> $(GEN_ROOTFS_FILELIST)
-	@echo "# TAs" >> $(GEN_ROOTFS_FILELIST)
-	@echo "dir /lib/optee_armtz 755 0 0" >> $(GEN_ROOTFS_FILELIST)
-	@find $(OPTEE_TEST_OUT_PATH) -name "*.ta" | \
-		sed 's/\(.*\)\/\(.*\)/file \/lib\/optee_armtz\/\2 \1\/\2 444 0 0/g' >> $(GEN_ROOTFS_FILELIST)
-	@echo "file /lib/optee_armtz/8aaaf200-2450-11e4-abe20002a5d5c51b.ta $(HELLOWORLD_PATH)/ta/8aaaf200-2450-11e4-abe20002a5d5c51b.ta 444 0 0" >> $(GEN_ROOTFS_FILELIST)
-	@echo "# Secure storage dir" >> $(GEN_ROOTFS_FILELIST)
-	@echo "dir /data 755 0 0" >> $(GEN_ROOTFS_FILELIST)
-	@echo "dir /data/tee 755 0 0" >> $(GEN_ROOTFS_FILELIST)
-	@if [ -e $(OPTEE_GENDRV_MODULE) ]; then \
-		echo "# OP-TEE device" >> $(GEN_ROOTFS_FILELIST); \
-		echo "dir /lib/modules 755 0 0" >> $(GEN_ROOTFS_FILELIST); \
-		echo "dir /lib/modules/$(call KERNEL_VERSION) 755 0 0" >> $(GEN_ROOTFS_FILELIST); \
-		echo "file /lib/modules/$(call KERNEL_VERSION)/optee.ko $(OPTEE_GENDRV_MODULE) 755 0 0" >> $(GEN_ROOTFS_FILELIST); \
-	fi
-	@echo "# OP-TEE Client" >> $(GEN_ROOTFS_FILELIST)
-	@echo "file /bin/tee-supplicant $(OPTEE_CLIENT_EXPORT)/bin/tee-supplicant 755 0 0" >> $(GEN_ROOTFS_FILELIST)
-	@echo "file /lib/libteec.so.1.0 $(OPTEE_CLIENT_EXPORT)/lib/libteec.so.1.0 755 0 0" >> $(GEN_ROOTFS_FILELIST)
-	@echo "slink /lib/libteec.so.1 libteec.so.1.0 755 0 0" >> $(GEN_ROOTFS_FILELIST)
-	@echo "slink /lib/libteec.so libteec.so.1 755 0 0" >> $(GEN_ROOTFS_FILELIST)
+filelist-tee: filelist-tee-common
 
 .PHONY: update_rootfs
-update_rootfs: u-boot busybox optee-client xtest helloworld filelist-tee
-	cat $(GEN_ROOTFS_PATH)/filelist-final.txt $(GEN_ROOTFS_PATH)/filelist-tee.txt > $(GEN_ROOTFS_PATH)/filelist.tmp
-	cd $(GEN_ROOTFS_PATH) && \
-	        $(LINUX_PATH)/usr/gen_init_cpio $(GEN_ROOTFS_PATH)/filelist.tmp | gzip > $(GEN_ROOTFS_PATH)/filesystem.cpio.gz
+update_rootfs: u-boot
+update_rootfs: update_rootfs-common
 	$(U-BOOT_PATH)/tools/mkimage -A arm64 -O linux -T ramdisk -C gzip \
 		-d $(GEN_ROOTFS_PATH)/filesystem.cpio.gz \
 		$(GEN_ROOTFS_PATH)/ramdisk.img