From efbb5d2e692283be32069e808b88522727c7fe98 Mon Sep 17 00:00:00 2001 From: Tao Bao <tbao@google.com> Date: Tue, 23 Jun 2015 11:16:05 -0700 Subject: Adjust the size computation for reserved blocks Due to the change in https://lwn.net/Articles/546473/, kernel reserves a few extra blocks (lesser of 2% and 4096 blocks) on ext4 FS which leads to OTA update failures. Adjust the size computation if the device has BOARD_HAS_EXT4_RESERVED_BLOCKS := true. Bug: 21522719 Bug: 22023465 Change-Id: I49f16adbf2dedc5279fbb8622bf99ef71dcc494f --- core/Makefile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/Makefile b/core/Makefile index c96f04f..a181023 100644 --- a/core/Makefile +++ b/core/Makefile @@ -729,6 +729,8 @@ $(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMA $(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1)) $(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) $(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(1)) +$(if $(BOARD_HAS_EXT4_RESERVED_BLOCKS),$(hide) echo "has_ext4_reserved_blocks=$(BOARD_HAS_EXT4_RESERVED_BLOCKS)" >> $(1)) +$(if $(BOARD_FLASH_BLOCK_SIZE),$(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $(1)) $(if $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "userdata_fs_type=$(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) $(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1)) $(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) @@ -991,7 +993,15 @@ define build-systemimage-target $(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 ;\ + if [ "$(INTERNAL_USERIMAGES_EXT_VARIANT)" == "ext4" ]; then \ + maxsize=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE); \ + if [ "$(BOARD_HAS_EXT4_RESERVED_BLOCKS)" == "true" ]; then \ + maxsize=$$((maxsize - 4096 * 4096)); \ + fi; \ + echo "The max is $$(( maxsize / 1048576 )) MB." 1>&2 ;\ + else \ + echo "The max is $$(( $(BOARD_SYSTEMIMAGE_PARTITION_SIZE) / 1048576 )) MB." 1>&2 ;\ + fi; \ mkdir -p $(DIST_DIR); cp $(INSTALLED_FILES_FILE) $(DIST_DIR)/installed-files-rescued.txt; \ exit 1 ) endef @@ -1473,6 +1483,9 @@ endif ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt endif +ifdef BOARD_HAS_EXT4_RESERVED_BLOCKS + $(hide) echo "has_ext4_reserved_blocks=$(BOARD_HAS_EXT4_RESERVED_BLOCKS)" >> $(zip_root)/META/misc_info.txt +endif ifdef TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS @# TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS can be empty to indicate that nothing but defaults should be used. $(hide) echo "recovery_mount_options=$(TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt -- cgit v1.1