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

Commit bc00c26f authored by Doug Zongker's avatar Doug Zongker Committed by Android (Google) Code Review
Browse files

Merge "use fs_config and file_contexts from target_files"

parents 0cf8e8d5 82822821
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -207,13 +207,20 @@ def MakeVerityEnabledImage(out_file, prop_dict):
  shutil.rmtree(tempdir_name, ignore_errors=True)
  return True

def BuildImage(in_dir, prop_dict, out_file):
def BuildImage(in_dir, prop_dict, out_file,
               fs_config=None,
               fc_config=None):
  """Build an image to out_file from in_dir with property prop_dict.

  Args:
    in_dir: path of input directory.
    prop_dict: property dictionary.
    out_file: path of the output image file.
    fs_config: path to the fs_config file (typically
      META/filesystem_config.txt).  If None then the configuration in
      the local client will be used.
    fc_config: path to the SELinux file_contexts file.  If None then
      the value from prop_dict['selinux_fc'] will be used.

  Returns:
    True iff the image is built successfully.
@@ -243,7 +250,11 @@ def BuildImage(in_dir, prop_dict, out_file):
    build_command.append(prop_dict["partition_size"])
    if "timestamp" in prop_dict:
      build_command.extend(["-T", str(prop_dict["timestamp"])])
    if "selinux_fc" in prop_dict:
    if fs_config is not None:
      build_command.extend(["-C", fs_config])
    if fc_config is not None:
      build_command.append(fc_config)
    elif "selinux_fc" in prop_dict:
      build_command.append(prop_dict["selinux_fc"])
  else:
    build_command = ["mkyaffs2image", "-f"]
+10 −1
Original line number Diff line number Diff line
@@ -83,8 +83,17 @@ def BuildSystem(input_dir, info_dict, sparse=True, map_file=None):
  fstab = info_dict["fstab"]
  if fstab:
    image_props["fs_type" ] = fstab["/system"].fs_type

  fs_config = os.path.join(input_dir, "META/filesystem_config.txt")
  if not os.path.exists(fs_config): fs_config = None

  fc_config = os.path.join(input_dir, "BOOT/RAMDISK/file_contexts")
  if not os.path.exists(fc_config): fc_config = None

  succ = build_image.BuildImage(os.path.join(input_dir, "system"),
                                image_props, img.name)
                                image_props, img.name,
                                fs_config=fs_config,
                                fc_config=fc_config)
  assert succ, "build system.img image failed"

  mapdata = None