Merge "Build: generate persist image where applicable"
diff --git a/generate_extra_images.mk b/generate_extra_images.mk
index 65f65fa..cb84efb 100644
--- a/generate_extra_images.mk
+++ b/generate_extra_images.mk
@@ -7,6 +7,7 @@
 # and gets parsed before build/core/Makefile, which has these
 # variables defined. build/core/Makefile will overwrite these
 # variables again.
+ifneq ($(strip $(TARGET_NO_KERNEL)),true)
 INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
 INSTALLED_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
 INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img
@@ -14,6 +15,7 @@
 INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
 recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
 INSTALLED_USBIMAGE_TARGET := $(PRODUCT_OUT)/usbdisk.img
+endif
 
 #----------------------------------------------------------------------
 # Generate secure boot image
@@ -51,6 +53,8 @@
 #----------------------------------------------------------------------
 # Generate persist image (persist.img)
 #----------------------------------------------------------------------
+ifneq ($(strip $(TARGET_NO_KERNEL)),true)
+
 TARGET_OUT_PERSIST := $(PRODUCT_OUT)/persist
 
 INTERNAL_PERSISTIMAGE_FILES := \
@@ -72,6 +76,7 @@
 ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PERSISTIMAGE_TARGET)
 ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(INSTALLED_PERSISTIMAGE_TARGET)
 
+endif
 
 #----------------------------------------------------------------------
 # Generate device tree image (dt.img)