ANDROID: arm64: Image.gz-dtb build target depends on Image.gz
authorAmit Pundir <amit.pundir@linaro.org>
Mon, 26 Mar 2018 15:13:33 +0000 (20:43 +0530)
committerAmit Pundir <amit.pundir@linaro.org>
Tue, 27 Mar 2018 13:43:57 +0000 (19:13 +0530)
commit89aa739e0d091c68d2fad72ef619e345934a0907
tree2acea8c28af7c4bb5d8a178357423984bde0a268
parenta45ab563a4b7f7bef7e80b62ee9526491c88e26d
ANDROID: arm64: Image.gz-dtb build target depends on Image.gz

While doing parallel builds using "make -j" option, I ran into
a build race condition a few times where-in Image.gz-dtb target
starts building before Image.gz is even ready, resulting in a
corrupt Image.gz-dtb kernel image.

How to reproduce -->

$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-androidkernel- defconfig menuconfig
+
CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE=y
CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE_NAMES="qcom/apq8096-db820c"

$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-androidkernel- -j9
<snip> ..
  SYSMAP  System.map
  OBJCOPY arch/arm64/boot/Image
  GZIP    arch/arm64/boot/Image.gz
  DTC     arch/arm64/boot/dts/qcom/apq8096-db820c.dtb
  Building modules, stage 2.
  CAT     arch/arm64/boot/Image.gz-dtb
  GZIP    arch/arm64/boot/Image.gz
.. <snip>

$ du -sh arch/arm64/boot/Image.gz-dtb
28K arch/arm64/boot/Image.gz-dtb

When built with this patch -->

$ du -sh arch/arm64/boot/Image.gz-dtb
8.9M arch/arm64/boot/Image.gz-dtb

Let's make Image.gz-dtb build target depend on Image.gz explicitly.

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
arch/arm64/Makefile