build: Fix some build deps and sequencing

Change-Id: I2160c3411c1e0760e5c602b71ba1ab3c81bc197f
diff --git a/Makefile b/Makefile
index f51a692..3087c3e 100644
--- a/Makefile
+++ b/Makefile
@@ -10,15 +10,17 @@
 	+make -f $(ROOTDIR)/build/Makefile validate-bootstrap-tarball
 	+make -f $(ROOTDIR)/build/Makefile all
 
-all: boot-targets partition-table rootfs
+all: boot-targets
 
 # We explicitly sequence these since they cannot be properly parallelized. The
-# u-boot and kernel build systems, in particular, do not play well as they share
-# some files.
+# u-boot and kernel build systems, in particular, do not play well together for
+# various odd reasons (duplicate targets such as depcheck, etc.)
 boot-targets:
 	+make -f $(ROOTDIR)/build/Makefile u-boot
 	+make -f $(ROOTDIR)/build/Makefile kernel
 	+make -f $(ROOTDIR)/build/Makefile boot
+	+make -f $(ROOTDIR)/build/Makefile partition-table
+	+make -f $(ROOTDIR)/build/Makefile rootfs
 
 help: targets
 targets::
diff --git a/kernel.mk b/kernel.mk
index 590a7f4..8df2f5d 100644
--- a/kernel.mk
+++ b/kernel.mk
@@ -10,34 +10,25 @@
 
 # Explicit sequencing here since u-boot and the kernel seriously hate each other
 # in parallel.
-kernel:
-	+make -f $(ROOTDIR)/build/kernel.mk kpkg
+kernel: $(PRODUCT_OUT)/linux-image-4.9.51-aiy_1_arm64.deb
 	+make -f $(ROOTDIR)/build/kernel.mk $(PRODUCT_OUT)/kernel
 	+make -f $(ROOTDIR)/build/kernel.mk $(PRODUCT_OUT)/fsl-imx8mq-phanbell.dtb
 
-kpkg: $(PRODUCT_OUT)/linux-image-4.9.51-aiy_1_arm64.deb
-
 $(KERNEL_OUT_DIR)/.config: $(ROOTDIR)/build/defconfig
 	mkdir -p $(KERNEL_OUT_DIR)
 	cp -afs $(ROOTDIR)/linux-imx/* $(KERNEL_OUT_DIR)
 	+make -C $(KERNEL_SRC_DIR) O=$(KERNEL_OUT_DIR) ARCH=arm64 CROSS_COMPILE=$(TOOLCHAIN) mrproper defconfig
 	cat $(ROOTDIR)/build/defconfig | tee -a $(KERNEL_OUT_DIR)/.config
 
-$(PRODUCT_OUT)/kernel: $(KERNEL_OUT_DIR)/.config $(KERNEL_OUT_DIR)/arch/arm64/boot/Image
+$(PRODUCT_OUT)/kernel: $(KERNEL_OUT_DIR)/arch/arm64/boot/Image
 	cp $(KERNEL_OUT_DIR)/arch/arm64/boot/Image $(PRODUCT_OUT)/kernel
 
-$(PRODUCT_OUT)/fsl-imx8mq-phanbell.dtb: $(PRODUCT_OUT)/linux-image-4.9.51-aiy_1_arm64.deb
+$(PRODUCT_OUT)/fsl-imx8mq-phanbell.dtb: $(KERNEL_OUT_DIR)/arch/arm64/boot/dts/freescale/fsl-imx8mq-phanbell.dtb
 	cp $(KERNEL_OUT_DIR)/arch/arm64/boot/dts/freescale/fsl-imx8mq-phanbell.dtb $(PRODUCT_OUT)/fsl-imx8mq-phanbell.dtb
 
 modules_install: $(PRODUCT_OUT)/kernel
 	+sudo make -C $(KERNEL_SRC_DIR) O=$(KERNEL_OUT_DIR) ARCH=arm64 CROSS_COMPILE=$(TOOLCHAIN) INSTALL_MOD_PATH=$(PRODUCT_OUT)/obj/ROOTFS/rootfs modules_install
 
-targets::
-	@echo "kernel - builds the kernel and boot partition"
-
-clean::
-	+make -C $(KERNEL_SRC_DIR) mrproper
-
 $(PRODUCT_OUT)/linux-image-4.9.51-aiy_1_arm64.deb: $(KERNEL_OUT_DIR)/.config
 	cd $(KERNEL_OUT_DIR); MFLAGS="" MAKEFLAGS="" make-kpkg --rootcmd fakeroot --arch arm64 \
 		--cross-compile $(TOOLCHAIN) --revision 1 --append-to-version=-aiy \
@@ -45,4 +36,12 @@
 		kernel_image kernel_headers
 	mv $(KERNEL_OUT_DIR)/../*.deb $(PRODUCT_OUT)
 
-.PHONY:: kernel kpkg
+targets::
+	@echo "kernel - builds the kernel and boot partition"
+
+clean::
+	+make -C $(KERNEL_SRC_DIR) mrproper
+
+# Mark the deb as phony so we enxure that we rely on the kbuild system for
+# incremental builds.
+.PHONY:: kernel modules_install $(PRODUCT_OUT)/linux-image-4.9.51-aiy_1_arm64.deb