turn down allowed image size
yaffs appears to reserve 5 blocks on the partition for itself.
Account for this when computing the maximum allowable image size.
diff --git a/core/Makefile b/core/Makefile
index 9247c75..2c4d133 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -299,7 +299,7 @@
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
$(call pretty,"Target boot image: $@")
$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
- $(hide) $(call assert-max-file-size,$@,$(BOARD_BOOTIMAGE_MAX_SIZE))
+ $(hide) $(call assert-max-file-size,$@,$(BOARD_BOOTIMAGE_MAX_SIZE),raw)
endif # TARGET_BOOTIMAGE_USE_EXT2
else # TARGET_NO_KERNEL
@@ -577,7 +577,7 @@
$(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
$(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@
@echo ----- Made recovery image -------- $@
- $(hide) $(call assert-max-file-size,$@,$(BOARD_RECOVERYIMAGE_MAX_SIZE))
+ $(hide) $(call assert-max-file-size,$@,$(BOARD_RECOVERYIMAGE_MAX_SIZE),raw)
else
INSTALLED_RECOVERYIMAGE_TARGET :=
@@ -662,7 +662,7 @@
$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH) | $(ACP)
@echo "Install system fs image: $@"
$(copy-file-to-target)
- $(hide) $(call assert-max-file-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_MAX_SIZE))
+ $(hide) $(call assert-max-file-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_MAX_SIZE),yaffs)
systemimage: $(INSTALLED_SYSTEMIMAGE)
@@ -671,7 +671,7 @@
| $(INTERNAL_MKUSERFS)
@echo "make $@: ignoring dependencies"
$(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE))
- $(hide) $(call assert-max-file-size,$(INSTALLED_SYSTEMIMAGE),$(BOARD_SYSTEMIMAGE_MAX_SIZE))
+ $(hide) $(call assert-max-file-size,$(INSTALLED_SYSTEMIMAGE),$(BOARD_SYSTEMIMAGE_MAX_SIZE),yaffs)
#######
## system tarball
@@ -708,7 +708,7 @@
$(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
@mkdir -p $(TARGET_OUT_DATA)
$(call build-userimage-ext2-target,$(TARGET_OUT_DATA),$(INSTALLED_USERDATAIMAGE_TARGET),userdata,)
- $(hide) $(call assert-max-file-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_MAX_SIZE))
+ $(hide) $(call assert-max-file-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_MAX_SIZE),yaffs)
endef
else # TARGET_USERIMAGES_USE_EXT2 != true
@@ -718,7 +718,7 @@
$(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
@mkdir -p $(TARGET_OUT_DATA)
$(hide) $(MKYAFFS2) -f $(TARGET_OUT_DATA) $(INSTALLED_USERDATAIMAGE_TARGET)
- $(hide) $(call assert-max-file-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_MAX_SIZE))
+ $(hide) $(call assert-max-file-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_MAX_SIZE),yaffs)
endef
endif # TARGET_USERIMAGES_USE_EXT2
diff --git a/core/definitions.mk b/core/definitions.mk
index e4d2ecb..3f8ab88 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1572,6 +1572,7 @@
# $(1): The file(s) to check (often $@)
# $(2): The maximum total image size, in decimal bytes
+# $(3): the type of filesystem "yaffs" or "raw"
#
# If $(2) is empty, evaluates to "true"
#
@@ -1585,9 +1586,15 @@
printname=$$(echo -n "$(1)" | tr " " +); \
echo "$$printname total size is $$total"; \
img_blocksize=$(call image-size-from-data-size,$(BOARD_FLASH_BLOCK_SIZE)); \
+ if [ "$(3)" == "yaffs" ]; then \
+ reservedblocks=5; \
+ else \
+ reselvedblocks=0; \
+ fi; \
twoblocks=$$((img_blocksize * 2)); \
onepct=$$((((($(2) / 100) - 1) / img_blocksize + 1) * img_blocksize)); \
- reserve=$$((twoblocks > onepct ? twoblocks : onepct)); \
+ reserve=$$(((twoblocks > onepct ? twoblocks : onepct) + \
+ reservedblocks * img_blocksize)); \
maxsize=$$(($(2) - reserve)); \
if [ "$$total" -gt "$$maxsize" ]; then \
echo "error: $$printname too large ($$total > [$(2) - $$reserve])"; \