Fix the case BOARD_FLASH_BLOCK_SIZE smaller than BOARD_NAND_PAGE_SIZE, eg generic_x86

Also don't build ota package for generic_x86.

Change-Id: I7606d56b312ac2e0c3514a8f250e005e0c05a3f1
diff --git a/core/Makefile b/core/Makefile
index 9a46095..3d92b60 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1085,7 +1085,7 @@
 
 ifneq ($(TARGET_SIMULATOR),true)
 ifneq ($(TARGET_PRODUCT),sdk)
-ifneq ($(TARGET_DEVICE),generic)
+ifeq ($(filter generic%,$(TARGET_DEVICE)),)
 ifneq ($(TARGET_NO_KERNEL),true)
 
 # -----------------------------------------------------------------
@@ -1140,7 +1140,7 @@
 updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
 
 endif    # TARGET_NO_KERNEL != true
-endif    # TARGET_DEVICE != generic
+endif    # TARGET_DEVICE != generic*
 endif    # TARGET_PRODUCT != sdk
 endif    # TARGET_SIMULATOR != true
 
diff --git a/core/definitions.mk b/core/definitions.mk
index b6f4515..a064e20 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1832,8 +1832,10 @@
 # spare area for each page).
 # $(1): the partition data size
 define image-size-from-data-size
-$(shell echo $$(($(1) / $(BOARD_NAND_PAGE_SIZE) * \
-  ($(BOARD_NAND_PAGE_SIZE)+$(BOARD_NAND_SPARE_SIZE)))))
+$(strip $(eval _isfds_value := $(shell echo $$(($(1) / $(BOARD_NAND_PAGE_SIZE) * \
+  ($(BOARD_NAND_PAGE_SIZE)+$(BOARD_NAND_SPARE_SIZE))))))\
+$(if $(filter 0, $(_isfds_value)),$(shell echo $$(($(BOARD_NAND_PAGE_SIZE)+$(BOARD_NAND_SPARE_SIZE)))),$(_isfds_value))\
+$(eval _isfds_value :=))
 endef
 
 # $(1): The file(s) to check (often $@)