Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53ea0a07 authored by David Ng's avatar David Ng Committed by Michael Bestas
Browse files

build: Add support for device tree in boot.img

Add support for optional device tree image (dt.img)
to boot and recovery images.  Some devices use kernel device
tree and this adds the device tree image as a section within
the boot/recovery images.

Change-Id: I91431ef2f4b86485895678916e39a8572be878eb

Build: add DT image variable to Makefile

DT image variable is currently present in
generate_extra_images.mk.This file is moved to
build/tasks to support persist image generation
during parallel make. As build/tasks is called
at the end of Makefile, DT image variable is not
available for other images generation like boot and
recovery. Adding this variable in Makefile ensures
the variable is defined before usage

Change-Id: I21f675d8ce648dc1cf1f4f3aede33278300e08c9
CRs-fixed: 548299

Fix case where boot/recovery.img were being built with wrong params.

The boot and recovery images  now get built using the same params during ota package
generation as during a normal build.

Change-Id: I93d46e11a4245288f0e87c87a2e4bf45ac5aff69

Fix the extra dt.img compilation issue.

Add support for optional device tree image (dt.img)
for device that doesnt have TARGET_BOOTIMAGE_USE_EXT2

Change-Id: I6e07b3ca6d049a8ebdad7ea304b4f39e7c846151

releasetools: Store and use the dt image file through target files

Target files packages may be used for signing images separate from the
build process. Store the device tree image file in the target files
package so it can be used during the signing process.

Change-Id: Ie8507121fa9c4ba57ecffeab05bd859ae5f5b788
parent 5d4dc44f
Loading
Loading
Loading
Loading
+21 −3
Original line number Original line Diff line number Diff line
@@ -1245,6 +1245,13 @@ INTERNAL_MKBOOTIMG_VERSION_ARGS := \
    --os_version $(PLATFORM_VERSION_LAST_STABLE) \
    --os_version $(PLATFORM_VERSION_LAST_STABLE) \
    --os_patch_level $(PLATFORM_SECURITY_PATCH)
    --os_patch_level $(PLATFORM_SECURITY_PATCH)


INSTALLED_DTIMAGE_TARGET := $(PRODUCT_OUT)/dt.img

ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true)
  INTERNAL_BOOTIMAGE_ARGS += --dt $(INSTALLED_DTIMAGE_TARGET)
  BOOTIMAGE_EXTRA_DEPS    := $(INSTALLED_DTIMAGE_TARGET)
endif

# Define these only if we are building boot
# Define these only if we are building boot
ifdef BUILDING_BOOT_IMAGE
ifdef BUILDING_BOOT_IMAGE
INSTALLED_BOOTIMAGE_TARGET := $(BUILT_BOOTIMAGE_TARGET)
INSTALLED_BOOTIMAGE_TARGET := $(BUILT_BOOTIMAGE_TARGET)
@@ -1294,7 +1301,7 @@ bootimage-nodeps: $(MKBOOTIMG) $(BOOT_SIGNER)


else ifeq (true,$(PRODUCT_SUPPORTS_VBOOT)) # PRODUCT_SUPPORTS_BOOT_SIGNER != true
else ifeq (true,$(PRODUCT_SUPPORTS_VBOOT)) # PRODUCT_SUPPORTS_BOOT_SIGNER != true


