| # Copyright 2022 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/product.gni") |
| import("//zircon/kernel/phys/qemu.gni") |
| |
| # This centralizes the definition of a bunch of labels and files used in the |
| # various //build/images/**/BUILD.gn files. |
| |
| flash_manifest_version = 3 |
| |
| # These are the common assembly-related labels. |
| labels = { |
| if (use_bringup_assembly) { |
| images = "//build/images/bringup(${default_toolchain})" |
| recovery_images = recovery_label |
| assembly_name = "bringup" |
| } else { |
| assert(use_bazel_images_only, |
| "Only bazel-based products and bringup are supported.") |
| if (bazel_product_bundle_target != "") { |
| # For now only Fuchsia images built by Bazel are useful. |
| assembly_name = "fuchsia" |
| |
| # When Bazel assembly is enabled, Bazel builds both product and recovery |
| # images, and include them in the product bundle. |
| images = "${bazel_product_bundle_target}(${default_toolchain})" |
| recovery_images = "${bazel_product_bundle_target}(${default_toolchain})" |
| |
| product_assembly = "${bazel_product_bundle_target}_product_assembly(${default_toolchain})" |
| |
| # Path to the `package_tool_package_manifest_list_create` target defined in |
| # `bazel_product_bundle`. |
| bazel_package_manifests_list = "${bazel_product_bundle_target}_package_manifests_list(${default_toolchain})" |
| } else { |
| # These targets cannot be defined when there isn't a bazel_product_bundle_target defined. |
| } |
| } |
| |
| _qemu_deps = qemu_boot_shim.deps |
| assert(_qemu_deps == [ _qemu_deps[0] ]) |
| qemu_kernel = _qemu_deps[0] |
| main_pb = main_pb_label |
| } |
| |
| # These are the common assembly-related files. |
| files = { |
| if (use_bazel_images_only) { |
| if (bazel_product_bundle_target != "") { |
| _bazel_target_name = get_label_info(labels.images, "name") |
| _images_outdir = get_label_info(labels.images, "target_out_dir") + |
| "/${_bazel_target_name}/product_bundle" |
| _assembly_outdir = _images_outdir + "/system_a" |
| product_bundle_dir = _images_outdir |
| |
| # Bazel has a single package_manifests.list that it produces |
| bazel_package_manifests_list = |
| get_label_info(labels.images, "target_out_dir") + |
| "/${_bazel_target_name}/manifests/package_manifests.list" |
| |
| # The assembled_system manifest |
| image_assembly_manifest = |
| get_label_info(labels.images, "target_out_dir") + |
| "/${_bazel_target_name}_product_assembly/image_assembly.json" |
| } |
| } else { |
| _images_outdir = get_label_info(labels.images, "target_out_dir") |
| _assembly_outdir = _images_outdir + "/${labels.assembly_name}" |
| product_bundle_dir = _images_outdir + "/product_bundle" |
| } |
| |
| _image_suffix = "zbi" |
| if (sign_zbi) { |
| _image_suffix = "zbi.signed" |
| } |
| |
| if (defined(_assembly_outdir)) { |
| # The zbi created by assembly |
| zbi = "${_assembly_outdir}/${labels.assembly_name}.${_image_suffix}" |
| } |
| } |