qcom: common: Update cdrom build process

The usb gadget mass_storage driver limit the min
size of CDROM file. SHOULD larger than 300 Sectors.
Each sector is 2KBytes.

If the resouce file size fit the limitation of cdrom
feature. Create cdrom_install.iso file dynamically at
compiling time.
If not, create a dummy file dynamically to increase the
total size of cdrom_install.iso

Change-Id: I49d08bad83b8debfb16fe011f350b3eed3d907cb
This commit is contained in:
Xiaogang Cui 2014-01-09 19:52:52 +08:00
parent 0e2800413b
commit 162b3cbe59
1 changed files with 10 additions and 1 deletions

View File

@ -128,9 +128,18 @@ endif
#----------------------------------------------------------------------
# Generate CDROM image
#----------------------------------------------------------------------
CDROM_RES_FILE = $(TARGET_DEVICE_DIR)/cdrom_res
CDROM_RES_FILE := $(TARGET_DEVICE_DIR)/cdrom_res
ifneq ($(wildcard $(CDROM_RES_FILE)),)
CDROM_ISO_TARGET := $(PRODUCT_OUT)/system/etc/cdrom_install.iso
CDROM_RES_SIZE := $(shell du -b $(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)
$(shell dd if=/dev/zero of=$(CDROM_RES_FILE)/zero.bin bs=1024 count=$(CDROM_DUMMY_SIZE_KB))
endif
define build-cdrom-target
$(hide) mkisofs -o $(CDROM_ISO_TARGET) $(CDROM_RES_FILE)