Lines Matching refs:prop_dict
138 def SetUpInDirAndFsConfig(origin_in, prop_dict): argument
152 fs_config = prop_dict.get("fs_config")
154 if prop_dict["mount_point"] == "system_other":
155 prop_dict["mount_point"] = "system"
158 if prop_dict["mount_point"] != "system":
161 if "first_pass" in prop_dict:
162 prop_dict["mount_point"] = "/"
163 return prop_dict["first_pass"]
167 root_dir = prop_dict.get("root_dir")
176 prop_dict["mount_point"] = "/"
182 if "root_fs_config" in prop_dict:
183 with open(prop_dict["root_fs_config"]) as fr:
188 prop_dict["first_pass"] = (in_dir, fs_config)
192 def CheckHeadroom(ext4fs_output, prop_dict): argument
209 assert prop_dict.get('fs_type', '').startswith('ext4')
210 assert 'partition_headroom' in prop_dict
211 assert 'mount_point' in prop_dict
220 headroom_blocks = int(prop_dict['partition_headroom']) // BLOCK_SIZE
223 mount_point = prop_dict["mount_point"]
231 def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config): argument
249 fs_type = prop_dict.get("fs_type", "")
251 needs_projid = prop_dict.get("needs_projid", 0)
252 needs_casefold = prop_dict.get("needs_casefold", 0)
255 build_command = [prop_dict["ext_mkuserimg"]]
256 if "extfs_sparse_flag" in prop_dict:
257 build_command.append(prop_dict["extfs_sparse_flag"])
260 prop_dict["mount_point"]])
261 build_command.append(prop_dict["image_size"])
262 if "journal_size" in prop_dict:
263 build_command.extend(["-j", prop_dict["journal_size"]])
264 if "timestamp" in prop_dict:
265 build_command.extend(["-T", str(prop_dict["timestamp"])])
270 if "block_list" in prop_dict:
271 build_command.extend(["-B", prop_dict["block_list"]])
272 if "base_fs_file" in prop_dict:
273 base_fs_file = ConvertBlockMapToBaseFs(prop_dict["base_fs_file"])
275 build_command.extend(["-L", prop_dict["mount_point"]])
276 if "extfs_inode_count" in prop_dict:
277 build_command.extend(["-i", prop_dict["extfs_inode_count"]])
278 if "extfs_rsv_pct" in prop_dict:
279 build_command.extend(["-M", prop_dict["extfs_rsv_pct"]])
280 if "flash_erase_block_size" in prop_dict:
281 build_command.extend(["-e", prop_dict["flash_erase_block_size"]])
282 if "flash_logical_block_size" in prop_dict:
283 build_command.extend(["-o", prop_dict["flash_logical_block_size"]])
285 if prop_dict["ext_mkuserimg"] == "mkuserimg_mke2fs":
286 if "uuid" in prop_dict:
287 build_command.extend(["-U", prop_dict["uuid"]])
288 if "hash_seed" in prop_dict:
289 build_command.extend(["-S", prop_dict["hash_seed"]])
290 if prop_dict.get("ext4_share_dup_blocks") == "true":
296 if "selinux_fc" in prop_dict:
297 build_command.append(prop_dict["selinux_fc"])
301 if "squashfs_sparse_flag" in prop_dict:
302 build_command.extend([prop_dict["squashfs_sparse_flag"]])
303 build_command.extend(["-m", prop_dict["mount_point"]])
308 if "selinux_fc" in prop_dict:
309 build_command.extend(["-c", prop_dict["selinux_fc"]])
310 if "block_list" in prop_dict:
311 build_command.extend(["-B", prop_dict["block_list"]])
312 if "squashfs_block_size" in prop_dict:
313 build_command.extend(["-b", prop_dict["squashfs_block_size"]])
314 if "squashfs_compressor" in prop_dict:
315 build_command.extend(["-z", prop_dict["squashfs_compressor"]])
316 if "squashfs_compressor_opt" in prop_dict:
317 build_command.extend(["-zo", prop_dict["squashfs_compressor_opt"]])
318 if prop_dict.get("squashfs_disable_4k_align") == "true":
322 build_command.extend([out_file, prop_dict["image_size"]])
323 if "f2fs_sparse_flag" in prop_dict:
324 build_command.extend([prop_dict["f2fs_sparse_flag"]])
330 if "selinux_fc" in prop_dict:
331 build_command.extend(["-s", prop_dict["selinux_fc"]])
332 build_command.extend(["-t", prop_dict["mount_point"]])
333 if "timestamp" in prop_dict:
334 build_command.extend(["-T", str(prop_dict["timestamp"])])
335 build_command.extend(["-L", prop_dict["mount_point"]])
359 int(prop_dict.get("partition_reserved_size", 0)),
360 int(prop_dict.get("partition_reserved_size", 0)) // BYTES_IN_MB))
364 int(prop_dict["image_size"]),
365 int(prop_dict["image_size"]) // BYTES_IN_MB,
366 int(prop_dict["partition_size"]),
367 int(prop_dict["partition_size"]) // BYTES_IN_MB))
370 if run_e2fsck and prop_dict.get("skip_fsck") != "true":
383 def BuildImage(in_dir, prop_dict, out_file, target_out=None): argument
399 in_dir, fs_config = SetUpInDirAndFsConfig(in_dir, prop_dict)
402 fs_type = prop_dict.get("fs_type", "")
410 verity_image_builder = verity_utils.CreateVerityImageBuilder(prop_dict)
412 if (prop_dict.get("use_dynamic_partition_size") == "true" and
413 "partition_size" not in prop_dict):
419 reserved_size = int(prop_dict.get("partition_reserved_size", BYTES_IN_MB * 16))
420 partition_headroom = int(prop_dict.get("partition_headroom", 0))
427 prop_dict["partition_size"] = str(size)
428 prop_dict["image_size"] = str(size)
429 if "extfs_inode_count" not in prop_dict:
430 prop_dict["extfs_inode_count"] = str(GetInodeUsage(in_dir))
433 size // BYTES_IN_MB, prop_dict["extfs_inode_count"])
434 BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config)
436 if "extfs_sparse_flag" in prop_dict:
442 reserved_size = int(prop_dict.get("partition_reserved_size", 0))
462 extfs_inode_count = prop_dict["extfs_inode_count"]
471 prop_dict["extfs_inode_count"] = str(inodes)
472 prop_dict["partition_size"] = str(size)
477 prop_dict["partition_size"] = str(size)
481 prop_dict["image_size"] = prop_dict["partition_size"]
486 prop_dict["image_size"] = str(max_image_size)
488 mkfs_output = BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config)
491 if "partition_headroom" in prop_dict and fs_type.startswith("ext4"):
492 CheckHeadroom(mkfs_output, prop_dict)