From 7832a4aeb0c557dc79a4c29635765f873596c7ad Mon Sep 17 00:00:00 2001 From: guopingy Date: Fri, 21 Feb 2014 17:10:02 +0800 Subject: [PATCH] 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 --- generate_extra_images.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/generate_extra_images.mk b/generate_extra_images.mk index 169caec1..ec2183f5 100644 --- a/generate_extra_images.mk +++ b/generate_extra_images.mk @@ -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