blob: 9aa1f4c2ac392b2ce13ead63633857fb4ac8318f [file] [log] [blame]
# Copyright 2020 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/images/args.gni")
import("//build/images/custom_signing.gni")
import("//build/images/paths.gni")
if (use_bringup_assembly) {
# The installer requires either a FVM or Fxfs.
group("installer") {
}
} else {
input_partition_labels = [
labels.images,
recovery_label,
"//build/images/recovery",
"//build/images/flash",
]
# To avoid a circular dependency, collect image-related metadata into a JSON file with the same
# format as the one produced by //:images (which $target_name cannot depend on), but only for the
# input partitions.
input_images_json = "installer_images_json"
input_images_json_file =
get_label_info(":$input_images_json", "target_gen_dir") + "/images.json"
generated_file(input_images_json) {
testonly = true
data_keys = [ "images" ]
deps = input_partition_labels
outputs = [ input_images_json_file ]
output_conversion = "json"
}
action("installer") {
testonly = true
script = "//scripts/mkinstaller/mkinstaller.py"
outputs = [ "$target_out_dir/$target_name.img" ]
dest_image = rebase_path("$target_out_dir/$target_name.img", root_build_dir)
no_output_dir_leaks = false
args = [
"--create",
"--force",
"--cgpt-path",
"host-tools/cgpt",
"--images",
rebase_path(input_images_json_file, root_build_dir),
"--build-dir",
".",
dest_image,
]
# this pulls in all the image dependencies we need.
deps = input_partition_labels + [
":$input_images_json",
"//build/images/archive:paver-script",
"//tools/vboot_reference:cgpt_host",
]
inputs = [
"$root_build_dir/host-tools/cgpt",
files.final_zbi,
files.final_vbmeta,
files.final_recovery_zbi,
files.final_recovery_vbmeta,
files.installer_zbi,
files.installer_vbmeta,
input_images_json_file,
]
if (fxfs_blob) {
inputs += [ files.fxfs_sparse ]
} else {
inputs += [ files.fvm_sparse ]
}
if (defined(files.esp)) {
inputs += [ files.esp ]
}
metadata = {
images = [
{
label = get_label_info(":$target_name", "label_with_toolchain")
name = "installer"
path = dest_image
type = "installer"
},
]
image_paths = [ "INSTALLER_IMAGE=$target_name.img" ]
}
}
}