Remove the support for BOARD_HAS_EXT4_RESERVED_BLOCKS.
This is only used in file-based OTA, where we may reserve space on /system partition. With the deprecation of file-based OTA since O, the code has become obsolete. Test: `m dist` Change-Id: I2bd686b292f93b566fe28a2bcd74c564ffc75dac
This commit is contained in:
parent
3af39153a8
commit
79d52f8798
|
@ -1039,7 +1039,6 @@ $(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTE
|
||||||
$(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
|
$(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
|
||||||
$(if $(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_extfs_inode_count=$(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
|
$(if $(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_extfs_inode_count=$(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
|
||||||
$(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(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_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
|
$(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
|
||||||
$(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
|
$(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
|
||||||
$(if $(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_squashfs_block_size=$(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
|
$(if $(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_squashfs_block_size=$(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
|
||||||
|
@ -1452,9 +1451,6 @@ define build-systemimage-target
|
||||||
du -sm $(TARGET_OUT) 1>&2;\
|
du -sm $(TARGET_OUT) 1>&2;\
|
||||||
if [ "$(INTERNAL_USERIMAGES_EXT_VARIANT)" == "ext4" ]; then \
|
if [ "$(INTERNAL_USERIMAGES_EXT_VARIANT)" == "ext4" ]; then \
|
||||||
maxsize=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE); \
|
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 ;\
|
echo "The max is $$(( maxsize / 1048576 )) MB." 1>&2 ;\
|
||||||
else \
|
else \
|
||||||
echo "The max is $$(( $(BOARD_SYSTEMIMAGE_PARTITION_SIZE) / 1048576 )) MB." 1>&2 ;\
|
echo "The max is $$(( $(BOARD_SYSTEMIMAGE_PARTITION_SIZE) / 1048576 )) MB." 1>&2 ;\
|
||||||
|
@ -2475,9 +2471,6 @@ endif
|
||||||
ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
|
ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
|
||||||
$(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
|
$(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
|
||||||
endif
|
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
|
ifdef TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS
|
||||||
@# TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS can be empty to indicate that nothing but defaults should be used.
|
@# 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
|
$(hide) echo "recovery_mount_options=$(TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
|
||||||
|
|
|
@ -531,7 +531,6 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
|
||||||
shutil.rmtree(staging_system, ignore_errors=True)
|
shutil.rmtree(staging_system, ignore_errors=True)
|
||||||
shutil.copytree(origin_in, staging_system, symlinks=True)
|
shutil.copytree(origin_in, staging_system, symlinks=True)
|
||||||
|
|
||||||
has_reserved_blocks = prop_dict.get("has_ext4_reserved_blocks") == "true"
|
|
||||||
ext4fs_output = None
|
ext4fs_output = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -551,15 +550,9 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
|
||||||
print("Error: '%s' failed with exit code %d" % (build_command, exit_code))
|
print("Error: '%s' failed with exit code %d" % (build_command, exit_code))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Bug: 21522719, 22023465
|
# Check if there's enough headroom space available. This is useful for devices
|
||||||
# There are some reserved blocks on ext4 FS (lesser of 4096 blocks and 2%).
|
# with low disk space that have system image variation between builds.
|
||||||
# We need to deduct those blocks from the available space, since they are
|
if "partition_headroom" in prop_dict and fs_type.startswith("ext4"):
|
||||||
# not writable even with root privilege. It only affects devices using
|
|
||||||
# file-based OTA and a kernel version of 3.10 or greater (currently just
|
|
||||||
# sprout).
|
|
||||||
# Separately, check if there's enough headroom space available. This is useful for
|
|
||||||
# devices with low disk space that have system image variation between builds.
|
|
||||||
if (has_reserved_blocks or "partition_headroom" in prop_dict) and fs_type.startswith("ext4"):
|
|
||||||
assert ext4fs_output is not None
|
assert ext4fs_output is not None
|
||||||
ext4fs_stats = re.compile(
|
ext4fs_stats = re.compile(
|
||||||
r'Created filesystem with .* (?P<used_blocks>[0-9]+)/'
|
r'Created filesystem with .* (?P<used_blocks>[0-9]+)/'
|
||||||
|
@ -567,20 +560,13 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
|
||||||
m = ext4fs_stats.match(ext4fs_output.strip().split('\n')[-1])
|
m = ext4fs_stats.match(ext4fs_output.strip().split('\n')[-1])
|
||||||
used_blocks = int(m.groupdict().get('used_blocks'))
|
used_blocks = int(m.groupdict().get('used_blocks'))
|
||||||
total_blocks = int(m.groupdict().get('total_blocks'))
|
total_blocks = int(m.groupdict().get('total_blocks'))
|
||||||
reserved_blocks = 0
|
headroom_blocks = int(prop_dict.get('partition_headroom')) / BLOCK_SIZE
|
||||||
headroom_blocks = 0
|
adjusted_blocks = total_blocks - headroom_blocks
|
||||||
adjusted_blocks = total_blocks
|
|
||||||
if has_reserved_blocks:
|
|
||||||
reserved_blocks = min(4096, int(total_blocks * 0.02))
|
|
||||||
adjusted_blocks -= reserved_blocks
|
|
||||||
if "partition_headroom" in prop_dict:
|
|
||||||
headroom_blocks = int(prop_dict.get('partition_headroom')) / BLOCK_SIZE
|
|
||||||
adjusted_blocks -= headroom_blocks
|
|
||||||
if used_blocks > adjusted_blocks:
|
if used_blocks > adjusted_blocks:
|
||||||
mount_point = prop_dict.get("mount_point")
|
mount_point = prop_dict.get("mount_point")
|
||||||
print("Error: Not enough room on %s (total: %d blocks, used: %d blocks, "
|
print("Error: Not enough room on %s (total: %d blocks, used: %d blocks, "
|
||||||
"reserved: %d blocks, headroom: %d blocks, available: %d blocks)" % (
|
"headroom: %d blocks, available: %d blocks)" % (
|
||||||
mount_point, total_blocks, used_blocks, reserved_blocks,
|
mount_point, total_blocks, used_blocks,
|
||||||
headroom_blocks, adjusted_blocks))
|
headroom_blocks, adjusted_blocks))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -687,7 +673,6 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
|
||||||
copy_prop("system_root_image", "system_root_image")
|
copy_prop("system_root_image", "system_root_image")
|
||||||
copy_prop("ramdisk_dir", "ramdisk_dir")
|
copy_prop("ramdisk_dir", "ramdisk_dir")
|
||||||
copy_prop("ramdisk_fs_config", "ramdisk_fs_config")
|
copy_prop("ramdisk_fs_config", "ramdisk_fs_config")
|
||||||
copy_prop("has_ext4_reserved_blocks", "has_ext4_reserved_blocks")
|
|
||||||
copy_prop("system_squashfs_compressor", "squashfs_compressor")
|
copy_prop("system_squashfs_compressor", "squashfs_compressor")
|
||||||
copy_prop("system_squashfs_compressor_opt", "squashfs_compressor_opt")
|
copy_prop("system_squashfs_compressor_opt", "squashfs_compressor_opt")
|
||||||
copy_prop("system_squashfs_block_size", "squashfs_block_size")
|
copy_prop("system_squashfs_block_size", "squashfs_block_size")
|
||||||
|
@ -707,7 +692,6 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
|
||||||
copy_prop("system_size", "partition_size")
|
copy_prop("system_size", "partition_size")
|
||||||
copy_prop("system_journal_size", "journal_size")
|
copy_prop("system_journal_size", "journal_size")
|
||||||
copy_prop("system_verity_block_device", "verity_block_device")
|
copy_prop("system_verity_block_device", "verity_block_device")
|
||||||
copy_prop("has_ext4_reserved_blocks", "has_ext4_reserved_blocks")
|
|
||||||
copy_prop("system_squashfs_compressor", "squashfs_compressor")
|
copy_prop("system_squashfs_compressor", "squashfs_compressor")
|
||||||
copy_prop("system_squashfs_compressor_opt", "squashfs_compressor_opt")
|
copy_prop("system_squashfs_compressor_opt", "squashfs_compressor_opt")
|
||||||
copy_prop("system_squashfs_block_size", "squashfs_block_size")
|
copy_prop("system_squashfs_block_size", "squashfs_block_size")
|
||||||
|
@ -733,7 +717,6 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
|
||||||
copy_prop("vendor_size", "partition_size")
|
copy_prop("vendor_size", "partition_size")
|
||||||
copy_prop("vendor_journal_size", "journal_size")
|
copy_prop("vendor_journal_size", "journal_size")
|
||||||
copy_prop("vendor_verity_block_device", "verity_block_device")
|
copy_prop("vendor_verity_block_device", "verity_block_device")
|
||||||
copy_prop("has_ext4_reserved_blocks", "has_ext4_reserved_blocks")
|
|
||||||
copy_prop("vendor_squashfs_compressor", "squashfs_compressor")
|
copy_prop("vendor_squashfs_compressor", "squashfs_compressor")
|
||||||
copy_prop("vendor_squashfs_compressor_opt", "squashfs_compressor_opt")
|
copy_prop("vendor_squashfs_compressor_opt", "squashfs_compressor_opt")
|
||||||
copy_prop("vendor_squashfs_block_size", "squashfs_block_size")
|
copy_prop("vendor_squashfs_block_size", "squashfs_block_size")
|
||||||
|
@ -744,7 +727,6 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
|
||||||
copy_prop("fs_type", "fs_type")
|
copy_prop("fs_type", "fs_type")
|
||||||
copy_prop("oem_size", "partition_size")
|
copy_prop("oem_size", "partition_size")
|
||||||
copy_prop("oem_journal_size", "journal_size")
|
copy_prop("oem_journal_size", "journal_size")
|
||||||
copy_prop("has_ext4_reserved_blocks", "has_ext4_reserved_blocks")
|
|
||||||
copy_prop("oem_extfs_inode_count", "extfs_inode_count")
|
copy_prop("oem_extfs_inode_count", "extfs_inode_count")
|
||||||
d["partition_name"] = mount_point
|
d["partition_name"] = mount_point
|
||||||
return d
|
return d
|
||||||
|
|
Loading…
Reference in New Issue