releasetools: Rename the ramdisk_dir in prop dict to root_dir.
This property indicates the path to the root directory (i.e.
TARGET_ROOT_OUT at build time, or ROOT/ in a target_files.zip).
build_image.py will only use this property when building a target using
system_root_image. Under such a configuration, files under this dir
never land into a ramdisk, but as part of system.img. This CL renames
the property name to avoid confusion.
Note that with this change releasetools keeps working with older
target_files zips that contain 'ramdisk_dir'. Because common.py doesn't
read the value of that property, but sets it to ROOT/ directly.
Test: `m dist` on aosp_marlin-userdebug.
Test: `m dist` on aosp_angler-userdebug.
Test: Run add_img_to_target_files.py with a new target_files.zip and an
old target_files.zip respectively.
Change-Id: Ie9e19dd17d8c2abb4c4a97449e436774d5dd2a36
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index d0c9d09..386cf78 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -483,7 +483,7 @@
True iff the image is built successfully.
"""
# system_root_image=true: build a system.img that combines the contents of
- # /system and the ramdisk, and can be mounted at the root of the file system.
+ # /system and root, which should be mounted at the root of the file system.
origin_in = in_dir
fs_config = prop_dict.get("fs_config")
if (prop_dict.get("system_root_image") == "true" and
@@ -492,12 +492,12 @@
# Change the mount point to "/".
prop_dict["mount_point"] = "/"
if fs_config:
- # We need to merge the fs_config files of system and ramdisk.
- merged_fs_config = common.MakeTempFile(prefix="root_fs_config",
+ # We need to merge the fs_config files of system and root.
+ merged_fs_config = common.MakeTempFile(prefix="merged_fs_config",
suffix=".txt")
with open(merged_fs_config, "w") as fw:
- if "ramdisk_fs_config" in prop_dict:
- with open(prop_dict["ramdisk_fs_config"]) as fr:
+ if "root_fs_config" in prop_dict:
+ with open(prop_dict["root_fs_config"]) as fr:
fw.writelines(fr.readlines())
with open(fs_config) as fr:
fw.writelines(fr.readlines())
@@ -645,10 +645,10 @@
if in_dir != origin_in:
# Construct a staging directory of the root file system.
- ramdisk_dir = prop_dict.get("ramdisk_dir")
- if ramdisk_dir:
+ root_dir = prop_dict.get("root_dir")
+ if root_dir:
shutil.rmtree(in_dir)
- shutil.copytree(ramdisk_dir, in_dir, symlinks=True)
+ shutil.copytree(root_dir, in_dir, symlinks=True)
staging_system = os.path.join(in_dir, "system")
shutil.rmtree(staging_system, ignore_errors=True)
shutil.copytree(origin_in, staging_system, symlinks=True)
@@ -790,8 +790,8 @@
d["journal_size"] = "0"
copy_prop("system_verity_block_device", "verity_block_device")
copy_prop("system_root_image", "system_root_image")
- copy_prop("ramdisk_dir", "ramdisk_dir")
- copy_prop("ramdisk_fs_config", "ramdisk_fs_config")
+ copy_prop("root_dir", "root_dir")
+ copy_prop("root_fs_config", "root_fs_config")
copy_prop("ext4_share_dup_blocks", "ext4_share_dup_blocks")
copy_prop("system_squashfs_compressor", "squashfs_compressor")
copy_prop("system_squashfs_compressor_opt", "squashfs_compressor_opt")