blob: ee3117f8f9dc71d76f61923702754cfc68565f9c [file] [log] [blame]
# 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")
# This centralizes the definition of a bunch of labels and files used in the
# various //build/images/**/BUILD.gn files.
# Kernel file used to populate emu manifest
_qemu_kernel_file = ""
_qemu_kernel_target = ""
if (target_cpu == "x64") {
_qemu_kernel_file = "$root_build_dir/multiboot.bin"
_qemu_kernel_target = "//zircon/kernel/arch/x86/phys/boot-shim:multiboot-shim"
} else if (target_cpu == "arm64") {
_qemu_kernel_file = "$root_build_dir/qemu-boot-shim.bin"
_qemu_kernel_target = "//zircon/kernel/target/arm64/boot-shim:qemu"
} else {
assert(false, "Unsupported target cpu: $target_cpu")
}
flash_manifest_version = 3
# These are the common assembly-related labels.
labels = {
if (use_bringup_assembly) {
images = "//build/images/bringup"
assembly_name = "bringup"
} else {
images = "//build/images/fuchsia"
assembly_name = "fuchsia"
images_prime = "${images}:${assembly_name}_prime"
fuchsia_netboot = "${images}:netboot"
meta_packages = "${images}:fuchsia.meta_packages"
}
zedboot_images = "//build/images/zedboot"
qemu_kernel = _qemu_kernel_target
}
supports_fastboot_fvm = fvm_partition != "" && !use_bringup_assembly
# These are the common assembly-related files.
files = {
images_outdir = get_label_info(labels.images, "target_out_dir")
assembly_outdir = images_outdir + "/${labels.assembly_name}"
zedboot_assembly_outdir =
get_label_info(labels.zedboot_images, "target_out_dir") + "/zedboot"
if (!use_bringup_assembly) {
minfs = "${assembly_outdir}/data.blk"
blobfs = "${assembly_outdir}/blob.blk"
# TODO(fxbug.dev/82077): Remove this once clients switch to the new path
old_blobfs_path = "${root_out_dir}/obj/build/images/blob.blk"
flash_manifest = "${images_outdir}/flash_manifest/flash.json"
if (use_gigaboot) {
esp = "${root_out_dir}/fuchsia.esp.blk"
}
fvm = "${assembly_outdir}/fvm.blk"
fvm_sparse = "${assembly_outdir}/fvm.sparse.blk"
if (supports_fastboot_fvm) {
fvm_fastboot = "${assembly_outdir}/fvm.fastboot.blk"
}
base_package_names = "$root_build_dir/base_packages.list"
cache_package_names = "$root_build_dir/cache_packages.list"
universe_package_names = "$root_build_dir/universe_packages.list"
manifests_from_metadata =
"$root_build_dir/package_manifests_from_metadata.list"
# TODO(https://fxbug.dev/98480) move these to image-relative paths along with tools' usages
base_package_manifests = "$root_build_dir/base_package_manifests.list"
cache_package_manifests = "$root_build_dir/cache_package_manifests.list"
}
_image_suffix = "zbi"
if (sign_zbi) {
_image_suffix = "zbi.signed"
}
# The zbi and vbmeta created by assembly
zbi = "${assembly_outdir}/${labels.assembly_name}.${_image_suffix}"
vbmeta = "${assembly_outdir}/${labels.assembly_name}.vbmeta"
# Final output image and vbmeta (the files at the above paths are copied here)
final_zbi = "$root_out_dir/" + rebase_path(zbi, assembly_outdir)
final_vbmeta = "$root_out_dir/" + rebase_path(vbmeta, assembly_outdir)
# Recovery output image and vbmeta
if (recovery_is_zedboot) {
_recovery_outdir = zedboot_assembly_outdir
recovery_zbi = "${zedboot_assembly_outdir}/zedboot.${_image_suffix}"
recovery_vbmeta = "${zedboot_assembly_outdir}/zedboot.vbmeta"
} else if (recovery_is_recovery_eng) {
_recovery_outdir = root_out_dir
recovery_zbi = "${root_out_dir}/obj/build/images/recovery/recovery-eng/recovery-eng.${_image_suffix}"
recovery_vbmeta = "${root_out_dir}/obj/build/images/recovery/recovery-eng/recovery-eng.vbmeta"
} else if (recovery_is_recovery_fastboot) {
_recovery_outdir = root_out_dir
recovery_zbi = "${root_out_dir}/obj/build/images/recovery/recovery-fastboot/recovery-fastboot.${_image_suffix}"
recovery_vbmeta = "${root_out_dir}/obj/build/images/recovery/recovery-fastboot/recovery-fastboot.vbmeta"
} else {
# The standard recovery image and vbmeta locations.
_recovery_outdir = root_out_dir
recovery_zbi = "${root_out_dir}/recovery.${_image_suffix}"
recovery_vbmeta = "${root_out_dir}/recovery.vbmeta"
}
final_recovery_zbi =
"$root_out_dir/" + rebase_path(recovery_zbi, _recovery_outdir)
final_recovery_vbmeta =
"$root_out_dir/" + rebase_path(recovery_vbmeta, _recovery_outdir)
installer_zbi = "$root_out_dir/obj/build/images/recovery/recovery-installer/recovery-installer.${_image_suffix}"
installer_vbmeta = "$root_out_dir/obj/build/images/recovery/recovery-installer/recovery-installer.vbmeta"
qemu_kernel = _qemu_kernel_file
}