qcom: common: Fix size of CDROM dummy file is zero

Dummy file size is zero because design flaw.
This fix will delete the dummy file if it already exists
before make the iso file and add additional 1KB size to avoid
size gap between byte and Kbyte.

Change-Id: I8f7a0a28b74e5413d4ad3d931a69275d011b73d7
This commit is contained in:
guopingy 2014-02-21 17:10:02 +08:00
parent 05fafb86a7
commit 7832a4aeb0
1 changed files with 7 additions and 1 deletions

View File

@ -129,15 +129,21 @@ endif
# Generate CDROM image
#----------------------------------------------------------------------
CDROM_RES_FILE := $(TARGET_DEVICE_DIR)/cdrom_res
CDROM_DUMMY_FILE := $(TARGET_DEVICE_DIR)/cdrom_res/zero.bin
ifneq ($(wildcard $(CDROM_RES_FILE)),)
CDROM_ISO_TARGET := $(PRODUCT_OUT)/system/etc/cdrom_install.iso
#delete the dummy file if it already exists.
ifneq ($(wildcard $(CDROM_DUMMY_FILE)),)
$(shell rm -f $(CDROM_DUMMY_FILE))
endif
CDROM_RES_SIZE := $(shell du -bs $(CDROM_RES_FILE) | egrep -o '^[0-9]+')
#At least 300 sectors, 2048Bytes per Sector, set as 310 here
CDROM_MIN_SIZE := 634880
CDROM_CAPACITY_IS_ENOUGH := $(shell expr $(CDROM_RES_SIZE) / $(CDROM_MIN_SIZE))
ifeq ($(CDROM_CAPACITY_IS_ENOUGH),0)
CDROM_DUMMY_SIZE := $(shell expr $(CDROM_MIN_SIZE) - $(CDROM_RES_SIZE))
CDROM_DUMMY_SIZE_KB := $(shell expr $(CDROM_DUMMY_SIZE) / 1024)
CDROM_DUMMY_SIZE_KB := $(shell expr `expr $(CDROM_DUMMY_SIZE) + 1023` / 1024)
$(shell dd if=/dev/zero of=$(CDROM_RES_FILE)/zero.bin bs=1024 count=$(CDROM_DUMMY_SIZE_KB))
endif