| # Copyright 2019 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/component/component_id_index.gni") |
| import("//build/config.gni") |
| import("//build/drivers/driver_manifest.gni") |
| import("//build/images/assembly/generated_assembly_inputs.gni") |
| import("//build/images/assembly/generated_board_config.gni") |
| import("//build/images/assembly/generated_partitions_config.gni") |
| import("//build/images/assembly/generated_product_config.gni") |
| import("//build/images/fvm.gni") |
| import("//build/images/pkgfs.gni") |
| import("//build/images/shell_commands.gni") |
| import("//build/info/info.gni") |
| import("//build/packages/package_metadata.gni") |
| import("//build/security/verifier/verify_bootfs.gni") |
| import("//build/security/verifier/verify_kernel_cmdline.gni") |
| import("//build/security/verifier/verify_route_sources.gni") |
| import("//build/security/verifier/verify_static_pkgs.gni") |
| import("//build/zircon/tools.gni") |
| import("//src/developer/ffx/build/ffx_action.gni") |
| |
| # Assembles a Fuchsia system. |
| # |
| # Given base, cache, and universe packages, assembles a Fuchsia system |
| # containing those packages. |
| # |
| # Parameters: |
| # |
| # image_name (optional; default: target_name) |
| # [string] A name to use for naming all outputs and generated files, instead |
| # of $target_name. |
| # |
| # sysmgr_golden, sysmgr_golden_warn (optional, default: false) |
| # [path, boolean] Passed directly to the config_package template, see //build/config.gni. |
| # |
| # output_dir (optional; default: target_out_dir) |
| # [string] The output directory into which the final system ZBI is written. |
| # |
| # output_name (optional; default: <target_name>.zbi) |
| # [string] The name of the final system ZBI file. |
| # |
| # cmdline_goldens (optional) |
| # [list of files] A list of possible kernel cmdline golden file to compare |
| # against. Verified if matches one of the goldens. At most two entries are |
| # supported for soft migration, if the content matches either of the entries, |
| # it is consider a match. Only one entry should be used for normal case. |
| # |
| # bootfs_goldens (optional) |
| # [list of files] A list of possible bootFS golden file to compare against. |
| # Verified if matches one of the goldens. At most two entries are |
| # supported for soft migration, if the content matches either of the entries, |
| # it is consider a match. Only one entry should be used for normal case. |
| # |
| # static_pkgs_goldens (optional) |
| # [list of files] A list of possible static pkgs golden file to compare |
| # against. Verified if matches one of the goldens. At most two entries are |
| # supported for soft migration, if the content matches either of the entries, |
| # it is consider a match. Only one entry should be used for normal case. |
| # |
| # route_sources_config |
| # [string] A path to the config file to be used when invoking the |
| # route_sources verifier on the assembled system. This parameter is, |
| # temporarily, only available for the `fuchsia` image. For details, see |
| # fxbug.dev/85664. |
| # |
| # testonly (optional) |
| # [bool] Usual GN meanings. |
| # |
| # Product parameters: |
| # |
| # base_packages (required) |
| # [list of labels] The packages to include in the base package set. |
| # |
| # base_driver_packages (optional) |
| # [list of labels] The driver packages to include in the base package set. |
| # |
| # cache_packages (optional) |
| # [list of labels] The packages to cache in the images. |
| # |
| # universe_packages (optional) |
| # [list of labels] The packages to build in addition to the base and cache |
| # sets. These packages do not contribute to the produced images directly, |
| # however they may contribute to the config-data and shell-commands meta |
| # packages. |
| # |
| # bootfs_labels (required) |
| # [list of labels] The objects installed on the bootfs partition of the |
| # generated ZBI. |
| # |
| # system_image_deps (optional) |
| # [list of labels] The objects installed in the system image. |
| # |
| # devmgr_config (default: []) |
| # [list of strings] List of arguments to add to /boot/config/devmgr. |
| # These arguments come after synthesized arguments to configure blobfs and |
| # pkgfs. |
| # |
| # cmdline (optional) |
| # [list of strings] Kernel command line text. |
| # |
| # cmdline_deps (optional) |
| # [list of labels] Dependencies with metadata including additional kernel |
| # command arguments to add to the ZBI. |
| # |
| # include_component_id_index (default: false) |
| # [bool] Collect and merges a component id index from the base |
| # package set. |
| # |
| # include_shell_commands (default: true) |
| # [bool] Whether to include shell commands. Should be set to false for |
| # build without shell access. |
| # |
| # update_package_name (optional; default: "update") |
| # [string] The name to give the update package. For prime builds this |
| # should be "update_prime", so that the package does not override the |
| # non-prime package during publishing. |
| # |
| # base_package_name (optional; default: "system_image") |
| # [string] The name to give the base package. For prime builds this |
| # should be "system_image_prime", so that the package does not override the |
| # non-prime package during publishing. |
| # |
| # Board parameters: |
| # |
| # board_name (required) |
| # [string] The name of the board to place in the images. |
| # |
| # assembly_compress_blobs (default: true) |
| # [boolean] Whether the blobs added to the blobfs image should be compressed. |
| # |
| # assembly_blob_layout_format (default: "compact") |
| # [string] The format blobfs should store blobs in. The valid values are "deprecated_padded" and |
| # "compact". The deprecated padded format is supported only for Astro devices and will be |
| # removed in the future (it wastes space). |
| # |
| # check_production_tag (default: false) |
| # [bool] Whether to check there is no non_production_tag dependencies. |
| # |
| # include_version_and_epoch (default: false) |
| # [bool] Whether to include the version and epoch files into the Update |
| # Package. |
| # |
| # recovery (optional) |
| # [label] Recovery label to include in the update package. |
| # |
| # use_esp (optional) |
| # [bool] Whether to include ESP bootloaders in the update package. |
| # |
| # Board: MinFS parameters: |
| # |
| # minfs_minimum_data_bytes, minfs_maximum_bytes (optional) |
| # [int] Size options for minfs to pass to the fvm tool. |
| # |
| # Board: BlobFS parameters |
| # |
| # blobfs_minimum_inodes, blobfs_minimum_data_bytes, blobfs_maximum_bytes (optional) |
| # [int] Size options for blobfs to pass to the fvm tool. |
| # |
| # Board: FVM parameters |
| # |
| # generate_fvm (optional; default: true) |
| # [bool] Whether to generate a FVM image. |
| # |
| # assembly_include_account_in_fvm (optional; default: false) |
| # [bool] Whether to include an account partition in the FVM image. |
| # |
| # ramdisk_fvm_in_zbi (optional) |
| # [bool] Whether the FVM should be embedded into the ZBI as a ramdisk. |
| # |
| # assembly_fvm_slice_size (optional; default: 1048576) |
| # [int] The slice size of the FVM. |
| # |
| # Board: ZBI arguments |
| # |
| # zbi_name (optional; default: target_name) |
| # [string] The name to give the ZBI in the out directory. |
| # Typically: fuchsia, recovery, etc. |
| # |
| # zbi_signing_script (optional) |
| # [path] Location of script to use to sign the ZBI. |
| # |
| # zbi_signing_args (optional) |
| # [list of strings] Arguments to pass to the signing script. |
| # |
| template("assemble_system") { |
| assert(defined(invoker.base_packages), "Need to define base_packages") |
| assert(defined(invoker.bootfs_labels), "Need to define bootfs_labels") |
| assert(defined(invoker.board_name), "Need to define board_name") |
| |
| image_name = target_name |
| if (defined(invoker.image_name)) { |
| image_name = invoker.image_name |
| } |
| |
| # Internal labels used for Image Assembly. |
| labels = { |
| product_config = "${image_name}_product_config" |
| board_config = "${image_name}_board_config" |
| partitions_config = "${image_name}_partitions_config" |
| image_assembler = "${image_name}_image_assembler" |
| copy_vbmeta = "${image_name}_copy_vbmeta" |
| copy_zbi = "${image_name}_copy_zbi" |
| copy_zbi_signed = "${image_name}_copy_zbi_signed" |
| copy_zbi_manifest = "${image_name}_copy_zbi_manifest" |
| copy_images = "${image_name}_copy_images" |
| config_data = "${image_name}_config-data" |
| shell_commands = "${image_name}_shell_commands" |
| assembly_inputs = "${image_name}_assembly_inputs" |
| } |
| |
| # Intermediate files produced for Image Assembly. |
| files = { |
| product_config = "$target_out_dir/${image_name}_product_config.json" |
| board_config = "$target_out_dir/${image_name}_board_config.json" |
| partitions_config = "$target_out_dir/${image_name}_partitions.json" |
| |
| outdir = "$target_out_dir/$image_name" |
| gendir = "$outdir/gen" |
| |
| zbi = "${outdir}/${image_name}.zbi" |
| zbi_signed = "${zbi}.signed" |
| vbmeta = "${outdir}/${image_name}.vbmeta" |
| base_package = "${outdir}/base.far" |
| update_package = "${outdir}/update.far" |
| minfs = "${outdir}/data.blk" |
| blobfs = "${outdir}/blob.blk" |
| fvm = "${outdir}/fvm.blk" |
| fvm_sparse = "${outdir}/fvm.sparse.blk" |
| fvm_blob_sparse = "${outdir}/fvm.blob.sparse.blk" |
| fvm_fastboot = "${outdir}/fvm.fastboot.blk" |
| update_package_manifest = "${outdir}/update_package_manifest.json" |
| base_package_manifest = "${outdir}/base_package_manifest.json" |
| |
| zbi_manifest = "${gendir}/zbi.json" |
| blobfs_manifest = "${gendir}/blob.manifest" |
| blobs_json = "${gendir}/blobs.json" |
| static_packages = "${gendir}/data/static_packages" |
| cache_packages = "${gendir}/data/cache_packages" |
| base_meta_package = "${gendir}/system_image/meta/package" |
| update_meta_package = "${gendir}/update/meta/package" |
| packages = "${gendir}/packages.json" |
| images_manifest = "${outdir}/images.json" |
| assembly_inputs = "${outdir}/assembly_inputs.json" |
| |
| # Determine which ZBI we are shipping. |
| zbi_final = zbi |
| if (defined(invoker.zbi_signing_script)) { |
| zbi_final = zbi_signed |
| } |
| } |
| |
| _base_packages = invoker.base_packages |
| _base_driver_packages = [] |
| _cache_packages = [] |
| _universe_packages = [] |
| if (defined(invoker.base_driver_packages)) { |
| _base_driver_packages = invoker.base_driver_packages |
| } |
| _base_packages += _base_driver_packages |
| |
| if (defined(invoker.cache_packages)) { |
| _cache_packages = invoker.cache_packages |
| } |
| if (defined(invoker.universe_packages)) { |
| _universe_packages = invoker.universe_packages |
| } |
| |
| generate_fvm = true |
| if (defined(invoker.generate_fvm)) { |
| generate_fvm = invoker.generate_fvm |
| } |
| |
| system_image_deps = [] |
| if (defined(invoker.system_image_deps) && generate_fvm) { |
| system_image_deps += invoker.system_image_deps |
| } else { |
| not_needed(invoker, [ "system_image_deps" ]) |
| } |
| |
| embed_fvm_in_zbi = false |
| if (defined(invoker.ramdisk_fvm_in_zbi)) { |
| embed_fvm_in_zbi = invoker.ramdisk_fvm_in_zbi && generate_fvm |
| } |
| |
| devmgr_config = [] |
| if (defined(invoker.devmgr_config)) { |
| devmgr_config = invoker.devmgr_config |
| } |
| |
| include_shell_commands = true |
| if (defined(invoker.include_shell_commands)) { |
| include_shell_commands = invoker.include_shell_commands |
| } |
| |
| # Generate the base driver manifest file that lists all available drivers |
| # collected from _base_driver_packages dependency tree. This manifest file |
| # will be included in the driver-manager-base-config package. |
| base_driver_manifest_label = "${image_name}_base-driver-manifest" |
| combined_driver_manifest(base_driver_manifest_label) { |
| forward_variables_from(invoker, [ "testonly" ]) |
| manifest_name = "base-driver-manifest.json" |
| deps = _base_driver_packages |
| } |
| |
| # The driver-manager-base-config package is read by Driver Manager to |
| # discover where the base drivers are located. |
| driver_manager_base_config_label = "${image_name}_driver-manager-base-config" |
| fuchsia_package(driver_manager_base_config_label) { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| package_name = "driver-manager-base-config" |
| deps = [ ":${base_driver_manifest_label}" ] |
| } |
| |
| # TODO(fxbug.dev/81290): Construct the shell commands package in the Image |
| # Assembler. |
| if (include_shell_commands) { |
| shell_commands(labels.shell_commands) { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| package_name = "shell-commands" |
| deps = _base_packages + _cache_packages + _universe_packages |
| } |
| } |
| |
| # For details, see //docs/development/components/component_id_index.md#system-assembly |
| component_id_index_config("${image_name}_component_id_index_config") { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| |
| # collect and merge component ID indices from the base set. |
| deps = _base_packages |
| } |
| |
| component_id_index_dep = [] |
| component_id_index_config_data_dep = [] |
| if (defined(invoker.include_component_id_index) && |
| invoker.include_component_id_index) { |
| component_id_index_dep = [ ":${image_name}_component_id_index_config" ] |
| component_id_index_config_data_dep = |
| [ ":${image_name}_component_id_index_config-config-data" ] |
| } |
| |
| config_package(labels.config_data) { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| package_name = "config-data" |
| deps = _base_packages + _cache_packages + _universe_packages + |
| component_id_index_config_data_dep |
| if (defined(invoker.sysmgr_golden)) { |
| sysmgr_golden = invoker.sysmgr_golden |
| } |
| if (defined(invoker.sysmgr_golden_warn)) { |
| sysmgr_golden_warn = invoker.sysmgr_golden_warn |
| } |
| } |
| |
| ####### |
| # Build the images using the Image Assembler. |
| # |
| |
| generated_product_config(labels.product_config) { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| |
| output_path = files.product_config |
| kernel_image = "//zircon/kernel" |
| |
| base_packages = [] |
| if (generate_fvm) { |
| base_packages = _base_packages |
| base_packages += component_id_index_dep |
| base_packages += [ ":${driver_manager_base_config_label}" ] |
| base_packages += [ |
| ":${labels.config_data}", |
| pkgfs_package_label, |
| ] |
| if (include_shell_commands) { |
| base_packages += [ ":${labels.shell_commands}" ] |
| } |
| cache_packages = _cache_packages |
| } |
| |
| boot_args = devmgr_config |
| |
| # Search for BootFS files in these targets. |
| bootfs_labels = invoker.bootfs_labels |
| bootfs_labels += component_id_index_dep |
| bootfs_labels += [ "//zircon/kernel" ] |
| |
| # Only builds with an FVM need base-resolver for pkgfs. |
| if (generate_fvm) { |
| bootfs_labels += [ "//src/sys/base-resolver:bootfs" ] |
| } |
| |
| if (embed_fvm_in_zbi) { |
| bootfs_labels += [ "//src/storage/fshost:minfs_ramdisk" ] |
| } |
| extra_base_deps = system_image_deps |
| |
| # Search for the Kernel cmdline in the BootFS dependencies. |
| cmdline_deps = invoker.bootfs_labels |
| if (defined(invoker.cmdline_deps)) { |
| cmdline_deps += invoker.cmdline_deps |
| } |
| if (defined(invoker.cmdline)) { |
| cmdline = invoker.cmdline |
| } |
| } |
| |
| generated_board_config(labels.board_config) { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| "recovery", |
| "use_esp", |
| "blobfs_minimum_inodes", |
| "blobfs_minimum_data_bytes", |
| "blobfs_maximum_bytes", |
| "minfs_minimum_data_bytes", |
| "minfs_maximum_bytes", |
| "embed_fvm_in_zbi", |
| "zbi_name", |
| "zbi_signing_script", |
| "zbi_signing_args", |
| "include_version_and_epoch", |
| "base_package_name", |
| "update_package_name", |
| ]) |
| board_name = invoker.board_name |
| generate_fvm = generate_fvm |
| output_path = files.board_config |
| |
| zbi_name = "${image_name}" |
| if (defined(invoker.zbi_name)) { |
| zbi_name = invoker.zbi_name |
| } |
| |
| if (generate_fvm) { |
| fvm_slice_size = 1048576 |
| if (defined(invoker.assembly_fvm_slice_size)) { |
| fvm_slice_size = invoker.assembly_fvm_slice_size |
| } |
| |
| blob_layout_format = "compact" |
| if (defined(invoker.assembly_blob_layout_format)) { |
| blob_layout_format = invoker.assembly_blob_layout_format |
| } |
| |
| compress_blobs = true |
| if (defined(invoker.assembly_compress_blobs)) { |
| compress_blobs = invoker.assembly_compress_blobs |
| } |
| |
| assembly_include_account_in_fvm = false |
| if (defined(invoker.assembly_include_account_in_fvm)) { |
| assembly_include_account_in_fvm = |
| invoker.assembly_include_account_in_fvm |
| } |
| } |
| } |
| |
| generated_partitions_config(labels.partitions_config) { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| |
| output_path = files.partitions_config |
| if (defined(invoker.use_esp) && invoker.use_esp) { |
| esp_image_path = "${root_build_dir}/fuchsia.esp.blk" |
| deps = [ "//build/images:esp" ] |
| } |
| } |
| |
| check_production_tag = false |
| if (defined(invoker.check_production_tag)) { |
| check_production_tag = invoker.check_production_tag |
| } |
| |
| generated_assembly_inputs(labels.assembly_inputs) { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| product_config = files.product_config |
| board_config = files.board_config |
| output_path = files.assembly_inputs |
| |
| deps = [ |
| ":${labels.board_config}", |
| ":${labels.product_config}", |
| ] |
| } |
| |
| ffx_action(labels.image_assembler) { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| metadata = { |
| # We insert these barriers to prevent the dependencies of these images |
| # from leaking into images "higher up" in the dependency chain. |
| package_barrier = [] |
| config_package_barrier = [] |
| distribution_entries_barrier = [] |
| |
| if (defined(invoker.metadata)) { |
| forward_variables_from(invoker.metadata, "*") |
| } |
| } |
| |
| # TODO(fxbug.dev/77290) - Add depfile support and then remove the following |
| hermetic_deps = false |
| |
| args = [ |
| "--config", |
| "assembly_enabled=true", |
| "assembly", |
| "image", |
| "--product", |
| rebase_path(files.product_config, root_build_dir), |
| "--board", |
| rebase_path(files.board_config, root_build_dir), |
| "--gendir", |
| rebase_path(files.gendir, root_build_dir), |
| "--outdir", |
| rebase_path(files.outdir, root_build_dir), |
| ] |
| |
| # The SDK produces a manifest, which is used by ffx to find the host tools. |
| deps = [ "//sdk:host_tools.all" ] |
| if (defined(invoker.deps)) { |
| deps += invoker.deps |
| } |
| deps += [ |
| ":${labels.board_config}", |
| ":${labels.product_config}", |
| ] |
| |
| inputs = [ |
| files.board_config, |
| files.product_config, |
| ] |
| |
| # zbi outputs |
| outputs = [ |
| files.zbi, |
| files.zbi_manifest, |
| files.update_package, |
| files.packages, |
| files.images_manifest, |
| ] |
| |
| if (defined(invoker.zbi_signing_script)) { |
| outputs += [ files.zbi_signed ] |
| } |
| |
| if (use_vbmeta) { |
| outputs += [ files.vbmeta ] |
| } |
| |
| # Base package dependencies and outputs, if this configuration uses them. |
| if (generate_fvm) { |
| fvm_tool_target = "//src/storage/bin/fvm($host_toolchain)" |
| fvm_tool_path = get_label_info(fvm_tool_target, "root_out_dir") |
| fvm_tool_path += "/fvm" |
| |
| deps += [ |
| blobfs_tool_target, |
| fvm_tool_target, |
| ] |
| |
| inputs += [ |
| blobfs_tool_path, |
| fvm_tool_path, |
| ] |
| |
| outputs += [ |
| # In the outdir. |
| files.base_package, |
| files.minfs, |
| files.blobfs, |
| files.fvm, |
| files.fvm_sparse, |
| files.fvm_blob_sparse, |
| |
| # In the gendir. |
| files.blobfs_manifest, |
| files.blobs_json, |
| files.static_packages, |
| files.cache_packages, |
| files.base_meta_package, |
| files.update_meta_package, |
| files.update_package_manifest, |
| files.base_package_manifest, |
| ] |
| |
| if (fvm_emmc_partition_size != false || |
| fvm_ftl_nand_block_count != false) { |
| outputs += [ files.fvm_fastboot ] |
| } |
| } |
| |
| if (check_production_tag) { |
| assert_no_deps = [ "//build/validate:non_production_tag" ] |
| } |
| } |
| |
| ####### |
| # Optionally, copy the resulting ZBI to the specified directory. |
| # |
| |
| if (defined(invoker.output_dir)) { |
| assert( |
| invoker.output_dir != target_out_dir, |
| "The specified output directory must be different from the default target_out_dir") |
| |
| # The output name is the same as the original file by default. |
| # Otherwise, it takes the output_name, and strips any extension. |
| output_name = "${image_name}" |
| if (defined(invoker.output_name)) { |
| parts = string_split(invoker.output_name, ".") |
| output_name = parts[0] |
| } |
| |
| copy(labels.copy_zbi) { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| sources = [ files.zbi ] |
| outputs = [ "${invoker.output_dir}/${output_name}.zbi" ] |
| deps = [ ":${labels.image_assembler}" ] |
| } |
| |
| copy(labels.copy_zbi_manifest) { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| sources = [ files.zbi_manifest ] |
| outputs = [ "${invoker.output_dir}/${output_name}.zbi.json" ] |
| deps = [ ":${labels.image_assembler}" ] |
| } |
| |
| if (defined(invoker.zbi_signing_script)) { |
| copy(labels.copy_zbi_signed) { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| sources = [ files.zbi_signed ] |
| outputs = [ "${invoker.output_dir}/${output_name}.zbi.signed" ] |
| deps = [ ":${labels.image_assembler}" ] |
| } |
| } |
| |
| if (use_vbmeta) { |
| copy(labels.copy_vbmeta) { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| sources = [ files.vbmeta ] |
| outputs = [ "${invoker.output_dir}/${output_name}.vbmeta" ] |
| deps = [ ":${labels.image_assembler}" ] |
| } |
| } |
| |
| group(labels.copy_images) { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| public_deps = [ |
| ":${labels.copy_zbi_manifest}", |
| ":${labels.copy_zbi}", |
| ] |
| if (defined(invoker.zbi_signing_script)) { |
| public_deps += [ ":${labels.copy_zbi_signed}" ] |
| } |
| if (use_vbmeta) { |
| public_deps += [ ":${labels.copy_vbmeta}" ] |
| } |
| } |
| } |
| |
| ####### |
| # Check the golden files. |
| # |
| |
| if (defined(invoker.cmdline_goldens)) { |
| verify_kernel_cmdline("${image_name}_cmdline_verify_files") { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| zbi = files.zbi_final |
| goldens = invoker.cmdline_goldens |
| zbi_target = ":${labels.image_assembler}" |
| } |
| } |
| if (defined(invoker.bootfs_goldens)) { |
| verify_bootfs_filelist("${image_name}_bootfs_verify_files") { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| zbi = files.zbi_final |
| goldens = invoker.bootfs_goldens |
| zbi_target = ":${labels.image_assembler}" |
| } |
| } |
| if (defined(invoker.static_pkgs_goldens)) { |
| verify_static_pkgs("${image_name}_static_pkgs_verify_files") { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| zbi = files.zbi_final |
| zbi_target = ":${labels.image_assembler}" |
| blobfs_manifest = files.blobfs_manifest |
| blobfs_manifest_target = ":${labels.image_assembler}" |
| goldens = invoker.static_pkgs_goldens |
| } |
| } |
| if (defined(invoker.route_sources_config)) { |
| assert( |
| image_name == "fuchsia", |
| "assemble_system() { route_sources_config } is temporarily only available for the `fuchsia` image") |
| verify_route_sources("${image_name}_route_sources_verify_files") { |
| # TODO(fxbug.dev/85664): The testonly and the dependency on pm publish |
| # are both temporary; they will be fixed after all collectors use |
| # blobfs_manifest as the source of truth for loading blobs. |
| # |
| # Unlike other verifiers that rely on assembly metadata, the route_sources |
| # verifier depends on pm publish and is integrated into the build via the |
| # testonly //build/images:updates target. |
| testonly = true |
| forward_variables_from(invoker, [ "visibility" ]) |
| zbi = files.zbi_final |
| zbi_target = ":${labels.image_assembler}" |
| blobfs_manifest = files.blobfs_manifest |
| blobfs_manifest_target = ":${labels.image_assembler}" |
| config_path = invoker.route_sources_config |
| } |
| } |
| |
| group(target_name) { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| |
| # public_deps is used, so that the outputs of these dependencies are |
| # available to external targets. |
| public_deps = [ |
| ":${labels.assembly_inputs}", |
| ":${labels.image_assembler}", |
| ":${labels.partitions_config}", |
| ] |
| if (defined(invoker.output_dir)) { |
| public_deps += [ ":${labels.copy_images}" ] |
| } |
| |
| deps = [] |
| if (defined(invoker.cmdline_goldens)) { |
| deps += [ ":${image_name}_cmdline_verify_files" ] |
| } |
| if (defined(invoker.bootfs_goldens)) { |
| deps += [ ":${image_name}_bootfs_verify_files" ] |
| } |
| if (defined(invoker.static_pkgs_goldens)) { |
| deps += [ ":${image_name}_static_pkgs_verify_files" ] |
| } |
| |
| # Note: "${image_name}_route_sources_verify_files" dependency on pm-publish |
| # would create a dependency cycle if it were included here. Instead, it is |
| # integrated into the build via //build/images:updates. |
| } |
| } |