android OTA package packing and extract to partition

android OTA package packing and extract to partition

device/google/dragon/releasetools.py

def FullOTA_InstallEnd(info):
  # copy the data into the package.
  try:
    bootloader_img = info.input_zip.read("RADIO/bootloader.img")
    ec_img = info.input_zip.read("RADIO/ec.bin")
  except KeyError:
    print "no firmware images in target_files; skipping install"
    return
  # copy the data into the package.
  common.ZipWriteStr(info.output_zip, "bootloader.img", bootloader_img) #应该是将bootloader.img打包到OTA package
  common.ZipWriteStr(info.output_zip, "ec.bin", ec_img)

  # emit the script code to trigger the firmware updater on the device
  info.script.AppendExtra(
    """dragon.firmware_update(package_extract_file("bootloader.img"), package_extract_file("ec.bin"));""")

build/tools/releasetools/edify_generator.py

  def AppendExtra(self, extra):
    """Append text verbatim to the output script."""
    self.script.append(extra)

 

self.script.append()应该是将package_extract_file命令写入一个OTA升级脚本里,这个脚本最终的样子类似于:
https://www.cnblogs.com/aspirs/p/13060333.html
在升级OTA package会执行这个命令将文件写入partition

build/tools/releasetools/edify_generator.py

  def WriteRawImage(self, mount_point, fn, mapfn=None):
    """Write the given package file into the partition for the given
    mount point."""

    fstab = self.fstab
    if fstab:
      p = fstab[mount_point]
      partition_type = common.PARTITION_TYPES[p.fs_type]
      args = {device: p.device, fn: fn}
      if partition_type == "EMMC":
        if mapfn:
          args["map"] = mapfn
          self.script.append(
              package_extract_file("%(fn)s", "%(device)s", "%(map)s"); % args)
        else:
          self.script.append(
              package_extract_file("%(fn)s", "%(device)s"); % args)
      else:
        raise ValueError(
            "don‘t know how to write \"%s\" partitions" % p.fs_type)

 

android OTA package packing and extract to partition

上一篇:手机ARM种类,STM32中的ARM核又是什么东东?


下一篇:分布式计算引擎 Flink/Spark on k8s 的实现对比以及实践