rb5: Copy fw files to ramdisk.img for boot img header v2

Our assumption that we will always be booting RB5 with
boot image header v3 images is wrong. So making sure that,
we copy the firmware files, which can't be loaded directly
from vendor.img, to ramdisk.img as well. This will make
sure that Venus, ADSP and CDSP firmware files load
successfully in case we are booting with boot image header
v2.

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
diff --git a/src/rb5/device.mk b/src/rb5/device.mk
index fd91a0b..362f28f 100644
--- a/src/rb5/device.mk
+++ b/src/rb5/device.mk
@@ -48,23 +48,43 @@
 
 # Also copy a set of Venus and ADSP/CDSP firmware files to ramdisk to drop the
 # dependency on user sysfs fw loader helper (FW_LOADER_USER_HELPER_FALLBACK)
-PRODUCT_COPY_FILES += \
-    $(FIRMWARE_VENDOR_PATH)/qcom/sm8250/adsp.mbn:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/sm8250/adsp.mbn	\
-    $(FIRMWARE_VENDOR_PATH)/qcom/sm8250/cdsp.mbn:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/sm8250/cdsp.mbn	\
-    $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b00:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b00	\
-    $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b01:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b01	\
-    $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b02:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b02	\
-    $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b03:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b03	\
-    $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b04:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b04	\
-    $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b05:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b05	\
-    $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b06:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b06	\
-    $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b07:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b07	\
-    $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b08:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b08	\
-    $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b09:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b09	\
-    $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b10:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b10	\
-    $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b19:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b19	\
-    $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.mbn:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.mbn	\
-    $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.mdt:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.mdt
+ifeq ($(TARGET_USES_BOOT_HDR_V3), true)
+    PRODUCT_COPY_FILES += \
+        $(FIRMWARE_VENDOR_PATH)/qcom/sm8250/adsp.mbn:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/sm8250/adsp.mbn	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/sm8250/cdsp.mbn:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/sm8250/cdsp.mbn	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b00:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b00	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b01:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b01	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b02:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b02	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b03:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b03	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b04:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b04	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b05:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b05	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b06:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b06	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b07:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b07	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b08:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b08	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b09:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b09	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b10:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b10	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b19:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b19	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.mbn:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.mbn	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.mdt:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.mdt
+else
+    PRODUCT_COPY_FILES += \
+        $(FIRMWARE_VENDOR_PATH)/qcom/sm8250/adsp.mbn:$(TARGET_COPY_OUT_RAMDISK)/vendor/firmware/qcom/sm8250/adsp.mbn		\
+        $(FIRMWARE_VENDOR_PATH)/qcom/sm8250/cdsp.mbn:$(TARGET_COPY_OUT_RAMDISK)/vendor/firmware/qcom/sm8250/cdsp.mbn		\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b00:$(TARGET_COPY_OUT_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b00	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b01:$(TARGET_COPY_OUT_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b01	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b02:$(TARGET_COPY_OUT_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b02	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b03:$(TARGET_COPY_OUT_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b03	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b04:$(TARGET_COPY_OUT_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b04	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b05:$(TARGET_COPY_OUT_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b05	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b06:$(TARGET_COPY_OUT_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b06	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b07:$(TARGET_COPY_OUT_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b07	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b08:$(TARGET_COPY_OUT_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b08	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b09:$(TARGET_COPY_OUT_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b09	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b10:$(TARGET_COPY_OUT_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b10	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.b19:$(TARGET_COPY_OUT_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.b19	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.mbn:$(TARGET_COPY_OUT_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.mbn	\
+        $(FIRMWARE_VENDOR_PATH)/qcom/vpu-1.0/venus.mdt:$(TARGET_COPY_OUT_RAMDISK)/vendor/firmware/qcom/vpu-1.0/venus.mdt
+endif
 
 # Copy notice/license files to rootfs
 # Not an AOSP requirement but other Linux distros do this