hikey: Fix dependencies in boot_fat.uefi.img making

boot_fat.uifi.img depends on kernel, ramdisk.img and dtb file,
that are copied to out/ with PRODUCT_COPY_FILES, and it is possible
that dtb file is not copied when target is built:
out/target/product/hikey/hi6220-hikey.dtb: No such file or directory

Change-Id: Ic486e3ee5fcd40543be3697fa3498ceef7558138
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
diff --git a/boot_fat.mk b/boot_fat.mk
deleted file mode 100644
index c5cba1e..0000000
--- a/boot_fat.mk
+++ /dev/null
@@ -1,11 +0,0 @@
-REALTOP=$(realpath $(TOP))
-boot_fatimage: bootimage
-	dd if=/dev/zero of=$(PRODUCT_OUT)/boot_fat.uefi.img bs=512 count=98304
-	mkfs.fat -n "BOOT IMG" $(PRODUCT_OUT)/boot_fat.uefi.img
-	mcopy -i $(PRODUCT_OUT)/boot_fat.uefi.img $(PRODUCT_OUT)/kernel ::Image
-	mcopy -i $(PRODUCT_OUT)/boot_fat.uefi.img $(PRODUCT_OUT)/hi6220-hikey.dtb ::hi6220-hikey.dtb
-	mcopy -s -i $(PRODUCT_OUT)/boot_fat.uefi.img device/linaro/hikey/bootloader/* ::
-	mcopy -i $(PRODUCT_OUT)/boot_fat.uefi.img  $(PRODUCT_OUT)/ramdisk.img ::ramdisk.img
-
-
-droidcore: boot_fatimage
diff --git a/build/tasks/boot_fat.mk b/build/tasks/boot_fat.mk
new file mode 100644
index 0000000..3937510
--- /dev/null
+++ b/build/tasks/boot_fat.mk
@@ -0,0 +1,10 @@
+$(PRODUCT_OUT)/boot_fat.uefi.img: $(PRODUCT_OUT)/kernel $(PRODUCT_OUT)/hi6220-hikey.dtb $(PRODUCT_OUT)/ramdisk.img
+# $@ is referring to $(PRODUCT_OUT)/boot_fat.uefi.img
+	dd if=/dev/zero of=$@ bs=512 count=98304
+	mkfs.fat -n "BOOT IMG" $@
+	mcopy -i $@ $(PRODUCT_OUT)/kernel ::Image
+	mcopy -i $@ $(PRODUCT_OUT)/hi6220-hikey.dtb ::hi6220-hikey.dtb
+	mcopy -s -i $@ device/linaro/hikey/bootloader/* ::
+	mcopy -i $@ $(PRODUCT_OUT)/ramdisk.img ::ramdisk.img
+
+droidcore: $(PRODUCT_OUT)/boot_fat.uefi.img
diff --git a/device.mk b/device.mk
index 7e6e8ac..0451a68 100644
--- a/device.mk
+++ b/device.mk
@@ -76,9 +76,6 @@
 # Include BT modules
 $(call inherit-product-if-exists, devices/linaro/hikey/wpan/ti-wpan-products.mk)
 
-# Build boot_fat partition image
-$(call inherit-product-if-exists, device/linaro/hikey/boot_fat.mk)
-
 PRODUCT_COPY_FILES += \
         frameworks/native/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml \
         frameworks/native/data/etc/android.hardware.bluetooth.xml:system/etc/permissions/android.hardware.bluetooth.xml \