diff --git a/generate_extra_images.mk b/generate_extra_images.mk index 6dac915f..3327f487 100644 --- a/generate_extra_images.mk +++ b/generate_extra_images.mk @@ -13,6 +13,7 @@ INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img INSTALLED_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img +INSTALLED_USBIMAGE_TARGET := $(PRODUCT_OUT)/usbdisk.img #---------------------------------------------------------------------- # Generate secure boot image @@ -100,6 +101,23 @@ ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DTIMAGE_TARGET) ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(INSTALLED_DTIMAGE_TARGET) endif +#--------------------------------------------------------------------- +# Generate usbdisk.img FAT32 image +# Please NOTICE: the valid max size of usbdisk.bin is 10GB +#--------------------------------------------------------------------- +ifneq ($(strip $(BOARD_USBIMAGE_PARTITION_SIZE_KB)),) +define build-usbimage-target + $(hide) mkfs.vfat -n "Internal SD" -F 32 -C $(PRODUCT_OUT)/usbdisk.tmp $(BOARD_USBIMAGE_PARTITION_SIZE_KB) + $(hide) dd if=$(PRODUCT_OUT)/usbdisk.tmp of=$(INSTALLED_USBIMAGE_TARGET) bs=1024 count=20480 + $(hide) rm -f $(PRODUCT_OUT)/usbdisk.tmp +endef + +$(INSTALLED_USBIMAGE_TARGET): + $(build-usbimage-target) +ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_USBIMAGE_TARGET) +ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(INSTALLED_DTIMAGE_TARGET) +endif + #---------------------------------------------------------------------- # Generate CDROM image #----------------------------------------------------------------------