Support a first stage ramdisk via TARGET_RAMDISK_OUT
Support a first stage ramdisk which will include the targets placed
into TARGET_RAMDISK_OUT. This replaces the existing ramdisk on
existing devices.
All system images are now built to be mounted as the root dir.
Devices with a first stage ramdisk will switch root to the system
partition.
BOARD_BUILD_SYSTEM_ROOT_IMAGE remains and is used to specify if the
system partition is going to be directly used as rootfs without the
ramdisk.
Bug: 79173823
Bug: 79758715
Test: hikey boots, sailfish boots
Test: OTA walleye from P to master
Change-Id: Idbb2dccc6340b0235a4bef03e11e420a9ed154b6
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 38c73fd..caefb79 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -181,26 +181,18 @@
if input_dir is not None:
# We carry a copy of file_contexts.bin under META/. If not available,
# search BOOT/RAMDISK/. Note that sometimes we may need a different file
- # to build images than the one running on device, such as when enabling
- # system_root_image. In that case, we must have the one for image
- # generation copied to META/.
+ # to build images than the one running on device, in that case, we must
+ # have the one for image generation copied to META/.
fc_basename = os.path.basename(d.get("selinux_fc", "file_contexts"))
fc_config = os.path.join(input_dir, "META", fc_basename)
- if d.get("system_root_image") == "true":
- assert os.path.exists(fc_config)
- if not os.path.exists(fc_config):
- fc_config = os.path.join(input_dir, "BOOT", "RAMDISK", fc_basename)
- if not os.path.exists(fc_config):
- fc_config = None
+ assert os.path.exists(fc_config)
- if fc_config:
- d["selinux_fc"] = fc_config
+ d["selinux_fc"] = fc_config
- # Similarly we need to redirect "root_dir" and "root_fs_config".
- if d.get("system_root_image") == "true":
- d["root_dir"] = os.path.join(input_dir, "ROOT")
- d["root_fs_config"] = os.path.join(
- input_dir, "META", "root_filesystem_config.txt")
+ # Similarly we need to redirect "root_dir", and "root_fs_config".
+ d["root_dir"] = os.path.join(input_dir, "ROOT")
+ d["root_fs_config"] = os.path.join(
+ input_dir, "META", "root_filesystem_config.txt")
# Redirect {system,vendor}_base_fs_file.
if "system_base_fs_file" in d:
@@ -709,15 +701,14 @@
if not entry.startswith('/'):
continue
- # "/system/framework/am.jar" => "SYSTEM/framework/am.jar". Note that when
- # using system_root_image, the filename listed in system.map may contain an
- # additional leading slash (i.e. "//system/framework/am.jar"). Using lstrip
- # to get consistent results.
+ # "/system/framework/am.jar" => "SYSTEM/framework/am.jar". Note that the
+ # filename listed in system.map may contain an additional leading slash
+ # (i.e. "//system/framework/am.jar"). Using lstrip to get consistent
+ # results.
arcname = string.replace(entry, which, which.upper(), 1).lstrip('/')
- # Special handling another case with system_root_image, where files not
- # under /system (e.g. "/sbin/charger") are packed under ROOT/ in a
- # target_files.zip.
+ # Special handling another case, where files not under /system
+ # (e.g. "/sbin/charger") are packed under ROOT/ in a target_files.zip.
if which == 'system' and not arcname.startswith('SYSTEM'):
arcname = 'ROOT/' + arcname