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

Commit e3859eb0 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

build: Fix OTA package generation with multi-image uboot files

The ota script generator replicates the mkbootimg invocation (and so
needed to get a mkimage invocation of its own)
Without this, OTA packages were getting standard android bootimages
(which flashed correctly, but of course failed to boot)

Change-Id: If94a20c9d0971a412832f2b77f11535a9b664aa8
parent 0ec29a33
Loading
Loading
Loading
Loading
+21 −0
Original line number Original line Diff line number Diff line
@@ -1136,6 +1136,22 @@ else
$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
endif
endif


ifeq ($(BOARD_USES_UBOOT_MULTIIMAGE),true)

  INTERNAL_URAMDISKIMAGE_ARGS := -A ARM -O Linux -T multi -C none -n Image

  BOARD_UBOOT_ENTRY := $(strip $(BOARD_UBOOT_ENTRY))
  ifdef BOARD_UBOOT_ENTRY
    INTERNAL_URAMDISKIMAGE_ARGS += -e $(BOARD_UBOOT_ENTRY)
  endif
  BOARD_UBOOT_LOAD := $(strip $(BOARD_UBOOT_LOAD))
  ifdef BOARD_UBOOT_LOAD
    INTERNAL_URAMDISKIMAGE_ARGS += -a $(BOARD_UBOOT_LOAD)
  endif

endif


# Depending on the various images guarantees that the underlying
# Depending on the various images guarantees that the underlying
# directories are up-to-date.
# directories are up-to-date.
$(BUILT_TARGET_FILES_PACKAGE): \
$(BUILT_TARGET_FILES_PACKAGE): \
@@ -1173,6 +1189,7 @@ endif
ifdef BOARD_KERNEL_PAGESIZE
ifdef BOARD_KERNEL_PAGESIZE
	$(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/RECOVERY/pagesize
	$(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/RECOVERY/pagesize
endif
endif

	@# Components of the boot image
	@# Components of the boot image
	$(hide) mkdir -p $(zip_root)/BOOT
	$(hide) mkdir -p $(zip_root)/BOOT
	$(hide) $(call package_files-copy-root, \
	$(hide) $(call package_files-copy-root, \
@@ -1200,6 +1217,10 @@ endif
ifdef BOARD_KERNEL_PAGESIZE
ifdef BOARD_KERNEL_PAGESIZE
	$(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
	$(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
endif
endif
ifdef INTERNAL_URAMDISKIMAGE_ARGS
	$(hide) echo "$(INTERNAL_URAMDISKIMAGE_ARGS)" > $(zip_root)/BOOT/ubootargs
endif

	$(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
	$(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
	            mkdir -p $(zip_root)/RADIO; \
	            mkdir -p $(zip_root)/RADIO; \
	            $(ACP) $(t) $(zip_root)/RADIO/$(notdir $(t));)
	            $(ACP) $(t) $(zip_root)/RADIO/$(notdir $(t));)
+26 −15
Original line number Original line Diff line number Diff line
@@ -214,6 +214,17 @@ def BuildBootableImage(sourcedir):
  assert p1.returncode == 0, "mkbootfs of %s ramdisk failed" % (targetname,)
  assert p1.returncode == 0, "mkbootfs of %s ramdisk failed" % (targetname,)
  assert p2.returncode == 0, "minigzip of %s ramdisk failed" % (targetname,)
  assert p2.returncode == 0, "minigzip of %s ramdisk failed" % (targetname,)


  """check if uboot is requested"""
  fn = os.path.join(sourcedir, "ubootargs")
  if os.access(fn, os.F_OK):
    cmd = ["mkimage"]
    for argument in open(fn).read().rstrip("\n").split(" "):
      cmd.append(argument)
    cmd.append("-d")
    cmd.append(os.path.join(sourcedir, "kernel")+":"+ramdisk_img.name)
    cmd.append(img.name)

  else:
    cmd = ["mkbootimg", "--kernel", os.path.join(sourcedir, "kernel")]
    cmd = ["mkbootimg", "--kernel", os.path.join(sourcedir, "kernel")]


    fn = os.path.join(sourcedir, "cmdline")
    fn = os.path.join(sourcedir, "cmdline")