ImageService/Create: Implement base_is_recovery
An image named "recovery_image.bin" needs to exist in order for the
Chromebook Recovery Utility, GoldenEye and other tools to discover an
image for a given build target.
This change adds an attribute to the
BuildConfig, base_is_recovery, that when true, skips recovery image
creation and copies the base image to "recovery_image.bin" instead.
BUG=b:229382044
TEST=./run_tests
Change-Id: I622a0a8cb68e032060c978523eb22698dc786ba4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3687376
Tested-by: Joseph Sussman <josephsussman@google.com>
Reviewed-by: Chris Gerber <gerb@google.com>
Auto-Submit: Joseph Sussman <josephsussman@google.com>
Commit-Queue: Chris Gerber <gerb@google.com>
diff --git a/api/controller/image.py b/api/controller/image.py
index 7c94856..4717c38 100644
--- a/api/controller/image.py
+++ b/api/controller/image.py
@@ -280,8 +280,13 @@
for mod_type in image_types.mod_images:
if mod_type == _RECOVERY_ID:
base_image_path = core_result.images[constants.IMAGE_TYPE_BASE]
- result = image.BuildRecoveryImage(
- board=board, image_path=base_image_path)
+ # For ChromeOS Flex special case.
+ if build_config.base_is_recovery:
+ result = image.CopyBaseToRecovery(
+ board=board, image_path=base_image_path)
+ else:
+ result = image.BuildRecoveryImage(
+ board=board, image_path=base_image_path)
if result.all_built:
_add_image_to_proto(output_proto,
result.images[_IMAGE_MAPPING[mod_type]], mod_type,
@@ -355,6 +360,7 @@
version = input_proto.version or None
disk_layout = input_proto.disk_layout or None
builder_path = input_proto.builder_path or None
+ base_is_recovery = input_proto.base_is_recovery or False
return image.BuildConfig(
enable_rootfs_verification=enable_rootfs_verification,
replace=True,
@@ -362,6 +368,7 @@
disk_layout=disk_layout,
builder_path=builder_path,
symlink=LOCATION_CORE,
+ base_is_recovery=base_is_recovery,
)