Print out the tree size of system directory if it failes to build system.img
The tree size gives a good estimate of how big the system.img would be.
Change-Id: Iaadd58e3521b5f76cd9dfdcf384f4d820b9fc71b
diff --git a/core/Makefile b/core/Makefile
index 0397833..7b3dfe4 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -940,7 +940,11 @@
skip_fsck=true)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
./build/tools/releasetools/build_image.py \
- $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1)
+ $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) \
+ || ( echo "Out of space? the tree size of $(TARGET_OUT) is (MB): " 1>&2 ;\
+ du -sm $(TARGET_OUT) 1>&2;\
+ echo "The max is $$(( $(BOARD_SYSTEMIMAGE_PARTITION_SIZE) / 1048576 )) MB." 1>&2 ;\
+ exit 1 )
endef
$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE)