blob: 8e4c01f8aaa0d33034e19e44dccce5e0c6ad76ad [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/board.gni")
import("//build/config/fuchsia/zbi.gni")
import("//build/images/args.gni")
import("//build/images/boot.gni")
import("//build/images/bootfs_manifest_additions.gni")
import("//build/images/custom_signing.gni")
import("//build/images/manifest.gni")
import("//build/images/ta.gni")
assert(current_toolchain == target_toolchain)
# XXX: Temporary solution: we grab every package in the build and ensure that
# these are contributing to the bootfs_manifest that we generate.
generated_file("system_package.manifest_args") {
testonly = true
outputs = [ target_gen_dir + "/system_package.manifest_args" ]
data_keys = [ "system_image_rsps" ]
walk_keys = [ "system_image_barrier" ]
deps = [ "//build/images:packages" ]
}
generate_manifest("boot.manifest") {
visibility = [ ":*" ]
testonly = true
output_name = "boot.manifest"
zircon_groups = "all"
deps = [ ":system_package.manifest_args" ]
system_package_manifest_args =
get_target_outputs(":system_package.manifest_args")
sources = system_package_manifest_args
args = [ "@" + rebase_path(system_package_manifest_args[0], root_build_dir) ]
}
action("devmgr_config.txt") {
testonly = true
script = "../manifest.py"
outputs = [ "$target_out_dir/devmgr_config.txt" ]
args = [ "--output=" + rebase_path(outputs[0], root_build_dir) ]
deps = [ ":boot.manifest" ]
foreach(entry, devmgr_config) {
args += [ "--entry=$entry" ]
}
}
additional_manifests = []
foreach(label, bootfs_manifest_additions) {
target_dir = get_label_info(label, "target_out_dir")
target_name = get_label_info(label, "name")
additional_manifests += [ target_dir + "/" + target_name ]
}
zbi("bringup") {
testonly = true
deps = [
":boot.manifest",
":devmgr_config.txt",
] + bootfs_manifest_additions
boot_manifest_outputs = get_target_outputs(":boot.manifest")
inputs = [ boot_manifest_outputs[0] ] + [ zircon_kernel_zbi ] +
additional_manifests
manifest = [
{
outputs = [ "config/devmgr" ]
sources = get_target_outputs(":devmgr_config.txt")
},
]
foreach(ta_uuid, fuchsia_ta_uuids) {
manifest += [
{
outputs = [ "lib/firmware/${ta_uuid}${ta_dest_suffix}" ]
sources = [ rebase_path("${ta_path}/${ta_uuid}${ta_src_suffix}") ]
},
]
}
cmdline = kernel_cmdline_args + board_kernel_cmdline_args
cmdline_inputs = kernel_cmdline_files
manifest += bootfs_extra
metadata = {
images = [
{
name = "zircon-a"
path = "bringup.zbi"
type = "zbi"
archive = true
bootserver_pave = []
# Bringup builds always mexec from the paver
bootserver_pave += [ "--boot" ]
if (custom_signing_script == "" && !use_vboot) {
bootserver_pave += [
"--zircona",
# TODO(ZX-2625): `dm reboot-recovery` boots from zircon-b instead of
# zircon-r, so for now zedboot is being paved to this slot.
# "--zirconb",
]
}
},
]
image_paths = [
"IMAGE_ZIRCONA_ZBI=bringup.zbi",
# TODO(mcgrathr): The complete ZBI can be used with a separate
# kernel too, the kernel image in it will just be ignored. So
# just use the primary ZBI for this until all uses are
# converted to using the ZBI alone. Then remove this as
# IMAGE_BOOT_RAM variable should no longer be in use.
"IMAGE_BOOT_RAM=bringup.zbi",
]
images += [
{
archive = true
bootserver_netboot = [ "--boot" ]
name = "fuchsia"
path = "bringup.zbi"
type = "zbi"
},
]
image_paths += [
"IMAGE_NETBOOT_RAM=bringup.zbi",
"IMAGE_NETBOOT_ZBI=bringup.zbi",
]
}
}
if (custom_signing_script != "") {
custom_signed_zbi("signed") {
output_name = "bringup.zbi"
testonly = true
deps = [ ":bringup" ]
zbi = get_target_outputs(":bringup")
}
}