diff options
author | Jon Medhurst <tixy@linaro.org> | 2012-09-21 09:46:07 +0100 |
---|---|---|
committer | Jon Medhurst <tixy@linaro.org> | 2012-09-21 13:27:09 +0100 |
commit | d49c1a4ad5a5684e1eef708baf1055a4262e9423 (patch) | |
tree | 592c308788eba945ebb71699666689062054c200 /tasks/kernel.mk | |
parent | 7d6bb6688bbc93e872ec8514f1ddb06054a985c0 (diff) |
kernel.mk: Fix device-tree parallel build failures
As we are generating separate make rules for each device-tree, we invoke
the Linux makefile multiple times. Now, as the The Linux makefile
creates some host helpers using scripts/mod/Makefile, we have the
situation for parallel builds where multiple processes attempt to
generate the same files, leading to race conditions and build failures like:
mv: cannot move `scripts/mod/.empty.o.tmp' to `scripts/mod/.empty.o.cmd': No such file or directory
fixdep: error opening depfile: scripts/mod/.file2alias.o.d: No such file or directory
To fix this problem, this patch adds a new make target 'all_dtbs' which
invokes the Linux makefile only once to generate all the device-trees in
one go, and re-arranges other rules and variable to accommodate this.
Change-Id: I55b4e0416287b21be6f4671b58fdd369fdbbe688
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Diffstat (limited to 'tasks/kernel.mk')
-rw-r--r-- | tasks/kernel.mk | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/tasks/kernel.mk b/tasks/kernel.mk index a745641..1f7d8a6 100644 --- a/tasks/kernel.mk +++ b/tasks/kernel.mk @@ -107,12 +107,12 @@ $(INSTALLED_SYSTEMTARBALL_TARGET): android_kernel_modules out_of_tree_modules # define MAKE_DEVICE_TREE -$(1): $$(INSTALLED_KERNEL_TARGET) $$(ACP) - cd $$(TOP)/kernel && \ - export PATH=../$$(BUILD_OUT_EXECUTABLES):$$(PATH) && \ - $$(MAKE) O=$$(KERNEL_OUT) ARCH=arm CROSS_COMPILE=$$(KERNEL_TOOLS_PREFIX) $2.dtb +$(1): $$(KERNEL_OUT)/arch/arm/boot/$(2).dtb $$(ACP) @mkdir -p $$(dir $$@) - $$(ACP) -fpt $$(KERNEL_OUT)/arch/arm/boot/$2.dtb $$@ + $$(ACP) -fpt $$< $$@ + +DTB_TARGETS += $(2).dtb +DTB_INSTALL_TARGETS += $(1) endef @@ -120,17 +120,31 @@ endef # DEVICE_TREES contains a list of device-trees to build, each # entry in the list is in the form <source-name>:<blob-name> # -DEVICE_TREE_TARGETS := +DTB_TARGETS := +DTB_INSTALL_TARGETS := $(foreach _ub,$(DEVICE_TREES), \ $(eval _source := $(call word-colon,1,$(_ub))) \ $(eval _blob := $(call word-colon,2,$(_ub))) \ $(eval _target := $(PRODUCT_OUT)/boot/$(_blob)) \ $(eval $(call MAKE_DEVICE_TREE,$(_target),$(_source))) \ - $(eval DEVICE_TREE_TARGETS += $(_target)) \ ) -$(INSTALLED_BOOTTARBALL_TARGET): $(DEVICE_TREE_TARGETS) + +ifneq ($(strip $(DTB_TARGETS)),) + +.PHONY : all_dtbs +all_dtbs : $(INSTALLED_KERNEL_TARGET) + cd $(TOP)/kernel && \ + export PATH=../$(BUILD_OUT_EXECUTABLES):$(PATH) && \ + $(MAKE) O=$(KERNEL_OUT) ARCH=arm CROSS_COMPILE=$(KERNEL_TOOLS_PREFIX) $(DTB_TARGETS) + +$(patsubst %,$(KERNEL_OUT)/arch/arm/boot/%,$(DTB_TARGETS)) : all_dtbs + +endif + + +$(INSTALLED_BOOTTARBALL_TARGET): $(DTB_INSTALL_TARGETS) ifeq ($(TARGET_PRODUCT), vexpress_rtsm) -bootwrapper: $(DEVICE_TREE_TARGETS) +bootwrapper: $(DTB_INSTALL_TARGETS) endif |