OSDN Git Service

Make image-size-from-data-size not use hard coded values.
authorLars Svensson <lars1.svensson@sonyericsson.com>
Mon, 6 Dec 2010 14:24:58 +0000 (15:24 +0100)
committerJohan Redestig <johan.redestig@sonyericsson.com>
Mon, 6 Dec 2010 15:18:46 +0000 (16:18 +0100)
The function image-size-from-data-size was using hard
coded values. The size of spare area and pages has become
configurable so we need to read from the variables.

Change-Id: I9461d34400ffc2cc5920860d8aa78750d559e397

core/Makefile
core/definitions.mk

index 9b0b8e7..515f91d 100644 (file)
@@ -621,13 +621,15 @@ ifneq ($(BOARD_NAND_PAGE_SIZE),)
 mkyaffs2_extra_flags := -c $(BOARD_NAND_PAGE_SIZE)
 else
 mkyaffs2_extra_flags :=
+BOARD_NAND_PAGE_SIZE := 2048
 endif
 
 ifneq ($(BOARD_NAND_SPARE_SIZE),)
 mkyaffs2_extra_flags += -s $(BOARD_NAND_SPARE_SIZE)
+else
+BOARD_NAND_SPARE_SIZE := 64
 endif
 
-
 # -----------------------------------------------------------------
 # system yaffs image
 #
index 7e2d1fb..8675f36 100644 (file)
@@ -1657,10 +1657,11 @@ endif
 
 # Convert a partition data size (eg, as reported in /proc/mtd) to the
 # size of the image used to flash that partition (which includes a
-# 64-byte spare area for each 2048-byte page).
+# spare area for each page).
 # $(1): the partition data size
 define image-size-from-data-size
-$(shell echo $$(($(1) / 2048 * (2048+64))))
+$(shell echo $$(($(1) / $(BOARD_NAND_PAGE_SIZE) * \
+  ($(BOARD_NAND_PAGE_SIZE)+$(BOARD_NAND_SPARE_SIZE)))))
 endef
 
 # $(1): The file(s) to check (often $@)