$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(VBOOT_SIGNER) $(FUTILITY)
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(VBOOT_SIGNER) $(FUTILITY) $(BOOTIMAGE_EXTRA_DEPS)
	$(call pretty,"Target boot image: $@")
	$(call pretty,"Target boot image: $@")
	$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@.unsigned
	$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@.unsigned
	$(VBOOT_SIGNER) $(FUTILITY) $@.unsigned $(PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $@.keyblock $@
	$(VBOOT_SIGNER) $(FUTILITY) $@.unsigned $(PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $@.keyblock $@
@@ -1309,7 +1316,7 @@ bootimage-nodeps: $(MKBOOTIMG) $(VBOOT_SIGNER) $(FUTILITY)


else # PRODUCT_SUPPORTS_VBOOT != true
else # PRODUCT_SUPPORTS_VBOOT != true


$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOTIMAGE_EXTRA_DEPS)
	$(call pretty,"Target boot image: $@")
	$(call pretty,"Target boot image: $@")
	$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
	$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
	$(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
	$(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
@@ -2195,6 +2202,11 @@ ifndef BOARD_RECOVERY_MKBOOTIMG_ARGS
  BOARD_RECOVERY_MKBOOTIMG_ARGS := $(BOARD_MKBOOTIMG_ARGS)
  BOARD_RECOVERY_MKBOOTIMG_ARGS := $(BOARD_MKBOOTIMG_ARGS)
endif
endif


ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true)
  INTERNAL_RECOVERYIMAGE_ARGS += --dt $(INSTALLED_DTIMAGE_TARGET)
  RECOVERYIMAGE_EXTRA_DEPS    := $(INSTALLED_DTIMAGE_TARGET)
endif

$(recovery_uncompressed_ramdisk): $(MKBOOTFS) \
$(recovery_uncompressed_ramdisk): $(MKBOOTFS) \
	    $(INTERNAL_ROOT_FILES) \
	    $(INTERNAL_ROOT_FILES) \
	    $(INSTALLED_RAMDISK_TARGET) \
	    $(INSTALLED_RAMDISK_TARGET) \
@@ -2296,7 +2308,7 @@ $(INSTALLED_BOOTIMAGE_TARGET): $(recoveryimage-deps)
endif # BOARD_USES_RECOVERY_AS_BOOT
endif # BOARD_USES_RECOVERY_AS_BOOT


ifndef BOARD_CUSTOM_BOOTIMG_MK
ifndef BOARD_CUSTOM_BOOTIMG_MK
$(INSTALLED_RECOVERYIMAGE_TARGET): $(recoveryimage-deps)
$(INSTALLED_RECOVERYIMAGE_TARGET): $(recoveryimage-deps) $(RECOVERYIMAGE_EXTRA_DEPS)
	$(call build-recoveryimage-target, $@, $(recovery_kernel))
	$(call build-recoveryimage-target, $@, $(recovery_kernel))
else
else
INTERNAL_RECOVERYIMAGE_ARGS += --kernel $(recovery_kernel)
INTERNAL_RECOVERYIMAGE_ARGS += --kernel $(recovery_kernel)
@@ -4674,6 +4686,9 @@ endif
ifdef BOARD_KERNEL_PAGESIZE
ifdef BOARD_KERNEL_PAGESIZE
	echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
	echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
endif
endif
ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true)
	$(hide) $(ACP) $(INSTALLED_DTIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/dt
endif
endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET not defined
endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET not defined
endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
	@# Components of the boot image
	@# Components of the boot image
@@ -4704,6 +4719,9 @@ endif
ifdef BOARD_KERNEL_PAGESIZE
ifdef BOARD_KERNEL_PAGESIZE
	echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
	echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
endif
endif
ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true)
	$(hide) $(ACP) $(INSTALLED_DTIMAGE_TARGET) $(zip_root)/BOOT/dt
endif
else # INSTALLED_VENDOR_BOOTIMAGE_TARGET defined
else # INSTALLED_VENDOR_BOOTIMAGE_TARGET defined
	echo "$(GENERIC_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
	echo "$(GENERIC_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET defined
endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET defined
+5 −0
Original line number Original line Diff line number Diff line
@@ -1241,6 +1241,11 @@ def _BuildBootableImage(image_name, sourcedir, fs_config_file, info_dict=None,
    cmd.append("--pagesize")
    cmd.append("--pagesize")
    cmd.append(open(fn).read().rstrip("\n"))
    cmd.append(open(fn).read().rstrip("\n"))


  fn = os.path.join(sourcedir, "dt")
  if os.access(fn, os.F_OK):
    cmd.append("--dt")
    cmd.append(fn)

  if partition_name == "recovery":
  if partition_name == "recovery":
    args = info_dict.get("recovery_mkbootimg_args")
    args = info_dict.get("recovery_mkbootimg_args")
    if not args:
    if not args: