Support to build image of root file system with /system and ramdisk combined.
Added support to build system.img that combines contents of /system and
the ramdisk, and can be mounted at the root of the file system.
To enable this feature, define BoardConfig.mk variable:
BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
Ideally we would just change TARGET_OUT (the path of the staging system
directory) to under TARGET_ROOT_OUT. But at this point many places in
the build system assume TARGET_OUT is independent of TARGET_ROOT_OUT and
we can't make it easily configurable.
Instead this implementation takes the least intrusive approach:
We don't change TARGET_OUT or TARGET_ROOT_OUT. We just assemble a
temporary staging directory that contains contents of both TARGET_OUT
and TARGET_ROOT_OUT, in build_image.BuildImage() of
tools/releasetools/build_image.py.
When build_image.py is directly called from the makefile, we pass in the
parameters from the global dictionary; when build_image.BuildImage() is
called from add_img_to_target_files.py, we need to override values to
point to files extracted from the target_files zip file.
We need to combine the fs_config files of both /system and ramdisk,
when fs_config is enabled.
Also this change refactored build_image.BuildImage() by moving the extra
parameters to the image property dictionary.
(cherry-picked from commit 0eabd4f2c5fe704d3c3212b45b80775a35b55b1b)
Bug:19868522
Change-Id: Iafc467a0e3427b0d6ad3b575abcc98ddcc9ea0f1
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index 8bbe452..b3d2ede 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -135,11 +135,20 @@
fc_config = os.path.join(input_dir, "BOOT/RAMDISK/file_contexts")
if not os.path.exists(fc_config): fc_config = None
+ # Override values loaded from info_dict.
+ if fs_config:
+ image_props["fs_config"] = fs_config
+ if fc_config:
+ image_props["selinux_fc"] = fc_config
+ if block_list:
+ image_props["block_list"] = block_list
+ if image_props.get("system_root_image") == "true":
+ image_props["ramdisk_dir"] = os.path.join(input_dir, "BOOT/RAMDISK")
+ image_props["ramdisk_fs_config"] = os.path.join(
+ input_dir, "META/boot_filesystem_config.txt")
+
succ = build_image.BuildImage(os.path.join(input_dir, what),
- image_props, img,
- fs_config=fs_config,
- fc_config=fc_config,
- block_list=block_list)
+ image_props, img)
assert succ, "build " + what + ".img image failed"
return img