ARM: RTIC 3.0:  Enabling MPGen

Added RTIC environmental variable check. If set, this will trigger
RTIC MPGen during the kernel build. MPGen generates and embeds the
kernel MP.s (measurement parameters) to the vmlinux. It has to be
called during the kernel build, before vmlinux is generated.
RTIC MP.s to be consumed by the RTIC TA.

Acked-by: Alex Mavrin <amavrin@qti.qualcomm.com>
Change-Id: Id64ae893f750337abbecfea0b461f2d3ae508d00
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
diff --git a/arch/arm64/boot/Makefile b/arch/arm64/boot/Makefile
index 92dc1e6..b97f1de 100644
--- a/arch/arm64/boot/Makefile
+++ b/arch/arm64/boot/Makefile
@@ -28,6 +28,17 @@
 DTB_OBJS := $(shell find $(obj)/dts/ -name \*.dtb)
 endif
 
+# Add RTIC DTB to the DTB list if RTIC MPGen is enabled
+ifdef RTIC_MPGEN
+DTB_OBJS += rtic_mp.dtb
+endif
+
+rtic_mp.dtb: vmlinux FORCE
+	$(RTIC_MPGEN) --objcopy="${OBJCOPY}" --objdump="${OBJDUMP}" \
+	--binpath="" --vmlinux="vmlinux" --config=${KCONFIG_CONFIG} \
+	--cc="${CC}" --dts=rtic_mp.dts && \
+	$(DTC) -O dtb -o rtic_mp.dtb -b 0 $(DTC_FLAGS) rtic_mp.dts
+
 $(obj)/Image: vmlinux FORCE
 	$(call if_changed,objcopy)