From ce7731af9f1349e574eabb00c6bc2606dddd1fa7 Mon Sep 17 00:00:00 2001 From: Andreas Makris Date: Thu, 16 Aug 2012 12:15:45 +0200 Subject: [PATCH] Add BOARD_CUSTOM_BOOTIMG_MK for custom bootimg building This patch adds BOARD_CUSTOM_BOOTIMG_MK. It is needed for some devices like Sony Xperia S (LT26) because it needs a own bootimg format. If BOARD_CUSTOM_BOOTIMG_MK is not set the build will be done in the normal way, so other devices are not affected. Change-Id: I66c8be6b107988d3238001e1dc612c044ed01aaa Signed-off-by: Andreas Makris --- core/Makefile | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/core/Makefile b/core/Makefile index 17f45cfa25..1c4288d63c 100644 --- a/core/Makefile +++ b/core/Makefile @@ -395,13 +395,13 @@ $(INSTALLED_BOOTIMAGE_TARGET): $(MKEXT2IMG) $(INTERNAL_BOOTIMAGE_FILES) $(call pretty,"Target boot image: $@") $(hide) $(MKEXT2BOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@ -else # TARGET_BOOTIMAGE_USE_EXT2 != true +else ifndef BOARD_CUSTOM_BOOTIMG_MK # TARGET_BOOTIMAGE_USE_EXT2 != true $(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(call pretty,"Target boot image: $@") $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@ $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw) -endif # TARGET_BOOTIMAGE_USE_EXT2 +endif # ifndef BOARD_CUSTOM_BOOTIMG_MK else # TARGET_NO_KERNEL # HACK: The top-level targets depend on the bootimage. Not all targets @@ -630,11 +630,11 @@ $(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) $(extra_keys) @mkdir -p $(dir $@) java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys) > $@ -$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \ +$(recovery_ramdisk): $(MKBOOTIMG) $(MINIGZIP) \ $(INSTALLED_RAMDISK_TARGET) \ $(INSTALLED_BOOTIMAGE_TARGET) \ $(recovery_binary) \ - $(recovery_initrc) $(recovery_kernel) \ + $(recovery_initrc) \ $(INSTALLED_2NDBOOTLOADER_TARGET) \ $(recovery_build_prop) $(recovery_resource_deps) \ $(recovery_fstab) \ @@ -659,10 +659,14 @@ $(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \ cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \ > $(TARGET_RECOVERY_ROOT_OUT)/default.prop - $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk) - $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@ - @echo ----- Made recovery image -------- $@ + $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $@ + +ifndef BOARD_CUSTOM_BOOTIMG_MK +$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) $(recovery_ramdisk) $(recovery_kernel) + $(call pretty,"Target recovery image: $@") + $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@ $(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw) +endif else INSTALLED_RECOVERYIMAGE_TARGET := @@ -684,6 +688,10 @@ else BOARD_NAND_SPARE_SIZE := 64 endif +ifdef BOARD_CUSTOM_BOOTIMG_MK +include $(BOARD_CUSTOM_BOOTIMG_MK) +endif + # ----------------------------------------------------------------- # system image # @@ -753,7 +761,11 @@ SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT) # image size check calculation. ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch) +ifndef BOARD_CUSTOM_BOOTIMG_MK RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p +else +RECOVERY_FROM_BOOT_PATCH := +endif $(RECOVERY_FROM_BOOT_PATCH): $(INSTALLED_RECOVERYIMAGE_TARGET) \ $(INSTALLED_BOOTIMAGE_TARGET) \ $(HOST_OUT_EXECUTABLES)/imgdiff \ @@ -896,6 +908,7 @@ define build-userdataimage-target $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs) endef + # We just build this directly to the install location. INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET) $(INSTALLED_USERDATAIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) \ @@ -1152,9 +1165,15 @@ INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip $(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR) +ifeq ($(TARGET_RELEASETOOL_OTA_FROM_TARGET_SCRIPT),) + OTA_FROM_TARGET_SCRIPT := ./build/tools/releasetools/ota_from_target_files +else + OTA_FROM_TARGET_SCRIPT := $(TARGET_RELEASETOOL_OTA_FROM_TARGET_SCRIPT) +endif + $(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(DISTTOOLS) @echo "Package OTA: $@" - $(hide) ./build/tools/releasetools/ota_from_target_files -v \ + $(OTA_FROM_TARGET_SCRIPT) -v \ -p $(HOST_OUT) \ -k $(KEY_CERT_PAIR) \ $(BUILT_TARGET_FILES_PACKAGE) $@ @@ -1180,9 +1199,15 @@ else $(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_RELEASETOOLS_EXTENSIONS) endif +ifeq ($(TARGET_RELEASETOOL_IMG_FROM_TARGET_SCRIPT),) + IMG_FROM_TARGET_SCRIPT := ./build/tools/releasetools/img_from_target_files +else + IMG_FROM_TARGET_SCRIPT := $(TARGET_RELEASETOOL_IMG_FROM_TARGET_SCRIPT) +endif + $(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(DISTTOOLS) @echo "Package: $@" - $(hide) ./build/tools/releasetools/img_from_target_files -v \ + $(IMG_FROM_TARGET_SCRIPT) -v \ -s $(extensions) \ -p $(HOST_OUT) \ $(BUILT_TARGET_FILES_PACKAGE) $@